CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes
L1GtCorrelationCondition Class Reference

#include <L1GtCorrelationCondition.h>

Inheritance diagram for L1GtCorrelationCondition:
L1GtConditionEvaluation

Public Member Functions

const bool evaluateCondition () const override
 the core function to check if the condition matches More...
 
const L1GtCorrelationTemplategtCorrelationTemplate () const
 get / set the pointer to a L1GtCondition More...
 
const L1GlobalTriggerGTLgtGTL () const
 get / set the pointer to GTL More...
 
const unsigned int gtNrBinsPhi () const
 get / set the number of phi bins More...
 
const L1GlobalTriggerPSBgtPSB () const
 get / set the pointer to PSB More...
 
 L1GtCorrelationCondition ()
 
 L1GtCorrelationCondition (const L1GtCondition *, const L1GtCondition *, const L1GtCondition *, const int, const int, const int, const int, const L1GlobalTriggerGTL *, const L1GlobalTriggerPSB *, const L1GtEtaPhiConversions *)
 from base template condition (from event setup usually) More...
 
 L1GtCorrelationCondition (const L1GtCorrelationCondition &)
 
L1GtCorrelationConditionoperator= (const L1GtCorrelationCondition &)
 
void print (std::ostream &myCout) const override
 print condition More...
 
void setGtCorrelationTemplate (const L1GtCorrelationTemplate *)
 
void setGtGTL (const L1GlobalTriggerGTL *)
 
void setGtNrBinsPhi (const unsigned int)
 
void setGtPSB (const L1GlobalTriggerPSB *)
 
 ~L1GtCorrelationCondition () override
 
- Public Member Functions inherited from L1GtConditionEvaluation
bool condLastResult () const
 get the latest result for the condition More...
 
int condMaxNumberObjects () const
 
void evaluateConditionStoreResult ()
 call evaluateCondition and save last result More...
 
CombinationsInCond const & getCombinationsInCond () const
 get all the object combinations evaluated to true in the condition More...
 
virtual std::string getNumericExpression () const
 get numeric expression More...
 
 L1GtConditionEvaluation ()
 constructor More...
 
void setCondMaxNumberObjects (int condMaxNumberObjectsValue)
 
void setVerbosity (const int verbosity)
 
virtual ~L1GtConditionEvaluation ()
 destructor More...
 

Private Member Functions

void copy (const L1GtCorrelationCondition &cp)
 copy function for copy constructor and operator= More...
 

Private Attributes

int m_cond0EtaBits
 
int m_cond0NrL1Objects
 
int m_cond1EtaBits
 
int m_cond1NrL1Objects
 
const L1GtConditionm_gtCond0
 pointer to first sub-condition More...
 
const L1GtConditionm_gtCond1
 pointer to second sub-condition More...
 
const L1GtCorrelationTemplatem_gtCorrelationTemplate
 pointer to a L1GtCorrelationTemplate More...
 
const L1GtEtaPhiConversionsm_gtEtaPhiConversions
 pointer to eta and phi conversion class More...
 
const L1GlobalTriggerGTLm_gtGTL
 pointer to GTL, to be able to get the trigger objects More...
 
const L1GlobalTriggerPSBm_gtPSB
 pointer to PSB, to be able to get the trigger objects More...
 
bool m_isDebugEnabled
 
unsigned int m_nrBinsPhi
 number of bins for delta phi More...
 

Additional Inherited Members

- Protected Member Functions inherited from L1GtConditionEvaluation
template<class Type1 >
const bool checkBit (const Type1 &mask, const unsigned int bitNumber) const
 check if a bit with a given number is set in a mask More...
 
template<class Type1 , class Type2 >
const bool checkThreshold (const Type1 &threshold, const Type2 &value, const bool condGEqValue) const
 
CombinationsInCondcombinationsInCond () const
 get all the object combinations (to fill it...) More...
 
- Protected Attributes inherited from L1GtConditionEvaluation
CombinationsInCond m_combinationsInCond
 store all the object combinations evaluated to true in the condition More...
 
bool m_condLastResult
 the last result of evaluateCondition() More...
 
int m_condMaxNumberObjects
 
int m_verbosity
 verbosity level More...
 

Detailed Description

Description: evaluation of a CondCorrelation condition.

Implementation: <TODO: enter implementation details>

Author
: Vasile Mihai Ghete - HEPHY Vienna

Definition at line 34 of file L1GtCorrelationCondition.h.

Constructor & Destructor Documentation

◆ L1GtCorrelationCondition() [1/3]

L1GtCorrelationCondition::L1GtCorrelationCondition ( )

constructors default

Definition at line 58 of file L1GtCorrelationCondition.cc.

◆ L1GtCorrelationCondition() [2/3]

L1GtCorrelationCondition::L1GtCorrelationCondition ( const L1GtCondition corrTemplate,
const L1GtCondition cond0Condition,
const L1GtCondition cond1Condition,
const int  cond0NrL1Objects,
const int  cond1NrL1Objects,
const int  cond0EtaBits,
const int  cond1EtaBits,
const L1GlobalTriggerGTL ptrGTL,
const L1GlobalTriggerPSB ptrPSB,
const L1GtEtaPhiConversions etaPhiConversions 
)

from base template condition (from event setup usually)

Definition at line 64 of file L1GtCorrelationCondition.cc.

References L1GtConditionEvaluation::m_condMaxNumberObjects, and m_nrBinsPhi.

