Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:04:32

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