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::L1GtCorrelationCondition ( )

constructors default

Definition at line 58 of file L1GtCorrelationCondition.cc.

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 65 of file L1GtCorrelationCondition.cc.

References L1GtConditionEvaluation::m_condMaxNumberObjects, and m_nrBinsPhi.

73  static_cast<const L1GtCorrelationTemplate *>(corrTemplate)),
74  m_gtCond0(cond0Condition), m_gtCond1(cond1Condition),
75  m_cond0NrL1Objects(cond0NrL1Objects),
76  m_cond1NrL1Objects(cond1NrL1Objects), m_cond0EtaBits(cond0EtaBits),
77  m_cond1EtaBits(cond1EtaBits), m_gtGTL(ptrGTL), m_gtPSB(ptrPSB),
78  m_gtEtaPhiConversions(etaPhiConversions),
80 
81  m_condMaxNumberObjects = 2; // irrelevant for correlation conditions
82  m_nrBinsPhi = 0;
83 }
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::L1GtCorrelationCondition ( const L1GtCorrelationCondition cp)

Definition at line 114 of file L1GtCorrelationCondition.cc.

References copy().

117  copy(cp);
118 }
void copy(const L1GtCorrelationCondition &cp)
copy function for copy constructor and operator=
L1GtCorrelationCondition::~L1GtCorrelationCondition ( )
override

Definition at line 121 of file L1GtCorrelationCondition.cc.

References operator=().

121  {
122 
123  // empty
124 }

Member Function Documentation

void L1GtCorrelationCondition::copy ( const L1GtCorrelationCondition cp)
private

copy function for copy constructor and operator=

Definition at line 86 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 gtPSB(), L1GtCorrelationCondition(), and operator=().

86  {
87 
89 
90  m_gtCond0 = cp.m_gtCond0;
91  m_gtCond1 = cp.m_gtCond1;
92 
97 
99 
101  m_gtGTL = cp.m_gtGTL;
102  m_gtPSB = cp.m_gtPSB;
103 
105 
109 
112 }
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
const bool L1GtCorrelationCondition::evaluateCondition ( ) const
overridevirtual

the core function to check if the condition matches

Implements L1GtConditionEvaluation.

Definition at line 160 of file L1GtCorrelationCondition.cc.

References CenJet, L1GtConditionEvaluation::checkBit(), hitfit::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(), findQualityFiles::size, and TauJet.

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

get / set the pointer to a L1GtCondition

Definition at line 71 of file L1GtCorrelationCondition.h.

References m_gtCorrelationTemplate, and setGtCorrelationTemplate().

71  {
73  }
const L1GtCorrelationTemplate * m_gtCorrelationTemplate
pointer to a L1GtCorrelationTemplate
const L1GlobalTriggerGTL* L1GtCorrelationCondition::gtGTL ( ) const
inline

get / set the pointer to GTL

Definition at line 78 of file L1GtCorrelationCondition.h.

References m_gtGTL, and setGtGTL().

78 { return m_gtGTL; }
const L1GlobalTriggerGTL * m_gtGTL
pointer to GTL, to be able to get the trigger objects
const unsigned int L1GtCorrelationCondition::gtNrBinsPhi ( ) const
inline

get / set the number of phi bins

Definition at line 66 of file L1GtCorrelationCondition.h.

References m_nrBinsPhi, and setGtNrBinsPhi().

66 { return m_nrBinsPhi; }
unsigned int m_nrBinsPhi
number of bins for delta phi
const L1GlobalTriggerPSB* L1GtCorrelationCondition::gtPSB ( ) const
inline

get / set the pointer to PSB

Definition at line 83 of file L1GtCorrelationCondition.h.

References copy(), SimDataFormats::CaloAnalysis::cp, m_gtPSB, and setGtPSB().

83 { return m_gtPSB; }
const L1GlobalTriggerPSB * m_gtPSB
pointer to PSB, to be able to get the trigger objects
L1GtCorrelationCondition & L1GtCorrelationCondition::operator= ( const L1GtCorrelationCondition cp)

Definition at line 128 of file L1GtCorrelationCondition.cc.

References copy().

Referenced by ~L1GtCorrelationCondition().

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

print condition

Reimplemented from L1GtConditionEvaluation.

Definition at line 822 of file L1GtCorrelationCondition.cc.

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

