test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
L1GtHfRingEtSumsCondition.cc
Go to the documentation of this file.
1 
15 // this class header
17 
18 // system include files
19 #include <iostream>
20 #include <iomanip>
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 
44 // from base template condition (from event setup usually)
46  const L1GtCondition* etTemplate, const L1GlobalTriggerPSB* ptrPSB) :
47  L1GtConditionEvaluation(), m_gtHfRingEtSumsTemplate(
48  static_cast<const L1GtHfRingEtSumsTemplate*> (etTemplate)), m_gtPSB(
49  ptrPSB)
50 {
51 
52  // maximum number of objects received for the evaluation of the condition
53  // no objects, in fact, just a number
55 
56 }
57 
58 // copy constructor
60 
62  m_gtPSB = cp.gtPSB();
63 
67 
69 
70 }
71 
74 
75  copy(cp);
76 
77 }
78 
79 // destructor
81 
82  // empty
83 
84 }
85 
86 // equal operator
88 {
89  copy(cp);
90  return *this;
91 }
92 
93 // methods
95 
96  m_gtHfRingEtSumsTemplate = etTemplate;
97 
98 }
99 
102 
103  m_gtPSB = ptrPSB;
104 
105 }
106 
107 // try all object permutations and check spatial correlations, if required
109 
110  // number of trigger objects in the condition
111  // no objects, in fact, just a number
112  int iCondition = 0;
113 
114  // condition result condResult will be set to true if the HF Ring Et sums
115  // passes the requirement
116  bool condResult = false;
117 
118  // store the index of the HfRingEtSums object
119  // from the combination evaluated in the condition
120  SingleCombInCond objectsInComb;
121 
122  // clear the m_combinationsInCond vector
124 
125  // get the HF Ring Et sums (event / condition)
126  const L1GctHFRingEtSums* etSumCand = m_gtPSB->getCandL1HfRingEtSums();
127 
128  // protection against missing HF Ring Et sums collection
129  if (etSumCand == 0) {
130  return false;
131  }
132 
134  ( *(m_gtHfRingEtSumsTemplate->objectParameter()) )[iCondition];
135 
136  // FIXME ask GCT to provide a method to retrieve it
137  const unsigned int numberL1HfRingEtSums = 4;
138 
139  const unsigned int cIndex = objPar.etSumIndex;
140  if (cIndex >= numberL1HfRingEtSums) {
141 
142  edm::LogError("L1GlobalTrigger") << "\nL1GtHfRingEtSumsCondition error: etSumIndex "
143  << cIndex << "greater than GCT maximum index = " << numberL1HfRingEtSums
144  << "\n ==> condResult = false " << std::endl;
145  return false;
146 
147  }
148 
149  const unsigned int etSumValue = etSumCand->etSum(cIndex);
150 
151  // check countThreshold
152  if ( !checkThreshold(objPar.etSumThreshold, etSumValue, m_gtHfRingEtSumsTemplate->condGEq()) ) {
153 
154  return false;
155  }
156 
157  // index is always zero - the object is in fact a count
158  int indexObj = 0;
159 
160  objectsInComb.push_back(indexObj);
161  (combinationsInCond()).push_back(objectsInComb);
162 
163  // if we get here all checks were successful for this combination
164  // set the general result for evaluateCondition to "true"
165 
166  condResult = true;
167  return condResult;
168 
169 }
170 
171 void L1GtHfRingEtSumsCondition::print(std::ostream& myCout) const {
172 
175 
176 }
177 
const bool evaluateCondition() const
the core function to check if the condition matches
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
std::vector< int > SingleCombInCond
typedefs
virtual void print(std::ostream &myCout) const
print the condition
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 &)
void print(std::ostream &myCout) const
print condition
const L1GlobalTriggerPSB * m_gtPSB
pointer to PSB, to be able to get the trigger objects
string const
Definition: compareJSON.py:14
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