CMS 3D CMS Logo

EnergySumCondition.cc
Go to the documentation of this file.
1 
13 // this class header
15 
16 // system include files
17 #include <iostream>
18 #include <iomanip>
19 
20 #include <string>
21 #include <vector>
22 #include <algorithm>
23 
24 // user include files
25 // base classes
30 
33 
34 // constructors
35 // default
37  //empty
38 }
39 
40 // from base template condition (from event setup usually)
43  m_gtEnergySumTemplate(static_cast<const EnergySumTemplate*>(eSumTemplate)),
44  m_uGtB(ptrGTB)
45 
46 {
47  // maximum number of objects received for the evaluation of the condition
48  // energy sums are global quantities - one object per event
49 
51 }
52 
53 // copy constructor
55  m_gtEnergySumTemplate = cp.gtEnergySumTemplate();
56  m_uGtB = cp.getuGtB();
57 
58  m_condMaxNumberObjects = cp.condMaxNumberObjects();
59  m_condLastResult = cp.condLastResult();
60  m_combinationsInCond = cp.getCombinationsInCond();
61 
62  m_verbosity = cp.m_verbosity;
63 }
64 
66 
67 // destructor
69  // empty
70 }
71 
72 // equal operator
74  copy(cp);
75  return *this;
76 }
77 
78 // methods
80  m_gtEnergySumTemplate = eSumTempl;
81 }
82 
84 void l1t::EnergySumCondition::setuGtB(const GlobalBoard* ptrGTB) { m_uGtB = ptrGTB; }
85 
86 // try all object permutations and check spatial correlations, if required
87 const bool l1t::EnergySumCondition::evaluateCondition(const int bxEval) const {
88  // number of trigger objects in the condition
89  // in fact, there is only one object
90  int iCondition = 0;
91 
92  // condition result condResult set to true if the energy sum
93  // passes all requirements
94  bool condResult = false;
95 
96  // store the indices of the calorimeter objects
97  // from the combination evaluated in the condition
98  SingleCombInCond objectsInComb;
99 
100  // clear the m_combinationsInCond vector
101  (combinationsInCond()).clear();
102 
103  // clear the indices in the combination
104  objectsInComb.clear();
105 
106  const BXVector<const l1t::EtSum*>* candVec = m_uGtB->getCandL1EtSum();
107 
108  // Look at objects in bx = bx + relativeBx
109  int useBx = bxEval + m_gtEnergySumTemplate->condRelativeBx();
110 
111  // Fail condition if attempting to get Bx outside of range
112  if ((useBx < candVec->getFirstBX()) || (useBx > candVec->getLastBX())) {
113  return false;
114  }
115 
116  // If no candidates, no use looking any further.
117  int numberObjects = candVec->size(useBx);
118  if (numberObjects < 1) {
119  return false;
120  }
121 
123  bool MissingEnergy = false;
124  int centbit = 0;
125  switch ((m_gtEnergySumTemplate->objectType())[0]) {
126  case gtETM:
128  MissingEnergy = true;
129  break;
130  case gtETT:
132  MissingEnergy = false;
133  break;
134  case gtETTem:
136  MissingEnergy = false;
137  break;
138  case gtHTM:
140  MissingEnergy = true;
141  break;
142  case gtHTT:
144  MissingEnergy = false;
145  break;
146  case gtETMHF:
148  MissingEnergy = true;
149  break;
150  case gtTowerCount:
152  MissingEnergy = false;
153  break;
154  case gtMinBiasHFP0:
156  MissingEnergy = false;
157  break;
158  case gtMinBiasHFM0:
160  MissingEnergy = false;
161  break;
162  case gtMinBiasHFP1:
164  MissingEnergy = false;
165  break;
166  case gtMinBiasHFM1:
168  MissingEnergy = false;
169  break;
170  case gtAsymmetryEt:
172  MissingEnergy = false;
173  break;
174  case gtAsymmetryHt:
176  MissingEnergy = false;
177  break;
178  case gtAsymmetryEtHF:
180  MissingEnergy = false;
181  break;
182  case gtAsymmetryHtHF:
184  MissingEnergy = false;
185  break;
186  case gtCentrality0:
187  centbit = 0;
189  MissingEnergy = false;
190  break;
191  case gtCentrality1:
192  centbit = 1;
194  MissingEnergy = false;
195  break;
196  case gtCentrality2:
197  centbit = 2;
199  MissingEnergy = false;
200  break;
201  case gtCentrality3:
202  centbit = 3;
204  MissingEnergy = false;
205  break;
206  case gtCentrality4:
207  centbit = 4;
209  MissingEnergy = false;
210  break;
211  case gtCentrality5:
212  centbit = 5;
214  MissingEnergy = false;
215  break;
216  case gtCentrality6:
217  centbit = 6;
219  MissingEnergy = false;
220  break;
221  case gtCentrality7:
222  centbit = 7;
224  MissingEnergy = false;
225  break;
226  default:
227  edm::LogError("L1TGlobal")
228  << "\n Error: "
229  << "Unmatched object type from template to EtSumType, (m_gtEnergySumTemplate->objectType())[0] = "
230  << (m_gtEnergySumTemplate->objectType())[0] << std::endl;
232  break;
233  }
234 
235  // get energy, phi (ETM and HTM) and overflow for the trigger object
236  unsigned int candEt = 0;
237  unsigned int candPhi = 0;
238  bool candOverflow = false;
239  for (int iEtSum = 0; iEtSum < numberObjects; ++iEtSum) {
240  l1t::EtSum cand = *(candVec->at(useBx, iEtSum));
241  if (cand.getType() != type)
242  continue;
243  candEt = cand.hwPt();
244  candPhi = cand.hwPhi();
245  }
246 
247  const EnergySumTemplate::ObjectParameter objPar = (*(m_gtEnergySumTemplate->objectParameter()))[iCondition];
248 
249  // check energy threshold and overflow
250  // overflow evaluation:
251  // for condGEq >=
252  // candidate overflow true -> condition true
253  // candidate overflow false -> evaluate threshold
254  // for condGEq =
255  // candidate overflow true -> condition false
256  // candidate overflow false -> evaluate threshold
257  //
258 
259  bool condGEqVal = m_gtEnergySumTemplate->condGEq();
260 
262  bool myres = checkBit(candEt, centbit);
263  //std::cout << "CCLC: Checking bit " << centbit << "\tResult is: " << myres << std::endl;
264  if (!myres) {
265  LogDebug("L1TGlobal") << "\t\t l1t::EtSum failed Centrality bit" << std::endl;
266  return false;
267  }
268  } else {
269  // check energy threshold
270  if (!checkThreshold(objPar.etLowThreshold, objPar.etHighThreshold, candEt, condGEqVal)) {
271  LogDebug("L1TGlobal") << "\t\t l1t::EtSum failed checkThreshold" << std::endl;
272  return false;
273  }
274 
275  if (!condGEqVal && candOverflow)
276  return false;
277 
278  // for ETM and HTM check phi also
279  // for overflow, the phi requirements are ignored
280  if (MissingEnergy) {
281  // check phi
282  if (!checkRangePhi(
283  candPhi, objPar.phiWindow1Lower, objPar.phiWindow1Upper, objPar.phiWindow2Lower, objPar.phiWindow2Upper)) {
284  LogDebug("L1TGlobal") << "\t\t l1t::EtSum failed checkRange(phi)" << std::endl;
285  return false;
286  }
287  }
288  }
289 
290  // index is always zero, as they are global quantities (there is only one object)
291  int indexObj = 0;
292 
293  objectsInComb.push_back(indexObj);
294  (combinationsInCond()).push_back(objectsInComb);
295 
296  // if we get here all checks were successfull for this combination
297  // set the general result for evaluateCondition to "true"
298 
299  condResult = true;
300  return condResult;
301 }
302 
303 void l1t::EnergySumCondition::print(std::ostream& myCout) const {
304  m_gtEnergySumTemplate->print(myCout);
306 }
l1t::GlobalBoard
Definition: GlobalBoard.h:52
l1t::gtHTM
Definition: GlobalObject.h:24
l1t::gtCentrality0
Definition: GlobalObject.h:36
L1Analysis::kAsymEtHF
Definition: L1AnalysisL1UpgradeDataFormat.h:42
GlobalBoard.h
MessageLogger.h
filterCSVwithJSON.copy
copy
Definition: filterCSVwithJSON.py:36
l1t::EnergySumCondition::evaluateCondition
const bool evaluateCondition(const int bxEval) const override
the core function to check if the condition matches
Definition: EnergySumCondition.cc:87
l1t::ConditionEvaluation::print
virtual void print(std::ostream &myCout) const
print condition
Definition: ConditionEvaluation.cc:32
l1t::gtETTem
Definition: GlobalObject.h:31
l1t::gtMinBiasHFP1
Definition: GlobalObject.h:29
l1t::gtMinBiasHFM1
Definition: GlobalObject.h:30
hgcal_conditions::parameters
Definition: HGCConditions.h:86
l1t::gtAsymmetryEt
Definition: GlobalObject.h:32
L1Analysis::kTowerCount
Definition: L1AnalysisL1UpgradeDataFormat.h:38
watchdog.const
const
Definition: watchdog.py:83
l1t::gtCentrality5
Definition: GlobalObject.h:41
EnergySumTemplate::ObjectParameter::phiWindow1Upper
unsigned int phiWindow1Upper
Definition: EnergySumTemplate.h:60
l1t::gtCentrality7
Definition: GlobalObject.h:43
l1t::gtAsymmetryHt
Definition: GlobalObject.h:33
l1t::gtCentrality4
Definition: GlobalObject.h:40
l1t::gtTowerCount
Definition: GlobalObject.h:26
BXVector< const l1t::EtSum * >
EnergySumTemplate::ObjectParameter::phiWindow2Upper
unsigned int phiWindow2Upper
Definition: EnergySumTemplate.h:62
SingleCombInCond
std::vector< int > SingleCombInCond
typedefs
Definition: L1GlobalTriggerObjectMapFwd.h:29
L1Analysis::kMinBiasHFP1
Definition: L1AnalysisL1UpgradeDataFormat.h:30
L1Analysis::kMissingEtHF
Definition: L1AnalysisL1UpgradeDataFormat.h:25
EnergySumTemplate::ObjectParameter
typedef for a single object template
Definition: EnergySumTemplate.h:54
L1Analysis::kTotalEt
Definition: L1AnalysisL1UpgradeDataFormat.h:17
l1t::gtETMHF
Definition: GlobalObject.h:25
l1t::EnergySumCondition::setGtEnergySumTemplate
void setGtEnergySumTemplate(const EnergySumTemplate *)
Definition: EnergySumCondition.cc:79
l1t::gtHTT
Definition: GlobalObject.h:23
l1t::EnergySumCondition::copy
void copy(const EnergySumCondition &cp)
copy function for copy constructor and operator=
Definition: EnergySumCondition.cc:54
l1t::EnergySumCondition::EnergySumCondition
EnergySumCondition()
Definition: EnergySumCondition.cc:36
L1Analysis::kAsymEt
Definition: L1AnalysisL1UpgradeDataFormat.h:40
l1t::gtCentrality1
Definition: GlobalObject.h:37
l1t::gtETM
Definition: GlobalObject.h:21
LogDebug
#define LogDebug(id)
Definition: MessageLogger.h:233
MessageDrop.h
L1Analysis::kAsymHt
Definition: L1AnalysisL1UpgradeDataFormat.h:41
l1t::EnergySumCondition::setuGtB
void setuGtB(const GlobalBoard *)
set the pointer to uGT GlobalBoard
Definition: EnergySumCondition.cc:84
clear
void clear(HadCaloObj &c)
Definition: data.h:124
type
type
Definition: SiPixelVCal_PayloadInspector.cc:37
EnergySumTemplate
Definition: EnergySumTemplate.h:32
l1t::gtAsymmetryEtHF
Definition: GlobalObject.h:34
BXVector::at
const T & at(int bx, unsigned i) const
l1t::gtCentrality6
Definition: GlobalObject.h:42
gainCalibHelper::gainCalibPI::type
type
Definition: SiPixelGainCalibHelper.h:40
l1t::EtSum
Definition: EtSum.h:20
cand
Definition: decayParser.h:32
l1t::EnergySumCondition::print
void print(std::ostream &myCout) const override
print condition
Definition: EnergySumCondition.cc:303
l1t::gtMinBiasHFP0
Definition: GlobalObject.h:27
ConditionEvaluation.h
L1Analysis::kMissingHt
Definition: L1AnalysisL1UpgradeDataFormat.h:20
EnergySumTemplate::ObjectParameter::phiWindow1Lower
unsigned int phiWindow1Lower
Definition: EnergySumTemplate.h:59
EnergySumTemplate::ObjectParameter::etLowThreshold
unsigned int etLowThreshold
Definition: EnergySumTemplate.h:55
L1Candidate.h
edm::LogError
Log< level::Error, false > LogError
Definition: MessageLogger.h:123
L1Analysis::kMissingEt
Definition: L1AnalysisL1UpgradeDataFormat.h:19
l1t::gtETT
Definition: GlobalObject.h:22
l1t::EnergySumCondition::~EnergySumCondition
~EnergySumCondition() override
Definition: EnergySumCondition.cc:68
EnergySumTemplate::ObjectParameter::phiWindow2Lower
unsigned int phiWindow2Lower
Definition: EnergySumTemplate.h:61
l1t::gtCentrality3
Definition: GlobalObject.h:39
L1Analysis::kAsymHtHF
Definition: L1AnalysisL1UpgradeDataFormat.h:43
L1Analysis::kMinBiasHFM0
Definition: L1AnalysisL1UpgradeDataFormat.h:29
L1Analysis::kMinBiasHFM1
Definition: L1AnalysisL1UpgradeDataFormat.h:31
l1t::ConditionEvaluation
Definition: ConditionEvaluation.h:39
EnergySumCondition.h
EnergySumTemplate.h
L1Analysis::kCentrality
Definition: L1AnalysisL1UpgradeDataFormat.h:39
l1t::gtMinBiasHFM0
Definition: GlobalObject.h:28
l1t::EtSum::EtSumType
EtSumType
Definition: EtSum.h:22
BXVector::size
unsigned size(int bx) const
L1Analysis::kTotalEtEm
Definition: L1AnalysisL1UpgradeDataFormat.h:33
GlobalCondition
Definition: GlobalCondition.h:34
l1t::ConditionEvaluation::m_condMaxNumberObjects
int m_condMaxNumberObjects
Definition: ConditionEvaluation.h:148
L1Analysis::kTotalHt
Definition: L1AnalysisL1UpgradeDataFormat.h:18
BXVector::getLastBX
int getLastBX() const
l1t::gtCentrality2
Definition: GlobalObject.h:38
l1t::EnergySumCondition::operator=
EnergySumCondition & operator=(const EnergySumCondition &)
Definition: EnergySumCondition.cc:73
EnergySumTemplate::ObjectParameter::etHighThreshold
unsigned int etHighThreshold
Definition: EnergySumTemplate.h:56
l1t::EnergySumCondition
Definition: EnergySumCondition.h:37
l1t::gtAsymmetryHtHF
Definition: GlobalObject.h:35
L1Analysis::kMinBiasHFP0
Definition: L1AnalysisL1UpgradeDataFormat.h:28