In file Column.hh:

class Column

Defines an event column

Inheritance:


Public Methods

[more] Column ()
Default constructor
[more] Column (const char* name)
Constructor
[more] Column (const std::string& name)
Constructor
[more] Column (const char* name, int eindex)
Constructor
[more] Column (const Column& col)
Copy constructor
[more]virtual ~Column ()
Denstructor
[more]Column& operator= (const Column& col)
Assignment operator
[more]virtual Column* Copy () const
Copy the event column
[more]bool IsValid () const
Is valid?
[more]virtual bool Get (const Event& event, Value& val) const
Get column value (Value)
[more]virtual bool Get (const Event& event, ColumnType::Real& x) const
Get column value (Real)
[more]virtual bool Get (const Event& event, ColumnType::Int& i) const
Get column value (Int)
[more]virtual bool Get (const Event& event, ColumnType::Complex& c) const
Get column value (Complex)
[more]virtual bool Get (const Event& event, ColumnType::Time& t) const
Get column value (Time)
[more]virtual bool Get (const Event& event, std::string& s) const
Get column value (string)
[more]virtual bool Get (const Event& event, char* p, int& len) const
Get column value (string)
[more]virtual bool Set (Event& event, const Value& val)
Set column value (Value)
[more]virtual bool Set (Event& event, const ColumnType::Real& x)
Set column value (Real)
[more]virtual bool Set (Event& event, const ColumnType::Int& i)
Set column value (Int)
[more]virtual bool Set (Event& event, const ColumnType::Complex& c)
Set column value (Complex)
[more]virtual bool Set (Event& event, const ColumnType::Time& t)
Set column value (Time)
[more]virtual bool Set (Event& event, const std::string& s)
Set column value (string)
[more]virtual bool Set (Event& event, const char* p, int len = -1)
Set column value (string)
[more]virtual const Event* GetEvent (const Argument& arg) const
Get column event
[more]virtual const Event* GetEvent (const Argument& arg, int index) const
Get column event
[more]virtual Event* GetEvent (Event& event)
Get column event
[more]virtual const Event* GetEvent (const Event& event) const
Get column event
[more]virtual bool Evaluate (const Argument& arg, Value& val) const
Column value
[more]void SetName (const char* name)
Set column name
[more]void SetName (const std::string& name)
Set column name
[more]const char* GetName () const
Get column name
[more]void SetIndex (int index)
Set event index
[more]int GetIndex () const
Get event index
[more]void ResetCache () const
Clear cache


Inherited from Function:

Public Methods

obool operator() (const Argument& arg, Value& val) const
obool operator() (const Event& event, Value& val) const


Documentation

An event column represents a column value of an event. The basic tag of a column is its name. The column class will look up the name in the column information list assciated with the event and extract the corresponding column value from the event data block.

A column name is typically just an ASCII string. Example:

    Column ("Time")
    
will pick up the even time. A column can also specifiy an event index--denoted by index brackets--which is used in a coincidence analysis to determine which event to use. Example:
    Column ("Time[1]") - Column ("Time[0]")
    
will calculate the time difference bewteen the two coincidence events.

A special case are columns which are themselves events. If one want to access the amplitude of an event column with name "Event(1)", one can simply specify:

    Column ("Event(1).Amplitutde")
    
For the above case a short for exists:
    Column ("Amplitutde(1)")
    
will be expanded to the same column amplitude value. The short form can be used if the name of the event column has a name of the format "Event(n)", with n an non-zero positive integer. The index 0 is reserved for the original event, i.e., "Amplitude(0)" and "Amplitue" correspond to identical columns.

Even so not a likely case, it is possible to have an event with an event column which contains yet another event column with its own event. These columns can be access through:

    Column ("Event(m).Event(n).Amplitutde")   or
    Column ("Event(m).Amplitutde(n)")         or
    Column ("Amplitutde(m,n)")                or
    Column ("Event(m,n).Amplitutde")
    
with m and n the event column indices of the original and the sub event, respectively. The first form is the canonical representation which is used for internal storage.

If an event column of an event with non-zero index has to be accessed, they can both be specified simultanously, but the index must be specifed last. For example:

    Column ("Event(1).Time[1]")
    Column ("Time(1)[1]")
    
represent the time of the event stored at column "Event(1)".

Column names can not contain the characters "[", "]", ".", "*" or "?". They should not contain "(", ")" unless they are of the event type and contain the string "Event". Using something like "Amplitude(1)" as a column name is confusing. In case such a name has been used, the column name specification has to be "Amplitude(1)." with a dot at the end. Using a double index in any column name is forbidden, i.e., "Amplitude(1,2)" is not allowed, nor is "Event(1,2)".

A column can also be used to access the column value of an event. If a series of events with identical column layout is processed, this is more efficient than calling the SetValue method of the event. The event SetValue method requires a string search in the column table for every access, whereas the column class uses a caching algorithm to increase performance. Example:

    // Create a new coincidence event from two events represented by
    // i->Current(0) and i->Current(1)
    Column col0 ("Event(0)");
    Column col1 ("Event(1)");
    Column ifo ("Ifo");
    // loop over events here
    for (; i != end; ++i) {
       Event ne ("Coincidence", "2");
       if (ne.IsValid()) {
          col0.Set (ne, i->Current(0));
          col1.Set (ne, i->Current(1));
          ne.SetTime (i->GetTime());
          Value ifo0, ifo1;
          ifo.Get (i->Current(0), ifo0); 
          ifo.Get (i->Current(1), ifo1);
          ifo.Set (ne, ifo0 | ifo1);
       }
    }
    

