Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-06-28 02:36:29

0001 /**
0002  * \class TriggerMenu
0003  *
0004  *
0005  * Description: L1 trigger menu.
0006  *
0007  * Implementation:
0008  *    <TODO: enter implementation details>
0009  *
0010  * \author: Vasile Mihai Ghete - HEPHY Vienna
0011  *          Vladimir Rekovic - extend for overlap removal
0012  *          Elisa Fontanesi - extended for three-body correlation conditions
0013  *
0014  * $Date$
0015  * $Revision$
0016  *
0017  */
0018 
0019 // this class header
0020 #include "L1Trigger/L1TGlobal/interface/TriggerMenu.h"
0021 
0022 // system include files
0023 #include <iostream>
0024 #include <iomanip>
0025 
0026 // user include files
0027 #include "L1Trigger/L1TGlobal/interface/GlobalCondition.h"
0028 
0029 // forward declarations
0030 
0031 // constructor
0032 TriggerMenu::TriggerMenu()
0033     : m_triggerMenuInterface("NULL"),
0034       m_triggerMenuName("NULL"),
0035       m_triggerMenuImplementation(0x0),
0036       m_scaleDbKey("NULL") {
0037   // empty
0038 }
0039 
0040 TriggerMenu::TriggerMenu(
0041     const std::string& triggerMenuNameVal,
0042     const unsigned int numberConditionChips,
0043     const std::vector<std::vector<MuonTemplate> >& vecMuonTemplateVal,
0044     const std::vector<std::vector<MuonShowerTemplate> >& vecMuonShowerTemplateVal,
0045     const std::vector<std::vector<CaloTemplate> >& vecCaloTemplateVal,
0046     const std::vector<std::vector<EnergySumTemplate> >& vecEnergySumTemplateVal,
0047     const std::vector<std::vector<EnergySumZdcTemplate> >& vecEnergySumZdcTemplateVal,
0048     const std::vector<std::vector<AXOL1TLTemplate> >& vecAXOL1TLTemplateVal,
0049     const std::vector<std::vector<CICADATemplate> >& vecCICADATemplateVal,
0050     const std::vector<std::vector<ExternalTemplate> >& vecExternalTemplateVal,
0051     const std::vector<std::vector<CorrelationTemplate> >& vecCorrelationTemplateVal,
0052     const std::vector<std::vector<CorrelationThreeBodyTemplate> >& vecCorrelationThreeBodyTemplateVal,
0053     const std::vector<std::vector<CorrelationWithOverlapRemovalTemplate> >& vecCorrelationWithOverlapRemovalTemplateVal,
0054     const std::vector<std::vector<MuonTemplate> >& corMuonTemplateVal,
0055     const std::vector<std::vector<CaloTemplate> >& corCaloTemplateVal,
0056     const std::vector<std::vector<EnergySumTemplate> >& corEnergySumTemplateVal
0057 
0058     )
0059     : m_triggerMenuInterface("NULL"),
0060       m_triggerMenuName(triggerMenuNameVal),
0061       m_triggerMenuImplementation(0x0),
0062       m_scaleDbKey("NULL"),
0063       m_vecMuonTemplate(vecMuonTemplateVal),
0064       m_vecMuonShowerTemplate(vecMuonShowerTemplateVal),
0065       m_vecCaloTemplate(vecCaloTemplateVal),
0066       m_vecEnergySumTemplate(vecEnergySumTemplateVal),
0067       m_vecEnergySumZdcTemplate(vecEnergySumZdcTemplateVal),
0068       m_vecAXOL1TLTemplate(vecAXOL1TLTemplateVal),
0069       m_vecCICADATemplate(vecCICADATemplateVal),
0070       m_vecExternalTemplate(vecExternalTemplateVal),
0071       m_vecCorrelationTemplate(vecCorrelationTemplateVal),
0072       m_vecCorrelationThreeBodyTemplate(vecCorrelationThreeBodyTemplateVal),
0073       m_vecCorrelationWithOverlapRemovalTemplate(vecCorrelationWithOverlapRemovalTemplateVal),
0074       m_corMuonTemplate(corMuonTemplateVal),
0075       m_corCaloTemplate(corCaloTemplateVal),
0076       m_corEnergySumTemplate(corEnergySumTemplateVal) {
0077   m_conditionMap.resize(numberConditionChips);
0078   m_triggerMenuUUID = 0;
0079   buildGtConditionMap();
0080 }
0081 
0082 // copy constructor
0083 TriggerMenu::TriggerMenu(const TriggerMenu& rhs) {
0084   m_triggerMenuInterface = rhs.m_triggerMenuInterface;
0085   m_triggerMenuName = rhs.m_triggerMenuName;
0086   m_triggerMenuImplementation = rhs.m_triggerMenuImplementation;
0087   m_scaleDbKey = rhs.m_scaleDbKey;
0088   m_triggerMenuUUID = rhs.m_triggerMenuUUID;
0089 
0090   // copy physics conditions
0091   m_vecMuonTemplate = rhs.m_vecMuonTemplate;
0092   m_vecMuonShowerTemplate = rhs.m_vecMuonShowerTemplate;
0093   m_vecCaloTemplate = rhs.m_vecCaloTemplate;
0094   m_vecEnergySumTemplate = rhs.m_vecEnergySumTemplate;
0095   m_vecEnergySumZdcTemplate = rhs.m_vecEnergySumZdcTemplate;
0096   m_vecAXOL1TLTemplate = rhs.m_vecAXOL1TLTemplate;
0097   m_vecCICADATemplate = rhs.m_vecCICADATemplate;
0098   m_vecExternalTemplate = rhs.m_vecExternalTemplate;
0099 
0100   m_vecCorrelationTemplate = rhs.m_vecCorrelationTemplate;
0101   m_vecCorrelationThreeBodyTemplate = rhs.m_vecCorrelationThreeBodyTemplate;
0102   m_vecCorrelationWithOverlapRemovalTemplate = rhs.m_vecCorrelationWithOverlapRemovalTemplate;
0103   m_corMuonTemplate = rhs.m_corMuonTemplate;
0104   m_corCaloTemplate = rhs.m_corCaloTemplate;
0105   m_corEnergySumTemplate = rhs.m_corEnergySumTemplate;
0106 
0107   // rebuild condition map to update the pointers
0108   // (only physics conditions are included in it)
0109   m_conditionMap.resize(rhs.m_conditionMap.size());
0110   (*this).buildGtConditionMap();
0111 
0112   // copy algorithm map
0113   m_algorithmMap = rhs.m_algorithmMap;
0114   m_algorithmAliasMap = rhs.m_algorithmAliasMap;
0115 
0116   // copy technical triggers
0117   // (separate map for technical triggers and physics triggers)
0118   //m_technicalTriggerMap = rhs.m_technicalTriggerMap;
0119 }
0120 
0121 // destructor
0122 TriggerMenu::~TriggerMenu() {
0123   // loop over condition maps (one map per condition chip)
0124   for (std::vector<l1t::ConditionMap>::iterator itCondOnChip = m_conditionMap.begin();
0125        itCondOnChip != m_conditionMap.end();
0126        itCondOnChip++) {
0127     itCondOnChip->clear();
0128   }
0129 
0130   m_algorithmMap.clear();
0131   m_algorithmAliasMap.clear();
0132 }
0133 
0134 // assignment operator
0135 TriggerMenu& TriggerMenu::operator=(const TriggerMenu& rhs) {
0136   if (this != &rhs) {
0137     m_triggerMenuInterface = rhs.m_triggerMenuInterface;
0138     m_triggerMenuName = rhs.m_triggerMenuName;
0139     m_triggerMenuImplementation = rhs.m_triggerMenuImplementation;
0140     m_triggerMenuUUID = rhs.m_triggerMenuUUID;
0141 
0142     m_vecMuonTemplate = rhs.m_vecMuonTemplate;
0143     m_vecMuonShowerTemplate = rhs.m_vecMuonShowerTemplate;
0144     m_vecCaloTemplate = rhs.m_vecCaloTemplate;
0145     m_vecEnergySumTemplate = rhs.m_vecEnergySumTemplate;
0146     m_vecEnergySumZdcTemplate = rhs.m_vecEnergySumZdcTemplate;
0147     m_vecAXOL1TLTemplate = rhs.m_vecAXOL1TLTemplate;
0148     m_vecCICADATemplate = rhs.m_vecCICADATemplate;
0149     m_vecExternalTemplate = rhs.m_vecExternalTemplate;
0150 
0151     m_vecCorrelationTemplate = rhs.m_vecCorrelationTemplate;
0152     m_vecCorrelationThreeBodyTemplate = rhs.m_vecCorrelationThreeBodyTemplate;
0153     m_vecCorrelationWithOverlapRemovalTemplate = rhs.m_vecCorrelationWithOverlapRemovalTemplate;
0154     m_corMuonTemplate = rhs.m_corMuonTemplate;
0155     m_corCaloTemplate = rhs.m_corCaloTemplate;
0156     m_corEnergySumTemplate = rhs.m_corEnergySumTemplate;
0157 
0158     m_algorithmMap = rhs.m_algorithmMap;
0159     m_algorithmAliasMap = rhs.m_algorithmAliasMap;
0160 
0161     //        m_technicalTriggerMap = rhs.m_technicalTriggerMap;
0162   }
0163 
0164   // rebuild condition map to update the pointers
0165   // (only physics conditions are included in it)
0166   m_conditionMap.resize(rhs.m_conditionMap.size());
0167   (*this).buildGtConditionMap();
0168 
0169   // return the object
0170   return *this;
0171 }
0172 
0173 // set the condition maps
0174 void TriggerMenu::setGtConditionMap(const std::vector<l1t::ConditionMap>& condMap) { m_conditionMap = condMap; }
0175 
0176 // build the condition maps
0177 void TriggerMenu::buildGtConditionMap() {
0178   // clear the conditions from the maps, if any
0179   for (std::vector<l1t::ConditionMap>::iterator itCondOnChip = m_conditionMap.begin();
0180        itCondOnChip != m_conditionMap.end();
0181        itCondOnChip++) {
0182     itCondOnChip->clear();
0183   }
0184 
0185   // always check that the size of the condition map is greater than the size
0186   // of the specific condition vector
0187   size_t condMapSize = m_conditionMap.size();
0188 
0189   //
0190   size_t vecMuonSize = m_vecMuonTemplate.size();
0191   if (condMapSize < vecMuonSize) {
0192     m_conditionMap.resize(vecMuonSize);
0193     condMapSize = m_conditionMap.size();
0194   }
0195 
0196   int chipNr = -1;
0197 
0198   for (std::vector<std::vector<MuonTemplate> >::iterator itCondOnChip = m_vecMuonTemplate.begin();
0199        itCondOnChip != m_vecMuonTemplate.end();
0200        itCondOnChip++) {
0201     chipNr++;
0202 
0203     for (std::vector<MuonTemplate>::iterator itCond = itCondOnChip->begin(); itCond != itCondOnChip->end(); itCond++) {
0204       (m_conditionMap.at(chipNr))[itCond->condName()] = &(*itCond);
0205     }
0206   }
0207 
0208   //
0209   size_t vecMuonShowerSize = m_vecMuonShowerTemplate.size();
0210   if (condMapSize < vecMuonShowerSize) {
0211     m_conditionMap.resize(vecMuonShowerSize);
0212     condMapSize = m_conditionMap.size();
0213   }
0214 
0215   chipNr = -1;
0216 
0217   for (std::vector<std::vector<MuonShowerTemplate> >::iterator itCondOnChip = m_vecMuonShowerTemplate.begin();
0218        itCondOnChip != m_vecMuonShowerTemplate.end();
0219        itCondOnChip++) {
0220     chipNr++;
0221 
0222     for (std::vector<MuonShowerTemplate>::iterator itCond = itCondOnChip->begin(); itCond != itCondOnChip->end();
0223          itCond++) {
0224       (m_conditionMap.at(chipNr))[itCond->condName()] = &(*itCond);
0225     }
0226   }
0227 
0228   //
0229   size_t vecCaloSize = m_vecCaloTemplate.size();
0230   if (condMapSize < vecCaloSize) {
0231     m_conditionMap.resize(vecCaloSize);
0232     condMapSize = m_conditionMap.size();
0233   }
0234 
0235   chipNr = -1;
0236   for (std::vector<std::vector<CaloTemplate> >::iterator itCondOnChip = m_vecCaloTemplate.begin();
0237        itCondOnChip != m_vecCaloTemplate.end();
0238        itCondOnChip++) {
0239     chipNr++;
0240 
0241     for (std::vector<CaloTemplate>::iterator itCond = itCondOnChip->begin(); itCond != itCondOnChip->end(); itCond++) {
0242       (m_conditionMap.at(chipNr))[itCond->condName()] = &(*itCond);
0243     }
0244   }
0245 
0246   //
0247   size_t vecEnergySumSize = m_vecEnergySumTemplate.size();
0248   if (condMapSize < vecEnergySumSize) {
0249     m_conditionMap.resize(vecEnergySumSize);
0250     condMapSize = m_conditionMap.size();
0251   }
0252 
0253   chipNr = -1;
0254   for (std::vector<std::vector<EnergySumTemplate> >::iterator itCondOnChip = m_vecEnergySumTemplate.begin();
0255        itCondOnChip != m_vecEnergySumTemplate.end();
0256        itCondOnChip++) {
0257     chipNr++;
0258 
0259     for (std::vector<EnergySumTemplate>::iterator itCond = itCondOnChip->begin(); itCond != itCondOnChip->end();
0260          itCond++) {
0261       (m_conditionMap.at(chipNr))[itCond->condName()] = &(*itCond);
0262     }
0263   }
0264 
0265   //
0266   size_t vecEnergySumZdcSize = m_vecEnergySumZdcTemplate.size();
0267   if (condMapSize < vecEnergySumZdcSize) {
0268     m_conditionMap.resize(vecEnergySumZdcSize);
0269     condMapSize = m_conditionMap.size();
0270   }
0271 
0272   chipNr = -1;
0273   for (std::vector<std::vector<EnergySumZdcTemplate> >::iterator itCondOnChip = m_vecEnergySumZdcTemplate.begin();
0274        itCondOnChip != m_vecEnergySumZdcTemplate.end();
0275        itCondOnChip++) {
0276     chipNr++;
0277 
0278     for (std::vector<EnergySumZdcTemplate>::iterator itCond = itCondOnChip->begin(); itCond != itCondOnChip->end();
0279          itCond++) {
0280       (m_conditionMap.at(chipNr))[itCond->condName()] = &(*itCond);
0281     }
0282   }
0283 
0284   //
0285   size_t vecAXOL1TLSize = m_vecAXOL1TLTemplate.size();
0286   if (condMapSize < vecAXOL1TLSize) {
0287     m_conditionMap.resize(vecAXOL1TLSize);
0288     condMapSize = m_conditionMap.size();
0289   }
0290 
0291   chipNr = -1;
0292 
0293   for (std::vector<std::vector<AXOL1TLTemplate> >::iterator itCondOnChip = m_vecAXOL1TLTemplate.begin();
0294        itCondOnChip != m_vecAXOL1TLTemplate.end();
0295        itCondOnChip++) {
0296     chipNr++;
0297 
0298     for (std::vector<AXOL1TLTemplate>::iterator itCond = itCondOnChip->begin(); itCond != itCondOnChip->end();
0299          itCond++) {
0300       (m_conditionMap.at(chipNr))[itCond->condName()] = &(*itCond);
0301     }
0302   }
0303 
0304   //
0305   size_t vecCICADASize = m_vecCICADATemplate.size();
0306   if (condMapSize < vecCICADASize) {
0307     m_conditionMap.resize(vecCICADASize);
0308     condMapSize = m_conditionMap.size();
0309   }
0310 
0311   chipNr = -1;
0312 
0313   for (std::vector<std::vector<CICADATemplate> >::iterator itCondOnChip = m_vecCICADATemplate.begin();
0314        itCondOnChip != m_vecCICADATemplate.end();
0315        itCondOnChip++) {
0316     chipNr++;
0317 
0318     for (std::vector<CICADATemplate>::iterator itCond = itCondOnChip->begin(); itCond != itCondOnChip->end();
0319          itCond++) {
0320       (m_conditionMap.at(chipNr))[itCond->condName()] = &(*itCond);
0321     }
0322   }
0323 
0324   /// DMP: Comment out unused templates for now
0325   //
0326   //
0327   size_t vecExternalSize = m_vecExternalTemplate.size();
0328   if (condMapSize < vecExternalSize) {
0329     m_conditionMap.resize(vecExternalSize);
0330     condMapSize = m_conditionMap.size();
0331   }
0332 
0333   chipNr = -1;
0334   for (std::vector<std::vector<ExternalTemplate> >::iterator itCondOnChip = m_vecExternalTemplate.begin();
0335        itCondOnChip != m_vecExternalTemplate.end();
0336        itCondOnChip++) {
0337     chipNr++;
0338 
0339     for (std::vector<ExternalTemplate>::iterator itCond = itCondOnChip->begin(); itCond != itCondOnChip->end();
0340          itCond++) {
0341       (m_conditionMap.at(chipNr))[itCond->condName()] = &(*itCond);
0342     }
0343   }
0344 
0345   //
0346   size_t vecCorrelationSize = m_vecCorrelationTemplate.size();
0347   if (condMapSize < vecCorrelationSize) {
0348     m_conditionMap.resize(vecCorrelationSize);
0349     condMapSize = m_conditionMap.size();
0350   }
0351 
0352   chipNr = -1;
0353   for (std::vector<std::vector<CorrelationTemplate> >::iterator itCondOnChip = m_vecCorrelationTemplate.begin();
0354        itCondOnChip != m_vecCorrelationTemplate.end();
0355        itCondOnChip++) {
0356     chipNr++;
0357 
0358     for (std::vector<CorrelationTemplate>::iterator itCond = itCondOnChip->begin(); itCond != itCondOnChip->end();
0359          itCond++) {
0360       (m_conditionMap.at(chipNr))[itCond->condName()] = &(*itCond);
0361     }
0362   }
0363 
0364   //
0365   size_t vecCorrelationThreeBodySize = m_vecCorrelationThreeBodyTemplate.size();
0366   if (condMapSize < vecCorrelationThreeBodySize) {
0367     m_conditionMap.resize(vecCorrelationThreeBodySize);
0368     condMapSize = m_conditionMap.size();
0369   }
0370 
0371   chipNr = -1;
0372   for (std::vector<std::vector<CorrelationThreeBodyTemplate> >::iterator itCondOnChip =
0373            m_vecCorrelationThreeBodyTemplate.begin();
0374        itCondOnChip != m_vecCorrelationThreeBodyTemplate.end();
0375        itCondOnChip++) {
0376     chipNr++;
0377 
0378     for (std::vector<CorrelationThreeBodyTemplate>::iterator itCond = itCondOnChip->begin();
0379          itCond != itCondOnChip->end();
0380          itCond++) {
0381       (m_conditionMap.at(chipNr))[itCond->condName()] = &(*itCond);
0382     }
0383   }
0384 
0385   //
0386   size_t vecCorrelationWORSize = m_vecCorrelationWithOverlapRemovalTemplate.size();
0387   if (condMapSize < vecCorrelationWORSize) {
0388     m_conditionMap.resize(vecCorrelationWORSize);
0389     condMapSize = m_conditionMap.size();
0390   }
0391 
0392   chipNr = -1;
0393   for (std::vector<std::vector<CorrelationWithOverlapRemovalTemplate> >::iterator itCondOnChip =
0394            m_vecCorrelationWithOverlapRemovalTemplate.begin();
0395        itCondOnChip != m_vecCorrelationWithOverlapRemovalTemplate.end();
0396        itCondOnChip++) {
0397     chipNr++;
0398 
0399     for (std::vector<CorrelationWithOverlapRemovalTemplate>::iterator itCond = itCondOnChip->begin();
0400          itCond != itCondOnChip->end();
0401          itCond++) {
0402       (m_conditionMap.at(chipNr))[itCond->condName()] = &(*itCond);
0403     }
0404   }
0405 }
0406 
0407 // set the trigger menu name
0408 void TriggerMenu::setGtTriggerMenuInterface(const std::string& menuInterface) {
0409   m_triggerMenuInterface = menuInterface;
0410 }
0411 
0412 void TriggerMenu::setGtTriggerMenuName(const std::string& menuName) { m_triggerMenuName = menuName; }
0413 
0414 void TriggerMenu::setGtTriggerMenuImplementation(const unsigned long menuImplementation) {
0415   m_triggerMenuImplementation = menuImplementation;
0416 }
0417 
0418 void TriggerMenu::setGtTriggerMenuUUID(const unsigned long uuid) { m_triggerMenuUUID = uuid; }
0419 
0420 // set menu associated scale key
0421 void TriggerMenu::setGtScaleDbKey(const std::string& scaleKey) { m_scaleDbKey = scaleKey; }
0422 
0423 // set menu associated scale key
0424 void TriggerMenu::setGtScales(const l1t::GlobalScales& scales) { m_gtScales = scales; }
0425 
0426 // get / set the vectors containing the conditions
0427 void TriggerMenu::setVecMuonTemplate(const std::vector<std::vector<MuonTemplate> >& vecMuonTempl) {
0428   m_vecMuonTemplate = vecMuonTempl;
0429 }
0430 
0431 void TriggerMenu::setVecCaloTemplate(const std::vector<std::vector<CaloTemplate> >& vecCaloTempl) {
0432   m_vecCaloTemplate = vecCaloTempl;
0433 }
0434 
0435 void TriggerMenu::setVecEnergySumTemplate(const std::vector<std::vector<EnergySumTemplate> >& vecEnergySumTempl) {
0436   m_vecEnergySumTemplate = vecEnergySumTempl;
0437 }
0438 
0439 void TriggerMenu::setVecEnergySumZdcTemplate(
0440     const std::vector<std::vector<EnergySumZdcTemplate> >& vecEnergySumZdcTempl) {
0441   m_vecEnergySumZdcTemplate = vecEnergySumZdcTempl;
0442 }
0443 
0444 void TriggerMenu::setVecAXOL1TLTemplate(const std::vector<std::vector<AXOL1TLTemplate> >& vecAXOL1TLTempl) {
0445   m_vecAXOL1TLTemplate = vecAXOL1TLTempl;
0446 }
0447 
0448 void TriggerMenu::setVecCICADATemplate(const std::vector<std::vector<CICADATemplate> >& vecCICADATempl) {
0449   m_vecCICADATemplate = vecCICADATempl;
0450 }
0451 
0452 void TriggerMenu::setVecExternalTemplate(const std::vector<std::vector<ExternalTemplate> >& vecExternalTempl) {
0453   m_vecExternalTemplate = vecExternalTempl;
0454 }
0455 
0456 void TriggerMenu::setVecCorrelationTemplate(const std::vector<std::vector<CorrelationTemplate> >& vecCorrelationTempl) {
0457   m_vecCorrelationTemplate = vecCorrelationTempl;
0458 }
0459 
0460 void TriggerMenu::setVecCorrelationThreeBodyTemplate(
0461     const std::vector<std::vector<CorrelationThreeBodyTemplate> >& vecCorrelationThreeBodyTempl) {
0462   m_vecCorrelationThreeBodyTemplate = vecCorrelationThreeBodyTempl;
0463 }
0464 
0465 void TriggerMenu::setVecCorrelationWithOverlapRemovalTemplate(
0466     const std::vector<std::vector<CorrelationWithOverlapRemovalTemplate> >& vecCorrelationTempl) {
0467   m_vecCorrelationWithOverlapRemovalTemplate = vecCorrelationTempl;
0468 }
0469 
0470 // set the vectors containing the conditions for correlation templates
0471 void TriggerMenu::setCorMuonTemplate(const std::vector<std::vector<MuonTemplate> >& corMuonTempl) {
0472   m_corMuonTemplate = corMuonTempl;
0473 }
0474 
0475 void TriggerMenu::setCorCaloTemplate(const std::vector<std::vector<CaloTemplate> >& corCaloTempl) {
0476   m_corCaloTemplate = corCaloTempl;
0477 }
0478 
0479 void TriggerMenu::setCorEnergySumTemplate(const std::vector<std::vector<EnergySumTemplate> >& corEnergySumTempl) {
0480   m_corEnergySumTemplate = corEnergySumTempl;
0481 }
0482 
0483 // set the algorithm map (by algorithm names)
0484 void TriggerMenu::setGtAlgorithmMap(const l1t::AlgorithmMap& algoMap) { m_algorithmMap = algoMap; }
0485 
0486 // set the algorithm map (by algorithm aliases)
0487 void TriggerMenu::setGtAlgorithmAliasMap(const l1t::AlgorithmMap& algoMap) { m_algorithmAliasMap = algoMap; }
0488 
0489 /*
0490 // set the technical trigger map
0491 void TriggerMenu::setGtTechnicalTriggerMap(const l1t::AlgorithmMap& ttMap) {
0492     m_technicalTriggerMap = ttMap;
0493 }
0494 */
0495 
0496 // print the trigger menu (bit number, algorithm name, logical expression)
0497 void TriggerMenu::print(std::ostream& myCout, int& printVerbosity) const {
0498   // use another map <int, GlobalAlgorithm> to get the menu sorted after bit number
0499   // both algorithm and bit numbers are unique
0500   std::map<int, const GlobalAlgorithm*> algoBitToAlgo;
0501   typedef std::map<int, const GlobalAlgorithm*>::const_iterator CItBit;
0502 
0503   for (l1t::CItAlgo itAlgo = m_algorithmMap.begin(); itAlgo != m_algorithmMap.end(); itAlgo++) {
0504     int bitNumber = (itAlgo->second).algoBitNumber();
0505     algoBitToAlgo[bitNumber] = &(itAlgo->second);
0506   }
0507 
0508   size_t nrDefinedAlgo = algoBitToAlgo.size();
0509 
0510   /*
0511     // idem for technical trigger map - only name and bit number are relevant for them
0512     std::map<int, const GlobalAlgorithm*> ttBitToTt;
0513 
0514     for (l1t::CItAlgo itAlgo = m_technicalTriggerMap.begin(); itAlgo
0515             != m_technicalTriggerMap.end(); itAlgo++) {
0516 
0517         int bitNumber = (itAlgo->second).algoBitNumber();
0518         ttBitToTt[bitNumber] = &(itAlgo->second);
0519     }
0520 
0521     size_t nrDefinedTechTrig = ttBitToTt.size();
0522 */
0523   //
0524 
0525   switch (printVerbosity) {
0526     case 0: {
0527       // header for printing algorithms
0528 
0529       myCout << "\n   ********** L1 Trigger Menu - printing   ********** \n"
0530              << "\nL1 Trigger Menu Interface:         " << m_triggerMenuInterface
0531              << "\nL1 Trigger Menu Name:              " << m_triggerMenuName << "\nL1 Trigger Menu UUID (hash):     0x"
0532              << std::hex << m_triggerMenuUUID << std::dec << "\nL1 Trigger Menu Firmware (hash): 0x" << std::hex
0533              << m_triggerMenuImplementation << std::dec << "\nAssociated Scale DB Key: " << m_scaleDbKey << "\n\n"
0534              << "\nL1 Physics Algorithms: " << nrDefinedAlgo << " algorithms defined."
0535              << "\n\n"
0536              << "Bit Number " << std::right << std::setw(35) << "Algorithm Name"
0537              << "  " << std::right << std::setw(35) << "Algorithm Alias" << std::endl;
0538 
0539       for (CItBit itBit = algoBitToAlgo.begin(); itBit != algoBitToAlgo.end(); itBit++) {
0540         int bitNumber = itBit->first;
0541         std::string aName = (itBit->second)->algoName();
0542         std::string aAlias = (itBit->second)->algoAlias();
0543 
0544         myCout << std::setw(6) << bitNumber << "     " << std::right << std::setw(35) << aName << "  " << std::right
0545                << std::setw(35) << aAlias << std::endl;
0546       }
0547       /*
0548             myCout
0549             << "\nL1 Technical Triggers: " << nrDefinedTechTrig
0550             << " technical triggers defined." << "\n\n" << std::endl;
0551             if (nrDefinedTechTrig) {
0552                 myCout << "Bit Number " << " Technical trigger name " << std::endl;
0553             }
0554 
0555             for (CItBit itBit = ttBitToTt.begin(); itBit != ttBitToTt.end(); itBit++) {
0556 
0557                 int bitNumber = itBit->first;
0558                 std::string aName = (itBit->second)->algoName();
0559                 std::string aAlias = (itBit->second)->algoAlias();
0560 
0561                 myCout << std::setw(6) << bitNumber << "       "
0562                 << std::right << std::setw(35) << aName << "  "
0563                 << std::right << std::setw(35) << aAlias
0564                 << std::endl;
0565             }
0566 */
0567     } break;
0568 
0569     case 1: {
0570       // header for printing algorithms
0571 
0572       myCout << "\n   ********** L1 Trigger Menu - printing   ********** \n"
0573              << "\nL1 Trigger Menu Interface:         " << m_triggerMenuInterface
0574              << "\nL1 Trigger Menu Name:              " << m_triggerMenuName << "\nL1 Trigger Menu UUID (hash):     0x"
0575              << std::hex << m_triggerMenuUUID << std::dec << "\nL1 Trigger Menu Firmware (hash): 0x" << std::hex
0576              << m_triggerMenuImplementation << std::dec << "\nAssociated Scale DB Key: " << m_scaleDbKey << "\n\n"
0577              << "\nL1 Physics Algorithms: " << nrDefinedAlgo << " algorithms defined."
0578              << "\n\n"
0579              << "Bit Number " << std::right << std::setw(35) << "Algorithm Name"
0580              << "  " << std::right << std::setw(35) << "Algorithm Alias"
0581              << "\n  Logical Expression \n"
0582              << std::endl;
0583 
0584       for (CItBit itBit = algoBitToAlgo.begin(); itBit != algoBitToAlgo.end(); itBit++) {
0585         int bitNumber = itBit->first;
0586         std::string aName = (itBit->second)->algoName();
0587         std::string aAlias = (itBit->second)->algoAlias();
0588         std::string aLogicalExpression = (itBit->second)->algoLogicalExpression();
0589 
0590         myCout << std::setw(6) << bitNumber << "     " << std::right << std::setw(35) << aName << "  " << std::right
0591                << std::setw(35) << aAlias << "\n  Logical expression: " << aLogicalExpression << "\n"
0592                << std::endl;
0593       }
0594       /*
0595             myCout
0596             << "\nL1 Technical Triggers: " << nrDefinedTechTrig
0597             << " technical triggers defined." << "\n\n" << std::endl;
0598             if (nrDefinedTechTrig) {
0599                 myCout << "Bit Number " << " Technical trigger name " << std::endl;
0600             }
0601 
0602             for (CItBit itBit = ttBitToTt.begin(); itBit != ttBitToTt.end(); itBit++) {
0603 
0604                 int bitNumber = itBit->first;
0605                 std::string aName = (itBit->second)->algoName();
0606 
0607                 myCout << std::setw(6) << bitNumber << "       " << aName << std::endl;
0608             }
0609 */
0610     } break;
0611 
0612     case 2: {
0613       // header for printing algorithms
0614 
0615       myCout << "\n   ********** L1 Trigger Menu - printing   ********** \n"
0616              << "\nL1 Trigger Menu Interface:         " << m_triggerMenuInterface
0617              << "\nL1 Trigger Menu Name:              " << m_triggerMenuName << "\nL1 Trigger Menu UUID (hash):     0x"
0618              << std::hex << m_triggerMenuUUID << std::dec << "\nL1 Trigger Menu Firmware (hash): 0x" << std::hex
0619              << m_triggerMenuImplementation << std::dec << "\nAssociated Scale DB Key: " << m_scaleDbKey << "\n\n"
0620              << "\nL1 Physics Algorithms: " << nrDefinedAlgo << " algorithms defined."
0621              << "\n\n"
0622              << std::endl;
0623 
0624       for (CItBit itBit = algoBitToAlgo.begin(); itBit != algoBitToAlgo.end(); itBit++) {
0625         (itBit->second)->print(myCout);
0626       }
0627 
0628       myCout << "\nNumber of condition chips: " << m_conditionMap.size() << "\n" << std::endl;
0629 
0630       int chipNr = -1;
0631       int totalNrConditions = 0;
0632 
0633       for (std::vector<l1t::ConditionMap>::const_iterator itCondOnChip = m_conditionMap.begin();
0634            itCondOnChip != m_conditionMap.end();
0635            itCondOnChip++) {
0636         chipNr++;
0637 
0638         int condMapSize = itCondOnChip->size();
0639         totalNrConditions += condMapSize;
0640 
0641         myCout << "\nTotal number of conditions on condition chip " << chipNr << ": " << condMapSize << " conditions.\n"
0642                << std::endl;
0643 
0644         for (l1t::CItCond itCond = itCondOnChip->begin(); itCond != itCondOnChip->end(); itCond++) {
0645           (itCond->second)->print(myCout);
0646         }
0647       }
0648 
0649       myCout << "\nTotal number of conditions on all condition chips: " << totalNrConditions << "\n" << std::endl;
0650       /*
0651             myCout
0652             << "\nL1 Technical Triggers: " << nrDefinedTechTrig
0653             << " technical triggers defined." << "\n\n" << std::endl;
0654             if (nrDefinedTechTrig) {
0655                 myCout << "Bit Number " << " Technical trigger name " << std::endl;
0656             }
0657 
0658             for (CItBit itBit = ttBitToTt.begin(); itBit != ttBitToTt.end(); itBit++) {
0659 
0660                 int bitNumber = itBit->first;
0661                 std::string aName = (itBit->second)->algoName();
0662 
0663                 myCout << std::setw(6) << bitNumber << "       " << aName << std::endl;
0664             }
0665 */
0666 
0667     } break;
0668 
0669     default: {
0670       myCout << "\n   ********** L1 Trigger Menu - printing   ********** \n\n"
0671              << "Verbosity level: " << printVerbosity << " not implemented.\n\n"
0672              << std::endl;
0673     } break;
0674   }
0675 }
0676 
0677 // get the result for algorithm with name algName
0678 // use directly the format of decisionWord (no typedef)
0679 const bool TriggerMenu::gtAlgorithmResult(const std::string& algName, const std::vector<bool>& decWord) const {
0680   bool algResult = false;
0681 
0682   l1t::CItAlgo itAlgo = m_algorithmMap.find(algName);
0683   if (itAlgo != m_algorithmMap.end()) {
0684     int bitNumber = (itAlgo->second).algoBitNumber();
0685     algResult = decWord.at(bitNumber);
0686     return algResult;
0687   }
0688 
0689   // return false if the algorithm name is not found in the menu
0690   // TODO throw exception or LogInfo would be better - but the class is used in
0691   // XDAQ Trigger Supervisor (outside CMSSW) hence no CMSSW dependence
0692   // is allowed here...
0693 
0694   return false;
0695 }