Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2023-03-17 10:50:18

0001 /**
0002  * \class L1GlobalTriggerObjectMapRecord
0003  * 
0004  * 
0005  * Description: see header file.  
0006  *
0007  * Implementation:
0008  *    <TODO: enter implementation details>
0009  *   
0010  * \author: Vasile Mihai Ghete - HEPHY Vienna
0011  * 
0012  *
0013  */
0014 
0015 // this class header
0016 #include "DataFormats/L1GlobalTrigger/interface/L1GlobalTriggerObjectMapRecord.h"
0017 
0018 // system include files
0019 
0020 #include <algorithm>
0021 
0022 // user include files
0023 
0024 #include "DataFormats/L1GlobalTrigger/interface/L1GtLogicParser.h"
0025 
0026 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0027 
0028 // forward declarations
0029 
0030 // methods
0031 
0032 /// return the object map for the algorithm algoNameVal
0033 const L1GlobalTriggerObjectMap* L1GlobalTriggerObjectMapRecord::getObjectMap(const std::string& algoNameVal) const {
0034   for (std::vector<L1GlobalTriggerObjectMap>::const_iterator itObj = m_gtObjectMap.begin();
0035        itObj != m_gtObjectMap.end();
0036        ++itObj) {
0037     if (itObj->algoName() == algoNameVal) {
0038       return &((*itObj));
0039     }
0040   }
0041 
0042   // no algoName found, return zero pointer!
0043   edm::LogError("L1GlobalTriggerObjectMapRecord")
0044       << " ERROR: The requested algorithm name = " << algoNameVal << " does not exist in the trigger menu."
0045       << " Returning zero pointer for getObjectMap." << std::endl;
0046 
0047   return nullptr;
0048 }
0049 
0050 /// return the object map for the algorithm with bit number const int algoBitNumberVal
0051 const L1GlobalTriggerObjectMap* L1GlobalTriggerObjectMapRecord::getObjectMap(const int algoBitNumberVal) const {
0052   for (std::vector<L1GlobalTriggerObjectMap>::const_iterator itObj = m_gtObjectMap.begin();
0053        itObj != m_gtObjectMap.end();
0054        ++itObj) {
0055     if (itObj->algoBitNumber() == algoBitNumberVal) {
0056       return &((*itObj));
0057     }
0058   }
0059 
0060   // no algoBitNumberVal found, return zero pointer!
0061   edm::LogError("L1GlobalTriggerObjectMapRecord")
0062       << " ERROR: The requested algorithm with bit number = " << algoBitNumberVal
0063       << " does not exist in the trigger menu."
0064       << " Returning zero pointer for getObjectMap." << std::endl;
0065 
0066   return nullptr;
0067 }
0068 
0069 // return all the combinations passing the requirements imposed in condition condNameVal
0070 // from algorithm algoNameVal
0071 const CombinationsInCond* L1GlobalTriggerObjectMapRecord::getCombinationsInCond(const std::string& algoNameVal,
0072                                                                                 const std::string& condNameVal) const {
0073   for (std::vector<L1GlobalTriggerObjectMap>::const_iterator itObj = m_gtObjectMap.begin();
0074        itObj != m_gtObjectMap.end();
0075        ++itObj) {
0076     if (itObj->algoName() == algoNameVal) {
0077       return itObj->getCombinationsInCond(condNameVal);
0078     }
0079   }
0080 
0081   // no (algoName, condName) found, return zero pointer!
0082   edm::LogError("L1GlobalTriggerObjectMapRecord")
0083       << " ERROR: The requested (algorithm name, condition name) = (" << algoNameVal << ", " << condNameVal
0084       << ") does not exist in the trigger menu."
0085       << " Returning zero pointer for getCombinationsInCond." << std::endl;
0086 
0087   return nullptr;
0088 }
0089 
0090 // return all the combinations passing the requirements imposed in condition condNameVal
0091 // from algorithm with bit number algoBitNumberVal
0092 const CombinationsInCond* L1GlobalTriggerObjectMapRecord::getCombinationsInCond(const int algoBitNumberVal,
0093                                                                                 const std::string& condNameVal) const {
0094   for (std::vector<L1GlobalTriggerObjectMap>::const_iterator itObj = m_gtObjectMap.begin();
0095        itObj != m_gtObjectMap.end();
0096        ++itObj) {
0097     if (itObj->algoBitNumber() == algoBitNumberVal) {
0098       return itObj->getCombinationsInCond(condNameVal);
0099     }
0100   }
0101 
0102   // no (algoBitNumber, condName) found, return zero pointer!
0103   edm::LogError("L1GlobalTriggerObjectMapRecord")
0104       << " ERROR: The requested (algorithm bit number, condition name) = (" << algoBitNumberVal << ", " << condNameVal
0105       << ") does not exist in the trigger menu."
0106       << " Returning zero pointer for getCombinationsInCond." << std::endl;
0107 
0108   return nullptr;
0109 }
0110 
0111 // return the result for the condition condNameVal
0112 // from algorithm with name algoNameVal
0113 bool L1GlobalTriggerObjectMapRecord::getConditionResult(const std::string& algoNameVal,
0114                                                         const std::string& condNameVal) const {
0115   for (std::vector<L1GlobalTriggerObjectMap>::const_iterator itObj = m_gtObjectMap.begin();
0116        itObj != m_gtObjectMap.end();
0117        ++itObj) {
0118     if (itObj->algoName() == algoNameVal) {
0119       return itObj->getConditionResult(condNameVal);
0120     }
0121   }
0122 
0123   // no (algoName, condName) found, return false!
0124   edm::LogError("L1GlobalTriggerObjectMapRecord")
0125       << " ERROR: The requested (algorithm name, condition name) = (" << algoNameVal << ", " << condNameVal
0126       << ") does not exist in the trigger menu."
0127       << " Returning false for condition result! Unknown result, in fact!" << std::endl;
0128 
0129   return false;
0130 }
0131 
0132 // return the result for the condition condNameVal
0133 // from algorithm with bit number algoBitNumberVal
0134 bool L1GlobalTriggerObjectMapRecord::getConditionResult(const int algoBitNumberVal,
0135                                                         const std::string& condNameVal) const {
0136   for (std::vector<L1GlobalTriggerObjectMap>::const_iterator itObj = m_gtObjectMap.begin();
0137        itObj != m_gtObjectMap.end();
0138        ++itObj) {
0139     if (itObj->algoBitNumber() == algoBitNumberVal) {
0140       return itObj->getConditionResult(condNameVal);
0141     }
0142   }
0143 
0144   // no (algoBitNumber, condName) found, return false!
0145   edm::LogError("L1GlobalTriggerObjectMapRecord")
0146       << " ERROR: The requested (algorithm bit number, condition name) = (" << algoBitNumberVal << ", " << condNameVal
0147       << ") does not exist in the trigger menu."
0148       << " Returning false for condition result! Unknown result, in fact!" << std::endl;
0149 
0150   return false;
0151 }