CMS 3D CMS Logo

List of all members | Classes | Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Static Protected Member Functions | Protected Attributes
dqm::DQMFileSaverBase Class Reference

#include <DQMFileSaverBase.h>

Inheritance diagram for dqm::DQMFileSaverBase:
edm::global::EDAnalyzer< edm::RunCache< NoCache >, edm::LuminosityBlockCache< NoCache > > edm::global::EDAnalyzerBase edm::EDConsumerBase dqm::DQMFileSaverOnline dqm::DQMFileSaverPB

Classes

struct  FileParameters
 

Public Types

typedef dqm::legacy::DQMStore DQMStore
 
typedef dqm::legacy::MonitorElement MonitorElement
 
- Public Types inherited from edm::global::EDAnalyzerBase
typedef EDAnalyzerBase ModuleType
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 

Public Member Functions

 DQMFileSaverBase (const edm::ParameterSet &ps)
 
 ~DQMFileSaverBase () override
 
- Public Member Functions inherited from edm::global::EDAnalyzer< edm::RunCache< NoCache >, edm::LuminosityBlockCache< NoCache > >
 EDAnalyzer ()=default
 
 EDAnalyzer (const EDAnalyzer &)=delete
 
const EDAnalyzeroperator= (const EDAnalyzer &)=delete
 
bool wantsGlobalLuminosityBlocks () const final
 
bool wantsGlobalRuns () const final
 
bool wantsInputProcessBlocks () const final
 
bool wantsProcessBlocks () const final
 
bool wantsStreamLuminosityBlocks () const final
 
bool wantsStreamRuns () const final
 
- Public Member Functions inherited from edm::global::EDAnalyzerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzerBase ()
 
ModuleDescription const & moduleDescription () 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)
 

Static Public Member Functions

static void fillDescription (edm::ParameterSetDescription &d)
 
- Static Public Member Functions inherited from edm::global::EDAnalyzerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 

Protected Member Functions

void analyze (edm::StreamID, const edm::Event &e, const edm::EventSetup &) const final
 
std::shared_ptr< NoCacheglobalBeginLuminosityBlock (const edm::LuminosityBlock &, const edm::EventSetup &) const final
 
std::shared_ptr< NoCacheglobalBeginRun (const edm::Run &, const edm::EventSetup &) const final
 
void globalEndLuminosityBlock (const edm::LuminosityBlock &, const edm::EventSetup &) const final
 
void globalEndRun (const edm::Run &, const edm::EventSetup &) const final
 
virtual void initRun () const
 
void logFileAction (const std::string &msg, const std::string &fileName) const
 
void saveJobReport (const std::string &filename) const
 
virtual void saveLumi (const FileParameters &fp) const
 
virtual void saveRun (const FileParameters &fp) const
 
- 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)
 

Static Protected Member Functions

static const std::string filename (const FileParameters &fp, bool useLumi=false)
 

Protected Attributes

FileParameters initial_fp_
 
std::mutex initial_fp_lock_
 
int runNumber_
 

Detailed Description

Definition at line 23 of file DQMFileSaverBase.h.

Member Typedef Documentation

◆ DQMStore

Definition at line 26 of file DQMFileSaverBase.h.

◆ MonitorElement

Definition at line 25 of file DQMFileSaverBase.h.

Constructor & Destructor Documentation

◆ DQMFileSaverBase()

DQMFileSaverBase::DQMFileSaverBase ( const edm::ParameterSet ps)

Definition at line 29 of file DQMFileSaverBase.cc.

References personalPlayback::fp, edm::ParameterSet::getUntrackedParameter(), initial_fp_, initial_fp_lock_, runNumber_, and AlCaHLTBitMon_QueryRunRegistry::string.

29  {
30  FileParameters fp;
31 
32  fp.path_ = ps.getUntrackedParameter<std::string>("path");
33  fp.producer_ = ps.getUntrackedParameter<std::string>("producer");
34  fp.run_ = 0;
35  fp.tag_ = ps.getUntrackedParameter<std::string>("tag");
36  fp.lumi_ = 0;
37  fp.version_ = 1;
38  fp.child_ = "";
39 
40  std::unique_lock<std::mutex> lck(initial_fp_lock_);
41  initial_fp_ = fp;
42 
43  runNumber_ = ps.getUntrackedParameter<int>("runNumber", 111);
44 
45  // This makes sure a file saver runs in a very end
46  consumesMany<DQMToken, edm::InLumi>();
47  consumesMany<DQMToken, edm::InRun>();
48 }
T getUntrackedParameter(std::string const &, T const &) const
FileParameters initial_fp_

