23 #include <ext/hash_map> 67 m_firstEvLumiSegment(
true),
135 const bool receiveEG,
137 const bool receiveTau,
139 const bool receiveJet,
141 const bool receiveEtSums) {
143 LogDebug(
"L1TGlobal") <<
"\n**** Board receiving Calo Data " 157 edm::LogWarning(
"L1TGlobal") <<
"\nWarning: BXVector<l1t::EGamma> with input tag " 159 <<
"\nrequested in configuration, but not found in the event.\n" 164 for (
int i = egData->getFirstBX();
i <= egData->getLastBX(); ++
i) {
171 for (std::vector<l1t::EGamma>::const_iterator eg = egData->begin(
i); eg != egData->end(
i); ++eg) {
173 (*m_candL1EG).push_back(
i, &(*eg));
175 edm::LogWarning(
"L1TGlobal") <<
" Too many EG (" << nObj <<
") for uGT Configuration maxEG =" << nrL1EG
178 LogDebug(
"L1TGlobal") <<
"EG Pt " << eg->hwPt() <<
" Eta " << eg->hwEta() <<
" Phi " << eg->hwPhi()
179 <<
" Qual " << eg->hwQual() <<
" Iso " << eg->hwIso() << std::endl;
195 edm::LogWarning(
"L1TGlobal") <<
"\nWarning: BXVector<l1t::Tau> with input tag " 197 <<
"\nrequested in configuration, but not found in the event.\n" 202 for (
int i = tauData->getFirstBX();
i <= tauData->getLastBX(); ++
i) {
209 for (std::vector<l1t::Tau>::const_iterator
tau = tauData->begin(
i);
tau != tauData->end(
i); ++
tau) {
210 if (nObj < nrL1Tau) {
211 (*m_candL1Tau).push_back(
i, &(*
tau));
213 LogTrace(
"L1TGlobal") <<
" Too many Tau (" << nObj <<
") for uGT Configuration maxTau =" << nrL1Tau
217 LogDebug(
"L1TGlobal") <<
"tau Pt " <<
tau->hwPt() <<
" Eta " <<
tau->hwEta() <<
" Phi " <<
tau->hwPhi()
218 <<
" Qual " <<
tau->hwQual() <<
" Iso " <<
tau->hwIso() << std::endl;
234 edm::LogWarning(
"L1TGlobal") <<
"\nWarning: BXVector<l1t::Jet> with input tag " 236 <<
"\nrequested in configuration, but not found in the event.\n" 241 for (
int i = jetData->getFirstBX();
i <= jetData->getLastBX(); ++
i) {
248 for (std::vector<l1t::Jet>::const_iterator
jet = jetData->begin(
i);
jet != jetData->end(
i); ++
jet) {
249 if (nObj < nrL1Jet) {
250 (*m_candL1Jet).push_back(
i, &(*
jet));
252 edm::LogWarning(
"L1TGlobal") <<
" Too many Jets (" << nObj <<
") for uGT Configuration maxJet =" << nrL1Jet
256 LogDebug(
"L1TGlobal") <<
"Jet Pt " <<
jet->hwPt() <<
" Eta " <<
jet->hwEta() <<
" Phi " <<
jet->hwPhi()
257 <<
" Qual " <<
jet->hwQual() <<
" Iso " <<
jet->hwIso() << std::endl;
272 edm::LogWarning(
"L1TGlobal") <<
"\nWarning: BXVector<l1t::EtSum> with input tag " 274 <<
"\nrequested in configuration, but not found in the event.\n" 278 for (
int i = etSumData->getFirstBX();
i <= etSumData->getLastBX(); ++
i) {
284 for (std::vector<l1t::EtSum>::const_iterator etsum = etSumData->begin(
i); etsum != etSumData->end(
i); ++etsum) {
285 (*m_candL1EtSum).push_back(
i, &(*etsum));
334 const bool receiveMu,
337 LogDebug(
"L1TGlobal") <<
"\n**** GlobalBoard receiving muon data = " 351 edm::LogWarning(
"L1TGlobal") <<
"\nWarning: BXVector<l1t::Muon> with input tag " 353 <<
"\nrequested in configuration, but not found in the event.\n" 358 for (
int i = muonData->getFirstBX();
i <= muonData->getLastBX(); ++
i) {
365 for (std::vector<l1t::Muon>::const_iterator
mu = muonData->begin(
i);
mu != muonData->end(
i); ++
mu) {
367 (*m_candL1Mu).push_back(
i, &(*
mu));
369 edm::LogWarning(
"L1TGlobal") <<
" Too many Muons (" << nObj <<
") for uGT Configuration maxMu =" << nrL1Mu
373 LogDebug(
"L1TGlobal") <<
"Muon Pt " <<
mu->hwPt() <<
" EtaAtVtx " <<
mu->hwEtaAtVtx() <<
" PhiAtVtx " 374 <<
mu->hwPhiAtVtx() <<
" Qual " <<
mu->hwQual() <<
" Iso " <<
mu->hwIso()
388 const bool receiveExt) {
390 LogDebug(
"L1TGlobal") <<
"\n**** GlobalBoard receiving external data = " 404 edm::LogWarning(
"L1TGlobal") <<
"\nWarning: BXVector<GlobalExtBlk> with input tag " 406 <<
"\nrequested in configuration, but not found in the event.\n" 411 for (
int i = extData->getFirstBX();
i <= extData->getLastBX(); ++
i) {
417 for (std::vector<GlobalExtBlk>::const_iterator
ext = extData->begin(
i);
ext != extData->end(
i); ++
ext) {
418 (*m_candL1External).push_back(
i, &(*
ext));
431 const bool produceL1GtObjectMapRecord,
432 const int iBxInEvent,
433 std::unique_ptr<GlobalObjectMapRecord>& gtObjectMapRecord,
434 const unsigned int numberPhysTriggers,
439 const std::vector<ConditionMap>& conditionMap = m_l1GtMenu->
gtConditionMap();
443 LogDebug(
"L1TGlobal") <<
" L1 Menu Scales -- Set Name: " << scaleSetName << std::endl;
453 const std::vector<std::vector<MuonTemplate>>& corrMuon = m_l1GtMenu->
corMuonTemplate();
456 const std::vector<std::vector<CaloTemplate>>& corrCalo = m_l1GtMenu->
corCaloTemplate();
458 const std::vector<std::vector<EnergySumTemplate>>& corrEnergySum = m_l1GtMenu->
corEnergySumTemplate();
460 LogDebug(
"L1TGlobal") <<
"Size corrMuon " << corrMuon.size() <<
"\nSize corrCalo " << corrCalo.size()
461 <<
"\nSize corrSums " << corrEnergySum.size() << std::endl;
475 for (std::vector<ConditionMap>::const_iterator itCondOnChip = conditionMap.begin();
476 itCondOnChip != conditionMap.end();
482 for (
CItCond itCond = itCondOnChip->begin(); itCond != itCondOnChip->end(); itCond++) {
484 switch ((itCond->second)->condCategory()) {
487 const int ifMuEtaNumberBits = 0;
496 cMapResults[itCond->first] = muCondition;
499 std::ostringstream myCout;
500 muCondition->
print(myCout);
502 LogTrace(
"L1TGlobal") << myCout.str() << std::endl;
509 const int ifCaloEtaNumberBits = 0;
512 new CaloCondition(itCond->second,
this, nrL1EG, nrL1Jet, nrL1Tau, ifCaloEtaNumberBits);
518 cMapResults[itCond->first] = caloCondition;
521 std::ostringstream myCout;
522 caloCondition->
print(myCout);
524 LogTrace(
"L1TGlobal") << myCout.str() << std::endl;
535 cMapResults[itCond->first] = eSumCondition;
538 std::ostringstream myCout;
539 eSumCondition->
print(myCout);
541 LogTrace(
"L1TGlobal") << myCout.str() << std::endl;
553 cMapResults[itCond->first] = extCondition;
556 std::ostringstream myCout;
557 extCondition->
print(myCout);
559 LogTrace(
"L1TGlobal") << myCout.str() << std::endl;
569 const int cond0Ind = corrTemplate->
cond0Index();
570 const int cond1Ind = corrTemplate->
cond1Index();
576 int cond0NrL1Objects = 0;
577 int cond1NrL1Objects = 0;
578 LogDebug(
"L1TGlobal") <<
" cond0NrL1Objects" << cond0NrL1Objects <<
" cond1NrL1Objects " << cond1NrL1Objects
581 switch (cond0Categ) {
583 cond0Condition = &((corrMuon[iChip])[cond0Ind]);
586 cond0Condition = &((corrCalo[iChip])[cond0Ind]);
589 cond0Condition = &((corrEnergySum[iChip])[cond0Ind]);
596 switch (cond1Categ) {
598 cond1Condition = &((corrMuon[iChip])[cond1Ind]);
601 cond1Condition = &((corrCalo[iChip])[cond1Ind]);
604 cond1Condition = &((corrEnergySum[iChip])[cond1Ind]);
617 cMapResults[itCond->first] = correlationCond;
620 std::ostringstream myCout;
621 correlationCond->
print(myCout);
623 LogTrace(
"L1TGlobal") << myCout.str() << std::endl;
636 const int cond0Ind = corrTemplate->
cond0Index();
637 const int cond1Ind = corrTemplate->
cond1Index();
638 const int cond2Ind = corrTemplate->
cond2Index();
645 int cond0NrL1Objects = 0;
646 int cond1NrL1Objects = 0;
647 int cond2NrL1Objects = 0;
648 LogDebug(
"L1TGlobal") <<
" cond0NrL1Objects" << cond0NrL1Objects <<
" cond1NrL1Objects " << cond1NrL1Objects
649 <<
" cond2NrL1Objects " << cond2NrL1Objects << std::endl;
651 switch (cond0Categ) {
653 cond0Condition = &((corrMuon[iChip])[cond0Ind]);
656 cond0Condition = &((corrCalo[iChip])[cond0Ind]);
659 cond0Condition = &((corrEnergySum[iChip])[cond0Ind]);
666 switch (cond1Categ) {
668 cond1Condition = &((corrMuon[iChip])[cond1Ind]);
671 cond1Condition = &((corrCalo[iChip])[cond1Ind]);
674 cond1Condition = &((corrEnergySum[iChip])[cond1Ind]);
681 switch (cond2Categ) {
683 cond2Condition = &((corrMuon[iChip])[cond2Ind]);
686 cond2Condition = &((corrCalo[iChip])[cond2Ind]);
689 cond2Condition = &((corrEnergySum[iChip])[cond2Ind]);
700 correlationCondWOR->
setScales(>Scales);
703 cMapResults[itCond->first] = correlationCondWOR;
706 std::ostringstream myCout;
707 correlationCondWOR->
print(myCout);
709 LogTrace(
"L1TGlobal") << myCout.str() << std::endl;
730 std::vector<GlobalObjectMap> objMapVec;
731 if (produceL1GtObjectMapRecord && (iBxInEvent == 0))
732 objMapVec.reserve(numberPhysTriggers);
734 for (
CItAlgo itAlgo = algorithmMap.begin(); itAlgo != algorithmMap.end(); itAlgo++) {
738 int algBitNumber = (itAlgo->second).algoBitNumber();
741 LogDebug(
"L1TGlobal") <<
" ===> for iBxInEvent = " << iBxInEvent <<
":\t algBitName = " << itAlgo->first
742 <<
",\t algBitNumber = " << algBitNumber <<
",\t algResult = " << algResult << std::endl;
751 std::ostringstream myCout;
752 (itAlgo->second).
print(myCout);
755 LogTrace(
"L1TGlobal") << myCout.str() << std::endl;
759 if (produceL1GtObjectMapRecord && (iBxInEvent == 0)) {
760 std::vector<L1TObjectTypeInCond> otypes;
766 for (
auto imap = conditionMap.begin(); imap != conditionMap.end(); imap++) {
768 auto match = imap->find(iop->tokenName);
770 if (
match != imap->end()) {
774 otype =
match->second->objectType();
776 for (
auto itype = otype.begin(); itype != otype.end(); itype++) {
782 edm::LogWarning(
"L1TGlobal") <<
"\n Failed to find match for operand token " << iop->tokenName <<
"\n";
784 otypes.push_back(otype);
800 std::ostringstream myCout1;
801 objMap.
print(myCout1);
803 LogTrace(
"L1TGlobal") << myCout1.str() << std::endl;
806 objMapVec.push_back(objMap);
811 if (produceL1GtObjectMapRecord && (iBxInEvent == 0)) {
812 gtObjectMapRecord->swapGtObjectMap(objMapVec);
818 for (std::vector<AlgorithmEvaluation::ConditionEvaluationMap>::iterator itCondOnChip =
m_conditionResultMaps.begin();
822 delete itCond->second;
823 itCond->second =
nullptr;
830 const int iBxInEvent,
831 const int totalBxInEvent,
832 const unsigned int numberPhysTriggers,
833 const std::vector<int>& prescaleFactorsAlgoTrig,
834 const std::vector<unsigned int>& triggerMaskAlgoTrig,
835 const std::vector<int>& triggerMaskVetoAlgoTrig,
836 const bool algorithmTriggersUnprescaled,
837 const bool algorithmTriggersUnmasked) {
839 LogDebug(
"L1TGlobal") <<
"\n**** GlobalBoard apply Final Decision Logic " << std::endl;
847 for (
int iBxInEvent = 0; iBxInEvent <= totalBxInEvent; ++iBxInEvent) {
857 for (
int iBxInEvent = 0; iBxInEvent <= totalBxInEvent; ++iBxInEvent) {
872 if (!algorithmTriggersUnprescaled) {
874 int inBxInEvent = totalBxInEvent / 2 + iBxInEvent;
876 bool temp_algPrescaledOr =
false;
877 for (
unsigned int iBit = 0; iBit < numberPhysTriggers; ++iBit) {
881 if (iBit < prescaleFactorsAlgoTrig.size()) {
882 if (prescaleFactorsAlgoTrig.at(iBit) != 1) {
887 temp_algPrescaledOr =
true;
895 temp_algPrescaledOr =
true;
899 edm::LogWarning(
"L1TGlobal") <<
"\nWarning: algoBit >= prescaleFactorsAlgoTrig.size() " << std::endl;
916 if (!algorithmTriggersUnmasked) {
917 bool temp_algFinalOr =
false;
918 for (
unsigned int iBit = 0; iBit < numberPhysTriggers; ++iBit) {
923 bool isMasked =
false;
924 if (iBit < triggerMaskAlgoTrig.size())
925 isMasked = (triggerMaskAlgoTrig.at(iBit) == 0);
927 edm::LogWarning(
"L1TGlobal") <<
"\nWarning: algoBit >= triggerMaskAlgoTrig.size() " << std::endl;
930 bool passMask = (bitValue && !isMasked);
933 temp_algFinalOr =
true;
938 if (triggerMaskVetoAlgoTrig.at(iBit) == 1)
956 std::unique_ptr<GlobalAlgBlkBxCollection>& uGtAlgRecord,
961 LogDebug(
"L1TGlobal") <<
"\n**** GlobalBoard fill DAQ Records for bx= " << iBxInEvent << std::endl;
1015 LogTrace(
"L1TGlobal") <<
"\nl1t::L1GlobalTrigger: uGMT data received for BxInEvent = " << iBxInEvent << std::endl;
1018 LogTrace(
"L1TGlobal") <<
"Number of GMT muons = " << nrL1Mu <<
"\n" << std::endl;
1020 LogTrace(
"L1TGlobal") << std::endl;
void print(std::ostream &myCout) const override
print condition
BXVector< const l1t::Muon * > * m_candL1Mu
void setL1MenuUUID(int uuid)
set simple members
void setAlgoBitNumber(int algoBitNumberValue)
std::vector< bool > const & getAlgoDecisionInitial() const
Get decision bits.
void init(const int numberPhysTriggers, const int nrL1Mu, const int nrL1EG, const int nrL1Tau, const int nrL1Jet, int bxFirst, int bxLast)
initialize the class (mainly reserve)
bool gtAlgoResult() const
get / set the result of the algorithm
void evaluateConditionStoreResult(const int bxEval)
call evaluateCondition and save last result
std::vector< l1t::GlobalObject > L1TObjectTypeInCond
void swapOperandTokenVector(std::vector< GlobalLogicParser::OperandToken > &operandTokenVectorValue)
void print(std::ostream &myCout) const
void print(std::ostream &myCout) const override
print condition
void setFinalORPreVeto(bool fOR)
void setAlgoDecisionInitial(unsigned int bit, bool val)
Set decision bits.
bool getByToken(EDGetToken token, Handle< PROD > &result) const
void setbxInEventNr(int bxNr)
void setVerbosity(const int verbosity)
BXVector< const l1t::L1Candidate * > * m_candL1EG
const l1t::GtConditionCategory cond1Category() const
const l1t::GtConditionCategory cond0Category() const
get / set the category of the two sub-conditions
__gnu_cxx::hash_map< std::string, ConditionEvaluation * > ConditionEvaluationMap
copy constructor
void fillAlgRecord(int iBxInEvent, std::unique_ptr< GlobalAlgBlkBxCollection > &uGtAlgRecord, int prescaleSet, int menuUUID, int firmwareUUID)
Fill the Daq Records.
edm::LuminosityBlockNumber_t luminosityBlock() const
unsigned long long m_l1MuTriggerScalesCacheID
void copyInitialToInterm()
Copy vectors words.
void swapObjectTypeVector(std::vector< L1TObjectTypeInCond > &objectTypeVectorValue)
S & print(S &os, JobReport::InputFile const &f)
void swapCombinationVector(std::vector< CombinationsInCond > &combinationVectorValue)
ConditionEvaluationMap::iterator ItEvalMap
unsigned long long m_l1GtMenuCacheID
void receiveCaloObjectData(edm::Event &, const edm::EDGetTokenT< BXVector< l1t::EGamma >> &, const edm::EDGetTokenT< BXVector< l1t::Tau >> &, const edm::EDGetTokenT< BXVector< l1t::Jet >> &, const edm::EDGetTokenT< BXVector< l1t::EtSum >> &, const bool receiveEG, const int nrL1EG, const bool receiveTau, const int nrL1Tau, const bool receiveJet, const int nrL1Jet, const bool receiveEtSums)
receive data from Global Muon Trigger
std::bitset< GlobalAlgBlk::maxPhysicsTriggers > m_gtlDecisionWord
ConditionMap::const_iterator CItCond
iterators through map containing the conditions
GtConditionCategory
condition categories
void printGmtData(const int iBxInEvent) const
print received Muon dataWord
int m_verbosity
verbosity level
void print(std::ostream &myCout) const
print the full object map
unsigned int m_boardEventCount
const l1t::GtConditionCategory cond1Category() const
BXVector< const l1t::EtSum * > * m_candL1EtSum
const int cond1Index() const
AlgorithmMap::const_iterator CItAlgo
iterators through map containing the algorithms
std::vector< std::vector< int > > m_prescaleCounterAlgoTrig
prescale counters: NumberPhysTriggers counters per bunch cross in event
void reset()
reset the content of a GlobalAlgBlk
const TriggerMenu * m_l1GtMenu
void print(std::ostream &myCout) const override
print condition
const int cond0Index() const
get / set the index of the two sub-conditions in the cor* vector from menu
unsigned long long m_l1CaloGeometryCacheID
void setAlgoDecisionInterm(unsigned int bit, bool val)
void setAlgoGtlResult(bool algoGtlResultValue)
std::vector< CombinationsInCond > & gtAlgoCombinationVector()
BXVector< const l1t::L1Candidate * > * m_candL1Jet
void setFinalOR(bool fOR)
const int cond1Index() const
void setScales(const GlobalScales *)
const l1t::GtConditionCategory cond0Category() const
get / set the category of the thre sub-conditions
void evaluateAlgorithm(const int chipNumber, const std::vector< ConditionEvaluationMap > &)
evaluate an algorithm
void setFinalORVeto(bool fOR)
BXVector< const GlobalExtBlk * > * m_candL1External
void print(std::ostream &myCout) const override
print condition
void setL1FirmwareUUID(int fuuid)
void setAlgoName(const std::string &algoNameValue)
void setBXRange(int bxFirst, int bxLast)
bool m_firstEvLumiSegment
const l1t::GtConditionCategory cond2Category() const
void receiveMuonObjectData(edm::Event &, const edm::EDGetTokenT< BXVector< l1t::Muon >> &, const bool receiveMu, const int nrL1Mu)
const int cond0Index() const
get / set the index of the two sub-conditions in the cor* vector from menu
void runFDL(edm::Event &iEvent, const int iBxInEvent, const int totalBxInEvent, const unsigned int numberPhysTriggers, const std::vector< int > &prescaleFactorsAlgoTrig, const std::vector< unsigned int > &triggerMaskAlgoTrig, const std::vector< int > &triggerMaskVetoAlgoTrig, const bool algorithmTriggersUnprescaled, const bool algorithmTriggersUnmasked)
run the uGT FDL (Apply Prescales and Veto)
void setScales(const GlobalScales *)
std::vector< GlobalLogicParser::OperandToken > & operandTokenVector()
void print(std::ostream &myCout) const override
print condition
std::vector< bool > const & getAlgoDecisionInterm() const
const int cond2Index() const
void print(std::ostream &myCout) const override
print condition
void setPreScColumn(int psC)
std::pair< typename Association::data_type::first_type, double > match(Reference key, Association association, bool bestMatchByMaxValue)
Generic matching function.
std::bitset< GlobalAlgBlk::maxPhysicsTriggers > m_gtlAlgorithmOR
std::map< std::string, GlobalAlgorithm > AlgorithmMap
map containing the algorithms
void runGTL(edm::Event &iEvent, const edm::EventSetup &evSetup, const TriggerMenu *m_l1GtMenu, const bool produceL1GtObjectMapRecord, const int iBxInEvent, std::unique_ptr< GlobalObjectMapRecord > >ObjectMapRecord, const unsigned int numberPhysTriggers, const int nrL1Mu, const int nrL1EG, const int nrL1Tau, const int nrL1Jet)
run the uGT GTL (Conditions and Algorithms)
virtual std::string getScalesName() const
void setAlgoDecisionFinal(unsigned int bit, bool val)
void receiveExternalData(edm::Event &, const edm::EDGetTokenT< BXVector< GlobalExtBlk >> &, const bool receiveExt)
BXVector< const l1t::L1Candidate * > * m_candL1Tau
std::vector< AlgorithmEvaluation::ConditionEvaluationMap > m_conditionResultMaps