CMS 3D CMS Logo

L1GtHfBitCountsCondition.cc
Go to the documentation of this file.
1 
15 // this class header
17 
18 // system include files
19 #include <iomanip>
20 #include <iostream>
21 
22 #include <vector>
23 
24 // user include files
25 // base class
27 
30 
32 
34 
35 // constructors
36 // default
39 
40  // empty
41 }
42 
43 // from base template condition (from event setup usually)
45  const L1GtCondition *bcTemplate, const L1GlobalTriggerPSB *ptrPSB)
48  static_cast<const L1GtHfBitCountsTemplate *>(bcTemplate)),
49  m_gtPSB(ptrPSB) {
50 
51  // maximum number of objects received for the evaluation of the condition
52  // no objects, in fact, just a count
54 }
55 
56 // copy constructor
58 
60  m_gtPSB = cp.gtPSB();
61 
65 
67 }
68 
72 
73  copy(cp);
74 }
75 
76 // destructor
78 
79  // empty
80 }
81 
82 // equal operator
85  copy(cp);
86  return *this;
87 }
88 
89 // methods
91  const L1GtHfBitCountsTemplate *bcTemplate) {
92 
93  m_gtHfBitCountsTemplate = bcTemplate;
94 }
95 
98 
99  m_gtPSB = ptrPSB;
100 }
101 
102 // try all object permutations and check spatial correlations, if required
104 
105  // number of trigger objects in the condition
106  // no objects, in fact, just a count
107  int iCondition = 0;
108 
109  // condition result condResult will be set to true if the HF bit counts
110  // passes the requirement
111  bool condResult = false;
112 
113  // store the index of the HfBitCounts object
114  // from the combination evaluated in the condition
115  SingleCombInCond objectsInComb;
116 
117  // clear the m_combinationsInCond vector
119 
120  // get the HF bit counts (event / condition)
121  const L1GctHFBitCounts *bitCounts = m_gtPSB->getCandL1HfBitCounts();
122 
123  // protection against missing HF bit counts collection
124  if (bitCounts == nullptr) {
125  return false;
126  }
127 
129  (*(m_gtHfBitCountsTemplate->objectParameter()))[iCondition];
130 
131  // FIXME ask GCT to provide a method to retrieve it
132  const unsigned int numberL1HfBitCounts = 4;
133 
134  const unsigned int cIndex = objPar.countIndex;
135  if (cIndex >= numberL1HfBitCounts) {
136 
137  edm::LogError("L1GlobalTrigger")
138  << "\nL1GtHfBitCountsCondition error: countIndex " << cIndex
139  << "greater than GCT maximum index = " << numberL1HfBitCounts
140  << "\n ==> condResult = false " << std::endl;
141  return false;
142  }
143 
144  const unsigned int countValue = bitCounts->bitCount(cIndex);
145 
146  // check countThreshold
147  if (!checkThreshold(objPar.countThreshold, countValue,
149 
150  return false;
151  }
152 
153  // index is always zero - the object is in fact a count
154  int indexObj = 0;
155 
156  objectsInComb.push_back(indexObj);
157  (combinationsInCond()).push_back(objectsInComb);
158 
159  // if we get here all checks were successful for this combination
160  // set the general result for evaluateCondition to "true"
161 
162  condResult = true;
163  return condResult;
164 }
165 
166 void L1GtHfBitCountsCondition::print(std::ostream &myCout) const {
167 
170 }
void copy(const L1GtHfBitCountsCondition &cp)
copy function for copy constructor and operator=
void setGtPSB(const L1GlobalTriggerPSB *)
set the pointer to PSB
bool m_condLastResult
the last result of evaluateCondition()
typedef for a single object template
CombinationsInCond m_combinationsInCond
store all the object combinations evaluated to true in the condition
CombinationsInCond & combinationsInCond() const
get all the object combinations (to fill it...)
void setGtHfBitCountsTemplate(const L1GtHfBitCountsTemplate *)
const L1GtHfBitCountsTemplate * gtHfBitCountsTemplate() const
get / set the pointer to a L1GtCondition
std::vector< int > SingleCombInCond
typedefs
uint16_t bitCount(unsigned const i) const
const L1GtHfBitCountsTemplate * m_gtHfBitCountsTemplate
pointer to a L1GtHfBitCountsTemplate
void print(std::ostream &myCout) const override
print condition
L1GtHfBitCountsCondition & operator=(const L1GtHfBitCountsCondition &)
L1 GCT HF ring Et sums.
void clear(CLHEP::HepGenMatrix &m)
Helper function: Reset all elements of a matrix to 0.
Definition: matutil.cc:167
const bool checkThreshold(const Type1 &threshold, const Type2 &value, const bool condGEqValue) const
const L1GctHFBitCounts * getCandL1HfBitCounts() const
pointer to HfBitCounts data list
void print(std::ostream &myCout) const override
print the condition
const L1GlobalTriggerPSB * m_gtPSB
pointer to PSB, to be able to get the trigger objects
const bool evaluateCondition() const override
the core function to check if the condition matches
const L1GlobalTriggerPSB * gtPSB() const
get / set the pointer to PSB
virtual void print(std::ostream &myCout) const
print condition
const bool condGEq() const
get / set condition GEq flag
const std::vector< ObjectParameter > * objectParameter() const
CombinationsInCond const & getCombinationsInCond() const
get all the object combinations evaluated to true in the condition
bool condLastResult() const
get the latest result for the condition