CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros 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
 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
 print condition More...
 
void setGtCorrelationTemplate (const L1GtCorrelationTemplate *)
 
void setGtGTL (const L1GlobalTriggerGTL *)
 
void setGtNrBinsPhi (const unsigned int)
 
void setGtPSB (const L1GlobalTriggerPSB *)
 
virtual ~L1GtCorrelationCondition ()
 
- 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.

58  :
61 {
62 
63  // empty
64 
65 }
bool isDebugEnabled()
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 68 of file L1GtCorrelationCondition.cc.

References L1GtConditionEvaluation::m_condMaxNumberObjects, and m_nrBinsPhi.

74  :
76  m_gtCorrelationTemplate(static_cast<const L1GtCorrelationTemplate*>(corrTemplate)),
77  m_gtCond0(cond0Condition), m_gtCond1(cond1Condition),
78  m_cond0NrL1Objects(cond0NrL1Objects),
79  m_cond1NrL1Objects(cond1NrL1Objects), m_cond0EtaBits(cond0EtaBits),
80  m_cond1EtaBits(cond1EtaBits), m_gtGTL(ptrGTL), m_gtPSB(ptrPSB),
81  m_gtEtaPhiConversions(etaPhiConversions),
83  {
84 
85  m_condMaxNumberObjects = 2; // irrelevant for correlation conditions
86  m_nrBinsPhi = 0;
87 }
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 120 of file L1GtCorrelationCondition.cc.

References copy().

121  :
123  copy(cp);
124 }
void copy(const L1GtCorrelationCondition &cp)
copy function for copy constructor and operator=
L1GtCorrelationCondition::~L1GtCorrelationCondition ( )
virtual

Definition at line 127 of file L1GtCorrelationCondition.cc.

127  {
128 
129  // empty
130 
131 }

Member Function Documentation

void L1GtCorrelationCondition::copy ( const L1GtCorrelationCondition cp)
private

copy function for copy constructor and operator=

Definition at line 90 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=().

90  {
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 
117 
118 }
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
virtual

the core function to check if the condition matches

Implements L1GtConditionEvaluation.

Definition at line 172 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.

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

References m_gtCorrelationTemplate.

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

get / set the pointer to GTL

Definition at line 83 of file L1GtCorrelationCondition.h.

References m_gtGTL.

83  {
84  return m_gtGTL;
85  }
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 69 of file L1GtCorrelationCondition.h.

References m_nrBinsPhi.

69  {
70  return m_nrBinsPhi;
71  }
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 90 of file L1GtCorrelationCondition.h.

References m_gtPSB.

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

Definition at line 134 of file L1GtCorrelationCondition.cc.

References copy().

136 {
137  copy(cp);
138  return *this;
139 }
void copy(const L1GtCorrelationCondition &cp)
copy function for copy constructor and operator=
void L1GtCorrelationCondition::print ( std::ostream &  myCout) const
virtual

print condition

Reimplemented from L1GtConditionEvaluation.

Definition at line 861 of file L1GtCorrelationCondition.cc.

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

Referenced by L1GlobalTriggerGTL::run().

861  {
862 
865 
866 }
const L1GtCorrelationTemplate * m_gtCorrelationTemplate
pointer to a L1GtCorrelationTemplate
virtual void print(std::ostream &myCout) const
print the condition
virtual void print(std::ostream &myCout) const
print condition
void L1GtCorrelationCondition::setGtCorrelationTemplate ( const L1GtCorrelationTemplate corrTempl)

Definition at line 150 of file L1GtCorrelationCondition.cc.

References m_gtCorrelationTemplate.

151  {
152 
153  m_gtCorrelationTemplate = corrTempl;
154 
155 }
const L1GtCorrelationTemplate * m_gtCorrelationTemplate
pointer to a L1GtCorrelationTemplate
void L1GtCorrelationCondition::setGtGTL ( const L1GlobalTriggerGTL ptrGTL)

Definition at line 158 of file L1GtCorrelationCondition.cc.

References m_gtGTL.

158  {
159 
160  m_gtGTL = ptrGTL;
161 
162 }
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 143 of file L1GtCorrelationCondition.cc.

References m_nrBinsPhi.

143  {
144 
145  m_nrBinsPhi = nrBins;
146 
147 }
unsigned int m_nrBinsPhi
number of bins for delta phi
void L1GtCorrelationCondition::setGtPSB ( const L1GlobalTriggerPSB ptrPSB)

Definition at line 165 of file L1GtCorrelationCondition.cc.

References m_gtPSB.

165  {
166 
167  m_gtPSB = ptrPSB;
168 
169 }
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 115 of file L1GtCorrelationCondition.h.

Referenced by copy(), and evaluateCondition().

int L1GtCorrelationCondition::m_cond0NrL1Objects
private

Definition at line 113 of file L1GtCorrelationCondition.h.

Referenced by copy(), and evaluateCondition().

int L1GtCorrelationCondition::m_cond1EtaBits
private

Definition at line 116 of file L1GtCorrelationCondition.h.

Referenced by copy(), and evaluateCondition().

int L1GtCorrelationCondition::m_cond1NrL1Objects
private

Definition at line 114 of file L1GtCorrelationCondition.h.

Referenced by copy(), and evaluateCondition().

const L1GtCondition* L1GtCorrelationCondition::m_gtCond0
private

pointer to first sub-condition

Definition at line 107 of file L1GtCorrelationCondition.h.

Referenced by copy(), and evaluateCondition().

const L1GtCondition* L1GtCorrelationCondition::m_gtCond1
private

pointer to second sub-condition

Definition at line 110 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 128 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 122 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 125 of file L1GtCorrelationCondition.h.

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

bool L1GtCorrelationCondition::m_isDebugEnabled
private

Definition at line 132 of file L1GtCorrelationCondition.h.

Referenced by copy(), and evaluateCondition().

unsigned int L1GtCorrelationCondition::m_nrBinsPhi
private

number of bins for delta phi

Definition at line 119 of file L1GtCorrelationCondition.h.

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