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

$Date$ $Revision$

Definition at line 36 of file L1GtCorrelationCondition.h.

Constructor & Destructor Documentation

L1GtCorrelationCondition::L1GtCorrelationCondition ( )

constructors default

Definition at line 60 of file L1GtCorrelationCondition.cc.

60  :
63 {
64 
65  // empty
66 
67 }
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 70 of file L1GtCorrelationCondition.cc.

References L1GtConditionEvaluation::m_condMaxNumberObjects, and m_nrBinsPhi.

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

References copy().

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

Definition at line 129 of file L1GtCorrelationCondition.cc.

129  {
130 
131  // empty
132 
133 }

Member Function Documentation

void L1GtCorrelationCondition::copy ( const L1GtCorrelationCondition cp)
private

copy function for copy constructor and operator=

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

92  {
93 
95 
96  m_gtCond0 = cp.m_gtCond0;
97  m_gtCond1 = cp.m_gtCond1;
98 
103 
105 
107  m_gtGTL = cp.m_gtGTL;
108  m_gtPSB = cp.m_gtPSB;
109 
111 
115 
118 
119 
120 }
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 174 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.

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

References m_gtCorrelationTemplate.

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

get / set the pointer to GTL

Definition at line 85 of file L1GtCorrelationCondition.h.

References m_gtGTL.

85  {
86  return m_gtGTL;
87  }
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 71 of file L1GtCorrelationCondition.h.

References m_nrBinsPhi.

71  {
72  return m_nrBinsPhi;
73  }
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 92 of file L1GtCorrelationCondition.h.

References m_gtPSB.

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

Definition at line 136 of file L1GtCorrelationCondition.cc.

References copy().

138 {
139  copy(cp);
140  return *this;
141 }
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 863 of file L1GtCorrelationCondition.cc.

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

Referenced by L1GlobalTriggerGTL::run().

863  {
864 
867 
868 }
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 152 of file L1GtCorrelationCondition.cc.

References m_gtCorrelationTemplate.

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

Definition at line 160 of file L1GtCorrelationCondition.cc.

References m_gtGTL.

160  {
161 
162  m_gtGTL = ptrGTL;
163 
164 }
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 145 of file L1GtCorrelationCondition.cc.

References m_nrBinsPhi.

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

Definition at line 167 of file L1GtCorrelationCondition.cc.

References m_gtPSB.

167  {
168 
169  m_gtPSB = ptrPSB;
170 
171 }
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 117 of file L1GtCorrelationCondition.h.

Referenced by copy(), and evaluateCondition().

int L1GtCorrelationCondition::m_cond0NrL1Objects
private

Definition at line 115 of file L1GtCorrelationCondition.h.

Referenced by copy(), and evaluateCondition().

int L1GtCorrelationCondition::m_cond1EtaBits
private

Definition at line 118 of file L1GtCorrelationCondition.h.

Referenced by copy(), and evaluateCondition().

int L1GtCorrelationCondition::m_cond1NrL1Objects
private

Definition at line 116 of file L1GtCorrelationCondition.h.

Referenced by copy(), and evaluateCondition().

const L1GtCondition* L1GtCorrelationCondition::m_gtCond0
private

pointer to first sub-condition

Definition at line 109 of file L1GtCorrelationCondition.h.

Referenced by copy(), and evaluateCondition().

const L1GtCondition* L1GtCorrelationCondition::m_gtCond1
private

pointer to second sub-condition

Definition at line 112 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 130 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 124 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 127 of file L1GtCorrelationCondition.h.

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

bool L1GtCorrelationCondition::m_isDebugEnabled
private

Definition at line 134 of file L1GtCorrelationCondition.h.

Referenced by copy(), and evaluateCondition().

unsigned int L1GtCorrelationCondition::m_nrBinsPhi
private

number of bins for delta phi

Definition at line 121 of file L1GtCorrelationCondition.h.

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