#include <L1GtMuonCondition.h>
Public Member Functions | |
const bool | evaluateCondition () const |
the core function to check if the condition matches | |
const int | gtCorrParDeltaPhiNrBins () const |
get / set maximum number of bins for the delta phi scales | |
const L1GlobalTriggerGTL * | gtGTL () const |
get / set the pointer to GTL | |
const int | gtIfMuEtaNumberBits () const |
get / set the number of bits for eta of muon objects | |
const L1GtMuonTemplate * | gtMuonTemplate () const |
get / set the pointer to a L1GtCondition | |
L1GtMuonCondition (const L1GtCondition *, const L1GlobalTriggerGTL *, const int nrL1Mu, const int ifMuEtaNumberBits) | |
from base template condition (from event setup usually) | |
L1GtMuonCondition () | |
L1GtMuonCondition (const L1GtMuonCondition &) | |
L1GtMuonCondition & | operator= (const L1GtMuonCondition &) |
void | print (std::ostream &myCout) const |
print condition | |
void | setGtCorrParDeltaPhiNrBins (const int &) |
void | setGtGTL (const L1GlobalTriggerGTL *) |
set the pointer to GTL | |
void | setGtIfMuEtaNumberBits (const int &) |
void | setGtMuonTemplate (const L1GtMuonTemplate *) |
virtual | ~L1GtMuonCondition () |
Private Member Functions | |
const bool | checkObjectParameter (const int iCondition, const L1MuGMTCand &cand) const |
function to check a single object if it matches a condition | |
void | copy (const L1GtMuonCondition &cp) |
copy function for copy constructor and operator= | |
const L1MuGMTCand * | getCandidate (const int indexCand) const |
load muon candidates | |
Private Attributes | |
unsigned int | m_corrParDeltaPhiNrBins |
const L1GlobalTriggerGTL * | m_gtGTL |
pointer to GTL, to be able to get the trigger objects | |
const L1GtMuonTemplate * | m_gtMuonTemplate |
pointer to a L1GtMuonTemplate | |
int | m_ifMuEtaNumberBits |
number of bits for eta of muon objects |
Description: evaluation of a CondMuon condition.
Implementation: <TODO: enter implementation details>
$Date$ $Revision$
Definition at line 37 of file L1GtMuonCondition.h.
L1GtMuonCondition::L1GtMuonCondition | ( | ) |
constructors default
Definition at line 45 of file L1GtMuonCondition.cc.
: L1GtConditionEvaluation() { // empty }
L1GtMuonCondition::L1GtMuonCondition | ( | const L1GtCondition * | muonTemplate, |
const L1GlobalTriggerGTL * | ptrGTL, | ||
const int | nrL1Mu, | ||
const int | ifMuEtaNumberBits | ||
) |
from base template condition (from event setup usually)
Definition at line 53 of file L1GtMuonCondition.cc.
References L1GtConditionEvaluation::m_condMaxNumberObjects, and m_corrParDeltaPhiNrBins.
: L1GtConditionEvaluation(), m_gtMuonTemplate(static_cast<const L1GtMuonTemplate*>(muonTemplate)), m_gtGTL(ptrGTL), m_ifMuEtaNumberBits(ifMuEtaNumberBits) { m_corrParDeltaPhiNrBins = 0; m_condMaxNumberObjects = nrL1Mu; }
L1GtMuonCondition::L1GtMuonCondition | ( | const L1GtMuonCondition & | cp | ) |
Definition at line 82 of file L1GtMuonCondition.cc.
References copy().
: L1GtConditionEvaluation() { copy(cp); }
L1GtMuonCondition::~L1GtMuonCondition | ( | ) | [virtual] |
Definition at line 88 of file L1GtMuonCondition.cc.
{
// empty
}
const bool L1GtMuonCondition::checkObjectParameter | ( | const int | iCondition, |
const L1MuGMTCand & | 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 414 of file L1GtMuonCondition.cc.
References L1GtConditionEvaluation::checkBit(), L1GtConditionEvaluation::checkThreshold(), L1GtCondition::condGEq(), L1MuGMTCand::empty(), L1GtMuonTemplate::ObjectParameter::enableIso, L1GtMuonTemplate::ObjectParameter::enableMip, L1MuGMTCand::etaIndex(), L1GtMuonTemplate::ObjectParameter::etaRange, L1MuGMTCand::isol(), m_gtMuonTemplate, L1MuGMTCand::mip(), L1GtCondition::nrObjects(), L1GtMuonTemplate::objectParameter(), L1GtMuonTemplate::ObjectParameter::phiHigh, L1MuGMTCand::phiIndex(), L1GtMuonTemplate::ObjectParameter::phiLow, L1GtMuonTemplate::ObjectParameter::ptHighThreshold, L1MuGMTCand::ptIndex(), L1GtMuonTemplate::ObjectParameter::ptLowThreshold, L1MuGMTCand::quality(), L1GtMuonTemplate::ObjectParameter::qualityRange, and L1GtMuonTemplate::ObjectParameter::requestIso.
Referenced by evaluateCondition().
{ // number of objects in condition int nObjInCond = m_gtMuonTemplate->nrObjects(); if (iCondition >= nObjInCond || iCondition < 0) { return false; } // empty candidates can not be compared if (cand.empty()) { return false; } const L1GtMuonTemplate::ObjectParameter objPar = ( *(m_gtMuonTemplate->objectParameter()) )[iCondition]; // using the logic table from GTL-9U-module.pdf // "Truth table for Isolation bit" // check thresholds: // value < low pt threshold // fail trigger // low pt threshold <= value < high pt threshold & non-isolated muon: // requestIso true: fail trigger // requestIso false, enableIso true: fail trigger // requestIso false, enableIso false: OK, trigger // low pt threshold <= value < high pt threshold & isolated muon: // requestIso true: OK, trigger // requestIso false, enableIso true: OK, trigger // requestIso false, enableIso false: OK, trigger // value >= high pt threshold & non-isolated muon: // requestIso true: fail trigger // requestIso false: OK, trigger // value >= high pt threshold & isolated muon: // OK, trigger if ( !checkThreshold(objPar.ptHighThreshold, cand.ptIndex(), m_gtMuonTemplate->condGEq()) ) { if ( !checkThreshold(objPar.ptLowThreshold, cand.ptIndex(), m_gtMuonTemplate->condGEq()) ) { return false; } else { // check isolation if ( !cand.isol() ) { if (objPar.requestIso || objPar.enableIso) { return false; } } } } else { if ( !cand.isol() ) { if (objPar.requestIso) { return false; } } } // check eta if (!checkBit(objPar.etaRange, cand.etaIndex())) { return false; } // check phi - in the requested range (no LUT used - LUT too big for hw chip) // for phiLow <= phiHigh takes [phiLow, phiHigh] // for phiLow >= phiHigh takes [phiLow, phiHigh] over zero angle! if (objPar.phiHigh >= objPar.phiLow) { if (! ( (objPar.phiLow <= cand.phiIndex()) && (cand.phiIndex() <= objPar.phiHigh ) )) { return false; } } else { // go over zero angle!! if (! ( (objPar.phiLow <= cand.phiIndex()) || (cand.phiIndex() <= objPar.phiHigh ) )) { return false; } } // check quality ( bit check ) // A number of values is required to trigger (at least one). // "Don’t care" means that all values are allowed. // Qual = 000 means then NO MUON (GTL module) if (cand.quality() == 0) { return false; } if (objPar.qualityRange == 0) { return false; } else { if (!checkBit(objPar.qualityRange, cand.quality())) { return false; } } // check mip if (objPar.enableMip) { if (!cand.mip()) { return false; } } // particle matches if we get here //LogTrace("L1GlobalTrigger") // << " checkObjectParameter: muon object OK, passes all requirements\n" << std::endl; return true; }
void L1GtMuonCondition::copy | ( | const L1GtMuonCondition & | cp | ) | [private] |
copy function for copy constructor and operator=
Definition at line 66 of file L1GtMuonCondition.cc.
References L1GtConditionEvaluation::condLastResult(), L1GtConditionEvaluation::condMaxNumberObjects(), L1GtConditionEvaluation::getCombinationsInCond(), gtGTL(), gtIfMuEtaNumberBits(), gtMuonTemplate(), L1GtConditionEvaluation::m_combinationsInCond, L1GtConditionEvaluation::m_condLastResult, L1GtConditionEvaluation::m_condMaxNumberObjects, m_corrParDeltaPhiNrBins, m_gtGTL, m_gtMuonTemplate, m_ifMuEtaNumberBits, and L1GtConditionEvaluation::m_verbosity.
Referenced by L1GtMuonCondition(), and operator=().
{ m_gtMuonTemplate = cp.gtMuonTemplate(); m_gtGTL = cp.gtGTL(); m_ifMuEtaNumberBits = cp.gtIfMuEtaNumberBits(); m_corrParDeltaPhiNrBins = cp.m_corrParDeltaPhiNrBins; m_condMaxNumberObjects = cp.condMaxNumberObjects(); m_condLastResult = cp.condLastResult(); m_combinationsInCond = cp.getCombinationsInCond(); m_verbosity = cp.m_verbosity; }
const bool L1GtMuonCondition::evaluateCondition | ( | ) | const [virtual] |
the core function to check if the condition matches
Implements L1GtConditionEvaluation.
Definition at line 134 of file L1GtMuonCondition.cc.
References abs, DeDxDiscriminatorTools::charge(), L1GtMuonTemplate::CorrelationParameter::chargeCorrelation, L1GtConditionEvaluation::checkBit(), checkObjectParameter(), hitfit::clear(), L1GtConditionEvaluation::combinationsInCond(), L1GtMuonTemplate::correlationParameter(), L1GtMuonTemplate::CorrelationParameter::deltaEtaRange, L1GtMuonTemplate::CorrelationParameter::deltaPhiRange0Word, L1GtMuonTemplate::CorrelationParameter::deltaPhiRange1Word, factorial(), L1GlobalTriggerGTL::getCandL1Mu(), i, getHLTprescales::index, LogTrace, m_corrParDeltaPhiNrBins, m_gtGTL, m_gtMuonTemplate, m_ifMuEtaNumberBits, L1GtConditionEvaluation::m_verbosity, L1GtCondition::nrObjects(), and L1GtCondition::wsc().
{ // number of trigger objects in the condition int nObjInCond = m_gtMuonTemplate->nrObjects(); // the candidates const std::vector<const L1MuGMTCand*>* candVec = m_gtGTL->getCandL1Mu(); int numberObjects = candVec->size(); //LogTrace("L1GlobalTrigger") << " 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 muon objects // from the combination evaluated in the condition SingleCombInCond objectsInComb; objectsInComb.reserve(nObjInCond); // clear the m_combinationsInCond vector (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 charge correlation and spatial correlations if ( !tmpResult) { continue; } // get the correlation parameters (chargeCorrelation included here also) L1GtMuonTemplate::CorrelationParameter corrPar = *(m_gtMuonTemplate->correlationParameter()); // charge_correlation consists of 3 relevant bits (D2, D1, D0) unsigned int chargeCorr = corrPar.chargeCorrelation; // charge ignore bit (D0) not set? if ((chargeCorr & 1) == 0) { for (int i = 0; i < nObjInCond; i++) { // check valid charge - skip if invalid charge bool chargeValid = (*candVec)[index[i]]->charge_valid(); tmpResult &= chargeValid; if ( !chargeValid) { continue; } } if ( !tmpResult) { continue; } if (nObjInCond == 1) { // one object condition // D2..enable pos, D1..enable neg if ( ! ( ( (chargeCorr & 4) != 0 && (*candVec)[index[0]]->charge()> 0 ) || ( (chargeCorr & 2) != 0 && (*candVec)[index[0]]->charge() < 0 ) )) { continue; } } else { // more objects condition // find out if signs are equal bool equalSigns = true; for (int i = 0; i < nObjInCond-1; i++) { if ((*candVec)[index[i]]->charge() != (*candVec)[index[i+1]]->charge()) { equalSigns = false; break; } } // two or three particle condition if (nObjInCond == 2 || nObjInCond == 3) { // D2..enable equal, D1..enable not equal if ( ! ( ( (chargeCorr & 4) != 0 && equalSigns ) || ( (chargeCorr & 2) != 0 && !equalSigns ) )) { continue; } } // four particle condition if (nObjInCond == 4) { //counter to count positive charges to determine if there are pairs unsigned int posCount = 0; for (int i = 0; i < nObjInCond; i++) { if ((*candVec)[index[i]]->charge()> 0) { posCount++; } } // D2..enable equal, D1..enable pairs if ( ! ( ( (chargeCorr & 4) != 0 && equalSigns ) || ( (chargeCorr & 2) != 0 && posCount == 2 ) )) { continue; } } } } // end signchecks if (m_gtMuonTemplate->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) { edm::LogError("L1GlobalTrigger") << "\n Error: " << "number of particles in condition with spatial correlation = " << nObjInCond << "\n it must be = " << ObjInWscComb << std::endl; // TODO Perhaps I should throw here an exception, // since something is really wrong if nObjInCond != ObjInWscComb (=2) continue; } 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_ifMuEtaNumberBits - 1); for (int i = 0; i < ObjInWscComb; ++i) { signBit[i] = ((*candVec)[index[i]]->etaIndex() & scaleEta)>>(m_ifMuEtaNumberBits - 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) // protect also against infinite loop... int nMaxLoop = 10; int iLoop = 0; while (candDeltaPhi >= m_corrParDeltaPhiNrBins) { unsigned int candDeltaPhiInitial = candDeltaPhi; // candDeltaPhi > 180 ==> take 360 - candDeltaPhi candDeltaPhi = (m_corrParDeltaPhiNrBins - 1) * 2 - candDeltaPhi; if (m_verbosity) { LogTrace("L1GlobalTrigger") << " Initial candDeltaPhi = " << candDeltaPhiInitial << " > m_corrParDeltaPhiNrBins = " << m_corrParDeltaPhiNrBins << " ==> candDeltaPhi rescaled to: " << candDeltaPhi << " [ loop index " << iLoop << "; breaks after " << nMaxLoop << " loops ]\n" << std::endl; } iLoop++; if (iLoop > nMaxLoop) { return false; } } // delta_phi bitmask is saved in two boost::uint64_t words if (candDeltaPhi < 64) { if (!checkBit(corrPar.deltaPhiRange0Word, candDeltaPhi) ) { continue; } } else { if (!checkBit(corrPar.deltaPhiRange1Word, (candDeltaPhi - 64))) { 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++; (combinationsInCond()).push_back(objectsInComb); } while (std::next_permutation(index.begin(), index.end()) ); //LogTrace("L1GlobalTrigger") // << "\n L1GtMuonCondition: total number of permutations found: " << totalLoops // << "\n L1GtMuonCondition: number of permutations passing requirements: " << passLoops // << "\n" << std::endl; return condResult; }
const L1MuGMTCand * L1GtMuonCondition::getCandidate | ( | const int | indexCand | ) | const [private] |
load muon candidates
Definition at line 400 of file L1GtMuonCondition.cc.
References L1GlobalTriggerGTL::getCandL1Mu(), and m_gtGTL.
{ return (*(m_gtGTL->getCandL1Mu()))[indexCand]; }
const int L1GtMuonCondition::gtCorrParDeltaPhiNrBins | ( | ) | const [inline] |
get / set maximum number of bins for the delta phi scales
Definition at line 94 of file L1GtMuonCondition.h.
References m_corrParDeltaPhiNrBins.
{ return m_corrParDeltaPhiNrBins; }
const L1GlobalTriggerGTL* L1GtMuonCondition::gtGTL | ( | ) | const [inline] |
get / set the pointer to GTL
Definition at line 78 of file L1GtMuonCondition.h.
References m_gtGTL.
Referenced by copy().
{ return m_gtGTL; }
const int L1GtMuonCondition::gtIfMuEtaNumberBits | ( | ) | const [inline] |
get / set the number of bits for eta of muon objects
Definition at line 86 of file L1GtMuonCondition.h.
References m_ifMuEtaNumberBits.
Referenced by copy().
{ return m_ifMuEtaNumberBits; }
const L1GtMuonTemplate* L1GtMuonCondition::gtMuonTemplate | ( | ) | const [inline] |
get / set the pointer to a L1GtCondition
Definition at line 71 of file L1GtMuonCondition.h.
References m_gtMuonTemplate.
Referenced by copy().
{ return m_gtMuonTemplate; }
L1GtMuonCondition & L1GtMuonCondition::operator= | ( | const L1GtMuonCondition & | cp | ) |
void L1GtMuonCondition::print | ( | std::ostream & | myCout | ) | const [virtual] |
print condition
Reimplemented from L1GtConditionEvaluation.
Definition at line 546 of file L1GtMuonCondition.cc.
References m_corrParDeltaPhiNrBins, m_gtMuonTemplate, m_ifMuEtaNumberBits, and L1GtMuonTemplate::print().
Referenced by L1GtCorrelationCondition::evaluateCondition(), and L1GlobalTriggerGTL::run().
{ m_gtMuonTemplate->print(myCout); myCout << " Number of bits for eta of muon objects = " << m_ifMuEtaNumberBits << std::endl; myCout << " Maximum number of bins for the delta phi scales = " << m_corrParDeltaPhiNrBins << "\n " << std::endl; L1GtConditionEvaluation::print(myCout); }
void L1GtMuonCondition::setGtCorrParDeltaPhiNrBins | ( | const int & | corrParDeltaPhiNrBins | ) |
Definition at line 125 of file L1GtMuonCondition.cc.
References m_corrParDeltaPhiNrBins.
Referenced by L1GlobalTriggerGTL::run().
{ m_corrParDeltaPhiNrBins = corrParDeltaPhiNrBins; }
void L1GtMuonCondition::setGtGTL | ( | const L1GlobalTriggerGTL * | ptrGTL | ) |
set the pointer to GTL
Definition at line 109 of file L1GtMuonCondition.cc.
References m_gtGTL.
{ m_gtGTL = ptrGTL; }
void L1GtMuonCondition::setGtIfMuEtaNumberBits | ( | const int & | ifMuEtaNumberBitsValue | ) |
Definition at line 117 of file L1GtMuonCondition.cc.
References m_ifMuEtaNumberBits.
{ m_ifMuEtaNumberBits = ifMuEtaNumberBitsValue; }
void L1GtMuonCondition::setGtMuonTemplate | ( | const L1GtMuonTemplate * | muonTempl | ) |
Definition at line 102 of file L1GtMuonCondition.cc.
References m_gtMuonTemplate.
{ m_gtMuonTemplate = muonTempl; }
unsigned int L1GtMuonCondition::m_corrParDeltaPhiNrBins [private] |
Definition at line 125 of file L1GtMuonCondition.h.
Referenced by copy(), evaluateCondition(), gtCorrParDeltaPhiNrBins(), L1GtMuonCondition(), print(), and setGtCorrParDeltaPhiNrBins().
const L1GlobalTriggerGTL* L1GtMuonCondition::m_gtGTL [private] |
pointer to GTL, to be able to get the trigger objects
Definition at line 119 of file L1GtMuonCondition.h.
Referenced by copy(), evaluateCondition(), getCandidate(), gtGTL(), and setGtGTL().
const L1GtMuonTemplate* L1GtMuonCondition::m_gtMuonTemplate [private] |
pointer to a L1GtMuonTemplate
Definition at line 116 of file L1GtMuonCondition.h.
Referenced by checkObjectParameter(), copy(), evaluateCondition(), gtMuonTemplate(), print(), and setGtMuonTemplate().
int L1GtMuonCondition::m_ifMuEtaNumberBits [private] |
number of bits for eta of muon objects
Definition at line 122 of file L1GtMuonCondition.h.
Referenced by copy(), evaluateCondition(), gtIfMuEtaNumberBits(), print(), and setGtIfMuEtaNumberBits().