BOSS 7.0.3
BESIII Offline Software System
Loading...
Searching...
No Matches
EventType.cxx
Go to the documentation of this file.
1/***************************************************************************
2 Event Info Package
3 -----------------------------------------
4 Copyright (C) 2000 by ATLAS Collaboration
5 ***************************************************************************/
6
7
8//<<<<<< INCLUDES >>>>>>
9
10#include "HltDataTypes/EventType.h"
11
12//<<<<<< PRIVATE DEFINES >>>>>>
13//<<<<<< PRIVATE CONSTANTS >>>>>>
14//<<<<<< PRIVATE TYPES >>>>>>
15//<<<<<< PRIVATE VARIABLE DEFINITIONS >>>>>>
16//<<<<<< PUBLIC VARIABLE DEFINITIONS >>>>>>
17//<<<<<< CLASS STRUCTURE INITIALIZATION >>>>>>
18//<<<<<< PRIVATE FUNCTION DEFINITIONS >>>>>>
19//<<<<<< PUBLIC FUNCTION DEFINITIONS >>>>>>
20//<<<<<< MEMBER FUNCTION DEFINITIONS >>>>>>
21
22// List of EventTypeCodes
23// To add on a new code, simply extend at the end
27
28
30{}
31
32
34{}
35
36
37void
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}
43
44void
45EventType::set_user_type (const std::string& user_type)
46{
47 m_user_type = user_type;
48}
49
50void
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}
67
68
69bool
71{
72 if (m_bit_mask.size() <= type_code) return false;
73 return m_bit_mask[type_code];
74}
75
76const std::string&
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}
90
91
92void
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}
132
133
136{
137 return m_bit_mask.begin();
138}
139
142{
143 return m_bit_mask.end();
144}
void get_detdescr_tags(NameTagPairVec &pairs)
Definition: EventType.cxx:93
void set_detdescr_tags(const NameTagPairVec &pairs)
Definition: EventType.cxx:51
void set_user_type(const std::string &user_type)
Definition: EventType.cxx:45
const std::string & user_type(void) const
Definition: EventType.cxx:77
BitMaskIterator bit_mask_end(void) const
Definition: EventType.cxx:141
virtual ~EventType()
Definition: EventType.cxx:33
BitMaskIterator bit_mask_begin(void) const
Definition: EventType.cxx:135
void add_type(EventTypeCode type_code)
Definition: EventType.cxx:38
bool test(EventTypeCode type_code) const
Definition: EventType.cxx:70