CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
GlobalAlgBlk.cc
Go to the documentation of this file.
1 
15 // this class header
17 
18 
19 // system include files
20 
21 
22 // user include files
23 
26 
27 // constructors
28 
29 // empty constructor, all members set to zero;
30 GlobalAlgBlk::GlobalAlgBlk(int orbitNr, int bxNr, int bxInEvent):
31  m_orbitNr(orbitNr), m_bxNr(bxNr), m_bxInEvent(bxInEvent)
32 {
33 
34  //Clear out the header data
35  m_finalOR=0;
36 
37  // Reserve/Clear out the decision words
40 
43 
46 
47 }
48 
49 
50 // empty constructor, all members set to zero;
52 {
53 
54  //Clear out the header data
55  m_orbitNr=0;
56  m_bxNr=0;
57  m_bxInEvent=0;
58  m_finalOR=0;
59 
60  // Reserve/Clear out the decision words
63 
66 
69 
70 }
71 
72 
73 
74 // destructor
76 {
77 
78  // empty now
79 }
80 
81 
83 void GlobalAlgBlk::setAlgoDecisionInitial(int bit, bool val)
84 {
85 // if(bit < m_algoDecisionInitial.size()) {
86 
87  m_algoDecisionInitial.at(bit) = val;
88 
89  // }
90  // Need some erorr checking here.
91 
92 
93 }
95 {
96  m_algoDecisionPreScaled.at(bit) = val;
97 }
98 void GlobalAlgBlk::setAlgoDecisionFinal(int bit, bool val)
99 {
100  m_algoDecisionFinal.at(bit) = val;
101 }
102 
104 bool GlobalAlgBlk::getAlgoDecisionInitial(unsigned int bit) const
105 {
106  if(bit>=m_algoDecisionInitial.size()) return false;
107  return m_algoDecisionInitial.at(bit);
108 }
109 bool GlobalAlgBlk::getAlgoDecisionPreScaled(unsigned int bit) const
110 {
111  if(bit>=m_algoDecisionPreScaled.size()) return false;
112  return m_algoDecisionPreScaled.at(bit);
113 }
114 bool GlobalAlgBlk::getAlgoDecisionFinal(unsigned int bit) const
115 {
116  if(bit>=m_algoDecisionFinal.size()) return false;
117  return m_algoDecisionFinal.at(bit);
118 }
119 
120 
121 // reset the content of a GlobalAlgBlk
123 {
124 
125  //Clear out the header data
126  m_orbitNr=0;
127  m_bxNr=0;
128  m_bxInEvent=0;
129  m_finalOR=0;
130 
131  // Clear out the decision words
132  // but leave the vector intact
136 
137 
138 }
139 
140 // pretty print the content of a GlobalAlgBlk
141 void GlobalAlgBlk::print(std::ostream& myCout) const
142 {
143 
144 
145  myCout << " uGtGlobalAlgBlk: " << std::endl;
146 
147  myCout << " Orbit Number (hex): 0x" << std::hex << std::setw(8) << std::setfill('0') << m_orbitNr << std::endl;
148 
149  myCout << " Bx Number (hex): 0x" << std::hex << std::setw(4) << std::setfill('0') << m_bxNr << std::endl;
150 
151  myCout << " Local Bx (hex): 0x" << std::hex << std::setw(1) << std::setfill('0') << m_bxInEvent << std::endl;
152 
153  myCout << " Final OR (hex): Ox" << std::hex << std::setw(1) << std::setfill('0') << m_finalOR << std::endl;
154 
155  // Loop through bits to create a hex word of algorithm bits.
156  int lengthWd = m_algoDecisionInitial.size();
157  myCout << " Decision (Initial) 0x" << std::hex;
158  int digit = 0;
159  for(int i=lengthWd-1; i>-1; i--) {
160  if(m_algoDecisionInitial.at(i)) digit |= (1 << (i%4));
161  if((i%4) == 0){
162  myCout << std::hex << std::setw(1) << digit;
163  digit = 0;
164  }
165  } //end loop over algorithm bits
166  myCout << std::endl;
167 
168  // Loop through bits to create a hex word of algorithm bits.
169  lengthWd = m_algoDecisionPreScaled.size();
170  myCout << " Decision (Prescaled) 0x" << std::hex;
171  digit = 0;
172  for(int i=lengthWd-1; i>-1; i--) {
173  if(m_algoDecisionPreScaled.at(i)) digit |= (1 << (i%4));
174  if((i%4) == 0){
175  myCout << std::hex << std::setw(1) << digit;
176  digit = 0;
177  }
178  } //end loop over algorithm bits
179  myCout << std::endl;
180 
181 
182  // Loop through bits to create a hex word of algorithm bits.
183  lengthWd = m_algoDecisionFinal.size();
184  myCout << " Decision (Final) 0x" << std::hex;
185  digit = 0;
186  for(int i=lengthWd-1; i>-1; i--) {
187  if(m_algoDecisionFinal.at(i)) digit |= (1 << (i%4));
188  if((i%4) == 0){
189  myCout << std::hex << std::setw(1) << digit;
190  digit = 0;
191  }
192  } //end loop over algorithm bits
193  myCout << std::endl;
194 
195 }
196 
197 
int i
Definition: DBlmapReader.cc:9
std::vector< bool > m_algoDecisionInitial
Definition: GlobalAlgBlk.h:101
GlobalAlgBlk()
constructors
Definition: GlobalAlgBlk.cc:51
bool getAlgoDecisionFinal(unsigned int bit) const
int m_bxNr
bunch cross number of the actual bx
Definition: GlobalAlgBlk.h:92
bool getAlgoDecisionInitial(unsigned int bit) const
Get decision bits.
void print(std::ostream &myCout) const
pretty print the content of a GlobalAlgBlk
void reset()
reset the content of a GlobalAlgBlk
virtual ~GlobalAlgBlk()
destructor
Definition: GlobalAlgBlk.cc:75
static const unsigned int NumberPhysTriggers
void setAlgoDecisionPreScaled(int bit, bool val)
Definition: GlobalAlgBlk.cc:94
int m_orbitNr
orbit number
Definition: GlobalAlgBlk.h:89
void setAlgoDecisionInitial(int bit, bool val)
Set decision bits.
Definition: GlobalAlgBlk.cc:83
std::vector< bool > m_algoDecisionFinal
Definition: GlobalAlgBlk.h:103
int m_bxInEvent
bunch cross in the GT event record (E,F,0,1,2)
Definition: GlobalAlgBlk.h:95
std::vector< bool > m_algoDecisionPreScaled
Definition: GlobalAlgBlk.h:102
void setAlgoDecisionFinal(int bit, bool val)
Definition: GlobalAlgBlk.cc:98
bool getAlgoDecisionPreScaled(unsigned int bit) const