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 Attributes
PCLMetadataWriter Class Reference

#include <PCLMetadataWriter.h>

Inheritance diagram for PCLMetadataWriter:
edm::EDAnalyzer edm::EDConsumerBase

Public Member Functions

virtual void analyze (const edm::Event &, const edm::EventSetup &)
 
virtual void beginRun (const edm::Run &, const edm::EventSetup &)
 
virtual void endRun (const edm::Run &, const edm::EventSetup &)
 
 PCLMetadataWriter (const edm::ParameterSet &)
 Constructor. More...
 
virtual ~PCLMetadataWriter ()
 Destructor. More...
 
- Public Member Functions inherited from edm::EDAnalyzer
 EDAnalyzer ()
 
std::string workerType () const
 
virtual ~EDAnalyzer ()
 
- Public Member Functions inherited from edm::EDConsumerBase
 EDConsumerBase ()
 
ProductHolderIndex indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndex > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndex > &) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

Private Attributes

bool readFromDB
 
std::map< std::string,
std::map< std::string,
std::string > > 
recordMap
 

Additional Inherited Members

- Public Types inherited from edm::EDAnalyzer
typedef EDAnalyzer ModuleType
 
typedef WorkerT< EDAnalyzerWorkerType
 
- 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::EDAnalyzer
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
CurrentProcessingContext const * currentContext () const
 
- 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

No description available.

Date:
2011/03/03 09:32:46
Revision:
1.2
Author
G. Cerminara - CERN

Definition at line 21 of file PCLMetadataWriter.h.

Constructor & Destructor Documentation

PCLMetadataWriter::PCLMetadataWriter ( const edm::ParameterSet pSet)

Constructor.

Definition at line 26 of file PCLMetadataWriter.cc.

References edm::ParameterSet::getParameter(), combine::key, and record.

26  {
27 
28  readFromDB = pSet.getParameter<bool>("readFromDB");
29 
30 
31  vector<ParameterSet> recordsToMap = pSet.getParameter<vector<ParameterSet> >("recordsToMap");
32  for(vector<ParameterSet>::const_iterator recordPset = recordsToMap.begin();
33  recordPset != recordsToMap.end();
34  ++recordPset) {
35 
36  string record = (*recordPset).getUntrackedParameter<string>("record");
37  map<string, string> jrInfo;
38  if(!readFromDB) {
39  vector<string> paramKeys = (*recordPset).getParameterNames();
40  for(vector<string>::const_iterator key = paramKeys.begin();
41  key != paramKeys.end();
42  ++key) {
43  jrInfo["Source"] = "AlcaHarvesting";
44  jrInfo["FileClass"] = "ALCA";
45  if(*key != "record") {
46  jrInfo[*key] = (*recordPset).getUntrackedParameter<string>(*key);
47  }
48  }
49  }
50  recordMap[record] = jrInfo;
51 
52  }
53 
54 }
T getParameter(std::string const &) const
JetCorrectorParameters::Record record
Definition: classes.h:13
std::map< std::string, std::map< std::string, std::string > > recordMap
list key
Definition: combine.py:13
PCLMetadataWriter::~PCLMetadataWriter ( )
virtual

Destructor.

Definition at line 56 of file PCLMetadataWriter.cc.

56 {}

Member Function Documentation

void PCLMetadataWriter::analyze ( const edm::Event event,
const edm::EventSetup eSetup 
)
virtual

Implements edm::EDAnalyzer.

Definition at line 59 of file PCLMetadataWriter.cc.

59 {}
void PCLMetadataWriter::beginRun ( const edm::Run run,
const edm::EventSetup eSetup 
)
virtual

Reimplemented from edm::EDAnalyzer.

Definition at line 62 of file PCLMetadataWriter.cc.

62 {}
void PCLMetadataWriter::endRun ( const edm::Run run,
const edm::EventSetup eSetup 
)
virtual

Reimplemented from edm::EDAnalyzer.

Definition at line 64 of file PCLMetadataWriter.cc.

References cond::DbSession::connectionString(), lut2db_cfg::filename, edm::EventSetup::get(), DropBoxMetadata::Parameters::getParameterMap(), DropBoxMetadata::getRecordParameters(), edm::Service< T >::isAvailable(), DropBoxMetadata::knowsRecord(), Association::map, edm::ESHandle< class >::product(), record, edm::JobReport::reportAnalysisFile(), cond::service::PoolDBOutputService::session(), and cond::service::PoolDBOutputService::tag().

64  {
65 
66  const DropBoxMetadata *metadata = 0;
67 
68  if(readFromDB) {
69  // Read the objects
71  eSetup.get<DropBoxMetadataRcd>().get(mdPayload);
72 
73  metadata = mdPayload.product();
74  }
75 
76  // get the PoolDBOutputService
78  if(poolDbService.isAvailable() ) {
80  if (jr.isAvailable()) {
81  // the filename is unique for all records
82  string filename = poolDbService->session().connectionString();
83 
84  // loop over all records
85  for(map<string, map<string, string> >::const_iterator recordAndMap = recordMap.begin();
86  recordAndMap != recordMap.end();
87  ++recordAndMap) {
88 
89  string record = (*recordAndMap).first;
90  // this is the map of metadata that we write in the JR
91  map<string, string> jrInfo = (*recordAndMap).second;
92  if(readFromDB) {
93  if(metadata->knowsRecord(record)) {
94  jrInfo = metadata->getRecordParameters(record).getParameterMap();
95  }
96  }
97  jrInfo["inputtag"] = poolDbService->tag(record);
98 
99 
100  // actually write in the job report
101  jr->reportAnalysisFile(filename, jrInfo);
102  }
103  }
104  }
105 }
const std::string & connectionString() const
Definition: DbSession.cc:169
JetCorrectorParameters::Record record
Definition: classes.h:13
bool knowsRecord(const std::string &record) const
void reportAnalysisFile(std::string const &fileName, std::map< std::string, std::string > const &fileData)
Definition: JobReport.cc:685
dictionary map
Definition: Association.py:205
std::string tag(const std::string &recordName)
const std::map< std::string, std::string > & getParameterMap() const
std::map< std::string, std::map< std::string, std::string > > recordMap
bool isAvailable() const
Definition: Service.h:47
const T & get() const
Definition: EventSetup.h:55
T const * product() const
Definition: ESHandle.h:62
tuple filename
Definition: lut2db_cfg.py:20
const Parameters & getRecordParameters(const std::string &record) const

Member Data Documentation

bool PCLMetadataWriter::readFromDB
private

Definition at line 41 of file PCLMetadataWriter.h.

std::map<std::string, std::map<std::string, std::string> > PCLMetadataWriter::recordMap
private

Definition at line 42 of file PCLMetadataWriter.h.