CMS 3D CMS Logo

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

void analyze (const edm::Event &, const edm::EventSetup &) override
 
void beginRun (const edm::Run &, const edm::EventSetup &) override
 
void endRun (const edm::Run &, const edm::EventSetup &) override
 
 PCLMetadataWriter (const edm::ParameterSet &)
 Constructor. More...
 
 ~PCLMetadataWriter () override
 Destructor. More...
 
- 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
 
 ~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 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
 
- 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

No description available.

Author
G. Cerminara - CERN

Definition at line 19 of file PCLMetadataWriter.h.

Constructor & Destructor Documentation

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

Constructor.

Definition at line 25 of file PCLMetadataWriter.cc.

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

25  {
26 
27  readFromDB = pSet.getParameter<bool>("readFromDB");
28 
29 
30  vector<ParameterSet> recordsToMap = pSet.getParameter<vector<ParameterSet> >("recordsToMap");
31  for(vector<ParameterSet>::const_iterator recordPset = recordsToMap.begin();
32  recordPset != recordsToMap.end();
33  ++recordPset) {
34 
35  // record is the key which identifies one set of metadata in DropBoxMetadataRcd
36  // (not necessarily a record in the strict framework sense)
37  string record = (*recordPset).getUntrackedParameter<string>("record");
38 
39  map<string, string> jrInfo;
40  if(!readFromDB) {
41  vector<string> paramKeys = (*recordPset).getParameterNames();
42  for(vector<string>::const_iterator key = paramKeys.begin();
43  key != paramKeys.end();
44  ++key) {
45  jrInfo["Source"] = "AlcaHarvesting";
46  jrInfo["FileClass"] = "ALCA";
47  if(*key != "record") {
48  jrInfo[*key] = (*recordPset).getUntrackedParameter<string>(*key);
49  }
50  }
51  }
52  recordMap[record] = jrInfo;
53 
54  }
55 
56 }
T getParameter(std::string const &) const
JetCorrectorParameters::Record record
Definition: classes.h:7
std::map< std::string, std::map< std::string, std::string > > recordMap
PCLMetadataWriter::~PCLMetadataWriter ( )
override

Destructor.

Definition at line 58 of file PCLMetadataWriter.cc.

58 {}

Member Function Documentation

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

Definition at line 61 of file PCLMetadataWriter.cc.

61 {}
void PCLMetadataWriter::beginRun ( const edm::Run run,
const edm::EventSetup eSetup 
)
override

Definition at line 64 of file PCLMetadataWriter.cc.

64 {}
void PCLMetadataWriter::endRun ( const edm::Run run,
const edm::EventSetup eSetup 
)
override

Definition at line 66 of file PCLMetadataWriter.cc.

References cond::persistency::Session::connectionString(), DEFINE_FWK_MODULE, corrVsCorr::filename, edm::EventSetup::get(), DropBoxMetadata::Parameters::getParameterMap(), DropBoxMetadata::getRecordParameters(), edm::Service< T >::isAvailable(), DropBoxMetadata::knowsRecord(), genParticles_cff::map, edm::ESHandle< T >::product(), record, edm::JobReport::reportAnalysisFile(), cond::service::PoolDBOutputService::session(), and cond::service::PoolDBOutputService::tag().

66  {
67 
68  const DropBoxMetadata *metadata = nullptr;
69 
70  if(readFromDB) {
71  // Read the objects
73  eSetup.get<DropBoxMetadataRcd>().get(mdPayload);
74 
75  metadata = mdPayload.product();
76  }
77 
78  // get the PoolDBOutputService
80  if(poolDbService.isAvailable() ) {
82  if (jr.isAvailable()) {
83  // the filename is unique for all records
84  string filename = poolDbService->session().connectionString();
85 
86  // loop over all records
87  for(map<string, map<string, string> >::const_iterator recordAndMap = recordMap.begin();
88  recordAndMap != recordMap.end();
89  ++recordAndMap) {
90 
91  string record = (*recordAndMap).first;
92 
93  // this is the map of metadata that we write in the JR
94  map<string, string> jrInfo = (*recordAndMap).second;
95  if(readFromDB) {
96  if(metadata->knowsRecord(record)) {
97  jrInfo = metadata->getRecordParameters(record).getParameterMap();
98  }
99  }
100 
101  // name of the the input tag in the metadata for the condUploader metadata
102  // needs to be the same as the tag written out by the harvesting step
103  jrInfo["inputtag"] = poolDbService->tag(record);
104 
105  // actually write in the job report
106  jr->reportAnalysisFile(filename, jrInfo);
107 
108  }
109  }
110  }
111 }
JetCorrectorParameters::Record record
Definition: classes.h:7
bool knowsRecord(const std::string &record) const
cond::persistency::Session session() const
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:46
std::string connectionString()
Definition: Session.cc:224
const T & get() const
Definition: EventSetup.h:58
void reportAnalysisFile(std::string const &fileName, std::map< std::string, std::string > const &fileData)
Definition: JobReport.cc:507
const Parameters & getRecordParameters(const std::string &record) const
T const * product() const
Definition: ESHandle.h:86

Member Data Documentation

bool PCLMetadataWriter::readFromDB
private

Definition at line 39 of file PCLMetadataWriter.h.

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

Definition at line 40 of file PCLMetadataWriter.h.