23 #include <ext/hash_map> 69 m_firstEvLumiSegment(
true),
122 void l1t::GlobalBoard::init(
const int numberPhysTriggers,
const int nrL1Mu,
const int nrL1EG,
const int nrL1Tau,
const int nrL1Jet,
123 int bxFirst,
int bxLast) {
150 const bool receiveEG,
const int nrL1EG,
151 const bool receiveTau,
const int nrL1Tau,
152 const bool receiveJet,
const int nrL1Jet,
153 const bool receiveEtSums) {
157 <<
"\n**** Board receiving Calo Data " 173 <<
"\nWarning: BXVector<l1t::EGamma> with input tag " 175 <<
"\nrequested in configuration, but not found in the event.\n" 180 for(
int i = egData->getFirstBX();
i <= egData->getLastBX(); ++
i) {
183 if( i < m_bxFirst_ || i >
m_bxLast_ )
continue;
187 for(std::vector<l1t::EGamma>::const_iterator eg = egData->begin(
i); eg != egData->end(
i); ++eg) {
190 (*m_candL1EG).push_back(
i,&(*eg));
192 edm::LogWarning(
"L1TGlobal") <<
" Too many EG ("<<nObj<<
") for uGT Configuration maxEG =" <<nrL1EG << std::endl;
194 LogDebug(
"L1TGlobal") <<
"EG Pt " << eg->hwPt() <<
" Eta " << eg->hwEta() <<
" Phi " << eg->hwPhi() <<
" Qual " << eg->hwQual() <<
" Iso " << eg->hwIso() << std::endl;
212 <<
"\nWarning: BXVector<l1t::Tau> with input tag " 214 <<
"\nrequested in configuration, but not found in the event.\n" 219 for(
int i = tauData->getFirstBX();
i <= tauData->getLastBX(); ++
i) {
222 if( i < m_bxFirst_ || i >
m_bxLast_ )
continue;
226 for(std::vector<l1t::Tau>::const_iterator
tau = tauData->begin(
i);
tau != tauData->end(
i); ++
tau) {
229 (*m_candL1Tau).push_back(
i,&(*
tau));
231 LogTrace(
"L1TGlobal") <<
" Too many Tau ("<<nObj<<
") for uGT Configuration maxTau =" <<nrL1Tau << std::endl;
234 LogDebug(
"L1TGlobal") <<
"tau Pt " <<
tau->hwPt() <<
" Eta " <<
tau->hwEta() <<
" Phi " <<
tau->hwPhi() <<
" Qual " <<
tau->hwQual() <<
" Iso " <<
tau->hwIso() << std::endl;
252 <<
"\nWarning: BXVector<l1t::Jet> with input tag " 254 <<
"\nrequested in configuration, but not found in the event.\n" 259 for(
int i = jetData->getFirstBX();
i <= jetData->getLastBX(); ++
i) {
262 if( i < m_bxFirst_ || i >
m_bxLast_ )
continue;
266 for(std::vector<l1t::Jet>::const_iterator
jet = jetData->begin(
i);
jet != jetData->end(
i); ++
jet) {
269 (*m_candL1Jet).push_back(
i,&(*
jet));
271 edm::LogWarning(
"L1TGlobal") <<
" Too many Jets ("<<nObj<<
") for uGT Configuration maxJet =" <<nrL1Jet << std::endl;
274 LogDebug(
"L1TGlobal") <<
"Jet Pt " <<
jet->hwPt() <<
" Eta " <<
jet->hwEta() <<
" Phi " <<
jet->hwPhi() <<
" Qual " <<
jet->hwQual() <<
" Iso " <<
jet->hwIso() << std::endl;
291 <<
"\nWarning: BXVector<l1t::EtSum> with input tag " 293 <<
"\nrequested in configuration, but not found in the event.\n" 298 for(
int i = etSumData->getFirstBX();
i <= etSumData->getLastBX(); ++
i) {
301 if( i < m_bxFirst_ || i >
m_bxLast_ )
continue;
304 for(std::vector<l1t::EtSum>::const_iterator etsum = etSumData->begin(
i); etsum != etSumData->end(
i); ++etsum) {
306 (*m_candL1EtSum).push_back(
i,&(*etsum));
364 <<
"\n**** GlobalBoard receiving muon data = " 379 <<
"\nWarning: BXVector<l1t::Muon> with input tag " 381 <<
"\nrequested in configuration, but not found in the event.\n" 386 for(
int i = muonData->getFirstBX();
i <= muonData->getLastBX(); ++
i) {
389 if( i < m_bxFirst_ || i >
m_bxLast_ )
continue;
393 for(std::vector<l1t::Muon>::const_iterator
mu = muonData->begin(
i);
mu != muonData->end(
i); ++
mu) {
396 (*m_candL1Mu).push_back(
i,&(*
mu));
398 edm::LogWarning(
"L1TGlobal") <<
" Too many Muons ("<<nObj<<
") for uGT Configuration maxMu =" <<nrL1Mu << std::endl;
401 LogDebug(
"L1TGlobal") <<
"Muon Pt " <<
mu->hwPt() <<
" EtaAtVtx " <<
mu->hwEtaAtVtx() <<
" PhiAtVtx " <<
mu->hwPhiAtVtx() <<
" Qual " <<
mu->hwQual() <<
" Iso " <<
mu->hwIso() << std::endl;
420 <<
"\n**** GlobalBoard receiving external data = " 435 <<
"\nWarning: BXVector<GlobalExtBlk> with input tag " 437 <<
"\nrequested in configuration, but not found in the event.\n" 442 for(
int i = extData->getFirstBX();
i <= extData->getLastBX(); ++
i) {
445 if( i < m_bxFirst_ || i >
m_bxLast_ )
continue;
448 for(std::vector<GlobalExtBlk>::const_iterator
ext = extData->begin(
i);
ext != extData->end(
i); ++
ext) {
450 (*m_candL1External).push_back(
i,&(*
ext));
464 const bool produceL1GtObjectMapRecord,
465 const int iBxInEvent,
466 std::unique_ptr<GlobalObjectMapRecord>& gtObjectMapRecord,
467 const unsigned int numberPhysTriggers,
471 const int nrL1Jet ) {
473 const std::vector<ConditionMap>& conditionMap = m_l1GtMenu->
gtConditionMap();
477 LogDebug(
"L1TGlobal") <<
" L1 Menu Scales -- Set Name: " << scaleSetName << std::endl;
488 const std::vector<std::vector<MuonTemplate> >& corrMuon =
492 const std::vector<std::vector<CaloTemplate> >& corrCalo =
495 const std::vector<std::vector<EnergySumTemplate> >& corrEnergySum =
498 LogDebug(
"L1TGlobal") <<
"Size corrMuon " << corrMuon.size()
499 <<
"\nSize corrCalo " << corrCalo.size()
500 <<
"\nSize corrSums " << corrEnergySum.size() << std::endl;
515 for (std::vector<ConditionMap>::const_iterator
516 itCondOnChip = conditionMap.begin(); itCondOnChip != conditionMap.end(); itCondOnChip++) {
525 for (
CItCond itCond = itCondOnChip->begin(); itCond != itCondOnChip->end(); itCond++) {
528 switch ((itCond->second)->condCategory()) {
532 const int ifMuEtaNumberBits = 0;
535 nrL1Mu, ifMuEtaNumberBits);
542 cMapResults[itCond->first] = muCondition;
545 std::ostringstream myCout;
546 muCondition->
print(myCout);
548 LogTrace(
"L1TGlobal") << myCout.str() << std::endl;
557 const int ifCaloEtaNumberBits = 0;
560 itCond->second,
this,
564 ifCaloEtaNumberBits);
571 cMapResults[itCond->first] = caloCondition;
574 std::ostringstream myCout;
575 caloCondition->
print(myCout);
577 LogTrace(
"L1TGlobal") << myCout.str() << std::endl;
586 itCond->second,
this);
591 cMapResults[itCond->first] = eSumCondition;
594 std::ostringstream myCout;
595 eSumCondition->
print(myCout);
597 LogTrace(
"L1TGlobal") << myCout.str() << std::endl;
607 itCond->second,
this);
612 cMapResults[itCond->first] = extCondition;
615 std::ostringstream myCout;
616 extCondition->
print(myCout);
618 LogTrace(
"L1TGlobal") << myCout.str() << std::endl;
633 const int cond0Ind = corrTemplate->
cond0Index();
634 const int cond1Ind = corrTemplate->
cond1Index();
640 int cond0NrL1Objects = 0;
641 int cond1NrL1Objects = 0;
642 LogDebug(
"L1TGlobal") <<
" cond0NrL1Objects" << cond0NrL1Objects <<
" cond1NrL1Objects " << cond1NrL1Objects << std::endl;
645 switch (cond0Categ) {
647 cond0Condition = &((corrMuon[iChip])[cond0Ind]);
651 cond0Condition = &((corrCalo[iChip])[cond0Ind]);
655 cond0Condition = &((corrEnergySum[iChip])[cond0Ind]);
664 switch (cond1Categ) {
666 cond1Condition = &((corrMuon[iChip])[cond1Ind]);
670 cond1Condition = &((corrCalo[iChip])[cond1Ind]);
674 cond1Condition = &((corrEnergySum[iChip])[cond1Ind]);
684 new CorrCondition(itCond->second, cond0Condition, cond1Condition,
this);
690 cMapResults[itCond->first] = correlationCond;
693 std::ostringstream myCout;
694 correlationCond->
print(myCout);
696 LogTrace(
"L1TGlobal") << myCout.str() << std::endl;
712 const int cond0Ind = corrTemplate->
cond0Index();
713 const int cond1Ind = corrTemplate->
cond1Index();
714 const int cond2Ind = corrTemplate->
cond2Index();
721 int cond0NrL1Objects = 0;
722 int cond1NrL1Objects = 0;
723 int cond2NrL1Objects = 0;
724 LogDebug(
"L1TGlobal") <<
" cond0NrL1Objects" << cond0NrL1Objects <<
" cond1NrL1Objects " << cond1NrL1Objects <<
" cond2NrL1Objects " << cond2NrL1Objects << std::endl;
727 switch (cond0Categ) {
729 cond0Condition = &((corrMuon[iChip])[cond0Ind]);
733 cond0Condition = &((corrCalo[iChip])[cond0Ind]);
737 cond0Condition = &((corrEnergySum[iChip])[cond0Ind]);
746 switch (cond1Categ) {
748 cond1Condition = &((corrMuon[iChip])[cond1Ind]);
752 cond1Condition = &((corrCalo[iChip])[cond1Ind]);
756 cond1Condition = &((corrEnergySum[iChip])[cond1Ind]);
765 switch (cond2Categ) {
767 cond2Condition = &((corrMuon[iChip])[cond2Ind]);
771 cond2Condition = &((corrCalo[iChip])[cond2Ind]);
775 cond2Condition = &((corrEnergySum[iChip])[cond2Ind]);
788 correlationCondWOR->
setScales(>Scales);
791 cMapResults[itCond->first] = correlationCondWOR;
794 std::ostringstream myCout;
795 correlationCondWOR->
print(myCout);
797 LogTrace(
"L1TGlobal") << myCout.str() << std::endl;
825 std::vector<GlobalObjectMap> objMapVec;
826 if (produceL1GtObjectMapRecord && (iBxInEvent == 0)) objMapVec.reserve(numberPhysTriggers);
828 for (
CItAlgo itAlgo = algorithmMap.begin(); itAlgo != algorithmMap.end(); itAlgo++) {
832 int algBitNumber = (itAlgo->second).algoBitNumber();
835 LogDebug(
"L1TGlobal") <<
" ===> for iBxInEvent = " << iBxInEvent <<
":\t algBitName = " << itAlgo->first <<
",\t algBitNumber = " << algBitNumber <<
",\t algResult = " << algResult << std::endl;
844 std::ostringstream myCout;
845 ( itAlgo->second ).
print(myCout);
848 LogTrace(
"L1TGlobal") << myCout.str() << std::endl;
853 if (produceL1GtObjectMapRecord && (iBxInEvent == 0)) {
855 std::vector<L1TObjectTypeInCond> otypes;
861 for (
auto imap = conditionMap.begin(); imap != conditionMap.end(); imap++) {
863 auto match = imap->find(iop->tokenName);
865 if (
match != imap->end()){
869 otype =
match->second->objectType();
871 for (
auto itype = otype.begin(); itype != otype.end() ; itype++){
877 edm::LogWarning(
"L1TGlobal") <<
"\n Failed to find match for operand token " << iop->tokenName <<
"\n";
879 otypes.push_back(otype);
895 std::ostringstream myCout1;
896 objMap.
print(myCout1);
898 LogTrace(
"L1TGlobal") << myCout1.str() << std::endl;
901 objMapVec.push_back(objMap);
909 if (produceL1GtObjectMapRecord && (iBxInEvent == 0)) {
910 gtObjectMapRecord->swapGtObjectMap(objMapVec);
916 for (std::vector<AlgorithmEvaluation::ConditionEvaluationMap>::iterator
921 itCond = itCondOnChip->begin();
922 itCond != itCondOnChip->end(); itCond++) {
924 delete itCond->second;
925 itCond->second =
nullptr;
934 const int iBxInEvent,
935 const int totalBxInEvent,
936 const unsigned int numberPhysTriggers,
937 const std::vector<int>& prescaleFactorsAlgoTrig,
938 const std::vector<unsigned int>& triggerMaskAlgoTrig,
939 const std::vector<int>& triggerMaskVetoAlgoTrig,
940 const bool algorithmTriggersUnprescaled,
941 const bool algorithmTriggersUnmasked ){
946 <<
"\n**** GlobalBoard apply Final Decision Logic " 957 for(
int iBxInEvent = 0; iBxInEvent <= totalBxInEvent; ++iBxInEvent ){
968 for(
int iBxInEvent = 0; iBxInEvent <= totalBxInEvent; ++iBxInEvent ){
984 if( !algorithmTriggersUnprescaled ){
987 int inBxInEvent = totalBxInEvent/2 + iBxInEvent;
989 bool temp_algPrescaledOr =
false;
990 for(
unsigned int iBit = 0; iBit < numberPhysTriggers; ++iBit ){
995 if( iBit < prescaleFactorsAlgoTrig.size() ){
996 if( prescaleFactorsAlgoTrig.at(iBit) != 1 ){
1003 temp_algPrescaledOr =
true;
1014 temp_algPrescaledOr =
true;
1019 <<
"\nWarning: algoBit >= prescaleFactorsAlgoTrig.size() " 1039 if( !algorithmTriggersUnmasked ){
1041 bool temp_algFinalOr =
false;
1042 for(
unsigned int iBit = 0; iBit < numberPhysTriggers; ++iBit ){
1048 bool isMasked =
false;
1049 if( iBit < triggerMaskAlgoTrig.size() ) isMasked = ( triggerMaskAlgoTrig.at(iBit) == 0 );
1052 <<
"\nWarning: algoBit >= triggerMaskAlgoTrig.size() " 1056 bool passMask = ( bitValue && !isMasked );
1058 if( passMask ) temp_algFinalOr =
true;
1085 std::unique_ptr<GlobalAlgBlkBxCollection>& uGtAlgRecord,
1094 <<
"\n**** GlobalBoard fill DAQ Records for bx= " << iBxInEvent
1166 <<
"\nl1t::L1GlobalTrigger: uGMT data received for BxInEvent = " 1167 << iBxInEvent << std::endl;
1171 <<
"Number of GMT muons = " << nrL1Mu <<
"\n" 1174 LogTrace(
"L1TGlobal") << std::endl;
void receiveMuonObjectData(edm::Event &, const edm::EDGetTokenT< BXVector< l1t::Muon > > &, const bool receiveMu, const int nrL1Mu)
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
void receiveExternalData(edm::Event &, const edm::EDGetTokenT< BXVector< GlobalExtBlk > > &, const bool receiveExt)
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
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)
BXVector< const l1t::L1Candidate * > * m_candL1Tau
std::vector< AlgorithmEvaluation::ConditionEvaluationMap > m_conditionResultMaps