Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

EventType Class Reference

#include <EventType.h>

List of all members.

Public Types

typedef std::vector< boolBitMask
typedef std::vector< boolBitMask
typedef BitMask::const_iterator BitMaskIterator
typedef BitMask::const_iterator BitMaskIterator
typedef BitMask::size_type EventTypeCode
typedef BitMask::size_type EventTypeCode
typedef std::pair< std::string,
std::string > 
NameTagPair
typedef std::pair< std::string,
std::string > 
NameTagPair
typedef std::vector< NameTagPairNameTagPairVec
typedef std::vector< NameTagPairNameTagPairVec

Public Member Functions

void add_type (EventTypeCode type_code)
void add_type (EventTypeCode type_code)
BitMaskIterator bit_mask_begin (void) const
BitMaskIterator bit_mask_begin (void) const
BitMaskIterator bit_mask_end (void) const
BitMaskIterator bit_mask_end (void) const
 EventType ()
 EventType ()
void get_detdescr_tags (NameTagPairVec &pairs)
void get_detdescr_tags (NameTagPairVec &pairs)
void set_detdescr_tags (const NameTagPairVec &pairs)
void set_detdescr_tags (const NameTagPairVec &pairs)
void set_user_type (const std::string &user_type)
void set_user_type (const std::string &user_type)
bool test (EventTypeCode type_code) const
bool test (EventTypeCode type_code) const
const std::string & user_type (void) const
const std::string & user_type (void) const
virtual ~EventType ()
virtual ~EventType ()

Static Public Attributes

const EventTypeCode IS_CALIBRATION = 2
const EventTypeCode IS_SIMULATION = 0
const EventTypeCode IS_TESTBEAM = 1

Private Attributes

BitMask m_bit_mask
std::string m_user_type


Detailed Description

class EventType

This class represents the "type of event" where the type is given by one or more "characteristics".

Standard characteristics: -------------------------

IS_SIMULATION // false means IS_DATA IS_TESTBEAM // false means IS_FROM_ATLAS_DET IS_CALIBRATION // false means IS_PHYSICS

Since an event may have MORE than one characteristic, a testbeam simulation event would respond true to first two of the above characteristics, whereas an offline simulation event would respond true to ONLY IS_SIMULATION.

These are set with:

void add_type (EventTypeCode type_code);

where the possible EventTypeCode's are provided as constants, e.g.:

static const EventTypeCode IS_SIMULATION;

Thus, one would set IS_SIMULATION by:

an_event_type.set_type_bit(EventType::IS_SIMULATION);

User-defined characteristics: -----------------------------

There is a possible to set and get a "user-defined" characteristic in terms of a string:

void add_type (const string& user_type); const string& user_type (void) const;

Access to the full set of characteristics: ------------------------------------------

This is possible via:

BitMaskIterator bit_mask_begin (void) const; BitMaskIterator bit_mask_end (void) const;

Implementation details: -----------------------

The full set of characteristics is provided by static constants. One may add new event characteristics BOTH by adding more static constants AND by providing the cooresponding new boolean methods.


Member Typedef Documentation

typedef std::vector<bool> EventType::BitMask
 

typedef std::vector<bool> EventType::BitMask
 

typedef BitMask::const_iterator EventType::BitMaskIterator
 

typedef BitMask::const_iterator EventType::BitMaskIterator
 

typedef BitMask::size_type EventType::EventTypeCode
 

typedef BitMask::size_type EventType::EventTypeCode
 

typedef std::pair<std::string,std::string> EventType::NameTagPair
 

typedef std::pair<std::string,std::string> EventType::NameTagPair
 

typedef std::vector<NameTagPair> EventType::NameTagPairVec
 

typedef std::vector<NameTagPair> EventType::NameTagPairVec
 


Constructor & Destructor Documentation

EventType::EventType  ) 
 

00030 {}

EventType::~EventType  )  [virtual]
 

00034 {}

EventType::EventType  ) 
 

virtual EventType::~EventType  )  [virtual]
 


Member Function Documentation

void EventType::add_type EventTypeCode  type_code  ) 
 

void EventType::add_type EventTypeCode  type_code  ) 
 

