CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Member Functions | Private Attributes
CastorDumpConditions Class Reference
Inheritance diagram for CastorDumpConditions:
edm::EDAnalyzer edm::EDConsumerBase

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 ()
 
- Public Member Functions inherited from edm::EDAnalyzer
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzer ()
 
ModuleDescription const & moduleDescription () const
 
std::string workerType () const
 
virtual ~EDAnalyzer ()
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
 EDConsumerBase ()
 
ProductHolderIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
std::vector
< ProductHolderIndexAndSkipBit >
const & 
itemsToGetFromEvent () const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesDependentUpon (std::string const &iProcessName, std::string const &iModuleLabel, bool iPrint, std::vector< char const * > &oModuleLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

Private Member Functions

virtual void analyze (const edm::Event &, const edm::EventSetup &) override
 
virtual void beginJob (const edm::EventSetup &)
 
virtual void endJob () override
 

Private Attributes

std::string file_prefix
 
std::vector< std::string > mDumpRequest
 

Additional Inherited Members

- Public Types inherited from edm::EDAnalyzer
typedef EDAnalyzer ModuleType
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Static Public Member Functions inherited from edm::EDAnalyzer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &)
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 

Detailed Description

Definition at line 54 of file CastorDumpConditions.cc.

Constructor & Destructor Documentation

CastorDumpConditions::CastorDumpConditions ( const edm::ParameterSet iConfig)
explicit

Definition at line 82 of file CastorDumpConditions.cc.

References gather_cfg::cout, cmsRelvalreport::exit, file_prefix, edm::ParameterSet::getUntrackedParameter(), mDumpRequest, and AlCaHLTBitMon_QueryRunRegistry::string.

84 {
85  file_prefix = iConfig.getUntrackedParameter<std::string>("outFilePrefix","Dump");
86  mDumpRequest= iConfig.getUntrackedParameter<std::vector<std::string> >("dump",std::vector<std::string>());
87  if (mDumpRequest.empty()) {
88  std::cout << "CastorDumpConditions: No record to dump. Exiting." << std::endl;
89  exit(0);
90  }
91 
92 }
T getUntrackedParameter(std::string const &, T const &) const
std::vector< std::string > mDumpRequest
tuple cout
Definition: gather_cfg.py:145
CastorDumpConditions::~CastorDumpConditions ( )

Definition at line 95 of file CastorDumpConditions.cc.

96 {
97 
98  // do anything here that needs to be done at desctruction time
99  // (e.g. close files, deallocate resources etc.)
100 
101 }

Member Function Documentation

void CastorDumpConditions::analyze ( const edm::Event iEvent,
const edm::EventSetup iSetup 
)
overrideprivatevirtual

Implements edm::EDAnalyzer.

Definition at line 110 of file CastorDumpConditions.cc.

References gather_cfg::cout, dumpIt(), spr::find(), edm::EventSetup::get(), edm::Event::getByLabel(), edm::EventBase::id(), iEvent, mDumpRequest, edm::EventID::run(), and AlCaHLTBitMon_QueryRunRegistry::string.

