CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
PCLMetadataWriter Class Reference
Inheritance diagram for PCLMetadataWriter:
edm::one::EDAnalyzer<> edm::one::EDAnalyzerBase edm::EDConsumerBase

Public Member Functions

void analyze (const edm::Event &, const edm::EventSetup &) override
 
void beginRun (const edm::Run &, const edm::EventSetup &)
 
void endRun (const edm::Run &, const edm::EventSetup &)
 
 PCLMetadataWriter (const edm::ParameterSet &)
 Constructor. More...
 
 ~PCLMetadataWriter () override=default
 Destructor. More...
 
- Public Member Functions inherited from edm::one::EDAnalyzer<>
 EDAnalyzer ()=default
 
SerialTaskQueueglobalLuminosityBlocksQueue () final
 
SerialTaskQueueglobalRunsQueue () final
 
bool wantsGlobalLuminosityBlocks () const final
 
bool wantsGlobalRuns () const final
 
bool wantsInputProcessBlocks () const final
 
bool wantsProcessBlocks () const final
 
- Public Member Functions inherited from edm::one::EDAnalyzerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzerBase ()
 
ModuleDescription const & moduleDescription () const
 
bool wantsStreamLuminosityBlocks () const
 
bool wantsStreamRuns () const
 
 ~EDAnalyzerBase () 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
 
std::vector< ESProxyIndex > const & esGetTokenIndicesVector (edm::Transition iTrans) const
 
