BOSS 7.0.1
BESIII Offline Software System
Loading...
Searching...
No Matches
EventType Class Reference

#include <EventType.h>

Public Types

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

Public Member Functions

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

Static Public Attributes

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

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.

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.

Definition at line 84 of file EventFilter/HltUtilities/HltDataTypes/HltDataTypes-01-01-03/HltDataTypes/EventType.h.

Member Typedef Documentation

◆ BitMask [1/2]

◆ BitMask [2/2]

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

◆ BitMaskIterator [1/2]

◆ BitMaskIterator [2/2]

typedef BitMask::const_iterator EventType::BitMaskIterator

◆ EventTypeCode [1/2]

◆ EventTypeCode [2/2]

typedef BitMask::size_type EventType::EventTypeCode

◆ NameTagPair [1/2]

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

◆ NameTagPair [2/2]

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

◆ NameTagPairVec [1/2]

◆ NameTagPairVec [2/2]

Constructor & Destructor Documentation

◆ EventType() [1/2]

EventType::EventType ( )

Definition at line 29 of file EventType.cxx.

30{}

◆ ~EventType() [1/2]

EventType::~EventType ( )
virtual

Definition at line 33 of file EventType.cxx.

34{}

◆ EventType() [2/2]

EventType::EventType ( )

◆ ~EventType() [2/2]

virtual EventType::~EventType ( )
virtual

Member Function Documentation

◆ add_type() [1/2]

void EventType::add_type ( EventTypeCode  type_code)

Definition at line 38 of file EventType.cxx.

39{
40 if(m_bit_mask.size() <= type_code) m_bit_mask.resize(type_code + 1, false);
41 m_bit_mask[type_code] = true;
42}

◆ add_type() [2/2]

void EventType::add_type ( EventTypeCode  type_code)

◆ bit_mask_begin() [1/2]

EventType::BitMaskIterator EventType::bit_mask_begin ( void  ) const

Definition at line 135 of file EventType.cxx.

136{
137 return m_bit_mask.begin();
138}

◆ bit_mask_begin() [2/2]

BitMaskIterator EventType::bit_mask_begin ( void  ) const

◆ bit_mask_end() [1/2]

EventType::BitMaskIterator EventType::bit_mask_end ( void  ) const

Definition at line 141 of file EventType.cxx.

142{
143 return m_bit_mask.end();
144}

◆ bit_mask_end() [2/2]

BitMaskIterator EventType::bit_mask_end ( void  ) const

◆ get_detdescr_tags() [1/2]

void EventType::get_detdescr_tags ( NameTagPairVec pairs)

Definition at line 93 of file EventType.cxx.

94{
95 // We must extract from m_user_type the dd tags for the moment to
96 // avoid schema evolution.
97
98 char sep = '#';
99 bool done = false;
100 std::string::size_type beg = m_user_type.find(sep);
101 do {
102 if (beg != std::string::npos) {
103 std::string::size_type end1 = m_user_type.find(sep, beg+1);
104 if (end1 != std::string::npos) {
105 std::string::size_type end2 = m_user_type.find(sep, end1+1);
106 if (end2 != std::string::npos) {
107 // end2 is a new separator
108 std::string first = m_user_type.substr(beg+1, end1-beg-1);
109 std::string second = m_user_type.substr(end1+1, end2-end1-1);
110 pairs.push_back(NameTagPair(first,second));
111
112 // continue with new beg
113 beg = end2;
114 }
115 else {
116 // end2 is the end of the string
117 std::string first = m_user_type.substr(beg+1, end1-beg-1);
118 std::string second = m_user_type.substr(end1+1, m_user_type.size()-1);
119 pairs.push_back(NameTagPair(first,second));
120 done = true; // finished
121 }
122 }
123 else {
124 done = true; // finished
125 }
126 }
127 else {
128 done = true; // finished
129 }
130 } while (!done);
131}
Index second(Pair i)
Definition: EvtCyclic3.cc:206
Index first(Pair i)
Definition: EvtCyclic3.cc:195

◆ get_detdescr_tags() [2/2]

void EventType::get_detdescr_tags ( NameTagPairVec pairs)

◆ set_detdescr_tags() [1/2]

void EventType::set_detdescr_tags ( const NameTagPairVec pairs)

Definition at line 51 of file EventType.cxx.

52{
53 // We must save in m_user_type the dd tags for the moment to avoid
54 // schema evolution. Overwrite if existing "sep" is found.
55
56 // Force overwrite:
57 m_user_type = user_type();
58
59 char sep = '#';
60 for (unsigned int i = 0; i < pairs.size(); ++i) {
61 m_user_type += sep;
62 m_user_type += pairs[i].first;
63 m_user_type += sep;
64 m_user_type += pairs[i].second;
65 }
66}
const std::string & user_type(void) const
Definition: EventType.cxx:77

◆ set_detdescr_tags() [2/2]

void EventType::set_detdescr_tags ( const NameTagPairVec pairs)

◆ set_user_type() [1/2]

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

Definition at line 45 of file EventType.cxx.

46{
47 m_user_type = user_type;
48}

◆ set_user_type() [2/2]

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

◆ test() [1/2]

bool EventType::test ( EventTypeCode  type_code) const

Definition at line 70 of file EventType.cxx.

71{
72 if (m_bit_mask.size() <= type_code) return false;
73 return m_bit_mask[type_code];
74}

◆ test() [2/2]

bool EventType::test ( EventTypeCode  type_code) const

◆ user_type() [1/2]

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

Definition at line 77 of file EventType.cxx.

78{
79 char sep = '#';
80 std::string::size_type beg = m_user_type.find(sep);
81 static std::string user_type;
82 if (beg != std::string::npos) {
83 user_type = m_user_type.substr(0, beg);
84 }
85 else {
86 user_type = m_user_type;
87 }
88 return user_type;
89}

Referenced by set_detdescr_tags(), set_user_type(), and user_type().

◆ user_type() [2/2]

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

Member Data Documentation

◆ IS_CALIBRATION

static const EventTypeCode EventType::IS_CALIBRATION = 2
static

◆ IS_SIMULATION

static const EventTypeCode EventType::IS_SIMULATION = 0
static

◆ IS_TESTBEAM

static const EventTypeCode EventType::IS_TESTBEAM = 1
static

The documentation for this class was generated from the following files: