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 
17 // this class header
19 
20 // system include files
21 #include <iostream>
22 #include <iomanip>
23 
24 #include <vector>
25 
26 // user include files
27 // base classes
29 
32 
34 
36 
37 // constructors
38 // default
41 
42  //empty
43 
44 }
45 
46 // from base template condition (from event setup usually)
48  const L1GlobalTriggerPSB* ptrPSB, const int nrL1JetCounts) :
50  m_gtJetCountsTemplate(static_cast<const L1GtJetCountsTemplate*>(jcTemplate)),
51  m_gtPSB(ptrPSB),
52  m_numberL1JetCounts(nrL1JetCounts)
53 {
54 
55  // maximum number of objects received for the evaluation of the condition
56  // no objects, in fact, just a number
58 
59 }
60 
61 // copy constructor
63 
65  m_gtPSB = cp.gtPSB();
66 
70 
72 
73 }
74 
77 
78  copy(cp);
79 
80 }
81 
82 // destructor
84 
85  // empty
86 
87 }
88 
89 // equal operator
91 {
92  copy(cp);
93  return *this;
94 }
95 
96 // methods
98 
99  m_gtJetCountsTemplate = jcTemplate;
100 
101 }
102 
105 
106  m_gtPSB = ptrPSB;
107 
108 }
109 
110 // try all object permutations and check spatial correlations, if required
112 
113  // number of trigger objects in the condition
114  // in fact, there is only one object
115  int iCondition = 0;
116 
117  // condition result condResult will be set to true if the jet counts
118  // passes the requirement
119  bool condResult = false;
120 
121  // store the index of the JetCount object
122  // from the combination evaluated in the condition
123  SingleCombInCond objectsInComb;
124 
125  // clear the m_combinationsInCond vector
127 
128  // get the jet counts (event / condition)
129  const L1GctJetCounts* jetCounts = m_gtPSB->getCandL1JetCounts();
130 
131  // protection against missing jet counts collection
132  if (jetCounts == 0) {
133  return false;
134  }
135 
137  ( *(m_gtJetCountsTemplate->objectParameter()) )[iCondition];
138 
139  unsigned int cIndex = objPar.countIndex;
140 
141  if (cIndex >= m_numberL1JetCounts) {
142 
143  edm::LogError("L1GlobalTrigger") << "\nL1GtJetCountsCondition error: countIndex "
144  << cIndex << "greater than maximum allowed count = " << m_numberL1JetCounts
145  << "\n ==> condResult = false " << std::endl;
146  return false;
147 
148  }
149 
150  unsigned int countValue = jetCounts->count(cIndex);
151 
152  // check countThreshold
153  if ( !checkThreshold(objPar.countThreshold, countValue, m_gtJetCountsTemplate->condGEq()) ) {
154 
155  return false;
156  }
157 
158  // index is always zero, as they are global quantities (there is only one object)
159  int indexObj = 0;
160 
161  objectsInComb.push_back(indexObj);
162  (combinationsInCond()).push_back(objectsInComb);
163 
164  // if we get here all checks were successful for this combination
165  // set the general result for evaluateCondition to "true"
166 
167  condResult = true;
168  return condResult;
169 
170 }
171 
172 void L1GtJetCountsCondition::print(std::ostream& myCout) const {
173 
174  m_gtJetCountsTemplate->print(myCout);
176 
177 }
178 
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:168
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
Definition: L1GtCondition.h:99
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