111 {
112  using namespace edm;
113 
114 #ifdef THIS_IS_AN_EVENT_EXAMPLE
116  iEvent.getByLabel("example",pIn);
117 #endif
118 
119 #ifdef THIS_IS_AN_EVENTSETUP_EXAMPLE
120  ESHandle<SetupData> pSetup;
121  iSetup.get<SetupRecord>().get(pSetup);
122 #endif
123  std::cout << "I AM IN THE RUN " << iEvent.id().run() << std::endl;
124  std::cout << "What to dump? "<< std::endl;
125  if (mDumpRequest.empty()) {
126  std::cout<< "CastorDumpConditions: Empty request" << std::endl;
127  return;
128  }
129 
130  for(std::vector<std::string>::const_iterator it=mDumpRequest.begin();it!=mDumpRequest.end();it++)
131  std::cout << *it << std::endl;
132 
133  if (std::find (mDumpRequest.begin(), mDumpRequest.end(), std::string ("ElectronicsMap")) != mDumpRequest.end())
134  dumpIt(new CastorElectronicsMap(), new CastorElectronicsMapRcd(), iEvent,iSetup,"ElectronicsMap");
135 
136  if (std::find (mDumpRequest.begin(), mDumpRequest.end(), std::string ("QIEData")) != mDumpRequest.end())
137  dumpIt(new CastorQIEData(), new CastorQIEDataRcd(), iEvent,iSetup,"QIEData");
138 
139  if (std::find (mDumpRequest.begin(), mDumpRequest.end(), std::string ("Pedestals")) != mDumpRequest.end())
140  dumpIt(new CastorPedestals(), new CastorPedestalsRcd(), iEvent,iSetup,"Pedestals");
141 
142  if (std::find (mDumpRequest.begin(), mDumpRequest.end(), std::string ("PedestalWidths")) != mDumpRequest.end())
143  dumpIt(new CastorPedestalWidths(), new CastorPedestalWidthsRcd(), iEvent,iSetup,"PedestalWidths");
144 
145  if (std::find (mDumpRequest.begin(), mDumpRequest.end(), std::string ("Gains")) != mDumpRequest.end())
146  dumpIt(new CastorGains(), new CastorGainsRcd(), iEvent,iSetup,"Gains");
147 
148  if (std::find (mDumpRequest.begin(), mDumpRequest.end(), std::string ("GainWidths")) != mDumpRequest.end())
149  dumpIt(new CastorGainWidths(), new CastorGainWidthsRcd(), iEvent,iSetup,"GainWidths");
150 
151  if (std::find (mDumpRequest.begin(), mDumpRequest.end(), std::string ("ChannelQuality")) != mDumpRequest.end())
152  dumpIt(new CastorChannelQuality(), new CastorChannelQualityRcd(), iEvent,iSetup,"ChannelQuality");
153 
154  if (std::find (mDumpRequest.begin(), mDumpRequest.end(), std::string ("RecoParams")) != mDumpRequest.end())
155  dumpIt(new CastorRecoParams(), new CastorRecoParamsRcd(), iEvent,iSetup,"RecoParams");
156 
157  if (std::find (mDumpRequest.begin(), mDumpRequest.end(), std::string ("SaturationCorrs")) != mDumpRequest.end())
158  dumpIt(new CastorSaturationCorrs(), new CastorSaturationCorrsRcd(), iEvent,iSetup,"SaturationCorrs");
159 
160 /*
161  ESHandle<CastorPedestals> p;
162  iSetup.get<CastorPedestalsRcd>().get(p);
163  CastorPedestals* mypeds = new CastorPedestals(*p.product());
164  std::ostringstream file;
165  std::string name = "CastorPedestal";
166  file << file_prefix << name.c_str() << "_Run" << iEvent.id().run()<< ".txt";
167  std::ofstream outStream(file.str().c_str() );
168  std::cout << "CastorDumpConditions: ---- Dumping " << name.c_str() << " ----" << std::endl;
169  CastorDbASCIIIO::dumpObject (outStream, (*mypeds) );
170 
171 */
172 }
RunNumber_t run() const
Definition: EventID.h:39
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:7
int iEvent
Definition: GenABIO.cc:230
std::vector< std::string > mDumpRequest
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:418
const T & get() const
Definition: EventSetup.h:56
edm::EventID id() const
Definition: EventBase.h:59
tuple cout
Definition: gather_cfg.py:145
void dumpIt(S *myS, SRcd *mySRcd, const edm::Event &e, const edm::EventSetup &context, std::string name)
void CastorDumpConditions::beginJob ( const edm::EventSetup )
privatevirtual

Definition at line 177 of file CastorDumpConditions.cc.

178 {
179 }
template<class S , class SRcd >
void CastorDumpConditions::dumpIt ( S myS,
SRcd *  mySRcd,
const edm::Event e,
const edm::EventSetup context,
std::string  name 
)

Definition at line 187 of file CastorDumpConditions.cc.

References CastorDbASCIIIO::dumpObject(), mergeVDriftHistosByStation::file, file_prefix, edm::EventSetup::get(), edm::EventBase::id(), AlCaHLTBitMon_ParallelJobs::p, edm::ESHandle< class >::product(), edm::EventID::run(), and S().

Referenced by analyze().

187  {
188  int myrun = e.id().run();
190  context.get<SRcd>().get(p);
191  S* myobject = new S(*p.product());
192 
193  std::ostringstream file;
194  file << file_prefix << name.c_str() << "_Run" << myrun << ".txt";
195  std::ofstream outStream(file.str().c_str() );
196  CastorDbASCIIIO::dumpObject (outStream, (*myobject) );
197  }
RunNumber_t run() const
Definition: EventID.h:39
bool dumpObject(std::ostream &fOutput, const CastorPedestals &fObject)
const T & get() const
Definition: EventSetup.h:56
T const * product() const
Definition: ESHandle.h:86
double S(const TLorentzVector &, const TLorentzVector &)
Definition: Particle.cc:99
edm::EventID id() const
Definition: EventBase.h:59
void CastorDumpConditions::endJob ( void  )
overrideprivatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 183 of file CastorDumpConditions.cc.

183  {
184 }

Member Data Documentation

std::string CastorDumpConditions::file_prefix
private

Definition at line 62 of file CastorDumpConditions.cc.

Referenced by CastorDumpConditions(), and dumpIt().

std::vector<std::string> CastorDumpConditions::mDumpRequest
private

Definition at line 63 of file CastorDumpConditions.cc.

Referenced by analyze(), and CastorDumpConditions().