o Column()
Creates an event column withou a name.

o Column(const char* name)
Create an event column with the specified name. Allow automatic type conversion from const char*.
Parameters:
name - full name

o Column(const std::string& name)
Create an event column with the specified name. Allow automatic type conversion from string.
Parameters:
name - full name

o Column(const char* name, int eindex)
Create an event column with the specified name and event index.
Parameters:
name - column name only
eindex - Event index (for coincidence)

o Column(const Column& col)
Copy constructor.

ovirtual ~Column()
Destructs an event column.

oColumn& operator= (const Column& col)
Assignment operator.

ovirtual Column* Copy() const
Returns a copy of the event column. This method must be overriden by all descendents.
Returns:
event copy

obool IsValid() const
Checks if this is a valid column.
Returns:
true if valid

ovirtual bool Get(const Event& event, Value& val) const
Returns the column value of the event.
Parameters:
events - Event to pick column value from
val - Column value (return)
Returns:
true if column exists

ovirtual bool Get(const Event& event, ColumnType::Real& x) const
Returns the column value of the event.
Parameters:
events - Event to pick column value from
x - Column value (return)
Returns:
true if column exists

ovirtual bool Get(const Event& event, ColumnType::Int& i) const
Returns the column value of the event.
Parameters:
events - Event to pick column value from
i - Column value (return)
Returns:
true if column exists

ovirtual bool Get(const Event& event, ColumnType::Complex& c) const
Returns the column value of the event.
Parameters:
events - Event to pick column value from
c - Column value (return)
Returns:
true if column exists

ovirtual bool Get(const Event& event, ColumnType::Time& t) const
Returns the column value of the event.
Parameters:
events - Event to pick column value from
t - Column value (return)
Returns:
true if column exists

ovirtual bool Get(const Event& event, std::string& s) const
Returns the column value of the event.
Parameters:
events - Event to pick column value from
s - Column value (return)
Returns:
true if column exists

ovirtual bool Get(const Event& event, char* p, int& len) const
Returns the column value of the event.
Parameters:
events - Event to pick column value from
p - Column value (return)
len - Maximum length of buffer
Returns:
true if column exists

ovirtual bool Set(Event& event, const Value& val)
Sets the column value of the event.
Parameters:
events - Event for which to set column value
val - New column value
Returns:
true if column exists and value could be set

ovirtual bool Set(Event& event, const ColumnType::Real& x)
Sets the column value of the event.
Parameters:
events - Event for which to set column value
x - New column value
Returns:
true if column exists and value could be set

ovirtual bool Set(Event& event, const ColumnType::Int& i)
Sets the column value of the event.
Parameters:
events - Event for which to set column value
i - New column value
Returns:
true if column exists and value could be set

ovirtual bool Set(Event& event, const ColumnType::Complex& c)
Sets the column value of the event.
Parameters:
events - Event for which to set column value
c - New column value
Returns:
true if column exists and value could be set

ovirtual bool Set(Event& event, const ColumnType::Time& t)
Sets the column value of the event.
Parameters:
events - Event for which to set column value
t - New column value
Returns:
true if column exists and value could be set

ovirtual bool Set(Event& event, const std::string& s)
Sets the column value of the event.
Parameters:
events - Event for which to set column value
s - New column value
Returns:
true if column exists and value could be set

ovirtual bool Set(Event& event, const char* p, int len = -1)
Sets the column value of the event.
Parameters:
events - Event for which to set column value
p - New column value
len - length of buffer, or -1 for NULL terminated
Returns:
true if column exists and value could be set

ovirtual const Event* GetEvent(const Argument& arg) const
Returns a pointer to the last event. This method returns the event which is used to pick the column. This is useful for Event which contains events (array index). For example:
          Column name            Returns
          Amplitude              current event
          Amplitude(1)           Event(1)
          Event(2)               Event(2)
          Event(2).Event(1).E    Event(2).Event(1)  even if E is an event
          
All array indices are resolved and the last event is returned. If the event column does not exists, NULL is returned.
Returns:
Event if exist

ovirtual const Event* GetEvent(const Argument& arg, int index) const
Returns a pointer to the "last" event. This method explicitly specifies the event index.
Parameters:
- arg Event argument list
index - Event index
Returns:
Event if exist

ovirtual Event* GetEvent(Event& event)
Returns a pointer to the last event. This method specifies the first event.
Parameters:
event - Event
Returns:
Event if exist

ovirtual const Event* GetEvent(const Event& event) const
Returns a pointer to the last event. This method specifies the first event.
Parameters:
event - Event
Returns:
Event if exist

ovirtual bool Evaluate(const Argument& arg, Value& val) const
Returns the column value of the specified event.
Parameters:
- arg Event argument list
val - Column value (return)
Returns:
true if column exists and event is of correct type

ovoid SetName(const char* name)
Set the name of the column.

ovoid SetName(const std::string& name)
Set the name of the column.

oconst char* GetName() const
Get the name of the column in its canonical representation.
Returns:
Name

ovoid SetIndex(int index)
Set the event index.
Parameters:
index - Event index

oint GetIndex() const
Gets the event index.
Returns:
Event index

ovoid ResetCache() const
Clear the column cache.


This class has no child classes.
Author:
Written June 2001 by Masahiro Ito and Daniel Sigg
Version:
1.0

Alphabetic index HTML hierarchy of classes or Java


Please send questions and comments to zweizig_j@ligo-wa.caltech.edu