#include <RecoLuminosity/LumiProducer/src/LumiProducer.cc>
Public Member Functions | |
LumiProducer (const edm::ParameterSet &) | |
~LumiProducer () | |
Private Member Functions | |
virtual void | beginLuminosityBlock (edm::LuminosityBlock &iLBlock, edm::EventSetup const &iSetup) |
virtual void | produce (edm::Event &, const edm::EventSetup &) |
Private Attributes | |
edm::ParameterSet | pset_ |
Implementation: The are two main steps, the first one retrieve the record of the luminosity data from the DB and the second loads the Luminosity Obj into the Lumi Block. (Actually in the initial implementation it is retrieving from the ParameterSet from the configuration file, the DB is not implemented yet)
Definition at line 49 of file LumiProducer.cc.
LumiProducer::LumiProducer | ( | const edm::ParameterSet & | iConfig | ) | [explicit] |
Definition at line 68 of file LumiProducer.cc.
References pset_.
00069 { 00070 // register your products 00071 produces<LumiSummary, edm::InLumi>(); 00072 produces<LumiDetails, edm::InLumi>(); 00073 00074 pset_ = iConfig; 00075 }
LumiProducer::~LumiProducer | ( | ) |
void LumiProducer::beginLuminosityBlock | ( | edm::LuminosityBlock & | iLBlock, | |
edm::EventSetup const & | iSetup | |||
) | [private, virtual] |
Reimplemented from edm::EDProducer.
Definition at line 88 of file LumiProducer.cc.
References e, edm::ParameterSet::getUntrackedParameter(), i, edm::LuminosityBlock::id(), pset_, edm::LuminosityBlock::put(), ss, and pyDBSRunClass::temp.
00088 { 00089 00090 unsigned int lumiNumber = iLBlock.id().luminosityBlock(); 00091 std::stringstream ss; 00092 ss << "LS" << lumiNumber; 00093 std::string psetName = ss.str(); 00094 00095 // Some defaults that are used only if the configuration file 00096 // does not have the necessary parameters, We do not 00097 // want a crash in this case. 00098 edm::ParameterSet def; 00099 std::vector<int> defveci; 00100 std::vector<double> defvecd; 00101 00102 edm::ParameterSet lumiBlockPSet = 00103 pset_.getUntrackedParameter<edm::ParameterSet>(psetName, def); 00104 00105 std::auto_ptr<LumiSummary> pOut1(new LumiSummary( 00106 static_cast<float>(lumiBlockPSet.getUntrackedParameter<double>("avginsdellumi", -99.0)), 00107 static_cast<float>(lumiBlockPSet.getUntrackedParameter<double>("avginsdellumierr", -99.0)), 00108 lumiBlockPSet.getUntrackedParameter<int>("lumisecqual", -1), 00109 static_cast<float>(lumiBlockPSet.getUntrackedParameter<double>("deadfrac", -99.0)), 00110 lumiBlockPSet.getUntrackedParameter<int>("lsnumber", -1), 00111 lumiBlockPSet.getUntrackedParameter<std::vector<int> >("l1ratecounter", defveci), 00112 lumiBlockPSet.getUntrackedParameter<std::vector<int> >("l1scaler", defveci), 00113 lumiBlockPSet.getUntrackedParameter<std::vector<int> >("hltratecounter", defveci), 00114 lumiBlockPSet.getUntrackedParameter<std::vector<int> >("hltscaler", defveci), 00115 lumiBlockPSet.getUntrackedParameter<std::vector<int> >("hltinput", defveci) ) ); 00116 iLBlock.put(pOut1); 00117 00118 // One minor complication here. The configuration language allows double or 00119 // vector<double> but not float or vector<float> so we need to explicitly 00120 // convert from double to float 00121 00122 typedef std::vector<double>::const_iterator DIter; 00123 00124 std::vector<double> temp = 00125 lumiBlockPSet.getUntrackedParameter<std::vector<double> >("lumietsum", defvecd); 00126 std::vector<float> lumietsum; 00127 for (DIter i = temp.begin(), e = temp.end(); i != e; ++i) { 00128 lumietsum.push_back(static_cast<float>(*i)); 00129 } 00130 00131 temp = 00132 lumiBlockPSet.getUntrackedParameter<std::vector<double> >("lumietsumerr", defvecd); 00133 std::vector<float> lumietsumerr; 00134 for (DIter i = temp.begin(), e = temp.end(); i != e; ++i) { 00135 lumietsumerr.push_back(static_cast<float>(*i)); 00136 } 00137 00138 temp = lumiBlockPSet.getUntrackedParameter<std::vector<double> >("lumiocc", defvecd); 00139 std::vector<float> lumiocc; 00140 for (DIter i = temp.begin(), e = temp.end(); i != e; ++i) { 00141 lumiocc.push_back(static_cast<float>(*i)); 00142 } 00143 00144 temp = lumiBlockPSet.getUntrackedParameter<std::vector<double> >("lumioccerr", defvecd); 00145 std::vector<float> lumioccerr; 00146 for (DIter i = temp.begin(), e = temp.end(); i != e; ++i) { 00147 lumioccerr.push_back(static_cast<float>(*i)); 00148 } 00149 00150 std::auto_ptr<LumiDetails> pOut2(new LumiDetails( 00151 lumietsum, 00152 lumietsumerr, 00153 lumiBlockPSet.getUntrackedParameter<std::vector<int> >("lumietsumqual", defveci), 00154 lumiocc, 00155 lumioccerr, 00156 lumiBlockPSet.getUntrackedParameter<std::vector<int> >("lumioccqual", defveci) ) ); 00157 iLBlock.put(pOut2); 00158 00159 // ESHandle<SetupData> pLumiSetup; 00160 // iSetup.get<SetupRecord>().get(pLumiSetup); 00161 }
void LumiProducer::produce | ( | edm::Event & | , | |
const edm::EventSetup & | ||||
) | [private, virtual] |
edm::ParameterSet LumiProducer::pset_ [private] |
Definition at line 62 of file LumiProducer.cc.
Referenced by beginLuminosityBlock(), and LumiProducer().