Public Member Functions | |
CastorDumpConditions (const edm::ParameterSet &) | |
template<class S , class SRcd > | |
void | dumpIt (S *myS, SRcd *mySRcd, const edm::Event &e, const edm::EventSetup &context, std::string name) |
~CastorDumpConditions () | |
Private Member Functions | |
virtual void | analyze (const edm::Event &, const edm::EventSetup &) |
virtual void | beginJob (const edm::EventSetup &) |
virtual void | endJob () |
Private Attributes | |
std::string | file_prefix |
std::vector< std::string > | mDumpRequest |
Definition at line 53 of file CastorDumpConditions.cc.
CastorDumpConditions::CastorDumpConditions | ( | const edm::ParameterSet & | iConfig | ) | [explicit] |
Definition at line 81 of file CastorDumpConditions.cc.
References gather_cfg::cout, cmsRelvalreport::exit, file_prefix, edm::ParameterSet::getUntrackedParameter(), and mDumpRequest.
{ file_prefix = iConfig.getUntrackedParameter<std::string>("outFilePrefix","Dump"); mDumpRequest= iConfig.getUntrackedParameter<std::vector<std::string> >("dump",std::vector<std::string>()); if (mDumpRequest.empty()) { std::cout << "CastorDumpConditions: No record to dump. Exiting." << std::endl; exit(0); } }
CastorDumpConditions::~CastorDumpConditions | ( | ) |
Definition at line 94 of file CastorDumpConditions.cc.
{ // do anything here that needs to be done at desctruction time // (e.g. close files, deallocate resources etc.) }
void CastorDumpConditions::analyze | ( | const edm::Event & | iEvent, |
const edm::EventSetup & | iSetup | ||
) | [private, virtual] |
Implements edm::EDAnalyzer.
Definition at line 109 of file CastorDumpConditions.cc.
References gather_cfg::cout, dumpIt(), spr::find(), edm::EventSetup::get(), edm::Event::getByLabel(), edm::EventBase::id(), iEvent, mDumpRequest, and edm::EventID::run().
{ using namespace edm; #ifdef THIS_IS_AN_EVENT_EXAMPLE Handle<ExampleData> pIn; iEvent.getByLabel("example",pIn); #endif #ifdef THIS_IS_AN_EVENTSETUP_EXAMPLE ESHandle<SetupData> pSetup; iSetup.get<SetupRecord>().get(pSetup); #endif std::cout << "I AM IN THE RUN " << iEvent.id().run() << std::endl; std::cout << "What to dump? "<< std::endl; if (mDumpRequest.empty()) { std::cout<< "CastorDumpConditions: Empty request" << std::endl; return; } for(std::vector<std::string>::const_iterator it=mDumpRequest.begin();it!=mDumpRequest.end();it++) std::cout << *it << std::endl; if (std::find (mDumpRequest.begin(), mDumpRequest.end(), std::string ("ElectronicsMap")) != mDumpRequest.end()) dumpIt(new CastorElectronicsMap(), new CastorElectronicsMapRcd(), iEvent,iSetup,"ElectronicsMap"); if (std::find (mDumpRequest.begin(), mDumpRequest.end(), std::string ("QIEData")) != mDumpRequest.end()) dumpIt(new CastorQIEData(), new CastorQIEDataRcd(), iEvent,iSetup,"QIEData"); if (std::find (mDumpRequest.begin(), mDumpRequest.end(), std::string ("Pedestals")) != mDumpRequest.end()) dumpIt(new CastorPedestals(), new CastorPedestalsRcd(), iEvent,iSetup,"Pedestals"); if (std::find (mDumpRequest.begin(), mDumpRequest.end(), std::string ("PedestalWidths")) != mDumpRequest.end()) dumpIt(new CastorPedestalWidths(), new CastorPedestalWidthsRcd(), iEvent,iSetup,"PedestalWidths"); if (std::find (mDumpRequest.begin(), mDumpRequest.end(), std::string ("Gains")) != mDumpRequest.end()) dumpIt(new CastorGains(), new CastorGainsRcd(), iEvent,iSetup,"Gains"); if (std::find (mDumpRequest.begin(), mDumpRequest.end(), std::string ("GainWidths")) != mDumpRequest.end()) dumpIt(new CastorGainWidths(), new CastorGainWidthsRcd(), iEvent,iSetup,"GainWidths"); if (std::find (mDumpRequest.begin(), mDumpRequest.end(), std::string ("ChannelQuality")) != mDumpRequest.end()) dumpIt(new CastorChannelQuality(), new CastorChannelQualityRcd(), iEvent,iSetup,"ChannelQuality"); if (std::find (mDumpRequest.begin(), mDumpRequest.end(), std::string ("RecoParams")) != mDumpRequest.end()) dumpIt(new CastorRecoParams(), new CastorRecoParamsRcd(), iEvent,iSetup,"RecoParams"); /* ESHandle<CastorPedestals> p; iSetup.get<CastorPedestalsRcd>().get(p); CastorPedestals* mypeds = new CastorPedestals(*p.product()); std::ostringstream file; std::string name = "CastorPedestal"; file << file_prefix << name.c_str() << "_Run" << iEvent.id().run()<< ".txt"; std::ofstream outStream(file.str().c_str() ); std::cout << "CastorDumpConditions: ---- Dumping " << name.c_str() << " ----" << std::endl; CastorDbASCIIIO::dumpObject (outStream, (*mypeds) ); */ }
void CastorDumpConditions::beginJob | ( | const edm::EventSetup & | ) | [private, virtual] |
Definition at line 173 of file CastorDumpConditions.cc.
{ }
void CastorDumpConditions::dumpIt | ( | S * | myS, |
SRcd * | mySRcd, | ||
const edm::Event & | e, | ||
const edm::EventSetup & | context, | ||
std::string | name | ||
) |
Definition at line 183 of file CastorDumpConditions.cc.
References CastorDbASCIIIO::dumpObject(), mergeVDriftHistosByStation::file, file_prefix, edm::EventSetup::get(), edm::EventBase::id(), AlCaHLTBitMon_ParallelJobs::p, edm::ESHandle< T >::product(), and edm::EventID::run().
Referenced by analyze().
{ int myrun = e.id().run(); edm::ESHandle<S> p; context.get<SRcd>().get(p); S* myobject = new S(*p.product()); std::ostringstream file; file << file_prefix << name.c_str() << "_Run" << myrun << ".txt"; std::ofstream outStream(file.str().c_str() ); CastorDbASCIIIO::dumpObject (outStream, (*myobject) ); }
void CastorDumpConditions::endJob | ( | void | ) | [private, virtual] |
std::string CastorDumpConditions::file_prefix [private] |
Definition at line 61 of file CastorDumpConditions.cc.
Referenced by CastorDumpConditions(), and dumpIt().
std::vector<std::string> CastorDumpConditions::mDumpRequest [private] |
Definition at line 62 of file CastorDumpConditions.cc.
Referenced by analyze(), and CastorDumpConditions().