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::WatchRuns > 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 &) override
 
void endRun (const edm::Run &, const edm::EventSetup &) override
 
 PCLMetadataWriter (const edm::ParameterSet &)
 Constructor. More...
 
 ~PCLMetadataWriter () override=default
 Destructor. More...
 
- Public Member Functions inherited from edm::one::EDAnalyzer< edm::one::WatchRuns >
 EDAnalyzer ()=default
 
 EDAnalyzer (const EDAnalyzer &)=delete
 
SerialTaskQueueglobalLuminosityBlocksQueue () final
 
SerialTaskQueueglobalRunsQueue () final
 
const EDAnalyzeroperator= (const EDAnalyzer &)=delete
 
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 const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
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
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void selectInputProcessBlocks (ProductRegistry const &productRegistry, ProcessBlockHelperBase const &processBlockHelperBase)
 
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
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
template<BranchType B = InEvent>
EDConsumerBaseAdaptor< Bconsumes (edm::InputTag tag) noexcept
 
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 ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
template<Transition Tr = Transition::Event>
constexpr auto esConsumes ()
 
template<Transition Tr = Transition::Event>
auto esConsumes (ESInputTag tag)
 
template<Transition Tr = Transition::Event>
ESGetTokenGeneric esConsumes (eventsetup::EventSetupRecordKey const &iRecord, eventsetup::DataKey const &iKey)
 Used with EventSetupRecord::doGet. More...
 
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)
 
void resetItemsToGetFrom (BranchType iType)
 

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.

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

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 }
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
const edm::ESGetToken< DropBoxMetadata, DropBoxMetadataRcd > dropBoxToken_
std::map< std::string, std::map< std::string, std::string > > 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 
)
override

Definition at line 73 of file PCLMetadataWriter.cc.

73 {}

◆ endRun()

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

Definition at line 75 of file PCLMetadataWriter.cc.

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

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 }
const edm::ESGetToken< DropBoxMetadata, DropBoxMetadataRcd > dropBoxToken_
std::string tag(const std::string &recordName)
std::map< std::string, std::map< std::string, std::string > > recordMap
bool getData(T &iHolder) const
Definition: EventSetup.h:122
std::string connectionString()
Definition: Session.cc:216
void reportAnalysisFile(std::string const &fileName, std::map< std::string, std::string > const &fileData)
Definition: JobReport.cc:473
bool isAvailable() const
Definition: Service.h:40
cond::persistency::Session session() const

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().