Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2023-09-02 06:14:23

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