◆ ~DQMFileSaverBase()

DQMFileSaverBase::~DQMFileSaverBase ( )
overridedefault

Member Function Documentation

◆ analyze()

void DQMFileSaverBase::analyze ( edm::StreamID  ,
const edm::Event e,
const edm::EventSetup  
) const
finalprotectedvirtual

Implements edm::global::EDAnalyzerBase.

Definition at line 63 of file DQMFileSaverBase.cc.

63  {
64  // not supported
65 }

◆ filename()

const std::string DQMFileSaverBase::filename ( const FileParameters fp,
bool  useLumi = false 
)
staticprotected

Definition at line 92 of file DQMFileSaverBase.cc.

References visDQMUpload::buf, geometryDiff::file, personalPlayback::fp, compareTotals::fs, and castor_dqm_sourceclient_file_cfg::path.

Referenced by dqm::DQMFileSaverOnline::fillOrigin(), dqm::DQMFileSaverOnline::makeSnapshot(), saveJobReport(), and dqm::DQMFileSaverPB::savePB().

92  {
93  char buf[256];
94  if (useLumi) {
95  snprintf(buf,
96  256,
97  "%s_V%04d_%s_R%09ld_L%09ld%s",
98  fp.producer_.c_str(),
99  fp.version_,
100  fp.tag_.c_str(),
101  fp.run_,
102  fp.lumi_,
103  fp.child_.c_str());
104  } else {
105  snprintf(buf,
106  256,
107  "%s_V%04d_%s_R%09ld%s",
108  fp.producer_.c_str(),
109  fp.version_,
110  fp.tag_.c_str(),
111  fp.run_,
112  fp.child_.c_str());
113  }
114  buf[255] = 0;
115 
116  namespace fs = std::filesystem;
117  fs::path path(fp.path_);
118  fs::path file(buf);
119 
120  return (path / file).string();
121 }

◆ fillDescription()

void DQMFileSaverBase::fillDescription ( edm::ParameterSetDescription d)
static

Definition at line 139 of file DQMFileSaverBase.cc.

References submitPVResolutionJobs::desc, dqm::qstatus::STATUS_OK, and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by dqm::DQMFileSaverPB::fillDescriptions(), and dqm::DQMFileSaverOnline::fillDescriptions().

139  {
140  desc.addUntracked<std::string>("tag", "UNKNOWN")->setComment("File tag, DQM_V000_<TAG>*, usually a subsytem name.");
141 
142  desc.addUntracked<std::string>("producer", "DQM")
143  ->setComment("Base prefix for files, <BASE>_V000_**, either 'DQM' or 'Playback'.");
144 
145  desc.addUntracked<std::string>("referenceHandling", "all")->setComment("saveReference_, passed to the DQMStore");
146 
147  desc.addUntracked<int>("referenceRequireStatus", dqm::qstatus::STATUS_OK)
148  ->setComment("saveReference_, passed to the DQMStore");
149 
150  desc.addUntracked<std::string>("path", "./")->setComment("Output path prefix.");
151 
152  desc.addUntracked<int>("runNumber", 111)
153  ->setComment("Run number passed in the configuration. Will appear in output file names.");
154 }
static const int STATUS_OK

◆ globalBeginLuminosityBlock()

std::shared_ptr< NoCache > DQMFileSaverBase::globalBeginLuminosityBlock ( const edm::LuminosityBlock l,
const edm::EventSetup  
) const
finalprotected

Definition at line 58 of file DQMFileSaverBase.cc.

59  {
60  return nullptr;
61 }

◆ globalBeginRun()

std::shared_ptr< NoCache > DQMFileSaverBase::globalBeginRun ( const edm::Run r,
const edm::EventSetup  
) const
finalprotected

Definition at line 52 of file DQMFileSaverBase.cc.

References initRun().

52  {
53  this->initRun();
54 
55  return nullptr;
56 }
virtual void initRun() const

◆ globalEndLuminosityBlock()

void DQMFileSaverBase::globalEndLuminosityBlock ( const edm::LuminosityBlock iLS,
const edm::EventSetup  
) const
finalprotected

Definition at line 67 of file DQMFileSaverBase.cc.

References personalPlayback::fp, edm::LuminosityBlockBase::id(), initial_fp_, initial_fp_lock_, edm::LuminosityBlockID::luminosityBlock(), edm::LuminosityBlockID::run(), runNumber_, and saveLumi().

