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  // empty
39 }
40 
41 // from base template condition (from event setup usually)
43  const L1GlobalTriggerPSB *ptrPSB,
44  const int nrL1JetCounts)
46  m_gtJetCountsTemplate(static_cast<const L1GtJetCountsTemplate *>(jcTemplate)),
47  m_gtPSB(ptrPSB),
48  m_numberL1JetCounts(nrL1JetCounts) {
49  // maximum number of objects received for the evaluation of the condition
50  // no objects, in fact, just a number
52 }
53 
54 // copy constructor
56  m_gtJetCountsTemplate = cp.gtJetCountsTemplate();
57  m_gtPSB = cp.gtPSB();
58 
59  m_condMaxNumberObjects = cp.condMaxNumberObjects();
60  m_condLastResult = cp.condLastResult();
61  m_combinationsInCond = cp.getCombinationsInCond();
62 
63  m_verbosity = cp.m_verbosity;
64 }
65 
67  copy(cp);
68 }
69 
70 // destructor
72  // empty
73 }
74 
75 // equal operator
77  copy(cp);
78  return *this;
79 }
80 
81 // methods
83  m_gtJetCountsTemplate = jcTemplate;
84 }
85 
88 
89 // try all object permutations and check spatial correlations, if required
91  // number of trigger objects in the condition
92  // in fact, there is only one object
93  int iCondition = 0;
94 
95  // condition result condResult will be set to true if the jet counts
96  // passes the requirement
97  bool condResult = false;
98 
99  // store the index of the JetCount object
100  // from the combination evaluated in the condition
101  SingleCombInCond objectsInComb;
102 
103  // clear the m_combinationsInCond vector
105 
106  // get the jet counts (event / condition)
107  const L1GctJetCounts *jetCounts = m_gtPSB->getCandL1JetCounts();
108 
109  // protection against missing jet counts collection
110  if (jetCounts == nullptr) {
111  return false;
112  }
113 
115 
116  unsigned int cIndex = objPar.countIndex;
117 
118  if (cIndex >= m_numberL1JetCounts) {
119  edm::LogError("L1GlobalTrigger") << "\nL1GtJetCountsCondition error: countIndex " << cIndex
120  << "greater than maximum allowed count = " << m_numberL1JetCounts
121  << "\n ==> condResult = false " << std::endl;
122  return false;
123  }
124 
125  unsigned int countValue = jetCounts->count(cIndex);
126 
127  // check countThreshold
128  if (!checkThreshold(objPar.countThreshold, countValue, m_gtJetCountsTemplate->condGEq())) {
129  return false;
130  }
131 
132  // index is always zero, as they are global quantities (there is only one
133  // object)
134  int indexObj = 0;
135 
136  objectsInComb.push_back(indexObj);
137  (combinationsInCond()).push_back(objectsInComb);
138 
139  // if we get here all checks were successful for this combination
140  // set the general result for evaluateCondition to "true"
141 
142  condResult = true;
143  return condResult;
144 }
145 
146 void L1GtJetCountsCondition::print(std::ostream &myCout) const {
147  m_gtJetCountsTemplate->print(myCout);
149 }
const L1GctJetCounts * getCandL1JetCounts() const
pointer to JetCounts data list
bool m_condLastResult
the last result of evaluateCondition()
CombinationsInCond m_combinationsInCond
store all the object combinations evaluated to true in the condition
const L1GlobalTriggerPSB * m_gtPSB
pointer to PSB, to be able to get the trigger objects
std::vector< int > SingleCombInCond
typedefs
CombinationsInCond & combinationsInCond() const
get all the object combinations (to fill it...)
typedef for a single object template
void setGtPSB(const L1GlobalTriggerPSB *)
set the pointer to PSB
Log< level::Error, false > LogError
virtual void print(std::ostream &myCout) const
print condition
const bool checkThreshold(const Type1 &threshold, const Type2 &value, const bool condGEqValue) const
const std::vector< ObjectParameter > * objectParameter() 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 &)
const bool condGEq() const
get / set condition GEq flag
Definition: L1GtCondition.h:72
deadvectors [0] push_back({0.0175431, 0.538005, 6.80997, 13.29})
const L1GtJetCountsTemplate * m_gtJetCountsTemplate
pointer to a L1GtJetCountsTemplate
const bool evaluateCondition() const override
the core function to check if the condition matches
void print(std::ostream &myCout) const override
print the condition
void clear(EGIsoObj &c)
Definition: egamma.h:82
void print(std::ostream &myCout) const override
print condition
unsigned count(unsigned i) const
get count by index