23 #include <ext/hash_map> 69 m_firstEvLumiSegment(
true),
121 void l1t::GlobalBoard::init(
const int numberPhysTriggers,
const int nrL1Mu,
const int nrL1EG,
const int nrL1Tau,
const int nrL1Jet,
122 int bxFirst,
int bxLast) {
149 const bool receiveEG,
const int nrL1EG,
150 const bool receiveTau,
const int nrL1Tau,
151 const bool receiveJet,
const int nrL1Jet,
152 const bool receiveEtSums) {
156 <<
"\n**** Board receiving Calo Data " 172 <<
"\nWarning: BXVector<l1t::EGamma> with input tag " 174 <<
"\nrequested in configuration, but not found in the event.\n" 179 for(
int i = egData->getFirstBX();
i <= egData->getLastBX(); ++
i) {
182 if( i < m_bxFirst_ || i >
m_bxLast_ )
continue;
186 for(std::vector<l1t::EGamma>::const_iterator eg = egData->begin(
i); eg != egData->end(
i); ++eg) {
189 (*m_candL1EG).push_back(
i,&(*eg));
191 edm::LogWarning(
"L1TGlobal") <<
" Too many EG ("<<nObj<<
") for uGT Configuration maxEG =" <<nrL1EG << std::endl;
193 LogDebug(
"L1TGlobal") <<
"EG Pt " << eg->hwPt() <<
" Eta " << eg->hwEta() <<
" Phi " << eg->hwPhi() <<
" Qual " << eg->hwQual() <<
" Iso " << eg->hwIso() << std::endl;
211 <<
"\nWarning: BXVector<l1t::Tau> with input tag " 213 <<
"\nrequested in configuration, but not found in the event.\n" 218 for(
int i = tauData->getFirstBX();
i <= tauData->getLastBX(); ++
i) {
221 if( i < m_bxFirst_ || i >
m_bxLast_ )
continue;
225 for(std::vector<l1t::Tau>::const_iterator
tau = tauData->begin(
i);
tau != tauData->end(
i); ++
tau) {
228 (*m_candL1Tau).push_back(
i,&(*
tau));
230 LogTrace(
"L1TGlobal") <<
" Too many Tau ("<<nObj<<
") for uGT Configuration maxTau =" <<nrL1Tau << std::endl;
233 LogDebug(
"L1TGlobal") <<
"tau Pt " <<
tau->hwPt() <<
" Eta " <<
tau->hwEta() <<
" Phi " <<
tau->hwPhi() <<
" Qual " <<
tau->hwQual() <<
" Iso " <<
tau->hwIso() << std::endl;
251 <<
"\nWarning: BXVector<l1t::Jet> with input tag " 253 <<
"\nrequested in configuration, but not found in the event.\n" 258 for(
int i = jetData->getFirstBX();
i <= jetData->getLastBX(); ++
i) {
261 if( i < m_bxFirst_ || i >
m_bxLast_ )
continue;
265 for(std::vector<l1t::Jet>::const_iterator
jet = jetData->begin(
i);
jet != jetData->end(
i); ++
jet) {
268 (*m_candL1Jet).push_back(
i,&(*
jet));
270 edm::LogWarning(
"L1TGlobal") <<
" Too many Jets ("<<nObj<<
") for uGT Configuration maxJet =" <<nrL1Jet << std::endl;
273 LogDebug(
"L1TGlobal") <<
"Jet Pt " <<
jet->hwPt() <<
" Eta " <<
jet->hwEta() <<
" Phi " <<
jet->hwPhi() <<
" Qual " <<
jet->hwQual() <<
" Iso " <<
jet->hwIso() << std::endl;
290 <<
"\nWarning: BXVector<l1t::EtSum> with input tag " 292 <<
"\nrequested in configuration, but not found in the event.\n" 297 for(
int i = etSumData->getFirstBX();
i <= etSumData->getLastBX(); ++
i) {
300 if( i < m_bxFirst_ || i >
m_bxLast_ )
continue;
303 for(std::vector<l1t::EtSum>::const_iterator etsum = etSumData->begin(
i); etsum != etSumData->end(
i); ++etsum) {
305 (*m_candL1EtSum).push_back(
i,&(*etsum));
363 <<
"\n**** GlobalBoard receiving muon data = " 378 <<
"\nWarning: BXVector<l1t::Muon> with input tag " 380 <<
"\nrequested in configuration, but not found in the event.\n" 385 for(
int i = muonData->getFirstBX();
i <= muonData->getLastBX(); ++
i) {
388 if( i < m_bxFirst_ || i >
m_bxLast_ )
continue;
392 for(std::vector<l1t::Muon>::const_iterator
mu = muonData->begin(
i);
mu != muonData->end(
i); ++
mu) {
395 (*m_candL1Mu).push_back(
i,&(*
mu));
397 edm::LogWarning(
"L1TGlobal") <<
" Too many Muons ("<<nObj<<
") for uGT Configuration maxMu =" <<nrL1Mu << std::endl;
400 LogDebug(
"L1TGlobal") <<
"Muon Pt " <<
mu->hwPt() <<
" EtaAtVtx " <<
mu->hwEtaAtVtx() <<
" PhiAtVtx " <<
mu->hwPhiAtVtx() <<
" Qual " <<
mu->hwQual() <<
" Iso " <<
mu->hwIso() << std::endl;
419 <<
"\n**** GlobalBoard receiving external data = " 434 <<
"\nWarning: BXVector<GlobalExtBlk> with input tag " 436 <<
"\nrequested in configuration, but not found in the event.\n" 441 for(
int i = extData->getFirstBX();
i <= extData->getLastBX(); ++
i) {
444 if( i < m_bxFirst_ || i >
m_bxLast_ )
continue;
447 for(std::vector<GlobalExtBlk>::const_iterator
ext = extData->begin(
i);
ext != extData->end(
i); ++
ext) {
449 (*m_candL1External).push_back(
i,&(*
ext));
463 const bool produceL1GtObjectMapRecord,
464 const int iBxInEvent,
465 std::unique_ptr<GlobalObjectMapRecord>& gtObjectMapRecord,
466 const unsigned int numberPhysTriggers,
470 const int nrL1Jet ) {
472 const std::vector<ConditionMap>& conditionMap = m_l1GtMenu->
gtConditionMap();
476 LogDebug(
"L1TGlobal") <<
" L1 Menu Scales -- Set Name: " << scaleSetName << std::endl;
487 const std::vector<std::vector<MuonTemplate> >& corrMuon =
491 const std::vector<std::vector<CaloTemplate> >& corrCalo =
494 const std::vector<std::vector<EnergySumTemplate> >& corrEnergySum =
497 LogDebug(
"L1TGlobal") <<
"Size corrMuon " << corrMuon.size()
498 <<
"\nSize corrCalo " << corrCalo.size()
499 <<
"\nSize corrSums " << corrEnergySum.size() << std::endl;
514 for (std::vector<ConditionMap>::const_iterator
515 itCondOnChip = conditionMap.begin(); itCondOnChip != conditionMap.end(); itCondOnChip++) {
524 for (
CItCond itCond = itCondOnChip->begin(); itCond != itCondOnChip->end(); itCond++) {
527 switch ((itCond->second)->condCategory()) {
531 const int ifMuEtaNumberBits = 0;
534 nrL1Mu, ifMuEtaNumberBits);
541 cMapResults[itCond->first] = muCondition;
544 std::ostringstream myCout;
545 muCondition->
print(myCout);
547 LogTrace(
"L1TGlobal") << myCout.str() << std::endl;
556 const int ifCaloEtaNumberBits = 0;
559 itCond->second,
this,
563 ifCaloEtaNumberBits);
570 cMapResults[itCond->first] = caloCondition;
573 std::ostringstream myCout;
574 caloCondition->
print(myCout);
576 LogTrace(
"L1TGlobal") << myCout.str() << std::endl;
585 itCond->second,
this);
590 cMapResults[itCond->first] = eSumCondition;
593 std::ostringstream myCout;
594 eSumCondition->
print(myCout);
596 LogTrace(
"L1TGlobal") << myCout.str() << std::endl;
606 itCond->second,
this);
611 cMapResults[itCond->first] = extCondition;
614 std::ostringstream myCout;
615 extCondition->
print(myCout);
617 LogTrace(
"L1TGlobal") << myCout.str() << std::endl;
632 const int cond0Ind = corrTemplate->
cond0Index();
633 const int cond1Ind = corrTemplate->
cond1Index();
639 int cond0NrL1Objects = 0;
640 int cond1NrL1Objects = 0;
641 LogDebug(
"L1TGlobal") <<
" cond0NrL1Objects" << cond0NrL1Objects <<
" cond1NrL1Objects " << cond1NrL1Objects << std::endl;
644 switch (cond0Categ) {
646 cond0Condition = &((corrMuon[iChip])[cond0Ind]);
650 cond0Condition = &((corrCalo[iChip])[cond0Ind]);
654 cond0Condition = &((corrEnergySum[iChip])[cond0Ind]);
663 switch (cond1Categ) {
665 cond1Condition = &((corrMuon[iChip])[cond1Ind]);
669 cond1Condition = &((corrCalo[iChip])[cond1Ind]);
673 cond1Condition = &((corrEnergySum[iChip])[cond1Ind]);
683 new CorrCondition(itCond->second, cond0Condition, cond1Condition,
this);
689 cMapResults[itCond->first] = correlationCond;
692 std::ostringstream myCout;
693 correlationCond->
print(myCout);
695 LogTrace(
"L1TGlobal") << myCout.str() << std::endl;
711 const int cond0Ind = corrTemplate->
cond0Index();
712 const int cond1Ind = corrTemplate->
cond1Index();
713 const int cond2Ind = corrTemplate->
cond2Index();
720 int cond0NrL1Objects = 0;
721 int cond1NrL1Objects = 0;
722 int cond2NrL1Objects = 0;
723 LogDebug(
"L1TGlobal") <<
" cond0NrL1Objects" << cond0NrL1Objects <<
" cond1NrL1Objects " << cond1NrL1Objects <<
" cond2NrL1Objects " << cond2NrL1Objects << std::endl;
726 switch (cond0Categ) {
728 cond0Condition = &((corrMuon[iChip])[cond0Ind]);
732 cond0Condition = &((corrCalo[iChip])[cond0Ind]);
736 cond0Condition = &((corrEnergySum[iChip])[cond0Ind]);
745 switch (cond1Categ) {
747 cond1Condition = &((corrMuon[iChip])[cond1Ind]);
751 cond1Condition = &((corrCalo[iChip])[cond1Ind]);
755 cond1Condition = &((corrEnergySum[iChip])[cond1Ind]);
764 switch (cond2Categ) {
766 cond2Condition = &((corrMuon[iChip])[cond2Ind]);
770 cond2Condition = &((corrCalo[iChip])[cond2Ind]);
774 cond2Condition = &((corrEnergySum[iChip])[cond2Ind]);
787 correlationCondWOR->
setScales(>Scales);
790 cMapResults[itCond->first] = correlationCondWOR;
793 std::ostringstream myCout;
794 correlationCondWOR->
print(myCout);
796 LogTrace(
"L1TGlobal") << myCout.str() << std::endl;
824 std::vector<GlobalObjectMap> objMapVec;
825 if (produceL1GtObjectMapRecord && (iBxInEvent == 0)) objMapVec.reserve(numberPhysTriggers);
827 for (
CItAlgo itAlgo = algorithmMap.begin(); itAlgo != algorithmMap.end(); itAlgo++) {
831 int algBitNumber = (itAlgo->second).algoBitNumber();
834 LogDebug(
"L1TGlobal") <<
" ===> for iBxInEvent = " << iBxInEvent <<
":\t algBitName = " << itAlgo->first <<
",\t algBitNumber = " << algBitNumber <<
",\t algResult = " << algResult << std::endl;
843 std::ostringstream myCout;
844 ( itAlgo->second ).
print(myCout);
847 LogTrace(
"L1TGlobal") << myCout.str() << std::endl;
852 if (produceL1GtObjectMapRecord && (iBxInEvent == 0)) {
854 std::vector<L1TObjectTypeInCond> otypes;
860 for (
auto imap = conditionMap.begin(); imap != conditionMap.end(); imap++) {
862 auto match = imap->find(iop->tokenName);
864 if (
match != imap->end()){
868 otype =
match->second->objectType();
870 for (
auto itype = otype.begin(); itype != otype.end() ; itype++){
876 edm::LogWarning(
"L1TGlobal") <<
"\n Failed to find match for operand token " << iop->tokenName <<
"\n";
878 otypes.push_back(otype);
894 std::ostringstream myCout1;
895 objMap.
print(myCout1);
897 LogTrace(
"L1TGlobal") << myCout1.str() << std::endl;
900 objMapVec.push_back(objMap);
908 if (produceL1GtObjectMapRecord && (iBxInEvent == 0)) {
909 gtObjectMapRecord->swapGtObjectMap(objMapVec);
915 for (std::vector<AlgorithmEvaluation::ConditionEvaluationMap>::iterator
920 itCond = itCondOnChip->begin();
921 itCond != itCondOnChip->end(); itCond++) {
923 delete itCond->second;
924 itCond->second =
nullptr;
933 const int iBxInEvent,
934 const int totalBxInEvent,
935 const unsigned int numberPhysTriggers,
936 const std::vector<int>& prescaleFactorsAlgoTrig,
937 const std::vector<unsigned int>& triggerMaskAlgoTrig,
938 const std::vector<int>& triggerMaskVetoAlgoTrig,
939 const bool algorithmTriggersUnprescaled,
940 const bool algorithmTriggersUnmasked ){
945 <<
"\n**** GlobalBoard apply Final Decision Logic " 956 for(
int iBxInEvent = 0; iBxInEvent <= totalBxInEvent; ++iBxInEvent ){
966 for(
int iBxInEvent = 0; iBxInEvent <= totalBxInEvent; ++iBxInEvent ){
981 if( !algorithmTriggersUnprescaled ){
984 int inBxInEvent = totalBxInEvent/2 + iBxInEvent;
986 bool temp_algPrescaledOr =
false;
987 for(
unsigned int iBit = 0; iBit < numberPhysTriggers; ++iBit ){
992 if( iBit < prescaleFactorsAlgoTrig.size() ){
993 if( prescaleFactorsAlgoTrig.at(iBit) != 1 ){
1000 temp_algPrescaledOr =
true;
1011 temp_algPrescaledOr =
true;
1016 <<
"\nWarning: algoBit >= prescaleFactorsAlgoTrig.size() " 1036 if( !algorithmTriggersUnmasked ){
1038 bool temp_algFinalOr =
false;
1039 for(
unsigned int iBit = 0; iBit < numberPhysTriggers; ++iBit ){
1045 bool isMasked =
false;
1046 if( iBit < triggerMaskAlgoTrig.size() ) isMasked = ( triggerMaskAlgoTrig.at(iBit) == 0 );
1049 <<
"\nWarning: algoBit >= triggerMaskAlgoTrig.size() " 1053 bool passMask = ( bitValue && !isMasked );
1055 if( passMask ) temp_algFinalOr =
true;
1082 std::unique_ptr<GlobalAlgBlkBxCollection>& uGtAlgRecord,
1091 <<
"\n**** GlobalBoard fill DAQ Records for bx= " << iBxInEvent
1163 <<
"\nl1t::L1GlobalTrigger: uGMT data received for BxInEvent = " 1164 << iBxInEvent << std::endl;
1168 <<
"Number of GMT muons = " << nrL1Mu <<
"\n" 1171 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.
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