CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_3/src/L1TriggerConfig/L1GtConfigProducers/src/L1GtTriggerMenuXmlProducer.cc

Go to the documentation of this file.
00001 
00017 // this class header
00018 #include "L1TriggerConfig/L1GtConfigProducers/interface/L1GtTriggerMenuXmlProducer.h"
00019 
00020 // system include files
00021 #include <memory>
00022 
00023 #include "boost/shared_ptr.hpp"
00024 
00025 
00026 // user include files
00027 //   base class
00028 #include "FWCore/Framework/interface/ESProducer.h"
00029 
00030 #include "FWCore/Framework/interface/ModuleFactory.h"
00031 #include "FWCore/Framework/interface/ESHandle.h"
00032 
00033 #include "FWCore/MessageLogger/interface/MessageLogger.h"
00034 #include "FWCore/MessageLogger/interface/MessageDrop.h"
00035 
00036 #include "CondFormats/L1TObjects/interface/L1GtTriggerMenu.h"
00037 #include "CondFormats/DataRecord/interface/L1GtTriggerMenuRcd.h"
00038 
00039 #include "CondFormats/L1TObjects/interface/L1GtStableParameters.h"
00040 #include "CondFormats/DataRecord/interface/L1GtStableParametersRcd.h"
00041 
00042 #include "L1TriggerConfig/L1GtConfigProducers/interface/L1GtTriggerMenuXmlParser.h"
00043 
00044 
00045 
00046 // forward declarations
00047 
00048 // constructor(s)
00049 L1GtTriggerMenuXmlProducer::L1GtTriggerMenuXmlProducer(
00050     const edm::ParameterSet& parSet)
00051 {
00052     // tell the framework what data is being produced
00053     setWhatProduced(this, &L1GtTriggerMenuXmlProducer::produceGtTriggerMenu);
00054 
00055 
00056     // now do what ever other initialization is needed
00057 
00058 
00059     // directory in /data/Luminosity for the trigger menu
00060     std::string menuDir = parSet.getParameter<std::string>("TriggerMenuLuminosity");
00061 
00062 
00063     // def.xml file
00064     std::string defXmlFileName = parSet.getParameter<std::string>("DefXmlFile");
00065 
00066     edm::FileInPath f1("L1TriggerConfig/L1GtConfigProducers/data/Luminosity/" +
00067                        menuDir + "/" + defXmlFileName);
00068 
00069     m_defXmlFile = f1.fullPath();
00070 
00071 
00072     // vme.xml file
00073     std::string vmeXmlFileName = parSet.getParameter<std::string>("VmeXmlFile");
00074 
00075     if (vmeXmlFileName != "") {
00076         edm::FileInPath f2("L1TriggerConfig/L1GtConfigProducers/data/Luminosity/" +
00077                            menuDir + "/" + vmeXmlFileName);
00078 
00079         m_vmeXmlFile = f2.fullPath();
00080 
00081     }
00082 
00083     edm::LogInfo("L1GtConfigProducers")
00084     << "\n\nL1 Trigger Menu: "
00085     << "\n\n  def.xml file: \n    " << m_defXmlFile
00086     << "\n\n  vme.xml file: \n    " << m_vmeXmlFile
00087     << "\n\n"
00088     << std::endl;
00089 
00090 }
00091 
00092 // destructor
00093 L1GtTriggerMenuXmlProducer::~L1GtTriggerMenuXmlProducer()
00094 {
00095 
00096     // empty
00097 
00098 }
00099 
00100 
00101 // member functions
00102 
00103 // method called to produce the data
00104 boost::shared_ptr<L1GtTriggerMenu> L1GtTriggerMenuXmlProducer::produceGtTriggerMenu(
00105     const L1GtTriggerMenuRcd& l1MenuRecord)
00106 {
00107 
00108     // get the parameters needed from other records
00109     const L1GtStableParametersRcd& stableParametersRcd =
00110         l1MenuRecord.getRecord<L1GtStableParametersRcd>();
00111 
00112     edm::ESHandle<L1GtStableParameters> stableParameters;
00113     stableParametersRcd.get(stableParameters);
00114 
00115     unsigned int numberConditionChips = stableParameters->gtNumberConditionChips();
00116     unsigned int pinsOnConditionChip = stableParameters->gtPinsOnConditionChip();
00117     std::vector<int> orderConditionChip = stableParameters->gtOrderConditionChip();
00118     unsigned int numberPhysTriggers = stableParameters->gtNumberPhysTriggers();
00119     unsigned int numberTechTriggers = stableParameters->gtNumberTechnicalTriggers();
00120     unsigned int numberL1JetCounts = stableParameters->gtNumberL1JetCounts();
00121 
00122     L1GtTriggerMenuXmlParser gtXmlParser = L1GtTriggerMenuXmlParser();
00123 
00124     gtXmlParser.setGtNumberConditionChips(numberConditionChips);
00125     gtXmlParser.setGtPinsOnConditionChip(pinsOnConditionChip);
00126     gtXmlParser.setGtOrderConditionChip(orderConditionChip);
00127     gtXmlParser.setGtNumberPhysTriggers(numberPhysTriggers);
00128     gtXmlParser.setGtNumberTechTriggers(numberTechTriggers);
00129     gtXmlParser.setGtNumberL1JetCounts(numberL1JetCounts);
00130 
00131     gtXmlParser.parseXmlFile(m_defXmlFile, m_vmeXmlFile);
00132 
00133     // transfer the condition map and algorithm map from parser to L1GtTriggerMenu
00134 
00135     boost::shared_ptr<L1GtTriggerMenu> pL1GtTriggerMenu = boost::shared_ptr<L1GtTriggerMenu>(
00136                 new L1GtTriggerMenu(gtXmlParser.gtTriggerMenuName(), numberConditionChips,
00137                         gtXmlParser.vecMuonTemplate(),
00138                         gtXmlParser.vecCaloTemplate(),
00139                         gtXmlParser.vecEnergySumTemplate(),
00140                         gtXmlParser.vecJetCountsTemplate(),
00141                         gtXmlParser.vecCastorTemplate(),
00142                         gtXmlParser.vecHfBitCountsTemplate(),
00143                         gtXmlParser.vecHfRingEtSumsTemplate(),
00144                         gtXmlParser.vecBptxTemplate(),
00145                         gtXmlParser.vecExternalTemplate(),
00146                         gtXmlParser.vecCorrelationTemplate(),
00147                         gtXmlParser.corMuonTemplate(),
00148                         gtXmlParser.corCaloTemplate(),
00149                         gtXmlParser.corEnergySumTemplate()) );
00150 
00151 
00152     pL1GtTriggerMenu->setGtTriggerMenuInterface(gtXmlParser.gtTriggerMenuInterface());
00153     pL1GtTriggerMenu->setGtTriggerMenuImplementation(gtXmlParser.gtTriggerMenuImplementation());
00154     pL1GtTriggerMenu->setGtScaleDbKey(gtXmlParser.gtScaleDbKey());
00155 
00156     pL1GtTriggerMenu->setGtAlgorithmMap(gtXmlParser.gtAlgorithmMap());
00157     pL1GtTriggerMenu->setGtAlgorithmAliasMap(gtXmlParser.gtAlgorithmAliasMap());
00158     pL1GtTriggerMenu->setGtTechnicalTriggerMap(gtXmlParser.gtTechnicalTriggerMap());
00159 
00160     //LogDebug("L1GtConfigProducers")
00161     //<< "\n\nReturning L1 Trigger Menu!"
00162     //<< "\n\n"
00163     //<< std::endl;
00164 
00165     return pL1GtTriggerMenu ;
00166 }
00167