CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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 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::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 ( )
override

Definition at line 123 of file L1GtCorrelationCondition.cc.

123  {
124  // empty
125 }

Member Function Documentation

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  {
93 
94  m_gtCond0 = cp.m_gtCond0;
95  m_gtCond1 = cp.m_gtCond1;
96 
101 
103 
105  m_gtGTL = cp.m_gtGTL;
106  m_gtPSB = cp.m_gtPSB;
107 
109 
113 
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
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(), 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.

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

References m_gtCorrelationTemplate.

75 { return m_gtCorrelationTemplate; }
const L1GtCorrelationTemplate * m_gtCorrelationTemplate
pointer to a L1GtCorrelationTemplate
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
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
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
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=
void L1GtCorrelationCondition::print ( std::ostream &  myCout) const
overridevirtual

print condition

Reimplemented from L1GtConditionEvaluation.

Definition at line 769 of file L1GtCorrelationCondition.cc.

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

Referenced by L1GlobalTriggerGTL::run().

769  {
772 }
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
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
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
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
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

int L1GtCorrelationCondition::m_cond0EtaBits
private

Definition at line 106 of file L1GtCorrelationCondition.h.

Referenced by copy(), and evaluateCondition().

int L1GtCorrelationCondition::m_cond0NrL1Objects
private

Definition at line 104 of file L1GtCorrelationCondition.h.

Referenced by copy(), and evaluateCondition().

int L1GtCorrelationCondition::m_cond1EtaBits
private

Definition at line 107 of file L1GtCorrelationCondition.h.

Referenced by copy(), and evaluateCondition().

int L1GtCorrelationCondition::m_cond1NrL1Objects
private

Definition at line 105 of file L1GtCorrelationCondition.h.

Referenced by copy(), and evaluateCondition().

const L1GtCondition* L1GtCorrelationCondition::m_gtCond0
private

pointer to first sub-condition

Definition at line 98 of file L1GtCorrelationCondition.h.

Referenced by copy(), and evaluateCondition().

const L1GtCondition* L1GtCorrelationCondition::m_gtCond1
private

pointer to second sub-condition

Definition at line 101 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 119 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 113 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 116 of file L1GtCorrelationCondition.h.

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

bool L1GtCorrelationCondition::m_isDebugEnabled
private

Definition at line 122 of file L1GtCorrelationCondition.h.

Referenced by copy(), and evaluateCondition().

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().