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 }
L1GtConditionEvaluation
Definition: L1GtConditionEvaluation.h:37
L1GtCondition
Definition: L1GtCondition.h:35
L1GtConditionEvaluation::m_verbosity
int m_verbosity
verbosity level
Definition: L1GtConditionEvaluation.h:105
L1GtJetCountsCondition::setGtJetCountsTemplate
void setGtJetCountsTemplate(const L1GtJetCountsTemplate *)
Definition: L1GtJetCountsCondition.cc:82
L1GtJetCountsCondition
Definition: L1GtJetCountsCondition.h:33
L1GtJetCountsTemplate::print
void print(std::ostream &myCout) const override
print the condition
Definition: L1GtJetCountsTemplate.cc:77
L1GtConditionEvaluation::combinationsInCond
CombinationsInCond & combinationsInCond() const
get all the object combinations (to fill it...)
Definition: L1GtConditionEvaluation.h:82
L1GctJetCounts.h
L1GtJetCountsCondition::evaluateCondition
const bool evaluateCondition() const override
the core function to check if the condition matches
Definition: L1GtJetCountsCondition.cc:90
L1GtCondition::condGEq
const bool condGEq() const
get / set condition GEq flag
Definition: L1GtCondition.h:72
L1GlobalTriggerReadoutSetupFwd.h
L1GtConditionEvaluation::print
virtual void print(std::ostream &myCout) const
print condition
Definition: L1GtConditionEvaluation.cc:34
L1GtJetCountsCondition.h
L1GtJetCountsCondition::setGtPSB
void setGtPSB(const L1GlobalTriggerPSB *)
set the pointer to PSB
Definition: L1GtJetCountsCondition.cc:87
L1GtConditionEvaluation::m_combinationsInCond
CombinationsInCond m_combinationsInCond
store all the object combinations evaluated to true in the condition
Definition: L1GtConditionEvaluation.h:102
L1GtJetCountsTemplate::ObjectParameter::countThreshold
unsigned int countThreshold
Definition: L1GtJetCountsTemplate.h:59
L1GtJetCountsTemplate::ObjectParameter
typedef for a single object template
Definition: L1GtJetCountsTemplate.h:56
watchdog.const
const
Definition: watchdog.py:83
L1GtConditionEvaluation::checkThreshold
const bool checkThreshold(const Type1 &threshold, const Type2 &value, const bool condGEqValue) const
Definition: L1GtConditionEvaluation.h:113
L1GtConditionEvaluation::m_condLastResult
bool m_condLastResult
the last result of evaluateCondition()
Definition: L1GtConditionEvaluation.h:99
L1GtJetCountsTemplate::ObjectParameter::countIndex
unsigned int countIndex
Definition: L1GtJetCountsTemplate.h:58
L1GtJetCountsCondition::m_gtPSB
const L1GlobalTriggerPSB * m_gtPSB
pointer to PSB, to be able to get the trigger objects
Definition: L1GtJetCountsCondition.h:78
SingleCombInCond
std::vector< int > SingleCombInCond
typedefs
Definition: L1GlobalTriggerObjectMapFwd.h:29
L1GtJetCountsCondition::~L1GtJetCountsCondition
~L1GtJetCountsCondition() override
Definition: L1GtJetCountsCondition.cc:71
L1GtJetCountsCondition::m_numberL1JetCounts
unsigned int m_numberL1JetCounts
maximum number of jet counts
Definition: L1GtJetCountsCondition.h:81
L1GtJetCountsTemplate.h
L1GtConditionEvaluation.h
clear
void clear(HadCaloObj &c)
Definition: data.h:124
L1GtConditionEvaluation::m_condMaxNumberObjects
int m_condMaxNumberObjects
Definition: L1GtConditionEvaluation.h:96
L1GlobalTriggerPSB.h
L1GtJetCountsCondition::operator=
L1GtJetCountsCondition & operator=(const L1GtJetCountsCondition &)
Definition: L1GtJetCountsCondition.cc:76
L1GtJetCountsCondition::m_gtJetCountsTemplate
const L1GtJetCountsTemplate * m_gtJetCountsTemplate
pointer to a L1GtJetCountsTemplate
Definition: L1GtJetCountsCondition.h:75
edm::LogError
Log< level::Error, false > LogError
Definition: MessageLogger.h:123
L1GctJetCounts
Definition: L1GctJetCounts.h:16
L1GtJetCountsCondition::print
void print(std::ostream &myCout) const override
print condition
Definition: L1GtJetCountsCondition.cc:146
L1GctJetCounts::count
unsigned count(unsigned i) const
get count by index
Definition: L1GctJetCounts.cc:63
L1GtJetCountsTemplate::objectParameter
const std::vector< ObjectParameter > * objectParameter() const
Definition: L1GtJetCountsTemplate.h:67
L1GtJetCountsTemplate
Definition: L1GtJetCountsTemplate.h:34
L1GlobalTriggerPSB
Definition: L1GlobalTriggerPSB.h:58
L1GtJetCountsCondition::L1GtJetCountsCondition
L1GtJetCountsCondition()
Definition: L1GtJetCountsCondition.cc:37
L1GtJetCountsCondition::copy
void copy(const L1GtJetCountsCondition &cp)
copy function for copy constructor and operator=
Definition: L1GtJetCountsCondition.cc:55
CommonMethods.cp
def cp(fromDir, toDir, listOfFiles, overwrite=False, smallList=False)
Definition: CommonMethods.py:192
L1GlobalTriggerPSB::getCandL1JetCounts
const L1GctJetCounts * getCandL1JetCounts() const
pointer to JetCounts data list
Definition: L1GlobalTriggerPSB.h:171