test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
L1GtJetCountsCondition.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 classes
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 L1GlobalTriggerPSB* ptrPSB, const int nrL1JetCounts) :
48  m_gtJetCountsTemplate(static_cast<const L1GtJetCountsTemplate*>(jcTemplate)),
49  m_gtPSB(ptrPSB),
50  m_numberL1JetCounts(nrL1JetCounts)
51 {
52 
53  // maximum number of objects received for the evaluation of the condition
54  // no objects, in fact, just a number
56 
57 }
58 
59 // copy constructor
61 
63  m_gtPSB = cp.gtPSB();
64 
68 
70 
71 }
72 
75 
76  copy(cp);
77 
78 }
79 
80 // destructor
82 
83  // empty
84 
85 }
86 
87 // equal operator
89 {
90  copy(cp);
91  return *this;
92 }
93 
94 // methods
96 
97  m_gtJetCountsTemplate = jcTemplate;
98 
99 }
100 
103 
104  m_gtPSB = ptrPSB;
105 
106 }
107 
108 // try all object permutations and check spatial correlations, if required
110 
111  // number of trigger objects in the condition
112  // in fact, there is only one object
113  int iCondition = 0;
114 
115  // condition result condResult will be set to true if the jet counts
116  // passes the requirement
117  bool condResult = false;
118 
119  // store the index of the JetCount object
120  // from the combination evaluated in the condition
121  SingleCombInCond objectsInComb;
122 
123  // clear the m_combinationsInCond vector
125 
126  // get the jet counts (event / condition)
127  const L1GctJetCounts* jetCounts = m_gtPSB->getCandL1JetCounts();
128 
129  // protection against missing jet counts collection
130  if (jetCounts == 0) {
131  return false;
132  }
133 
135  ( *(m_gtJetCountsTemplate->objectParameter()) )[iCondition];
136 
137  unsigned int cIndex = objPar.countIndex;
138 
139  if (cIndex >= m_numberL1JetCounts) {
140 
141  edm::LogError("L1GlobalTrigger") << "\nL1GtJetCountsCondition error: countIndex "
142  << cIndex << "greater than maximum allowed count = " << m_numberL1JetCounts
143  << "\n ==> condResult = false " << std::endl;
144  return false;
145 
146  }
147 
148  unsigned int countValue = jetCounts->count(cIndex);
149 
150  // check countThreshold
151  if ( !checkThreshold(objPar.countThreshold, countValue, m_gtJetCountsTemplate->condGEq()) ) {
152 
153  return false;
154  }
155 
156  // index is always zero, as they are global quantities (there is only one object)
157  int indexObj = 0;
158 
159  objectsInComb.push_back(indexObj);
160  (combinationsInCond()).push_back(objectsInComb);
161 
162  // if we get here all checks were successful for this combination
163  // set the general result for evaluateCondition to "true"
164 
165  condResult = true;
166  return condResult;
167 
168 }
169 
170 void L1GtJetCountsCondition::print(std::ostream& myCout) const {
171 
172  m_gtJetCountsTemplate->print(myCout);
174 
175 }
176 
void print(std::ostream &myCout) const
print condition
const bool evaluateCondition() const
the core function to check if the condition matches
bool m_condLastResult
the last result of evaluateCondition()
CombinationsInCond m_combinationsInCond
store all the object combinations evaluated to true in the condition
const L1GtJetCountsTemplate * gtJetCountsTemplate() const
get / set the pointer to a L1GtCondition
const L1GlobalTriggerPSB * m_gtPSB
pointer to PSB, to be able to get the trigger objects
CombinationsInCond & combinationsInCond() const
get all the object combinations (to fill it...)
const L1GlobalTriggerPSB * gtPSB() const
get / set the pointer to PSB
std::vector< int > SingleCombInCond
typedefs
typedef for a single object template
void setGtPSB(const L1GlobalTriggerPSB *)
set the pointer to PSB
const std::vector< ObjectParameter > * objectParameter() const
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
void setGtJetCountsTemplate(const L1GtJetCountsTemplate *)
unsigned int m_numberL1JetCounts
maximum number of jet counts
void copy(const L1GtJetCountsCondition &cp)
copy function for copy constructor and operator=
L1GtJetCountsCondition & operator=(const L1GtJetCountsCondition &)
virtual void print(std::ostream &myCout) const
print the condition
unsigned count(unsigned i) const
get count by index
string const
Definition: compareJSON.py:14
const L1GtJetCountsTemplate * m_gtJetCountsTemplate
pointer to a L1GtJetCountsTemplate
virtual void print(std::ostream &myCout) const
print condition
const bool condGEq() const
get / set condition GEq flag
CombinationsInCond const & getCombinationsInCond() const
get all the object combinations evaluated to true in the condition
const L1GctJetCounts * getCandL1JetCounts() const
pointer to JetCounts data list
bool condLastResult() const
get the latest result for the condition