75  m_gtCorrelationTemplate(static_cast<const L1GtCorrelationTemplate *>(corrTemplate)),
76  m_gtCond0(cond0Condition),
77  m_gtCond1(cond1Condition),
78  m_cond0NrL1Objects(cond0NrL1Objects),
79  m_cond1NrL1Objects(cond1NrL1Objects),
80  m_cond0EtaBits(cond0EtaBits),
81  m_cond1EtaBits(cond1EtaBits),
82  m_gtGTL(ptrGTL),
83  m_gtPSB(ptrPSB),
84  m_gtEtaPhiConversions(etaPhiConversions),
86  m_condMaxNumberObjects = 2; // irrelevant for correlation conditions
87  m_nrBinsPhi = 0;
88 }
bool isDebugEnabled()
const L1GlobalTriggerPSB * m_gtPSB
pointer to PSB, to be able to get the trigger objects
unsigned int m_nrBinsPhi
number of bins for delta phi
const L1GtCorrelationTemplate * m_gtCorrelationTemplate
pointer to a L1GtCorrelationTemplate
const L1GtCondition * m_gtCond0
pointer to first sub-condition
const L1GlobalTriggerGTL * m_gtGTL
pointer to GTL, to be able to get the trigger objects
const L1GtCondition * m_gtCond1
pointer to second sub-condition
const L1GtEtaPhiConversions * m_gtEtaPhiConversions
pointer to eta and phi conversion class

◆ L1GtCorrelationCondition() [3/3]

L1GtCorrelationCondition::L1GtCorrelationCondition ( const L1GtCorrelationCondition cp)

Definition at line 118 of file L1GtCorrelationCondition.cc.

References copy().

119  copy(cp);
120 }
void copy(const L1GtCorrelationCondition &cp)
copy function for copy constructor and operator=

◆ ~L1GtCorrelationCondition()

L1GtCorrelationCondition::~L1GtCorrelationCondition ( )
override

Definition at line 123 of file L1GtCorrelationCondition.cc.

123  {
124  // empty
125 }

Member Function Documentation

◆ copy()

void L1GtCorrelationCondition::copy ( const L1GtCorrelationCondition cp)
private

copy function for copy constructor and operator=

Definition at line 91 of file L1GtCorrelationCondition.cc.

References L1GtConditionEvaluation::m_combinationsInCond, m_cond0EtaBits, m_cond0NrL1Objects, m_cond1EtaBits, m_cond1NrL1Objects, L1GtConditionEvaluation::m_condLastResult, L1GtConditionEvaluation::m_condMaxNumberObjects, m_gtCond0, m_gtCond1, m_gtCorrelationTemplate, m_gtEtaPhiConversions, m_gtGTL, m_gtPSB, m_isDebugEnabled, m_nrBinsPhi, and L1GtConditionEvaluation::m_verbosity.

Referenced by L1GtCorrelationCondition(), and operator=().

91  {
92  m_gtCorrelationTemplate = cp.m_gtCorrelationTemplate;
93 
94  m_gtCond0 = cp.m_gtCond0;
95  m_gtCond1 = cp.m_gtCond1;
96 
97  m_cond0NrL1Objects = cp.m_cond0NrL1Objects;
98  m_cond1NrL1Objects = cp.m_cond1NrL1Objects;
99  m_cond0EtaBits = cp.m_cond0EtaBits;
100  m_cond1EtaBits = cp.m_cond1EtaBits;
101 
102  m_nrBinsPhi = cp.m_nrBinsPhi;
103 
104  m_gtCorrelationTemplate = cp.m_gtCorrelationTemplate;
105  m_gtGTL = cp.m_gtGTL;
106  m_gtPSB = cp.m_gtPSB;
107 
108  m_gtEtaPhiConversions = cp.m_gtEtaPhiConversions;
109 
110  m_condMaxNumberObjects = cp.m_condMaxNumberObjects;
111  m_condLastResult = cp.m_condLastResult;
112  m_combinationsInCond = cp.m_combinationsInCond;
113 
114  m_verbosity = cp.m_verbosity;
115  m_isDebugEnabled = cp.m_isDebugEnabled;
116 }
const L1GlobalTriggerPSB * m_gtPSB
pointer to PSB, to be able to get the trigger objects
bool m_condLastResult
the last result of evaluateCondition()
CombinationsInCond m_combinationsInCond
store all the object combinations evaluated to true in the condition
unsigned int m_nrBinsPhi
number of bins for delta phi
const L1GtCorrelationTemplate * m_gtCorrelationTemplate
pointer to a L1GtCorrelationTemplate
const L1GtCondition * m_gtCond0
pointer to first sub-condition
const L1GlobalTriggerGTL * m_gtGTL
pointer to GTL, to be able to get the trigger objects
const L1GtCondition * m_gtCond1
pointer to second sub-condition
const L1GtEtaPhiConversions * m_gtEtaPhiConversions
pointer to eta and phi conversion class

◆ evaluateCondition()

const bool L1GtCorrelationCondition::evaluateCondition ( ) const
overridevirtual

the core function to check if the condition matches

Implements L1GtConditionEvaluation.

Definition at line 149 of file L1GtCorrelationCondition.cc.

References CenJet, L1GtConditionEvaluation::checkBit(), l1ct::clear(), L1GtConditionEvaluation::combinationsInCond(), L1GtCorrelationTemplate::cond0Category(), L1GtCorrelationTemplate::cond1Category(), CondCalo, CondEnergySum, L1GtConditionEvaluation::condLastResult(), CondMuon, L1GtEtaPhiConversions::convertEtaIndex(), L1GtEtaPhiConversions::convertPhiIndex(), L1GtCorrelationTemplate::correlationParameter(), L1GtCorrelationTemplate::CorrelationParameter::deltaEtaRange, L1GtCorrelationTemplate::CorrelationParameter::deltaPhiRange, ETM, L1GtConditionEvaluation::evaluateConditionStoreResult(), ForJet, L1GlobalTriggerPSB::getCandL1CenJet(), L1GlobalTriggerPSB::getCandL1ETM(), L1GlobalTriggerPSB::getCandL1ForJet(), L1GlobalTriggerPSB::getCandL1HTM(), L1GlobalTriggerPSB::getCandL1IsoEG(), L1GlobalTriggerGTL::getCandL1Mu(), L1GlobalTriggerPSB::getCandL1NoIsoEG(), L1GlobalTriggerPSB::getCandL1TauJet(), L1GtConditionEvaluation::getCombinationsInCond(), L1GtEtaPhiConversions::gtObjectNrBinsPhi(), L1GtEtaPhiConversions::gtObjectPairIndex(), hexStringToInt64(), HTM, IsoEG, l1GtObjectEnumToString(), LogTrace, m_cond0EtaBits, m_cond0NrL1Objects, m_cond1EtaBits, m_cond1NrL1Objects, m_gtCond0, m_gtCond1, m_gtCorrelationTemplate, m_gtEtaPhiConversions, m_gtGTL, m_gtPSB, m_isDebugEnabled, L1GtConditionEvaluation::m_verbosity, Mu, NoIsoEG, L1GtCondition::objectType(), L1GctEtMiss::phi(), L1GctHtMiss::phi(), L1GtEnergySumCondition::print(), L1GtMuonCondition::print(), L1GtCaloCondition::print(), push_back(), findQualityFiles::size, and TauJet.

