CMS 3D CMS Logo

L1GtJetCountsCondition.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 classes
27 
30 
32 
34 
35 // constructors
36 // default
38 
39  // empty
40 }
41 
42 // from base template condition (from event setup usually)
44  const L1GlobalTriggerPSB *ptrPSB,
45  const int nrL1JetCounts)
48  static_cast<const L1GtJetCountsTemplate *>(jcTemplate)),
49  m_gtPSB(ptrPSB), m_numberL1JetCounts(nrL1JetCounts) {
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 
71 
72  copy(cp);
73 }
74 
75 // destructor
77 
78  // empty
79 }
80 
81 // equal operator
84  copy(cp);
85  return *this;
86 }
87 
88 // methods
90  const L1GtJetCountsTemplate *jcTemplate) {
91 
92  m_gtJetCountsTemplate = jcTemplate;
93 }
94 
97 
98  m_gtPSB = ptrPSB;
99 }
100 
101 // try all object permutations and check spatial correlations, if required
103 
104  // number of trigger objects in the condition
105  // in fact, there is only one object
106  int iCondition = 0;
107 
108  // condition result condResult will be set to true if the jet counts
109  // passes the requirement
110  bool condResult = false;
111 
112  // store the index of the JetCount object
113  // from the combination evaluated in the condition
114  SingleCombInCond objectsInComb;
115 
116  // clear the m_combinationsInCond vector
118 
119  // get the jet counts (event / condition)
120  const L1GctJetCounts *jetCounts = m_gtPSB->getCandL1JetCounts();
121 
122  // protection against missing jet counts collection
123  if (jetCounts == nullptr) {
124  return false;
125  }
126 
128  (*(m_gtJetCountsTemplate->objectParameter()))[iCondition];
129 
130  unsigned int cIndex = objPar.countIndex;
131 
132  if (cIndex >= m_numberL1JetCounts) {
133 
134  edm::LogError("L1GlobalTrigger")
135  << "\nL1GtJetCountsCondition error: countIndex " << cIndex
136  << "greater than maximum allowed count = " << m_numberL1JetCounts
137  << "\n ==> condResult = false " << std::endl;
138  return false;
139  }
140 
141  unsigned int countValue = jetCounts->count(cIndex);
142 
143  // check countThreshold
144  if (!checkThreshold(objPar.countThreshold, countValue,
146 
147  return false;
148  }
149 
150  // index is always zero, as they are global quantities (there is only one
151  // object)
152  int indexObj = 0;
153 
154  objectsInComb.push_back(indexObj);
155  (combinationsInCond()).push_back(objectsInComb);
156 
157  // if we get here all checks were successful for this combination
158  // set the general result for evaluateCondition to "true"
159 
160  condResult = true;
161  return condResult;
162 }
163 
164 void L1GtJetCountsCondition::print(std::ostream &myCout) const {
165 
166  m_gtJetCountsTemplate->print(myCout);
168 }
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 print(std::ostream &myCout) const override
print condition
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 &)
unsigned count(unsigned i) const
get count by index
const bool evaluateCondition() const override
the core function to check if the condition matches
void print(std::ostream &myCout) const override
print the condition
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