00039 {
00040     if(m_bit_mask.size() <= type_code) m_bit_mask.resize(type_code + 1, false);
00041     m_bit_mask[type_code] = true;
00042 }

BitMaskIterator EventType::bit_mask_begin void   )  const
 

EventType::BitMaskIterator EventType::bit_mask_begin void   )  const
 

00136 {
00137     return m_bit_mask.begin();
00138 }

BitMaskIterator EventType::bit_mask_end void   )  const
 

EventType::BitMaskIterator EventType::bit_mask_end void   )  const
 

00142 {
00143     return m_bit_mask.end();
00144 }

void EventType::get_detdescr_tags NameTagPairVec pairs  ) 
 

void EventType::get_detdescr_tags NameTagPairVec pairs  ) 
 

00094 {
00095     // We must extract from m_user_type the dd tags for the moment to
00096     // avoid schema evolution.
00097 
00098     char sep = '#';
00099     bool done = false;
00100     unsigned int beg = m_user_type.find(sep);
00101     do {
00102         if (beg != std::string::npos) {
00103             unsigned int end1 = m_user_type.find(sep, beg+1);
00104             if (end1 != std::string::npos) {
00105                 unsigned int end2 = m_user_type.find(sep, end1+1);
00106                 if (end2 != std::string::npos) {
00107                     // end2 is a new separator
00108                     std::string first  = m_user_type.substr(beg+1, end1-beg-1);
00109                     std::string second = m_user_type.substr(end1+1, end2-end1-1);
00110                     pairs.push_back(NameTagPair(first,second));
00111 
00112                     // continue with new beg
00113                     beg = end2;
00114                 }
00115                 else {
00116                     // end2 is the end of the string
00117                     std::string first  = m_user_type.substr(beg+1, end1-beg-1);
00118                     std::string second = m_user_type.substr(end1+1, m_user_type.size()-1);
00119                     pairs.push_back(NameTagPair(first,second));
00120                     done = true; // finished
00121                 }
00122             }
00123             else {
00124                 done = true; // finished
00125             }
00126         }
00127         else {
00128             done = true; // finished
00129         }
00130     } while (!done);
00131 }

void EventType::set_detdescr_tags const NameTagPairVec pairs  ) 
 

void EventType::set_detdescr_tags const NameTagPairVec pairs  ) 
 

00052 {
00053     // We must save in m_user_type the dd tags for the moment to avoid
00054     // schema evolution. Overwrite if existing "sep" is found.
00055 
00056     // Force overwrite:
00057     m_user_type = user_type(); 
00058 
00059     char sep = '#';
00060     for (unsigned int i = 0; i < pairs.size(); ++i) {
00061         m_user_type += sep;
00062         m_user_type += pairs[i].first;
00063         m_user_type += sep;
00064         m_user_type += pairs[i].second;
00065     }
00066 }

void EventType::set_user_type const std::string &  user_type  ) 
 

void EventType::set_user_type const std::string &  user_type  ) 
 

00046 {
00047     m_user_type = user_type;
00048 }

bool EventType::test EventTypeCode  type_code  )  const
 

bool EventType::test EventTypeCode  type_code  )  const
 

00071 {
00072     if (m_bit_mask.size() <= type_code) return false;
00073     return m_bit_mask[type_code];
00074 }

const std::string& EventType::user_type void   )  const
 

const std::string & EventType::user_type void   )  const
 

00078 {
00079     char sep = '#';
00080     unsigned int beg = m_user_type.find(sep);
00081     static std::string user_type;
00082     if (beg != std::string::npos) {
00083         user_type = m_user_type.substr(0, beg);
00084     }
00085     else {
00086         user_type = m_user_type;
00087     }
00088     return user_type;
00089 }


Member Data Documentation

const EventTypeCode EventType::IS_CALIBRATION = 2 [static]
 

const EventTypeCode EventType::IS_SIMULATION = 0 [static]
 

const EventTypeCode EventType::IS_TESTBEAM = 1 [static]
 

BitMask EventType::m_bit_mask [private]
 

std::string EventType::m_user_type [private]
 


The documentation for this class was generated from the following files:
Generated on Wed Feb 2 16:02:56 2011 for BOSS6.5.5 by  doxygen 1.3.9.1