149  {
150  // std::cout << "m_isDebugEnabled = " << m_isDebugEnabled << std::endl;
151  // std::cout << "m_verbosity = " << m_verbosity << std::endl;
152 
153  bool condResult = false;
154  bool reqObjResult = false;
155 
156  // number of objects in condition (it is 2, no need to retrieve from
157  // condition template) and their type
158  int nObjInCond = 2;
159  std::vector<L1GtObject> cndObjTypeVec(nObjInCond);
160 
161  // evaluate first the two sub-conditions (Type1s)
162 
165 
166  const L1GtMuonTemplate *corrMuon = nullptr;
167  const L1GtCaloTemplate *corrCalo = nullptr;
168  const L1GtEnergySumTemplate *corrEnergySum = nullptr;
169 
170  // FIXME copying is slow...
171  CombinationsInCond cond0Comb;
172  CombinationsInCond cond1Comb;
173 
174  switch (cond0Categ) {
175  case CondMuon: {
176  corrMuon = static_cast<const L1GtMuonTemplate *>(m_gtCond0);
178 
179  muCondition.evaluateConditionStoreResult();
180  reqObjResult = muCondition.condLastResult();
181 
182  cond0Comb = (muCondition.getCombinationsInCond());
183  cndObjTypeVec[0] = (corrMuon->objectType())[0];
184 
185  if (m_verbosity && m_isDebugEnabled) {
186  std::ostringstream myCout;
187  muCondition.print(myCout);
188 
189  LogTrace("L1GlobalTrigger") << myCout.str() << std::endl;
190  }
191  } break;
192  case CondCalo: {
193  corrCalo = static_cast<const L1GtCaloTemplate *>(m_gtCond0);
194 
195  L1GtCaloCondition caloCondition(corrCalo,
196  m_gtPSB,
203 
204  caloCondition.evaluateConditionStoreResult();
205  reqObjResult = caloCondition.condLastResult();
206 
207  cond0Comb = (caloCondition.getCombinationsInCond());
208  cndObjTypeVec[0] = (corrCalo->objectType())[0];
209 
210  if (m_verbosity && m_isDebugEnabled) {
211  std::ostringstream myCout;
212  caloCondition.print(myCout);
213 
214  LogTrace("L1GlobalTrigger") << myCout.str() << std::endl;
215  }
216  } break;
217  case CondEnergySum: {
218  corrEnergySum = static_cast<const L1GtEnergySumTemplate *>(m_gtCond0);
219  L1GtEnergySumCondition eSumCondition(corrEnergySum, m_gtPSB);
220 
221  eSumCondition.evaluateConditionStoreResult();
222  reqObjResult = eSumCondition.condLastResult();
223 
224  cond0Comb = (eSumCondition.getCombinationsInCond());
225  cndObjTypeVec[0] = (corrEnergySum->objectType())[0];
226 
227  if (m_verbosity && m_isDebugEnabled) {
228  std::ostringstream myCout;
229  eSumCondition.print(myCout);
230 
231  LogTrace("L1GlobalTrigger") << myCout.str() << std::endl;
232  }
233  } break;
234  default: {
235  // should not arrive here, there are no correlation conditions defined for
236  // this object
237  return false;
238  } break;
239  }
240 
241  // return if first subcondition is false
242  if (!reqObjResult) {
243  if (m_verbosity && m_isDebugEnabled) {
244  LogTrace("L1GlobalTrigger") << "\n First sub-condition false, second sub-condition not "
245  "evaluated and not printed."
246  << std::endl;
247  }
248  return false;
249  }
250 
251  // second object
252  switch (cond1Categ) {
253  case CondMuon: {
254  corrMuon = static_cast<const L1GtMuonTemplate *>(m_gtCond1);
256 
257  muCondition.evaluateConditionStoreResult();
258  reqObjResult = muCondition.condLastResult();
259 
260  cond1Comb = (muCondition.getCombinationsInCond());
261  cndObjTypeVec[1] = (corrMuon->objectType())[0];
262 
263  if (m_verbosity && m_isDebugEnabled) {
264  std::ostringstream myCout;
265  muCondition.print(myCout);
266 
267  LogTrace("L1GlobalTrigger") << myCout.str() << std::endl;
268  }
269  } break;
270  case CondCalo: {
271  corrCalo = static_cast<const L1GtCaloTemplate *>(m_gtCond1);
272  L1GtCaloCondition caloCondition(corrCalo,
273  m_gtPSB,
280 
281  caloCondition.evaluateConditionStoreResult();
282  reqObjResult = caloCondition.condLastResult();
283 
284  cond1Comb = (caloCondition.getCombinationsInCond());
285  cndObjTypeVec[1] = (corrCalo->objectType())[0];
286 
287  if (m_verbosity && m_isDebugEnabled) {
288  std::ostringstream myCout;
289  caloCondition.print(myCout);
290 
291  LogTrace("L1GlobalTrigger") << myCout.str() << std::endl;
292  }
293 
294  } break;
295  case CondEnergySum: {
296  corrEnergySum = static_cast<const L1GtEnergySumTemplate *>(m_gtCond1);
297  L1GtEnergySumCondition eSumCondition(corrEnergySum, m_gtPSB);
298  eSumCondition.evaluateConditionStoreResult();
299  reqObjResult = eSumCondition.condLastResult();
300 
301  cond1Comb = (eSumCondition.getCombinationsInCond());
302  cndObjTypeVec[1] = (corrEnergySum->objectType())[0];
303 
304  if (m_verbosity && m_isDebugEnabled) {
305  std::ostringstream myCout;
306  eSumCondition.print(myCout);
307 
308  LogTrace("L1GlobalTrigger") << myCout.str() << std::endl;
309  }
310  } break;
311  default: {
312  // should not arrive here, there are no correlation conditions defined for
313  // this object
314  return false;
315  } break;
316  }
317 
318  // return if second sub-condition is false
319  if (!reqObjResult) {
320  return false;
321  } else {
322  LogTrace("L1GlobalTrigger") << "\n"
323  << " Both sub-conditions true for object requirements."
324  << " Evaluate correlation requirements.\n"
325  << std::endl;
326  }
327 
328  //
329  // evaluate the delta_eta and delta_phi correlations
330  // if here, the object requirements are satisfied for both sub-conditions
331  //
332 
333  // get the correlation parameters
334 
336 
337  // convert the eta template requirements from string to 64-bit integers
338  // number of 64-bit integers: string length / 16
339  size_t deltaEtaRangeConvSize = (corrPar.deltaEtaRange).size() / 16 + 1;
340  std::vector<unsigned long long> deltaEtaRangeConv(deltaEtaRangeConvSize);
341 
342  if (!(hexStringToInt64(corrPar.deltaEtaRange, deltaEtaRangeConv))) {
343  return false;
344  }
345 
346  // convert the phi template requirements from string to 64-bit integers
347  // number of 64-bit integers: string length / 16
348  size_t deltaPhiRangeConvSize = (corrPar.deltaPhiRange).size() / 16 + 1;
349  std::vector<unsigned long long> deltaPhiRangeConv(deltaPhiRangeConvSize);
350 
351  if (!(hexStringToInt64(corrPar.deltaPhiRange, deltaPhiRangeConv))) {
352  return false;
353  }
354 
355  // get the index of L1 GT object pair
356  unsigned int objPairIndex = (m_gtEtaPhiConversions->gtObjectPairIndex(cndObjTypeVec[0], cndObjTypeVec[1]));
357 
358  // get the maximum number of bins for the delta phi scales
359  unsigned int corrParDeltaPhiNrBins = (m_gtEtaPhiConversions->gtObjectNrBinsPhi(objPairIndex)) / 2 + 1;
360 
361  // vector to store the indices of the calorimeter objects
362  // from the combination evaluated in the condition
363  SingleCombInCond objectsInComb;
364  objectsInComb.reserve(nObjInCond);
365 
366  // clear the m_combinationsInCond vector
368 
369  // pointers to objects
370  const std::vector<const L1MuGMTCand *> *candMuVec = nullptr;
371  const std::vector<const L1GctCand *> *candCaloVec = nullptr;
372  // only ETM and HTM can appear in correlation conditions
373  const L1GctEtMiss *candETM = nullptr;
374  const L1GctHtMiss *candHTM = nullptr;
375 
376  // make the conversions of the indices, depending on the combination of
377  // objects involved (via pair index)
378 
379  unsigned int phiIndex0 = 0;
380  unsigned int phiIndex1 = 0;
381 
382  unsigned int phiIndex0Converted = 0;
383  unsigned int phiIndex1Converted = 0;
384 
385  unsigned int etaIndex0 = 0;
386  unsigned int etaIndex1 = 0;
387 
388  unsigned int etaIndex0Converted = 0;
389  unsigned int etaIndex1Converted = 0;
390 
391  LogTrace("L1GlobalTrigger") << " Sub-condition 0: std::vector<SingleCombInCond> size: " << (cond0Comb.size())
392  << std::endl;
393  LogTrace("L1GlobalTrigger") << " Sub-condition 1: std::vector<SingleCombInCond> size: " << (cond1Comb.size())
394  << std::endl;
395 
396  // loop over all combinations which produced individually "true" as Type1s
397  for (std::vector<SingleCombInCond>::const_iterator it0Comb = cond0Comb.begin(); it0Comb != cond0Comb.end();
398  it0Comb++) {
399  // Type1s: there is 1 object only, no need for a loop, index 0 should be OK
400  // in (*it0Comb)[0]
401  // ... but add protection to not crash
402  int obj0Index = -1;
403 
404  if (!(*it0Comb).empty()) {
405  obj0Index = (*it0Comb)[0];
406  } else {
407  LogTrace("L1GlobalTrigger") << "\n SingleCombInCond (*it0Comb).size() " << ((*it0Comb).size()) << std::endl;
408  return false;
409  }
410 
411  bool convStatus = false;
412 
413  switch (cond0Categ) {
414  case CondMuon: {
415  candMuVec = m_gtGTL->getCandL1Mu();
416  phiIndex0 = (*candMuVec)[obj0Index]->phiIndex();
417  etaIndex0 = (*candMuVec)[obj0Index]->etaIndex();
418 
419  convStatus = m_gtEtaPhiConversions->convertPhiIndex(objPairIndex, 0, phiIndex0, phiIndex0Converted);
420 
421  if (!convStatus) {
422  // conversion failed, message written in L1GtEtaPhiConversions
423  return false;
424  }
425 
426  convStatus = m_gtEtaPhiConversions->convertEtaIndex(Mu, etaIndex0, etaIndex0Converted);
427 
428  if (!convStatus) {
429  // conversion failed, message written in L1GtEtaPhiConversions
430  return false;
431  }
432 
433  } break;
434  case CondCalo: {
435  switch (cndObjTypeVec[0]) {
436  case NoIsoEG: {
437  candCaloVec = m_gtPSB->getCandL1NoIsoEG();
438  } break;
439  case IsoEG: {
440  candCaloVec = m_gtPSB->getCandL1IsoEG();
441  } break;
442  case CenJet: {
443  candCaloVec = m_gtPSB->getCandL1CenJet();
444  } break;
445  case ForJet: {
446  candCaloVec = m_gtPSB->getCandL1ForJet();
447  } break;
448  case TauJet: {
449  candCaloVec = m_gtPSB->getCandL1TauJet();
450  } break;
451  default: {
452  // do nothing
453  } break;
454  }
455 
456  phiIndex0 = (*candCaloVec)[obj0Index]->phiIndex();
457  etaIndex0 = (*candCaloVec)[obj0Index]->etaIndex();
458 
459  convStatus = m_gtEtaPhiConversions->convertPhiIndex(objPairIndex, 0, phiIndex0, phiIndex0Converted);
460 
461  if (!convStatus) {
462  // conversion failed, message written in L1GtEtaPhiConversions
463  return false;
464  }
465 
466  convStatus = m_gtEtaPhiConversions->convertEtaIndex(cndObjTypeVec[0], etaIndex0, etaIndex0Converted);
467 
468  if (!convStatus) {
469  // conversion failed, message written in L1GtEtaPhiConversions
470  return false;
471  }
472  } break;
473  case CondEnergySum: {
474  switch (cndObjTypeVec[0]) {
475  case ETM: {
476  candETM = m_gtPSB->getCandL1ETM();
477  phiIndex0 = candETM->phi();
478 
479  convStatus = m_gtEtaPhiConversions->convertPhiIndex(objPairIndex, 0, phiIndex0, phiIndex0Converted);
480 
481  if (!convStatus) {
482  // conversion failed, message written in L1GtEtaPhiConversions
483  return false;
484  }
485 
486  } break;
487  case HTM: {
488  candHTM = m_gtPSB->getCandL1HTM();
489  phiIndex0 = candHTM->phi();
490 
491  convStatus = m_gtEtaPhiConversions->convertPhiIndex(objPairIndex, 0, phiIndex0, phiIndex0Converted);
492 
493  if (!convStatus) {
494  // conversion failed, message written in L1GtEtaPhiConversions
495  return false;
496  }
497 
498  } break;
499  default:
500  // do nothing
501  break;
502  }
503  } break;
504  default: {
505  // should not arrive here, there are no correlation conditions defined for
506  // this object
507  return false;
508  } break;
509  }
510 
511  for (std::vector<SingleCombInCond>::const_iterator it1Comb = cond1Comb.begin(); it1Comb != cond1Comb.end();
512  it1Comb++) {
513  // Type1s: there is 1 object only, no need for a loop (*it1Comb)[0]
514  // ... but add protection to not crash
515  int obj1Index = -1;
516 
517  if (!(*it1Comb).empty()) {
518  obj1Index = (*it1Comb)[0];
519  } else {
520  LogTrace("L1GlobalTrigger") << "\n SingleCombInCond (*it1Comb).size() " << ((*it1Comb).size()) << std::endl;
521  return false;
522  }
523 
524  switch (cond1Categ) {
525  case CondMuon: {
526  candMuVec = m_gtGTL->getCandL1Mu();
527  phiIndex1 = (*candMuVec)[obj1Index]->phiIndex();
528  etaIndex1 = (*candMuVec)[obj1Index]->etaIndex();
529 
530  convStatus = m_gtEtaPhiConversions->convertPhiIndex(objPairIndex, 1, phiIndex1, phiIndex1Converted);
531 
532  if (!convStatus) {
533  // conversion failed, message written in L1GtEtaPhiConversions
534  return false;
535  }
536 
537  convStatus = m_gtEtaPhiConversions->convertEtaIndex(cndObjTypeVec[1], etaIndex1, etaIndex1Converted);
538 
539  if (!convStatus) {
540  // conversion failed, message written in L1GtEtaPhiConversions
541  return false;
542  }
543  } break;
544  case CondCalo: {
545  switch (cndObjTypeVec[1]) {
546  case NoIsoEG:
547  candCaloVec = m_gtPSB->getCandL1NoIsoEG();
548  break;
549  case IsoEG:
550  candCaloVec = m_gtPSB->getCandL1IsoEG();
551  break;
552  case CenJet:
553  candCaloVec = m_gtPSB->getCandL1CenJet();
554  break;
555  case ForJet:
556  candCaloVec = m_gtPSB->getCandL1ForJet();
557  break;
558  case TauJet:
559  candCaloVec = m_gtPSB->getCandL1TauJet();
560  break;
561  default:
562  // do nothing
563  break;
564  }
565 
566  phiIndex1 = (*candCaloVec)[obj1Index]->phiIndex();
567  etaIndex1 = (*candCaloVec)[obj1Index]->etaIndex();
568 
569  convStatus = m_gtEtaPhiConversions->convertPhiIndex(objPairIndex, 1, phiIndex1, phiIndex1Converted);
570 
571  if (!convStatus) {
572  // conversion failed, message written in L1GtEtaPhiConversions
573  return false;
574  }
575 
576  convStatus = m_gtEtaPhiConversions->convertEtaIndex(cndObjTypeVec[1], etaIndex1, etaIndex1Converted);
577 
578  if (!convStatus) {
579  // conversion failed, message written in L1GtEtaPhiConversions
580  return false;
581  }
582 
583  } break;
584  case CondEnergySum: {
585  switch (cndObjTypeVec[1]) {
586  case ETM: {
587  candETM = m_gtPSB->getCandL1ETM();
588  phiIndex1 = candETM->phi();
589 
590  convStatus = m_gtEtaPhiConversions->convertPhiIndex(objPairIndex, 1, phiIndex1, phiIndex1Converted);
591 
592  if (!convStatus) {
593  // conversion failed, message written in L1GtEtaPhiConversions
594  return false;
595  }
596  } break;
597  case HTM: {
598  candHTM = m_gtPSB->getCandL1HTM();
599  phiIndex1 = candHTM->phi();
600 
601  convStatus = m_gtEtaPhiConversions->convertPhiIndex(objPairIndex, 1, phiIndex1, phiIndex1Converted);
602 
603  if (!convStatus) {
604  // conversion failed, message written in L1GtEtaPhiConversions
605  return false;
606  }
607  } break;
608  default:
609  // do nothing
610  break;
611  }
612  } break;
613  default: {
614  // should not arrive here, there are no correlation conditions defined
615  // for this object
616  return false;
617  } break;
618  }
619 
620  if (m_verbosity && m_isDebugEnabled) {
621  LogTrace("L1GlobalTrigger") << " Correlation pair [" << l1GtObjectEnumToString(cndObjTypeVec[0]) << ", "
622  << l1GtObjectEnumToString(cndObjTypeVec[1]) << "] with collection indices ["
623  << obj0Index << ", " << obj1Index << "] "
624  << " has: \n phi indices = [" << phiIndex0 << ", " << phiIndex1
625  << "] converted to [" << phiIndex0Converted << ", " << phiIndex1Converted
626  << "] \n eta indices [" << etaIndex0 << ", " << etaIndex1 << "] converted to ["
627  << etaIndex0Converted << ", " << etaIndex1Converted << "] \n"
628  << std::endl;
629  }
630 
631  // the conversions were successful, need to evaluate requirements now
632 
633  bool reqEtaPhiResult = false;
634 
635  // evaluate candDeltaPhi requirements
636 
637  unsigned int candDeltaPhi;
638 
639  // calculate absolute value of candDeltaPhi
640  if (phiIndex0Converted > phiIndex1Converted) {
641  candDeltaPhi = phiIndex0Converted - phiIndex1Converted;
642  } else {
643  candDeltaPhi = phiIndex1Converted - phiIndex0Converted;
644  }
645 
646  // check if candDeltaPhi > 180 (via delta_phi_maxbits)
647  // delta_phi contains bits for 0..180 (0 and 180 included)
648  // protect also against infinite loop...
649 
650  int nMaxLoop = 10;
651  int iLoop = 0;
652 
653  while (candDeltaPhi >= corrParDeltaPhiNrBins) {
654  unsigned int candDeltaPhiInitial = candDeltaPhi;
655 
656  // candDeltaPhi > 180 ==> take 360 - candDeltaPhi
657  candDeltaPhi = (corrParDeltaPhiNrBins - 1) * 2 - candDeltaPhi;
658  if (m_verbosity) {
659  LogTrace("L1GlobalTrigger") << " Initial candDeltaPhi = " << candDeltaPhiInitial
660  << " > corrParDeltaPhiNrBins = " << corrParDeltaPhiNrBins
661  << " ==> candDeltaPhi rescaled to: " << candDeltaPhi << " [ loop index " << iLoop
662  << "; breaks after " << nMaxLoop << " loops ]\n"
663  << std::endl;
664  }
665 
666  iLoop++;
667  if (iLoop > nMaxLoop) {
668  return false;
669  }
670  }
671 
672  // template requirements already converted from string to 64-bit integers
673  // ...now check for each 64-bit integer against template requirements
674  bool indResult = true;
675 
676  for (size_t iDeltaPhi = 0; iDeltaPhi < deltaPhiRangeConv.size(); ++iDeltaPhi) {
677  if (!checkBit(deltaPhiRangeConv[iDeltaPhi], candDeltaPhi)) {
678  indResult = false;
679  }
680  }
681 
682  if (!indResult) {
683  if (m_verbosity && m_isDebugEnabled) {
684  LogTrace("L1GlobalTrigger") << " object delta phi = " << candDeltaPhi << " fails delta phi requirements."
685  << "\n Pair fails correlation condition.\n"
686  << std::endl;
687  }
688 
689  continue;
690 
691  } else {
692  if (m_verbosity && m_isDebugEnabled) {
693  LogTrace("L1GlobalTrigger") << " object delta phi = " << candDeltaPhi
694  << " passes delta phi requirements." << std::endl;
695  }
696  }
697 
698  // evaluate candDeltaEta requirements
699 
700  unsigned int candDeltaEta;
701 
702  // calculate absolute value of candDeltaEta
703  if (etaIndex0Converted > etaIndex1Converted) {
704  candDeltaEta = etaIndex0Converted - etaIndex1Converted;
705  } else {
706  candDeltaEta = etaIndex1Converted - etaIndex0Converted;
707  }
708 
709  // template requirements already converted from string to 64-bit integers
710  // ...now check for each 64-bit integer against template requirements
711  indResult = true;
712 
713  for (size_t iDeltaEta = 0; iDeltaEta < deltaEtaRangeConv.size(); ++iDeltaEta) {
714  if (!checkBit(deltaEtaRangeConv[iDeltaEta], candDeltaEta)) {
715  indResult = false;
716  }
717  }
718 
719  if (!indResult) {
720  if (m_verbosity && m_isDebugEnabled) {
721  LogTrace("L1GlobalTrigger") << " object delta eta = " << candDeltaEta << " fails delta eta requirements."
722  << "\n Pair fails correlation condition.\n"
723  << std::endl;
724  }
725 
726  reqEtaPhiResult = false;
727  continue;
728 
729  } else {
730  if (m_verbosity && m_isDebugEnabled) {
731  LogTrace("L1GlobalTrigger") << " object delta eta = " << candDeltaEta
732  << " passes delta eta requirements."
733  << "\n Pair passes correlation condition.\n"
734  << std::endl;
735  }
736 
737  reqEtaPhiResult = true;
738  }
739 
740  // clear the indices in the combination
741  objectsInComb.clear();
742 
743  objectsInComb.push_back(obj0Index);
744  objectsInComb.push_back(obj1Index);
745 
746  // if we get here all checks were successful for this combination
747  // set the general result for evaluateCondition to "true"
748 
749  if (reqEtaPhiResult) {
750  condResult = true;
751  (combinationsInCond()).push_back(objectsInComb);
752  }
753  }
754  }
755 
756  if (m_verbosity && m_isDebugEnabled && condResult) {
757  LogTrace("L1GlobalTrigger") << (combinationsInCond()).size() << " correlation pair(s) ["
758  << l1GtObjectEnumToString(cndObjTypeVec[0]) << ", "
759  << l1GtObjectEnumToString(cndObjTypeVec[1]) << "] pass(es) the correlation condition.\n"
760  << std::endl;
761  }
762 
763  return condResult;
764 }
size
Write out results.
Definition: L1GtObject.h:38
unsigned phi() const
get the Et
Definition: L1GctEtMiss.h:62
const L1GlobalTriggerPSB * m_gtPSB
pointer to PSB, to be able to get the trigger objects
const L1GtConditionCategory cond0Category() const
get / set the category of the two sub-conditions
const std::vector< const L1GctCand * > * getCandL1ForJet() const
pointer to ForJet data list
const L1GctEtMiss * getCandL1ETM() const
pointer to ETM data list
const bool checkBit(const Type1 &mask, const unsigned int bitNumber) const
check if a bit with a given number is set in a mask
Definition: L1GtObject.h:29
const std::vector< const L1GctCand * > * getCandL1CenJet() const
pointer to CenJet data list
const L1GctHtMiss * getCandL1HTM() const
pointer to HTM data list
std::vector< int > SingleCombInCond
typedefs
const L1GtCorrelationTemplate * m_gtCorrelationTemplate
pointer to a L1GtCorrelationTemplate
Persistable copy of missing Et measured at Level-1.
Definition: L1GctEtMiss.h:17
CombinationsInCond & combinationsInCond() const
get all the object combinations (to fill it...)
const std::vector< const L1MuGMTCand * > * getCandL1Mu() const
return global muon trigger candidate
const L1GtConditionCategory cond1Category() const
std::string l1GtObjectEnumToString(const L1GtObject &)
Definition: L1GtObject.cc:69
#define LogTrace(id)
const bool convertPhiIndex(const unsigned int pairIndex, const unsigned int positionPair, const unsigned int initialIndex, unsigned int &convertedIndex) const
const unsigned int gtObjectNrBinsPhi(const L1GtObject &) const
return the number of phi bins for a GT object
const bool convertEtaIndex(const L1GtObject &, const unsigned int initialIndex, unsigned int &convertedIndex) const
const std::vector< const L1GctCand * > * getCandL1IsoEG() const
pointer to IsoEG data list
const L1GtCondition * m_gtCond0
pointer to first sub-condition
const std::vector< const L1GctCand * > * getCandL1NoIsoEG() const
pointer to NoIsoEG data list
Definition: L1GtObject.h:35
const std::vector< L1GtObject > & objectType() const
get / set the trigger object type(s) in the condition
Definition: L1GtCondition.h:67
Persistable copy of missing Et measured at Level-1.
Definition: L1GctHtMiss.h:16
const std::vector< const L1GctCand * > * getCandL1TauJet() const
pointer to TauJet data list
deadvectors [0] push_back({0.0175431, 0.538005, 6.80997, 13.29})
const unsigned int gtObjectPairIndex(const L1GtObject &, const L1GtObject &) const
bool hexStringToInt64(const std::string &, std::vector< unsigned long long > &)
unsigned phi() const
get the Et
Definition: L1GctHtMiss.h:65
void clear(EGIsoObj &c)
Definition: egamma.h:82
L1GtConditionCategory
condition categories
std::vector< SingleCombInCond > CombinationsInCond
all the object combinations evaluated to true in the condition
const CorrelationParameter * correlationParameter() const
get / set correlation parameters
const L1GlobalTriggerGTL * m_gtGTL
pointer to GTL, to be able to get the trigger objects
const L1GtCondition * m_gtCond1
pointer to second sub-condition
const L1GtEtaPhiConversions * m_gtEtaPhiConversions
pointer to eta and phi conversion class

◆ gtCorrelationTemplate()

const L1GtCorrelationTemplate* L1GtCorrelationCondition::gtCorrelationTemplate ( ) const
inline

get / set the pointer to a L1GtCondition

Definition at line 75 of file L1GtCorrelationCondition.h.

References m_gtCorrelationTemplate.

75 { return m_gtCorrelationTemplate; }
const L1GtCorrelationTemplate * m_gtCorrelationTemplate
pointer to a L1GtCorrelationTemplate

◆ gtGTL()

const L1GlobalTriggerGTL* L1GtCorrelationCondition::gtGTL ( ) const
inline

get / set the pointer to GTL

Definition at line 80 of file L1GtCorrelationCondition.h.

References m_gtGTL.

80 { return m_gtGTL; }
const L1GlobalTriggerGTL * m_gtGTL
pointer to GTL, to be able to get the trigger objects

◆ gtNrBinsPhi()

const unsigned int L1GtCorrelationCondition::gtNrBinsPhi ( ) const
inline

get / set the number of phi bins

Definition at line 70 of file L1GtCorrelationCondition.h.

References m_nrBinsPhi.

70 { return m_nrBinsPhi; }
unsigned int m_nrBinsPhi
number of bins for delta phi

◆ gtPSB()

const L1GlobalTriggerPSB* L1GtCorrelationCondition::gtPSB ( ) const
inline

get / set the pointer to PSB

Definition at line 85 of file L1GtCorrelationCondition.h.

References m_gtPSB.

85 { return m_gtPSB; }
const L1GlobalTriggerPSB * m_gtPSB
pointer to PSB, to be able to get the trigger objects

◆ operator=()

L1GtCorrelationCondition & L1GtCorrelationCondition::operator= ( const L1GtCorrelationCondition cp)

Definition at line 128 of file L1GtCorrelationCondition.cc.

References copy().

128  {
129  copy(cp);
130  return *this;
131 }
void copy(const L1GtCorrelationCondition &cp)
copy function for copy constructor and operator=

◆ print()

void L1GtCorrelationCondition::print ( std::ostream &  myCout) const
overridevirtual

print condition

Reimplemented from L1GtConditionEvaluation.

Definition at line 766 of file L1GtCorrelationCondition.cc.

References m_gtCorrelationTemplate, L1GtConditionEvaluation::print(), and L1GtCorrelationTemplate::print().

Referenced by L1GlobalTriggerGTL::run().

766  {
769 }
const L1GtCorrelationTemplate * m_gtCorrelationTemplate
pointer to a L1GtCorrelationTemplate
virtual void print(std::ostream &myCout) const
print condition
void print(std::ostream &myCout) const override
print the condition

◆ setGtCorrelationTemplate()

void L1GtCorrelationCondition::setGtCorrelationTemplate ( const L1GtCorrelationTemplate corrTempl)

Definition at line 138 of file L1GtCorrelationCondition.cc.

References m_gtCorrelationTemplate.

138  {
139  m_gtCorrelationTemplate = corrTempl;
140 }
const L1GtCorrelationTemplate * m_gtCorrelationTemplate
pointer to a L1GtCorrelationTemplate

◆ setGtGTL()

void L1GtCorrelationCondition::setGtGTL ( const L1GlobalTriggerGTL ptrGTL)

Definition at line 143 of file L1GtCorrelationCondition.cc.

References m_gtGTL.

143 { m_gtGTL = ptrGTL; }
const L1GlobalTriggerGTL * m_gtGTL
pointer to GTL, to be able to get the trigger objects

◆ setGtNrBinsPhi()

void L1GtCorrelationCondition::setGtNrBinsPhi ( const unsigned int  nrBins)

Definition at line 135 of file L1GtCorrelationCondition.cc.

References m_nrBinsPhi.

135 { m_nrBinsPhi = nrBins; }
unsigned int m_nrBinsPhi
number of bins for delta phi

◆ setGtPSB()

void L1GtCorrelationCondition::setGtPSB ( const L1GlobalTriggerPSB ptrPSB)

Definition at line 146 of file L1GtCorrelationCondition.cc.

References m_gtPSB.

146 { m_gtPSB = ptrPSB; }
const L1GlobalTriggerPSB * m_gtPSB
pointer to PSB, to be able to get the trigger objects

Member Data Documentation

◆ m_cond0EtaBits

int L1GtCorrelationCondition::m_cond0EtaBits
private

Definition at line 106 of file L1GtCorrelationCondition.h.

Referenced by copy(), and evaluateCondition().

◆ m_cond0NrL1Objects

int L1GtCorrelationCondition::m_cond0NrL1Objects
private

Definition at line 104 of file L1GtCorrelationCondition.h.

Referenced by copy(), and evaluateCondition().

◆ m_cond1EtaBits

int L1GtCorrelationCondition::m_cond1EtaBits
private

Definition at line 107 of file L1GtCorrelationCondition.h.

Referenced by copy(), and evaluateCondition().

◆ m_cond1NrL1Objects

int L1GtCorrelationCondition::m_cond1NrL1Objects
private

Definition at line 105 of file L1GtCorrelationCondition.h.

Referenced by copy(), and evaluateCondition().

◆ m_gtCond0

const L1GtCondition* L1GtCorrelationCondition::m_gtCond0
private

pointer to first sub-condition

Definition at line 98 of file L1GtCorrelationCondition.h.

Referenced by copy(), and evaluateCondition().

◆ m_gtCond1

const L1GtCondition* L1GtCorrelationCondition::m_gtCond1
private

pointer to second sub-condition

Definition at line 101 of file L1GtCorrelationCondition.h.

Referenced by copy(), and evaluateCondition().

◆ m_gtCorrelationTemplate

const L1GtCorrelationTemplate* L1GtCorrelationCondition::m_gtCorrelationTemplate
private

◆ m_gtEtaPhiConversions

const L1GtEtaPhiConversions* L1GtCorrelationCondition::m_gtEtaPhiConversions
private

pointer to eta and phi conversion class

Definition at line 119 of file L1GtCorrelationCondition.h.

Referenced by copy(), and evaluateCondition().

◆ m_gtGTL

const L1GlobalTriggerGTL* L1GtCorrelationCondition::m_gtGTL
private

pointer to GTL, to be able to get the trigger objects

Definition at line 113 of file L1GtCorrelationCondition.h.

Referenced by copy(), evaluateCondition(), gtGTL(), and setGtGTL().

◆ m_gtPSB

const L1GlobalTriggerPSB* L1GtCorrelationCondition::m_gtPSB
private

pointer to PSB, to be able to get the trigger objects

Definition at line 116 of file L1GtCorrelationCondition.h.

Referenced by copy(), evaluateCondition(), gtPSB(), and setGtPSB().

◆ m_isDebugEnabled

bool L1GtCorrelationCondition::m_isDebugEnabled
private

Definition at line 122 of file L1GtCorrelationCondition.h.

Referenced by copy(), and evaluateCondition().

◆ m_nrBinsPhi

unsigned int L1GtCorrelationCondition::m_nrBinsPhi
private

number of bins for delta phi

Definition at line 110 of file L1GtCorrelationCondition.h.

Referenced by copy(), gtNrBinsPhi(), L1GtCorrelationCondition(), and setGtNrBinsPhi().