CMS 3D CMS Logo

L1GtHfRingEtSumsCondition.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 *etTemplate, const L1GlobalTriggerPSB *ptrPSB)
48  static_cast<const L1GtHfRingEtSumsTemplate *>(etTemplate)),
49  m_gtPSB(ptrPSB) {
50 
51  // maximum number of objects received for the evaluation of the condition
52  // no objects, in fact, just a number
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 L1GtHfRingEtSumsTemplate *etTemplate) {
92 
93  m_gtHfRingEtSumsTemplate = etTemplate;
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 number
107  int iCondition = 0;
108 
109  // condition result condResult will be set to true if the HF Ring Et sums
110  // passes the requirement
111  bool condResult = false;
112 
113  // store the index of the HfRingEtSums object
114  // from the combination evaluated in the condition
115  SingleCombInCond objectsInComb;
116 
117  // clear the m_combinationsInCond vector
119 
120  // get the HF Ring Et sums (event / condition)
121  const L1GctHFRingEtSums *etSumCand = m_gtPSB->getCandL1HfRingEtSums();
122 
123  // protection against missing HF Ring Et sums collection
124  if (etSumCand == nullptr) {
125  return false;
126  }
127 
129  (*(m_gtHfRingEtSumsTemplate->objectParameter()))[iCondition];
130 
131  // FIXME ask GCT to provide a method to retrieve it
132  const unsigned int numberL1HfRingEtSums = 4;
133 
134  const unsigned int cIndex = objPar.etSumIndex;
135  if (cIndex >= numberL1HfRingEtSums) {
136 
137  edm::LogError("L1GlobalTrigger")
138  << "\nL1GtHfRingEtSumsCondition error: etSumIndex " << cIndex
139  << "greater than GCT maximum index = " << numberL1HfRingEtSums
140  << "\n ==> condResult = false " << std::endl;
141  return false;
142  }
143 
144  const unsigned int etSumValue = etSumCand->etSum(cIndex);
145 
146  // check countThreshold
147  if (!checkThreshold(objPar.etSumThreshold, etSumValue,
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 L1GtHfRingEtSumsCondition::print(std::ostream &myCout) const {
167 
170 }
typedef for a single object template
bool m_condLastResult
the last result of evaluateCondition()
void setGtHfRingEtSumsTemplate(const L1GtHfRingEtSumsTemplate *)
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...)
const L1GctHFRingEtSums * getCandL1HfRingEtSums() const
pointer to HfRingEtSums data list
void print(std::ostream &myCout) const override
print condition
void print(std::ostream &myCout) const override
print the condition
std::vector< int > SingleCombInCond
typedefs
const bool evaluateCondition() const override
the core function to check if the condition matches
void setGtPSB(const L1GlobalTriggerPSB *)
set the pointer to PSB
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 L1GtHfRingEtSumsTemplate * m_gtHfRingEtSumsTemplate
pointer to a L1GtHfRingEtSumsTemplate
L1 GCT HF ring Et sums.
L1GtHfRingEtSumsCondition & operator=(const L1GtHfRingEtSumsCondition &)
const L1GlobalTriggerPSB * m_gtPSB
pointer to PSB, to be able to get the trigger objects
uint16_t etSum(unsigned const i) const
virtual void print(std::ostream &myCout) const
print condition
const bool condGEq() const
get / set condition GEq flag
const L1GlobalTriggerPSB * gtPSB() const
get / set the pointer to PSB
CombinationsInCond const & getCombinationsInCond() const
get all the object combinations evaluated to true in the condition
const L1GtHfRingEtSumsTemplate * gtHfRingEtSumsTemplate() const
get / set the pointer to a L1GtCondition
void copy(const L1GtHfRingEtSumsCondition &cp)
copy function for copy constructor and operator=
const std::vector< ObjectParameter > * objectParameter() const
bool condLastResult() const
get the latest result for the condition