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 noexcept final
 
bool wantsGlobalRuns () const noexcept final
 
bool wantsInputProcessBlocks () const noexcept final
 
bool wantsProcessBlocks () const noexcept 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 noexcept
 
bool wantsStreamRuns () const noexcept
 
 ~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
 
ESResolverIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
std::vector< ESResolverIndex > 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
 
void selectInputProcessBlocks (ProductRegistry const &productRegistry, ProcessBlockHelperBase const &processBlockHelperBase)
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProductResolverIndices 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 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 23 of file PCLMetadataWriter.cc.

Constructor & Destructor Documentation

◆ PCLMetadataWriter()

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

Constructor.

Definition at line 46 of file PCLMetadataWriter.cc.

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

47  : dropBoxToken_(esConsumes<DropBoxMetadata, DropBoxMetadataRcd, edm::Transition::EndRun>()) {
48  readFromDB = pSet.getParameter<bool>("readFromDB");
49 
50  vector<ParameterSet> recordsToMap = pSet.getParameter<vector<ParameterSet>>("recordsToMap");
51  for (const auto &recordPset : recordsToMap) {
52  // record is the key which identifies one set of metadata in
53  // DropBoxMetadataRcd (not necessarily a record in the strict framework
54  // sense)
55  string record = recordPset.getUntrackedParameter<string>("record");
56 
57  map<string, string> jrInfo;
58  if (!readFromDB) {
59  vector<string> paramKeys = recordPset.getParameterNames();
60  for (const auto &key : paramKeys) {
61  jrInfo["Source"] = "AlcaHarvesting";
62  jrInfo["FileClass"] = "ALCA";
63  if (key != "record") {
64  jrInfo[key] = recordPset.getUntrackedParameter<string>(key);
65  }
66  }
67  }
68  recordMap[record] = jrInfo;
69  }
70 }
T getParameter(std::string const &) const
Definition: ParameterSet.h:307
const edm::ESGetToken< DropBoxMetadata, DropBoxMetadataRcd > dropBoxToken_
std::map< std::string, std::map< std::string, std::string > > recordMap
key
prepare the HTCondor submission files and eventually submit them

◆ ~PCLMetadataWriter()

PCLMetadataWriter::~PCLMetadataWriter ( )
overridedefault

Destructor.

Member Function Documentation

◆ analyze()

void PCLMetadataWriter::analyze ( const edm::Event ,
const edm::EventSetup  
)
inlineoverridevirtual

Implements edm::one::EDAnalyzerBase.

Definition at line 32 of file PCLMetadataWriter.cc.

32 {};

◆ beginRun()

void PCLMetadataWriter::beginRun ( const edm::Run ,
const edm::EventSetup  
)
inlineoverride

Definition at line 33 of file PCLMetadataWriter.cc.

33 {};

◆ endRun()

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

Definition at line 72 of file PCLMetadataWriter.cc.

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

72  {
73  const DropBoxMetadata *metadata = nullptr;
74 
75  if (readFromDB) {
76  // Read the objects
77  metadata = &eSetup.getData(dropBoxToken_);
78  }
79 
80  // get the PoolDBOutputService
82  if (poolDbService.isAvailable()) {
84  if (jr.isAvailable()) {
85  // the filename is unique for all records
86  string filename = poolDbService->session().connectionString();
87 
88  // loop over all records
89  for (const auto &recordAndMap : recordMap) {
90  string record = recordAndMap.first;
91 
92  // this is the map of metadata that we write in the JR
93  map<string, string> jrInfo = recordAndMap.second;
94  if (readFromDB) {
95  if (metadata->knowsRecord(record)) {
96  jrInfo = metadata->getRecordParameters(record).getParameterMap();
97  }
98  }
99 
100  // name of the the input tag in the metadata for the condUploader
101  // metadata needs to be the same as the tag written out by the
102  // 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 }
T const & getData(const ESGetToken< T, R > &iToken) const noexcept(false)
Definition: EventSetup.h:119
const edm::ESGetToken< DropBoxMetadata, DropBoxMetadataRcd > dropBoxToken_
std::string tag(const std::string &recordName)
std::map< std::string, std::map< std::string, std::string > > recordMap
std::string connectionString()
Definition: Session.cc:216
void reportAnalysisFile(std::string const &fileName, std::map< std::string, std::string > const &fileData)
Definition: JobReport.cc:509
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 38 of file PCLMetadataWriter.cc.

Referenced by endRun().

◆ readFromDB

bool PCLMetadataWriter::readFromDB
private

Definition at line 39 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 40 of file PCLMetadataWriter.cc.

Referenced by endRun(), and PCLMetadataWriter().