#include <L1GtCaloCondition.h>
Public Member Functions | |
const bool | evaluateCondition () const |
the core function to check if the condition matches | |
const L1GtCaloTemplate * | gtCaloTemplate () const |
get / set the pointer to a L1GtCondition | |
const int | gtIfCaloEtaNumberBits () const |
get / set the number of bits for eta of calorimeter objects | |
const L1GlobalTriggerPSB * | gtPSB () const |
get / set the pointer to PSB | |
L1GtCaloCondition (const L1GtCaloCondition &) | |
L1GtCaloCondition (const L1GtCondition *, const L1GlobalTriggerPSB *, const int nrL1NoIsoEG, const int nrL1IsoEG, const int nrL1CenJet, const int nrL1ForJet, const int nrL1TauJet, const int ifCaloEtaNumberBits) | |
from base template condition (from event setup usually) | |
L1GtCaloCondition () | |
L1GtCaloCondition & | operator= (const L1GtCaloCondition &) |
void | print (std::ostream &myCout) const |
print condition | |
void | setGtCaloTemplate (const L1GtCaloTemplate *) |
void | setGtIfCaloEtaNumberBits (const int &) |
void | setGtPSB (const L1GlobalTriggerPSB *) |
set the pointer to PSB | |
virtual | ~L1GtCaloCondition () |
Private Member Functions | |
const bool | checkObjectParameter (const int iCondition, const L1GctCand &cand) const |
function to check a single object if it matches a condition | |
void | copy (const L1GtCaloCondition &cp) |
copy function for copy constructor and operator= | |
const L1GctCand * | getCandidate (const int indexCand) const |
load calo candidates | |
Private Attributes | |
const L1GtCaloTemplate * | m_gtCaloTemplate |
pointer to a L1GtCaloTemplate | |
const L1GlobalTriggerPSB * | m_gtPSB |
pointer to PSB, to be able to get the trigger objects | |
int | m_ifCaloEtaNumberBits |
number of bits for eta of calorimeter objects |
Description: evaluation of a CondCalo condition.
Implementation: <TODO: enter implementation details>
$Date$ $Revision$
Definition at line 37 of file L1GtCaloCondition.h.
L1GtCaloCondition::L1GtCaloCondition | ( | ) |
constructors default
Definition at line 50 of file L1GtCaloCondition.cc.
References m_ifCaloEtaNumberBits.
: L1GtConditionEvaluation() { m_ifCaloEtaNumberBits = -1; }
L1GtCaloCondition::L1GtCaloCondition | ( | const L1GtCondition * | caloTemplate, |
const L1GlobalTriggerPSB * | ptrPSB, | ||
const int | nrL1NoIsoEG, | ||
const int | nrL1IsoEG, | ||
const int | nrL1CenJet, | ||
const int | nrL1ForJet, | ||
const int | nrL1TauJet, | ||
const int | ifCaloEtaNumberBits | ||
) |
from base template condition (from event setup usually)
Definition at line 58 of file L1GtCaloCondition.cc.
References CenJet, ForJet, IsoEG, L1GtConditionEvaluation::m_condMaxNumberObjects, m_gtCaloTemplate, NoIsoEG, L1GtCondition::objectType(), and TauJet.
: L1GtConditionEvaluation(), m_gtCaloTemplate(static_cast<const L1GtCaloTemplate*>(caloTemplate)), m_gtPSB(ptrPSB), m_ifCaloEtaNumberBits(ifCaloEtaNumberBits) { // maximum number of objects received for the evaluation of the condition // retrieved before from event setup // for a CondCalo, all objects ar of same type, hence it is enough to get the // type for the first object switch ((m_gtCaloTemplate->objectType())[0]) { case NoIsoEG: m_condMaxNumberObjects = nrL1NoIsoEG; break; case IsoEG: m_condMaxNumberObjects = nrL1IsoEG; break; case CenJet: m_condMaxNumberObjects = nrL1CenJet; break; case ForJet: m_condMaxNumberObjects = nrL1ForJet; break; case TauJet: m_condMaxNumberObjects = nrL1TauJet; break; default: m_condMaxNumberObjects = 0; break; } }
L1GtCaloCondition::L1GtCaloCondition | ( | const L1GtCaloCondition & | cp | ) |
Definition at line 115 of file L1GtCaloCondition.cc.
References copy().
: L1GtConditionEvaluation() { copy(cp); }
L1GtCaloCondition::~L1GtCaloCondition | ( | ) | [virtual] |
Definition at line 123 of file L1GtCaloCondition.cc.
{
// empty
}
const bool L1GtCaloCondition::checkObjectParameter | ( | const int | iCondition, |
const L1GctCand & | cand | ||
) | const [private] |
function to check a single object if it matches a condition
checkObjectParameter - Compare a single particle with a numbered condition.
iCondition | The number of the condition. |
cand | The candidate to compare. |
Definition at line 395 of file L1GtCaloCondition.cc.
References L1GtConditionEvaluation::checkBit(), L1GtConditionEvaluation::checkThreshold(), L1GtCondition::condGEq(), L1GctCand::empty(), L1GctCand::etaIndex(), L1GtCaloTemplate::ObjectParameter::etaRange, L1GtCaloTemplate::ObjectParameter::etThreshold, m_gtCaloTemplate, L1GtCondition::nrObjects(), L1GtCaloTemplate::objectParameter(), L1GctCand::phiIndex(), L1GtCaloTemplate::ObjectParameter::phiRange, and L1GctCand::rank().
Referenced by evaluateCondition().
{ // number of objects in condition int nObjInCond = m_gtCaloTemplate->nrObjects(); if (iCondition >= nObjInCond || iCondition < 0) { return false; } // empty candidates can not be compared if (cand.empty()) { return false; } const L1GtCaloTemplate::ObjectParameter objPar = ( *(m_gtCaloTemplate->objectParameter()) )[iCondition]; // check energy threshold if ( !checkThreshold(objPar.etThreshold, cand.rank(), m_gtCaloTemplate->condGEq()) ) { return false; } // check eta if (!checkBit(objPar.etaRange, cand.etaIndex())) { return false; } // check phi if (!checkBit(objPar.phiRange, cand.phiIndex())) { return false; } // particle matches if we get here //LogTrace("L1GtCaloCondition") // << " checkObjectParameter: calorimeter object OK, passes all requirements\n" // << std::endl; return true; }
void L1GtCaloCondition::copy | ( | const L1GtCaloCondition & | cp | ) | [private] |
copy function for copy constructor and operator=
Definition at line 100 of file L1GtCaloCondition.cc.
References L1GtConditionEvaluation::condLastResult(), L1GtConditionEvaluation::condMaxNumberObjects(), L1GtConditionEvaluation::getCombinationsInCond(), gtCaloTemplate(), gtIfCaloEtaNumberBits(), gtPSB(), L1GtConditionEvaluation::m_combinationsInCond, L1GtConditionEvaluation::m_condLastResult, L1GtConditionEvaluation::m_condMaxNumberObjects, m_gtCaloTemplate, m_gtPSB, m_ifCaloEtaNumberBits, and L1GtConditionEvaluation::m_verbosity.
Referenced by L1GtCaloCondition(), and operator=().
{ m_gtCaloTemplate = cp.gtCaloTemplate(); m_gtPSB = cp.gtPSB(); m_ifCaloEtaNumberBits = cp.gtIfCaloEtaNumberBits(); m_condMaxNumberObjects = cp.condMaxNumberObjects(); m_condLastResult = cp.condLastResult(); m_combinationsInCond = cp.getCombinationsInCond(); m_verbosity = cp.m_verbosity; }
const bool L1GtCaloCondition::evaluateCondition | ( | ) | const [virtual] |
the core function to check if the condition matches
Implements L1GtConditionEvaluation.
Definition at line 158 of file L1GtCaloCondition.cc.
References abs, CenJet, L1GtConditionEvaluation::checkBit(), checkObjectParameter(), L1GtCaloTemplate::correlationParameter(), L1GtCaloTemplate::CorrelationParameter::deltaEtaRange, L1GtCaloTemplate::CorrelationParameter::deltaPhiMaxbits, L1GtCaloTemplate::CorrelationParameter::deltaPhiRange, factorial(), ForJet, L1GlobalTriggerPSB::getCandL1CenJet(), L1GlobalTriggerPSB::getCandL1ForJet(), L1GlobalTriggerPSB::getCandL1IsoEG(), L1GlobalTriggerPSB::getCandL1NoIsoEG(), L1GlobalTriggerPSB::getCandL1TauJet(), i, getHLTprescales::index, IsoEG, LogTrace, m_gtCaloTemplate, m_gtPSB, m_ifCaloEtaNumberBits, L1GtConditionEvaluation::m_verbosity, NoIsoEG, L1GtCondition::nrObjects(), L1GtCondition::objectType(), TauJet, and L1GtCondition::wsc().
{ // number of trigger objects in the condition int nObjInCond = m_gtCaloTemplate->nrObjects(); //LogTrace("L1GtCaloCondition") << " nObjInCond: " << nObjInCond // << std::endl; // the candidates // objectType() gives the type for nrObjects() only, // but in a CondCalo all objects have the same type // take type from the type of the first object const std::vector<const L1GctCand*>* candVec; switch ((m_gtCaloTemplate->objectType())[0]) { case NoIsoEG: candVec = m_gtPSB->getCandL1NoIsoEG(); break; case IsoEG: candVec = m_gtPSB->getCandL1IsoEG(); break; case CenJet: candVec = m_gtPSB->getCandL1CenJet(); break; case ForJet: candVec = m_gtPSB->getCandL1ForJet(); break; case TauJet: candVec = m_gtPSB->getCandL1TauJet(); break; default: return false; break; } int numberObjects = candVec->size(); //LogTrace("L1GtCaloCondition") << " numberObjects: " << numberObjects // << std::endl; if (numberObjects < nObjInCond) { return false; } std::vector<int> index(numberObjects); for (int i = 0; i < numberObjects; ++i) { index[i] = i; } int jumpIndex = 1; int jump = factorial(numberObjects - nObjInCond); int totalLoops = 0; int passLoops = 0; // condition result condResult set to true if at least one permutation // passes all requirements // all possible permutations are checked bool condResult = false; // store the indices of the calorimeter objects // from the combination evaluated in the condition SingleCombInCond objectsInComb; objectsInComb.reserve(nObjInCond); // clear the m_combinationsInCond vector (*m_combinationsInCond).clear(); do { if (--jumpIndex) continue; jumpIndex = jump; totalLoops++; // clear the indices in the combination objectsInComb.clear(); bool tmpResult = true; // check if there is a permutation that matches object-parameter requirements for (int i = 0; i < nObjInCond; i++) { tmpResult &= checkObjectParameter(i, *(*candVec)[index[i]]); objectsInComb.push_back(index[i]); } // if permutation does not match particle conditions // skip spatial correlations if (!tmpResult) { continue; } if (m_gtCaloTemplate->wsc()) { // wsc requirements have always nObjInCond = 2 // one can use directly index[0] and index[1] to compute // eta and phi differences const int ObjInWscComb = 2; if (nObjInCond != ObjInWscComb) { if (m_verbosity) { edm::LogError("L1GtCaloCondition") << "\n Error: " << "number of particles in condition with spatial correlation = " << nObjInCond << "\n it must be = " << ObjInWscComb << std::endl; } continue; } L1GtCaloTemplate::CorrelationParameter corrPar = *(m_gtCaloTemplate->correlationParameter()); unsigned int candDeltaEta; unsigned int candDeltaPhi; // check candDeltaEta // get eta index and the sign bit of the eta index (MSB is the sign) // signedEta[i] is the signed eta index of candVec[index[i]] int signedEta[ObjInWscComb]; int signBit[ObjInWscComb] = { 0, 0 }; int scaleEta = 1 << (m_ifCaloEtaNumberBits - 1); for (int i = 0; i < ObjInWscComb; ++i) { signBit[i] = ((*candVec)[index[i]]->etaIndex() & scaleEta) >>(m_ifCaloEtaNumberBits - 1); signedEta[i] = ((*candVec)[index[i]]->etaIndex() )%scaleEta; if (signBit[i] == 1) { signedEta[i] = (-1)*signedEta[i]; } } // compute candDeltaEta - add 1 if signs are different (due to +0/-0 indices) candDeltaEta = static_cast<int> (std::abs(signedEta[1] - signedEta[0])) + static_cast<int> (signBit[1]^signBit[0]); if ( !checkBit(corrPar.deltaEtaRange, candDeltaEta) ) { continue; } // check candDeltaPhi // calculate absolute value of candDeltaPhi if ((*candVec)[index[0]]->phiIndex()> (*candVec)[index[1]]->phiIndex()) { candDeltaPhi = (*candVec)[index[0]]->phiIndex() - (*candVec)[index[1]]->phiIndex(); } else { candDeltaPhi = (*candVec)[index[1]]->phiIndex() - (*candVec)[index[0]]->phiIndex(); } // check if candDeltaPhi > 180 (via delta_phi_maxbits) // delta_phi contains bits for 0..180 (0 and 180 included) while (candDeltaPhi> corrPar.deltaPhiMaxbits) { // candDeltaPhi > 180 ==> take 360 - candDeltaPhi candDeltaPhi = (corrPar.deltaPhiMaxbits - 1)*2 - candDeltaPhi; if (m_verbosity) { LogTrace("L1GtCaloCondition") << " candDeltaPhi rescaled to: " << candDeltaPhi << std::endl; } } if (!checkBit(corrPar.deltaPhiRange, candDeltaPhi)) { continue; } } // end wsc check // if we get here all checks were successfull for this combination // set the general result for evaluateCondition to "true" condResult = true; passLoops++; (*m_combinationsInCond).push_back(objectsInComb); // } while ( std::next_permutation(index, index + nObj) ); } while (std::next_permutation(index.begin(), index.end()) ); //LogTrace("L1GtCaloCondition") // << "\n L1GtCaloCondition: total number of permutations found: " << totalLoops // << "\n L1GtCaloCondition: number of permutations passing requirements: " << passLoops // << "\n" << std::endl; return condResult; }
const L1GctCand * L1GtCaloCondition::getCandidate | ( | const int | indexCand | ) | const [private] |
load calo candidates
Definition at line 357 of file L1GtCaloCondition.cc.
References CenJet, ForJet, L1GlobalTriggerPSB::getCandL1CenJet(), L1GlobalTriggerPSB::getCandL1ForJet(), L1GlobalTriggerPSB::getCandL1IsoEG(), L1GlobalTriggerPSB::getCandL1NoIsoEG(), L1GlobalTriggerPSB::getCandL1TauJet(), IsoEG, m_gtCaloTemplate, m_gtPSB, NoIsoEG, L1GtCondition::objectType(), and TauJet.
{ // objectType() gives the type for nrObjects() only, // but in a CondCalo all objects have the same type // take type from the type of the first object switch ((m_gtCaloTemplate->objectType())[0]) { case NoIsoEG: return (*(m_gtPSB->getCandL1NoIsoEG()))[indexCand]; break; case IsoEG: return (*(m_gtPSB->getCandL1IsoEG()))[indexCand]; break; case CenJet: return (*(m_gtPSB->getCandL1CenJet()))[indexCand]; break; case ForJet: return (*(m_gtPSB->getCandL1ForJet()))[indexCand]; break; case TauJet: return (*(m_gtPSB->getCandL1TauJet()))[indexCand]; break; default: return 0; break; } return 0; }
const L1GtCaloTemplate* L1GtCaloCondition::gtCaloTemplate | ( | ) | const [inline] |
get / set the pointer to a L1GtCondition
Definition at line 75 of file L1GtCaloCondition.h.
References m_gtCaloTemplate.
Referenced by copy().
{ return m_gtCaloTemplate; }
const int L1GtCaloCondition::gtIfCaloEtaNumberBits | ( | ) | const [inline] |
get / set the number of bits for eta of calorimeter objects
Definition at line 82 of file L1GtCaloCondition.h.
References m_ifCaloEtaNumberBits.
Referenced by copy().
{ return m_ifCaloEtaNumberBits; }
const L1GlobalTriggerPSB* L1GtCaloCondition::gtPSB | ( | ) | const [inline] |
get / set the pointer to PSB
Definition at line 89 of file L1GtCaloCondition.h.
References m_gtPSB.
Referenced by copy().
{ return m_gtPSB; }
L1GtCaloCondition & L1GtCaloCondition::operator= | ( | const L1GtCaloCondition & | cp | ) |
void L1GtCaloCondition::print | ( | std::ostream & | myCout | ) | const [virtual] |
print condition
Reimplemented from L1GtConditionEvaluation.
Definition at line 435 of file L1GtCaloCondition.cc.
References m_gtCaloTemplate, and L1GtCaloTemplate::print().
Referenced by L1GtCorrelationCondition::evaluateCondition(), and L1GlobalTriggerGTL::run().
{ m_gtCaloTemplate->print(myCout); L1GtConditionEvaluation::print(myCout); }
void L1GtCaloCondition::setGtCaloTemplate | ( | const L1GtCaloTemplate * | caloTempl | ) |
Definition at line 137 of file L1GtCaloCondition.cc.
References m_gtCaloTemplate.
{ m_gtCaloTemplate = caloTempl; }
void L1GtCaloCondition::setGtIfCaloEtaNumberBits | ( | const int & | ifCaloEtaNumberBitsValue | ) |
Definition at line 144 of file L1GtCaloCondition.cc.
References m_ifCaloEtaNumberBits.
{ m_ifCaloEtaNumberBits = ifCaloEtaNumberBitsValue; }
void L1GtCaloCondition::setGtPSB | ( | const L1GlobalTriggerPSB * | ptrPSB | ) |
set the pointer to PSB
Definition at line 151 of file L1GtCaloCondition.cc.
References m_gtPSB.
{ m_gtPSB = ptrPSB; }
const L1GtCaloTemplate* L1GtCaloCondition::m_gtCaloTemplate [private] |
pointer to a L1GtCaloTemplate
Definition at line 110 of file L1GtCaloCondition.h.
Referenced by checkObjectParameter(), copy(), evaluateCondition(), getCandidate(), gtCaloTemplate(), L1GtCaloCondition(), print(), and setGtCaloTemplate().
const L1GlobalTriggerPSB* L1GtCaloCondition::m_gtPSB [private] |
pointer to PSB, to be able to get the trigger objects
Definition at line 113 of file L1GtCaloCondition.h.
Referenced by copy(), evaluateCondition(), getCandidate(), gtPSB(), and setGtPSB().
int L1GtCaloCondition::m_ifCaloEtaNumberBits [private] |
number of bits for eta of calorimeter objects
Definition at line 116 of file L1GtCaloCondition.h.
Referenced by copy(), evaluateCondition(), gtIfCaloEtaNumberBits(), L1GtCaloCondition(), and setGtIfCaloEtaNumberBits().