std::vector< ESRecordIndex > const & esGetTokenRecordIndicesVector (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::array< std::vector< ModuleDescription const * > *, NumBranchTypes > &modulesAll, std::vector< ModuleProcessName > &modulesInPreviousProcesses, 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

const edm::ESGetToken< DropBoxMetadata, DropBoxMetadataRcddropBoxToken_
 
bool readFromDB
 
std::map< std::string, std::map< std::string, std::string > > recordMap
 

Additional Inherited Members

- Public Types inherited from edm::one::EDAnalyzerBase
typedef EDAnalyzerBase ModuleType
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Static Public Member Functions inherited from edm::one::EDAnalyzerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- 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 = InEvent>
EDConsumerBaseAdaptor< B > consumes (edm::InputTag tag) noexcept
 
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<Transition Tr = Transition::Event>
constexpr auto esConsumes () noexcept
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
template<Transition Tr = Transition::Event>
auto esConsumes (ESInputTag tag) noexcept
 
template<Transition Tr = Transition::Event>
ESGetTokenGeneric esConsumes (eventsetup::EventSetupRecordKey const &iRecord, eventsetup::DataKey const &iKey)
 Used with EventSetupRecord::doGet. More...
 
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 21 of file PCLMetadataWriter.cc.

Constructor & Destructor Documentation

◆ PCLMetadataWriter()

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

Constructor.

Definition at line 44 of file PCLMetadataWriter.cc.

45  : dropBoxToken_(esConsumes<DropBoxMetadata, DropBoxMetadataRcd, edm::Transition::EndRun>()) {
46  readFromDB = pSet.getParameter<bool>("readFromDB");
47 
48  vector<ParameterSet> recordsToMap = pSet.getParameter<vector<ParameterSet>>("recordsToMap");
49  for (vector<ParameterSet>::const_iterator recordPset = recordsToMap.begin(); recordPset != recordsToMap.end();
50  ++recordPset) {
51  // record is the key which identifies one set of metadata in
52  // DropBoxMetadataRcd (not necessarily a record in the strict framework
53  // sense)
54  string record = (*recordPset).getUntrackedParameter<string>("record");
55 
56  map<string, string> jrInfo;
57  if (!readFromDB) {
58  vector<string> paramKeys = (*recordPset).getParameterNames();
59  for (vector<string>::const_iterator key = paramKeys.begin(); key != paramKeys.end(); ++key) {
60  jrInfo["Source"] = "AlcaHarvesting";
61  jrInfo["FileClass"] = "ALCA";
62  if (*key != "record") {
63  jrInfo[*key] = (*recordPset).getUntrackedParameter<string>(*key);
64  }
65  }
66  }
67  recordMap[record] = jrInfo;
68  }
69 }

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

◆ ~PCLMetadataWriter()

PCLMetadataWriter::~PCLMetadataWriter ( )
overridedefault

Destructor.

Member Function Documentation

◆ analyze()

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

Implements edm::one::EDAnalyzerBase.

Definition at line 71 of file PCLMetadataWriter.cc.

71 {}

◆ beginRun()

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

Definition at line 73 of file PCLMetadataWriter.cc.

73 {}

◆ endRun()

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

Definition at line 75 of file PCLMetadataWriter.cc.

75  {
76  const DropBoxMetadata *metadata = nullptr;
77 
78  if (readFromDB) {
79  // Read the objects
80  metadata = &eSetup.getData(dropBoxToken_);
81  }
82 
83  // get the PoolDBOutputService
85  if (poolDbService.isAvailable()) {
87  if (jr.isAvailable()) {
88  // the filename is unique for all records
89  string filename = poolDbService->session().connectionString();
90 
91  // loop over all records
92  for (map<string, map<string, string>>::const_iterator recordAndMap = recordMap.begin();
93  recordAndMap != recordMap.end();
94  ++recordAndMap) {
95  string record = (*recordAndMap).first;
96 
97  // this is the map of metadata that we write in the JR
98  map<string, string> jrInfo = (*recordAndMap).second;
99  if (readFromDB) {
100  if (metadata->knowsRecord(record)) {
101  jrInfo = metadata->getRecordParameters(record).getParameterMap();
102  }
103  }
104 
105  // name of the the input tag in the metadata for the condUploader
106  // metadata needs to be the same as the tag written out by the
107  // harvesting step
108  jrInfo["inputtag"] = poolDbService->tag(record);
109 
110  // actually write in the job report
111  jr->reportAnalysisFile(filename, jrInfo);
112  }
113  }
114  }
115 }

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

Member Data Documentation

◆ dropBoxToken_

const edm::ESGetToken<DropBoxMetadata, DropBoxMetadataRcd> PCLMetadataWriter::dropBoxToken_
private

Definition at line 36 of file PCLMetadataWriter.cc.

Referenced by endRun().

◆ readFromDB

bool PCLMetadataWriter::readFromDB
private

Definition at line 37 of file PCLMetadataWriter.cc.

Referenced by endRun(), and PCLMetadataWriter().

◆ recordMap

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

Definition at line 38 of file PCLMetadataWriter.cc.

Referenced by endRun(), and PCLMetadataWriter().

cond::service::PoolDBOutputService::tag
std::string tag(const std::string &recordName)
Definition: PoolDBOutputService.cc:124
PCLMetadataWriter::readFromDB
bool readFromDB
Definition: PCLMetadataWriter.cc:37
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
cond::service::PoolDBOutputService::session
cond::persistency::Session session() const
Definition: PoolDBOutputService.cc:92
corrVsCorr.filename
filename
Definition: corrVsCorr.py:123
TrackingMonitor_cfi.metadata
metadata
Definition: TrackingMonitor_cfi.py:71
PCLMetadataWriter::dropBoxToken_
const edm::ESGetToken< DropBoxMetadata, DropBoxMetadataRcd > dropBoxToken_
Definition: PCLMetadataWriter.cc:36
PCLMetadataWriter::recordMap
std::map< std::string, std::map< std::string, std::string > > recordMap
Definition: PCLMetadataWriter.cc:38
cond::persistency::Session::connectionString
std::string connectionString()
Definition: Session.cc:216
edm::Service< cond::service::PoolDBOutputService >
DropBoxMetadata
Definition: DropBoxMetadata.h:17
edm::EventSetup::getData
bool getData(T &iHolder) const
Definition: EventSetup.h:127
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
genParticles_cff.map
map
Definition: genParticles_cff.py:11
crabWrapper.key
key
Definition: crabWrapper.py:19