CMS 3D CMS Logo

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 (const std::vector< std::string > &mDumpRequest, const edm::Event &e, const edm::EventSetup &context, const std::string name)
 
 ~CastorDumpConditions () override
 
- Public Member Functions inherited from edm::EDAnalyzer
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzer ()
 
SerialTaskQueueglobalLuminosityBlocksQueue ()
 
SerialTaskQueueglobalRunsQueue ()
 
ModuleDescription const & moduleDescription () const
 
std::string workerType () const
 
 ~EDAnalyzer () override
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
void convertCurrentProcessAlias (std::string const &processName)
 Convert "@currentProcess" in InputTag process names to the actual current process name. More...
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
ProductResolverIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
std::vector< ProductResolverIndexAndSkipBit > const & itemsToGetFrom (BranchType iType) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
virtual ~EDConsumerBase () noexcept(false)
 

Private Member Functions

void analyze (const edm::Event &, const edm::EventSetup &) override
 
virtual void beginJob (const edm::EventSetup &)
 
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 &)
 
static bool wantsGlobalLuminosityBlocks ()
 
static bool wantsGlobalRuns ()
 
static bool wantsStreamLuminosityBlocks ()
 
static bool wantsStreamRuns ()
 
- 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 85 of file CastorDumpConditions.cc.

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

87 {
88  file_prefix = iConfig.getUntrackedParameter<std::string>("outFilePrefix","Dump");
89  mDumpRequest= iConfig.getUntrackedParameter<std::vector<std::string> >("dump",std::vector<std::string>());
90  if (mDumpRequest.empty()) {
91  std::cout << "CastorDumpConditions: No record to dump. Exiting." << std::endl;
92  exit(0);
93  }
94 
95 }
T getUntrackedParameter(std::string const &, T const &) const
std::vector< std::string > mDumpRequest
CastorDumpConditions::~CastorDumpConditions ( )
override

Definition at line 98 of file CastorDumpConditions.cc.

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

Member Function Documentation

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

Definition at line 113 of file CastorDumpConditions.cc.

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

114 {
115  using namespace edm;
116 
117 #ifdef THIS_IS_AN_EVENT_EXAMPLE
119  iEvent.getByLabel("example",pIn);
120 #endif
121 
122 #ifdef THIS_IS_AN_EVENTSETUP_EXAMPLE
123  ESHandle<SetupData> pSetup;
124  iSetup.get<SetupRecord>().get(pSetup);
125 #endif
126  std::cout << "I AM IN THE RUN " << iEvent.id().run() << std::endl;
127  std::cout << "What to dump? "<< std::endl;
128  if (mDumpRequest.empty()) {
129  std::cout<< "CastorDumpConditions: Empty request" << std::endl;
130  return;
131  }
132 
133  for(std::vector<std::string>::const_iterator it=mDumpRequest.begin();it!=mDumpRequest.end();it++)
134  std::cout << *it << std::endl;
135 
136  // dumpIt called for all possible ValueMaps. The function checks if the dump is actually requested.
137  dumpIt<CastorElectronicsMap , CastorElectronicsMapRcd> (mDumpRequest, iEvent,iSetup,"ElectronicsMap" );
138  dumpIt<CastorQIEData , CastorQIEDataRcd> (mDumpRequest, iEvent,iSetup,"QIEData" );
139  dumpIt<CastorPedestals , CastorPedestalsRcd> (mDumpRequest, iEvent,iSetup,"Pedestals" );
140  dumpIt<CastorPedestalWidths , CastorPedestalWidthsRcd> (mDumpRequest, iEvent,iSetup,"PedestalWidths" );
141  dumpIt<CastorGains , CastorGainsRcd> (mDumpRequest, iEvent,iSetup,"Gains" );
142  dumpIt<CastorGainWidths , CastorGainWidthsRcd> (mDumpRequest, iEvent,iSetup,"GainWidths" );
143  dumpIt<CastorChannelQuality , CastorChannelQualityRcd> (mDumpRequest, iEvent,iSetup,"ChannelQuality" );
144  dumpIt<CastorRecoParams , CastorRecoParamsRcd> (mDumpRequest, iEvent,iSetup,"RecoParams" );
145  dumpIt<CastorSaturationCorrs, CastorSaturationCorrsRcd>(mDumpRequest, iEvent,iSetup,"SaturationCorrs");
146 }
RunNumber_t run() const
Definition: EventID.h:39
int iEvent
Definition: GenABIO.cc:230
std::vector< std::string > mDumpRequest
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:535
edm::EventID id() const
Definition: EventBase.h:60
HLT enums.
T get() const
Definition: EventSetup.h:62
void CastorDumpConditions::beginJob ( const edm::EventSetup )
privatevirtual

Definition at line 151 of file CastorDumpConditions.cc.

152 {
153 }
template<class S , class SRcd >
void CastorDumpConditions::dumpIt ( const std::vector< std::string > &  mDumpRequest,
const edm::Event e,
const edm::EventSetup context,
const std::string  name 
)

Definition at line 161 of file CastorDumpConditions.cc.

References DEFINE_FWK_MODULE, CastorDbASCIIIO::dumpObject(), FrontierConditions_GlobalTag_cff::file, file_prefix, spr::find(), edm::EventSetup::get(), edm::EventBase::id(), dataset::name, AlCaHLTBitMon_ParallelJobs::p, edm::ESHandle< T >::product(), and edm::EventID::run().

164  {
165  if (std::find (mDumpRequest.begin(), mDumpRequest.end(), name) != mDumpRequest.end())
166  {
167  int myrun = e.id().run();
169  context.get<SRcd>().get(p);
170  S myobject(*p.product());
171 
172  std::ostringstream file;
173  file << file_prefix << name.c_str() << "_Run" << myrun << ".txt";
174  std::ofstream outStream(file.str().c_str() );
175  CastorDbASCIIIO::dumpObject (outStream, myobject );
176  }
177 }
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:20
std::vector< std::string > mDumpRequest
bool dumpObject(std::ostream &fOutput, const CastorPedestals &fObject)
edm::EventID id() const
Definition: EventBase.h:60
T get() const
Definition: EventSetup.h:62
T const * product() const
Definition: ESHandle.h:86
void CastorDumpConditions::endJob ( void  )
overrideprivatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 157 of file CastorDumpConditions.cc.

157  {
158 }

Member Data Documentation

std::string CastorDumpConditions::file_prefix
private

Definition at line 65 of file CastorDumpConditions.cc.

Referenced by CastorDumpConditions(), and dumpIt().

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

Definition at line 66 of file CastorDumpConditions.cc.

Referenced by analyze(), and CastorDumpConditions().