Referenced by L1GlobalTriggerGTL::run().

822  {
823 
826 }
const L1GtCorrelationTemplate * m_gtCorrelationTemplate
pointer to a L1GtCorrelationTemplate
void print(std::ostream &myCout) const override
print the condition
virtual void print(std::ostream &myCout) const
print condition
void L1GtCorrelationCondition::setGtCorrelationTemplate ( const L1GtCorrelationTemplate corrTempl)

Definition at line 141 of file L1GtCorrelationCondition.cc.

References m_gtCorrelationTemplate.

Referenced by gtCorrelationTemplate().

142  {
143 
144  m_gtCorrelationTemplate = corrTempl;
145 }
const L1GtCorrelationTemplate * m_gtCorrelationTemplate
pointer to a L1GtCorrelationTemplate
void L1GtCorrelationCondition::setGtGTL ( const L1GlobalTriggerGTL ptrGTL)

Definition at line 148 of file L1GtCorrelationCondition.cc.

References m_gtGTL.

Referenced by gtGTL().

148  {
149 
150  m_gtGTL = ptrGTL;
151 }
const L1GlobalTriggerGTL * m_gtGTL
pointer to GTL, to be able to get the trigger objects
void L1GtCorrelationCondition::setGtNrBinsPhi ( const unsigned int  nrBins)

Definition at line 135 of file L1GtCorrelationCondition.cc.

References m_nrBinsPhi.

Referenced by gtNrBinsPhi().

135  {
136 
137  m_nrBinsPhi = nrBins;
138 }
unsigned int m_nrBinsPhi
number of bins for delta phi
void L1GtCorrelationCondition::setGtPSB ( const L1GlobalTriggerPSB ptrPSB)

Definition at line 154 of file L1GtCorrelationCondition.cc.

References m_gtPSB.

Referenced by gtPSB().

154  {
155 
156  m_gtPSB = ptrPSB;
157 }
const L1GlobalTriggerPSB * m_gtPSB
pointer to PSB, to be able to get the trigger objects

Member Data Documentation

int L1GtCorrelationCondition::m_cond0EtaBits
private

Definition at line 104 of file L1GtCorrelationCondition.h.

Referenced by copy(), and evaluateCondition().

int L1GtCorrelationCondition::m_cond0NrL1Objects
private

Definition at line 102 of file L1GtCorrelationCondition.h.

Referenced by copy(), and evaluateCondition().

int L1GtCorrelationCondition::m_cond1EtaBits
private

Definition at line 105 of file L1GtCorrelationCondition.h.

Referenced by copy(), and evaluateCondition().

int L1GtCorrelationCondition::m_cond1NrL1Objects
private

Definition at line 103 of file L1GtCorrelationCondition.h.

Referenced by copy(), and evaluateCondition().

const L1GtCondition* L1GtCorrelationCondition::m_gtCond0
private

pointer to first sub-condition

Definition at line 96 of file L1GtCorrelationCondition.h.

Referenced by copy(), and evaluateCondition().

const L1GtCondition* L1GtCorrelationCondition::m_gtCond1
private

pointer to second sub-condition

Definition at line 99 of file L1GtCorrelationCondition.h.

Referenced by copy(), and evaluateCondition().

const L1GtCorrelationTemplate* L1GtCorrelationCondition::m_gtCorrelationTemplate
private
const L1GtEtaPhiConversions* L1GtCorrelationCondition::m_gtEtaPhiConversions
private

pointer to eta and phi conversion class

Definition at line 117 of file L1GtCorrelationCondition.h.

Referenced by copy(), and evaluateCondition().

const L1GlobalTriggerGTL* L1GtCorrelationCondition::m_gtGTL
private

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

Definition at line 111 of file L1GtCorrelationCondition.h.

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

const L1GlobalTriggerPSB* L1GtCorrelationCondition::m_gtPSB
private

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

Definition at line 114 of file L1GtCorrelationCondition.h.

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

bool L1GtCorrelationCondition::m_isDebugEnabled
private

Definition at line 120 of file L1GtCorrelationCondition.h.

Referenced by copy(), and evaluateCondition().

unsigned int L1GtCorrelationCondition::m_nrBinsPhi
private

number of bins for delta phi

Definition at line 108 of file L1GtCorrelationCondition.h.

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