67  {
68  int ilumi = iLS.id().luminosityBlock();
69  int irun = iLS.id().run();
70 
71  std::unique_lock<std::mutex> lck(initial_fp_lock_);
72  FileParameters fp = initial_fp_;
73  lck.unlock();
74 
75  fp.lumi_ = ilumi;
76  fp.run_ = runNumber_ == 111 ? irun : runNumber_;
77 
78  this->saveLumi(fp);
79 }
LuminosityBlockNumber_t luminosityBlock() const
virtual void saveLumi(const FileParameters &fp) const
RunNumber_t run() const
LuminosityBlockID id() const
FileParameters initial_fp_

◆ globalEndRun()

void DQMFileSaverBase::globalEndRun ( const edm::Run iRun,
const edm::EventSetup  
) const
finalprotected

Definition at line 81 of file DQMFileSaverBase.cc.

References personalPlayback::fp, edm::RunBase::id(), initial_fp_, initial_fp_lock_, edm::RunID::run(), runNumber_, and saveRun().

81  {
82  std::unique_lock<std::mutex> lck(initial_fp_lock_);
83  FileParameters fp = initial_fp_;
84  lck.unlock();
85 
86  fp.run_ = runNumber_ == 111 ? iRun.id().run() : runNumber_;
87 
88  // empty
89  this->saveRun(fp);
90 }
virtual void saveRun(const FileParameters &fp) const
RunID const & id() const
Definition: RunBase.h:39
FileParameters initial_fp_
RunNumber_t run() const
Definition: RunID.h:26

◆ initRun()

virtual void dqm::DQMFileSaverBase::initRun ( ) const
inlineprotectedvirtual

Reimplemented in dqm::DQMFileSaverPB.

Definition at line 59 of file DQMFileSaverBase.h.

Referenced by globalBeginRun().

59 {};

◆ logFileAction()

void DQMFileSaverBase::logFileAction ( const std::string &  msg,
const std::string &  fileName 
) const
protected

◆ saveJobReport()

void DQMFileSaverBase::saveJobReport ( const std::string &  filename) const
protected

Definition at line 123 of file DQMFileSaverBase.cc.

References filename(), info(), edm::Service< T >::isAvailable(), and edm::JobReport::reportAnalysisFile().

Referenced by dqm::DQMFileSaverOnline::makeSnapshot().

123  {
124  // Report the file to job report service.
126  if (jr.isAvailable()) {
127  std::map<std::string, std::string> info;
128  info["Source"] = "DQMStore";
129  info["FileClass"] = "DQM";
131  }
132 }
static const TGPicture * info(bool iBackgroundIsBlack)
static const std::string filename(const FileParameters &fp, bool useLumi=false)
void reportAnalysisFile(std::string const &fileName, std::map< std::string, std::string > const &fileData)
Definition: JobReport.cc:486
bool isAvailable() const
Definition: Service.h:40

◆ saveLumi()

virtual void dqm::DQMFileSaverBase::saveLumi ( const FileParameters fp) const
inlineprotectedvirtual

Reimplemented in dqm::DQMFileSaverPB, and dqm::DQMFileSaverOnline.

Definition at line 60 of file DQMFileSaverBase.h.

Referenced by globalEndLuminosityBlock().

60 {};

◆ saveRun()

virtual void dqm::DQMFileSaverBase::saveRun ( const FileParameters fp) const
inlineprotectedvirtual

Reimplemented in dqm::DQMFileSaverPB, and dqm::DQMFileSaverOnline.

Definition at line 61 of file DQMFileSaverBase.h.

Referenced by globalEndRun().

61 {};

Member Data Documentation

◆ initial_fp_

FileParameters dqm::DQMFileSaverBase::initial_fp_
protected

Definition at line 71 of file DQMFileSaverBase.h.

Referenced by DQMFileSaverBase(), globalEndLuminosityBlock(), and globalEndRun().

◆ initial_fp_lock_

std::mutex dqm::DQMFileSaverBase::initial_fp_lock_
mutableprotected

Definition at line 70 of file DQMFileSaverBase.h.

Referenced by DQMFileSaverBase(), globalEndLuminosityBlock(), and globalEndRun().

◆ runNumber_

int dqm::DQMFileSaverBase::runNumber_
protected

Definition at line 72 of file DQMFileSaverBase.h.

Referenced by DQMFileSaverBase(), globalEndLuminosityBlock(), and globalEndRun().