CMS 3D CMS Logo

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules 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

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 ()
 
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 &&)=default
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
ESProxyIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
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
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProxyIndices const &)
 
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
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (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 ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 

Detailed Description

No description available.

Author
G. Cerminara - CERN

Definition at line 18 of file PCLMetadataWriter.h.

Constructor & Destructor Documentation

◆ PCLMetadataWriter()

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

Constructor.

Definition at line 25 of file PCLMetadataWriter.cc.

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

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

◆ ~PCLMetadataWriter()

PCLMetadataWriter::~PCLMetadataWriter ( )
override

Destructor.

Definition at line 51 of file PCLMetadataWriter.cc.

51 {}

Member Function Documentation

◆ analyze()

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

Implements edm::EDAnalyzer.

Definition at line 53 of file PCLMetadataWriter.cc.

53 {}

◆ beginRun()

void PCLMetadataWriter::beginRun ( const edm::Run run,
const edm::EventSetup eSetup 
)
overridevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 55 of file PCLMetadataWriter.cc.

55 {}

◆ endRun()

void PCLMetadataWriter::endRun ( const edm::Run run,
const edm::EventSetup eSetup 
)
overridevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 57 of file PCLMetadataWriter.cc.

57  {
58  const DropBoxMetadata *metadata = nullptr;
59 
60  if (readFromDB) {
61  // Read the objects
63  eSetup.get<DropBoxMetadataRcd>().get(mdPayload);
64 
65  metadata = mdPayload.product();
66  }
67 
68  // get the PoolDBOutputService
70  if (poolDbService.isAvailable()) {
72  if (jr.isAvailable()) {
73  // the filename is unique for all records
74  string filename = poolDbService->session().connectionString();
75 
76  // loop over all records
77  for (map<string, map<string, string>>::const_iterator recordAndMap = recordMap.begin();
78  recordAndMap != recordMap.end();
79  ++recordAndMap) {
80  string record = (*recordAndMap).first;
81 
82  // this is the map of metadata that we write in the JR
83  map<string, string> jrInfo = (*recordAndMap).second;
84  if (readFromDB) {
85  if (metadata->knowsRecord(record)) {
86  jrInfo = metadata->getRecordParameters(record).getParameterMap();
87  }
88  }
89 
90  // name of the the input tag in the metadata for the condUploader
91  // metadata needs to be the same as the tag written out by the
92  // harvesting step
93  jrInfo["inputtag"] = poolDbService->tag(record);
94 
95  // actually write in the job report
96  jr->reportAnalysisFile(filename, jrInfo);
97  }
98  }
99  }
100 }

References cond::persistency::Session::connectionString(), corrVsCorr::filename, edm::EventSetup::get(), get, edm::Service< T >::isAvailable(), genParticles_cff::map, TrackingMonitor_cfi::metadata, edm::ESHandle< T >::product(), GlobalPosition_Frontier_DevDB_cff::record, edm::JobReport::reportAnalysisFile(), cond::service::PoolDBOutputService::session(), and cond::service::PoolDBOutputService::tag().

Member Data Documentation

◆ readFromDB

bool PCLMetadataWriter::readFromDB
private

Definition at line 38 of file PCLMetadataWriter.h.

◆ recordMap

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

Definition at line 39 of file PCLMetadataWriter.h.

edm::ESHandle::product
T const * product() const
Definition: ESHandle.h:86
cond::service::PoolDBOutputService::tag
std::string tag(const std::string &recordName)
Definition: PoolDBOutputService.cc:96
PCLMetadataWriter::readFromDB
bool readFromDB
Definition: PCLMetadataWriter.h:38
edm::JobReport::reportAnalysisFile
void reportAnalysisFile(std::string const &fileName, std::map< std::string, std::string > const &fileData)
Definition: JobReport.cc:473
GlobalPosition_Frontier_DevDB_cff.record
record
Definition: GlobalPosition_Frontier_DevDB_cff.py:10
edm::Service::isAvailable
bool isAvailable() const
Definition: Service.h:40
edm::EventSetup::get
T get() const
Definition: EventSetup.h:73
cond::service::PoolDBOutputService::session
cond::persistency::Session session() const
Definition: PoolDBOutputService.cc:94
edm::ESHandle
Definition: DTSurvey.h:22
corrVsCorr.filename
filename
Definition: corrVsCorr.py:123
TrackingMonitor_cfi.metadata
metadata
Definition: TrackingMonitor_cfi.py:71
PCLMetadataWriter::recordMap
std::map< std::string, std::map< std::string, std::string > > recordMap
Definition: PCLMetadataWriter.h:39
cond::persistency::Session::connectionString
std::string connectionString()
Definition: Session.cc:216
edm::Service< cond::service::PoolDBOutputService >
DropBoxMetadata
Definition: DropBoxMetadata.h:17
get
#define get
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
DropBoxMetadataRcd
Definition: DropBoxMetadataRcd.h:24
genParticles_cff.map
map
Definition: genParticles_cff.py:11
crabWrapper.key
key
Definition: crabWrapper.py:19