22 #include <ext/hash_map>
128 delete m_candL1EtSum;
147 void l1t::GtBoard::init(
const int numberPhysTriggers,
const int nrL1Mu,
const int nrL1EG,
const int nrL1Tau,
const int nrL1Jet,
153 m_candL1Mu->setBXRange( m_bxFirst_, m_bxLast_ );
154 m_candL1EG->setBXRange( m_bxFirst_, m_bxLast_ );
155 m_candL1Tau->setBXRange( m_bxFirst_, m_bxLast_ );
156 m_candL1Jet->setBXRange( m_bxFirst_, m_bxLast_ );
157 m_candL1EtSum->setBXRange( m_bxFirst_, m_bxLast_ );
162 LogDebug(
"l1t|Global") <<
"\t Initializing Board with bxFirst = " << m_bxFirst_ <<
", bxLast = " << m_bxLast_ << std::endl;
182 const bool receiveEG,
const int nrL1EG,
183 const bool receiveTau,
const int nrL1Tau,
184 const bool receiveJet,
const int nrL1Jet,
185 const bool receiveEtSums) {
189 <<
"\n**** Board receiving Calo Data "
190 <<
"\n from input tag " << caloInputTag <<
"\n"
205 <<
"\nWarning: BXVector<l1t::EGamma> with input tag "
207 <<
"\nrequested in configuration, but not found in the event.\n"
212 for(
int i = egData->getFirstBX();
i <= egData->getLastBX(); ++
i) {
215 for(std::vector<l1t::EGamma>::const_iterator eg = egData->begin(
i); eg != egData->end(
i); ++eg) {
217 (*m_candL1EG).push_back(
i,&(*eg));
218 LogDebug(
"l1t|Global") <<
"EG Pt " << eg->hwPt() <<
" Eta " << eg->hwEta() <<
" Phi " << eg->hwPhi() <<
" Qual " << eg->hwQual() <<
" Iso " << eg->hwIso() << std::endl;
234 <<
"\nWarning: BXVector<l1t::Tau> with input tag "
236 <<
"\nrequested in configuration, but not found in the event.\n"
241 for(
int i = tauData->getFirstBX();
i <= tauData->getLastBX(); ++
i) {
244 for(std::vector<l1t::Tau>::const_iterator
tau = tauData->begin(
i);
tau != tauData->end(
i); ++
tau) {
246 (*m_candL1Tau).push_back(
i,&(*
tau));
247 LogDebug(
"l1t|Global") <<
"tau Pt " <<
tau->hwPt() <<
" Eta " <<
tau->hwEta() <<
" Phi " <<
tau->hwPhi() <<
" Qual " <<
tau->hwQual() <<
" Iso " <<
tau->hwIso() << std::endl;
263 <<
"\nWarning: BXVector<l1t::Jet> with input tag "
265 <<
"\nrequested in configuration, but not found in the event.\n"
270 for(
int i = jetData->getFirstBX();
i <= jetData->getLastBX(); ++
i) {
273 for(std::vector<l1t::Jet>::const_iterator
jet = jetData->begin(
i);
jet != jetData->end(
i); ++
jet) {
275 (*m_candL1Jet).push_back(
i,&(*
jet));
276 LogDebug(
"l1t|Global") <<
"Jet Pt " <<
jet->hwPt() <<
" Eta " <<
jet->hwEta() <<
" Phi " <<
jet->hwPhi() <<
" Qual " <<
jet->hwQual() <<
" Iso " <<
jet->hwIso() << std::endl;
292 <<
"\nWarning: BXVector<l1t::EtSum> with input tag "
294 <<
"\nrequested in configuration, but not found in the event.\n"
299 for(
int i = etSumData->getFirstBX();
i <= etSumData->getLastBX(); ++
i) {
302 for(std::vector<l1t::EtSum>::const_iterator etsum = etSumData->begin(
i); etsum != etSumData->end(
i); ++etsum) {
304 (*m_candL1EtSum).push_back(
i,&(*etsum));
345 <<
"\n**** GtBoard receiving muon data = "
346 <<
"\n from input tag " << muInputTag <<
"\n"
360 <<
"\nWarning: BXVector<l1t::Muon> with input tag "
362 <<
"\nrequested in configuration, but not found in the event.\n"
367 for(
int i = muonData->getFirstBX();
i <= muonData->getLastBX(); ++
i) {
370 for(std::vector<l1t::Muon>::const_iterator
mu = muonData->begin(
i);
mu != muonData->end(
i); ++
mu) {
372 (*m_candL1Mu).push_back(
i,&(*
mu));
373 LogDebug(
"l1t|Global") <<
"Muon Pt " <<
mu->hwPt() <<
" Eta " <<
mu->hwEta() <<
" Phi " <<
mu->hwPhi() <<
" Qual " <<
mu->hwQual() <<
" Iso " <<
mu->hwIso() << std::endl;
381 if (m_verbosity && m_isDebugEnabled) {
391 const bool produceL1GtObjectMapRecord,
392 const int iBxInEvent,
393 std::auto_ptr<L1GlobalTriggerObjectMapRecord>& gtObjectMapRecord,
394 const unsigned int numberPhysTriggers,
399 const int nrL1JetCounts) {
406 if (m_l1GtMenuCacheID != l1GtMenuCacheID) {
410 m_l1GtMenu = l1GtMenu.
product();
411 (
const_cast<TriggerMenu*
>(m_l1GtMenu))->buildGtConditionMap();
413 m_l1GtMenuCacheID = l1GtMenuCacheID;
416 const std::vector<ConditionMap>& conditionMap = m_l1GtMenu->gtConditionMap();
417 const AlgorithmMap& algorithmMap = m_l1GtMenu->gtAlgorithmMap();
422 m_algInitialOr=
false;
423 m_algPrescaledOr=
false;
445 bool convertScale =
false;
449 unsigned long long l1CaloGeometryCacheID =
453 if (m_l1CaloGeometryCacheID != l1CaloGeometryCacheID) {
457 m_l1CaloGeometry = l1CaloGeometry.
product();
459 m_l1CaloGeometryCacheID = l1CaloGeometryCacheID;
466 unsigned long long l1MuTriggerScalesCacheID =
469 if (m_l1MuTriggerScalesCacheID != l1MuTriggerScalesCacheID) {
473 m_l1MuTriggerScales = l1MuTriggerScales.
product();
475 m_l1MuTriggerScalesCacheID = l1MuTriggerScalesCacheID;
499 convertScale =
false;
508 if (m_conditionResultMaps.size() != conditionMap.size()) {
509 m_conditionResultMaps.clear();
510 m_conditionResultMaps.resize(conditionMap.size());
515 for (std::vector<ConditionMap>::const_iterator
516 itCondOnChip = conditionMap.begin(); itCondOnChip != conditionMap.end(); itCondOnChip++) {
525 m_conditionResultMaps[iChip];
529 for (
CItCond itCond = itCondOnChip->begin(); itCond != itCondOnChip->end(); itCond++) {
532 switch ((itCond->second)->condCategory()) {
536 const int ifMuEtaNumberBits = 0;
539 nrL1Mu, ifMuEtaNumberBits);
550 cMapResults[itCond->first] = muCondition;
552 if (m_verbosity && m_isDebugEnabled) {
553 std::ostringstream myCout;
554 muCondition->
print(myCout);
556 LogTrace(
"l1t|Global") << myCout.str() << std::endl;
565 const int ifCaloEtaNumberBits = 0;
568 itCond->second,
this,
572 ifCaloEtaNumberBits);
584 cMapResults[itCond->first] = caloCondition;
586 if (m_verbosity && m_isDebugEnabled) {
587 std::ostringstream myCout;
588 caloCondition->
print(myCout);
590 LogTrace(
"l1t|Global") << myCout.str() << std::endl;
819 std::vector<L1GlobalTriggerObjectMap> objMapVec;
820 if (produceL1GtObjectMapRecord && (iBxInEvent == 0)) objMapVec.reserve(numberPhysTriggers);
822 for (
CItAlgo itAlgo = algorithmMap.begin(); itAlgo != algorithmMap.end(); itAlgo++) {
824 gtAlg.
evaluateAlgorithm((itAlgo->second).algoChipNumber(), m_conditionResultMaps);
826 int algBitNumber = (itAlgo->second).algoBitNumber();
829 LogDebug(
"l1t|Global") <<
" ===> for iBxInEvent = " << iBxInEvent <<
":\t algBitName = " << itAlgo->first <<
",\t algBitNumber = " << algBitNumber <<
",\t algResult = " << algResult << std::endl;
833 m_uGtAlgBlk.setAlgoDecisionInitial(algBitNumber,algResult);
834 m_algInitialOr =
true;
837 if (m_verbosity && m_isDebugEnabled) {
838 std::ostringstream myCout;
839 ( itAlgo->second ).
print(myCout);
842 LogTrace(
"l1t|Global") << myCout.str() << std::endl;
847 if (produceL1GtObjectMapRecord && (iBxInEvent == 0)) {
859 if (m_verbosity && m_isDebugEnabled) {
860 std::ostringstream myCout1;
861 objMap.
print(myCout1);
863 LogTrace(
"l1t|Global") << myCout1.str() << std::endl;
866 objMapVec.push_back(objMap);
874 if (produceL1GtObjectMapRecord && (iBxInEvent == 0)) {
875 gtObjectMapRecord->swapGtObjectMap(objMapVec);
881 for (std::vector<AlgorithmEvaluation::ConditionEvaluationMap>::iterator
882 itCondOnChip = m_conditionResultMaps.begin();
883 itCondOnChip != m_conditionResultMaps.end(); itCondOnChip++) {
886 itCond = itCondOnChip->begin();
887 itCond != itCondOnChip->end(); itCond++) {
889 delete itCond->second;
899 const int iBxInEvent,
900 const bool algorithmTriggersUnprescaled,
901 const bool algorithmTriggersUnmasked ){
906 <<
"\n**** GtBoard apply Final Decision Logic "
928 m_uGtAlgBlk.copyInitialToPrescaled();
934 if (!algorithmTriggersUnprescaled){
959 m_algPrescaledOr = m_algInitialOr;
964 m_algPrescaledOr = m_algInitialOr;
972 m_uGtAlgBlk.copyPrescaledToFinal();
974 if(!algorithmTriggersUnmasked) {
980 m_algFinalOr = m_algPrescaledOr;
984 m_algFinalOr = m_algPrescaledOr;
994 std::auto_ptr<GlobalAlgBlkBxCollection>& uGtAlgRecord,
1002 <<
"\n**** GtBoard fill DAQ Records for bx= " << iBxInEvent
1008 m_uGtAlgBlk.setOrbitNr((
unsigned int)(orbNr & 0xFFFFFFFF));
1009 m_uGtAlgBlk.setbxNr((bxNr & 0xFFFF));
1010 m_uGtAlgBlk.setbxInEventNr((iBxInEvent & 0xF));
1014 if(m_algFinalOr) finalOR = (finalOR | 0x2);
1015 if(m_uGtFinalBoard) {
1016 finalOR = (finalOR | 0x8);
1017 if( (finalOR >>1) & 0x1 ) finalOR = (finalOR | 0x1);
1019 m_uGtAlgBlk.setFinalOR(finalOR);
1022 uGtAlgRecord->push_back(iBxInEvent, m_uGtAlgBlk);
1028 std::auto_ptr<GlobalExtBlkBxCollection>& uGtExtRecord,
1036 <<
"\n**** Board fill DAQ Records for bx= " << iBxInEvent
1041 m_uGtExtBlk.setOrbitNr((
unsigned int)(orbNr & 0xFFFFFFFF));
1042 m_uGtExtBlk.setbxNr((bxNr & 0xFFFF));
1043 m_uGtExtBlk.setbxInEventNr((iBxInEvent & 0xF));
1045 uGtExtRecord->push_back(iBxInEvent, m_uGtExtBlk);
1056 m_uGtAlgBlk.reset();
1057 m_uGtExtBlk.reset();
1059 m_gtlDecisionWord.reset();
1060 m_gtlAlgorithmOR.reset();
1069 m_candL1Mu->clear();
1070 m_candL1Mu->setBXRange( m_bxFirst_, m_bxLast_ );
1077 m_candL1EG->clear();
1078 m_candL1Tau->clear();
1079 m_candL1Jet->clear();
1080 m_candL1EtSum->clear();
1082 m_candL1EG->setBXRange( m_bxFirst_, m_bxLast_ );
1083 m_candL1Tau->setBXRange( m_bxFirst_, m_bxLast_ );
1084 m_candL1Jet->setBXRange( m_bxFirst_, m_bxLast_ );
1085 m_candL1EtSum->setBXRange( m_bxFirst_, m_bxLast_ );
1093 <<
"\nL1GlobalTrigger: GMT data received for BxInEvent = "
1094 << iBxInEvent << std::endl;
1096 int nrL1Mu = m_candL1Mu->size(iBxInEvent);
1098 <<
"Number of GMT muons = " << nrL1Mu <<
"\n"
1108 LogTrace(
"l1t|Global") << std::endl;
bool gtAlgoResult() const
get / set the result of the algorithm
std::bitset< L1GlobalTriggerReadoutSetup::NumberPhysTriggers > m_gtlAlgorithmOR
void printGmtData(const int iBxInEvent) const
print received Muon dataWord
void evaluateConditionStoreResult(const int bxEval)
call evaluateCondition and save last result
void reset()
reset the content of a GlobalExtBlk
void swapCombinationVector(std::vector< CombinationsInCond > &combinationVectorValue)
void print(std::ostream &myCout) const
std::vector< L1GtLogicParser::OperandToken > & operandTokenVector()
void setAlgoName(const std::string &algoNameValue)
void runFDL(edm::Event &iEvent, const int iBxInEvent, const bool algorithmTriggersUnprescaled, const bool algorithmTriggersUnmasked)
run the uGT FDL (Apply Prescales and Veto)
std::string print(const Track &, edm::Verbosity=edm::Concise)
Track print utility.
void setVerbosity(const int verbosity)
void print(std::ostream &myCout) const
print condition
__gnu_cxx::hash_map< std::string, ConditionEvaluation * > ConditionEvaluationMap
copy constructor
void print(std::ostream &myCout) const
print condition
void swapOperandTokenVector(std::vector< L1GtLogicParser::OperandToken > &operandTokenVectorValue)
ConditionEvaluationMap::iterator ItEvalMap
unsigned int m_boardEventCount
ConditionMap::const_iterator CItCond
iterators through map containing the conditions
std::bitset< L1GlobalTriggerReadoutSetup::NumberPhysTriggers > m_gtlDecisionWord
unsigned long long m_l1MuTriggerScalesCacheID
AlgorithmMap::const_iterator CItAlgo
iterators through map containing the algorithms
void receiveCaloObjectData(edm::Event &, const edm::InputTag &, 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
void receiveMuonObjectData(edm::Event &, const edm::InputTag &, const bool receiveMu, const int nrL1Mu)
void reset()
reset the content of a GlobalAlgBlk
void runGTL(edm::Event &iEvent, const edm::EventSetup &evSetup, const bool produceL1GtObjectMapRecord, const int iBxInEvent, std::auto_ptr< L1GlobalTriggerObjectMapRecord > >ObjectMapRecord, const unsigned int numberPhysTriggers, const int nrL1Mu, const int nrL1EG, const int nrL1Tau, const int nrL1Jet, const int nrL1JetCounts)
run the uGT GTL (Conditions and Algorithms)
void print(std::ostream &myCout) const
print the full object map
std::vector< CombinationsInCond > & gtAlgoCombinationVector()
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
std::map< std::string, L1GtAlgorithm > AlgorithmMap
map containing the algorithms
void evaluateAlgorithm(const int chipNumber, const std::vector< ConditionEvaluationMap > &)
evaluate an algorithm
void setAlgoGtlResult(bool algoGtlResultValue)
unsigned long long m_l1GtMenuCacheID
T const * product() const
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)
void setAlgoBitNumber(int algoBitNumberValue)
void fillExtRecord(int iBxInEvent, std::auto_ptr< GlobalExtBlkBxCollection > &uGtExtRecord, cms_uint64_t orbNr, int bxNr)
void fillAlgRecord(int iBxInEvent, std::auto_ptr< GlobalAlgBlkBxCollection > &uGtAlgRecord, cms_uint64_t orbNr, int bxNr)
Fill the Daq Records.
unsigned long long cms_uint64_t
void reset(double vett[256])
unsigned long long m_l1CaloGeometryCacheID