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 noexcept final
 
bool wantsGlobalRuns () const noexcept final
 
bool wantsInputProcessBlocks () const noexcept final
 
bool wantsProcessBlocks () const noexcept final
 
bool wantsStreamLuminosityBlocks () const noexcept final
 
bool wantsStreamRuns () const noexcept 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
 
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)
 

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 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_
 
edm::GetterOfProducts< DQMTokenlumigetter_
 
edm::GetterOfProducts< DQMTokenrungetter_
 
int runNumber_
 

Detailed Description

Definition at line 27 of file DQMFileSaverBase.h.

Member Typedef Documentation

◆ DQMStore

Definition at line 30 of file DQMFileSaverBase.h.

◆ MonitorElement

Definition at line 29 of file DQMFileSaverBase.h.

Constructor & Destructor Documentation

◆ DQMFileSaverBase()

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

Definition at line 31 of file DQMFileSaverBase.cc.

References edm::global::EDAnalyzerBase::callWhenNewProductsRegistered(), personalPlayback::fp, edm::ParameterSet::getUntrackedParameter(), initial_fp_, initial_fp_lock_, edm::InLumi, edm::InRun, lumigetter_, rungetter_, runNumber_, and AlCaHLTBitMon_QueryRunRegistry::string.

31  {
32  FileParameters fp;
33 
34  fp.path_ = ps.getUntrackedParameter<std::string>("path");
35  fp.producer_ = ps.getUntrackedParameter<std::string>("producer");
36  fp.run_ = 0;
37  fp.tag_ = ps.getUntrackedParameter<std::string>("tag");
38  fp.lumi_ = 0;
39  fp.version_ = 1;
40  fp.child_ = "";
41 
42  std::unique_lock<std::mutex> lck(initial_fp_lock_);
43  initial_fp_ = fp;
44 
45  runNumber_ = ps.getUntrackedParameter<int>("runNumber", 111);
46 
47  // This makes sure a file saver runs in a very end
51  this->lumigetter_(bd);
52  this->rungetter_(bd);
53  });
54 }
void callWhenNewProductsRegistered(std::function< void(BranchDescription const &)> const &func)
edm::GetterOfProducts< DQMToken > rungetter_
T getUntrackedParameter(std::string const &, T const &) const
FileParameters initial_fp_
edm::GetterOfProducts< DQMToken > lumigetter_

◆ ~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 69 of file DQMFileSaverBase.cc.

69  {
70  // not supported
71 }

◆ filename()

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

Definition at line 98 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().

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

◆ fillDescription()

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

Definition at line 145 of file DQMFileSaverBase.cc.

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

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

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

◆ globalBeginLuminosityBlock()

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

Definition at line 64 of file DQMFileSaverBase.cc.

65  {
66  return nullptr;
67 }

◆ globalBeginRun()

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

Definition at line 58 of file DQMFileSaverBase.cc.

References initRun().

58  {
59  this->initRun();
60 
61  return nullptr;
62 }
virtual void initRun() const

◆ globalEndLuminosityBlock()

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

Definition at line 73 of file DQMFileSaverBase.cc.

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

73  {
74  int ilumi = iLS.id().luminosityBlock();
75  int irun = iLS.id().run();
76 
77  std::unique_lock<std::mutex> lck(initial_fp_lock_);
78  FileParameters fp = initial_fp_;
79  lck.unlock();
80 
81  fp.lumi_ = ilumi;
82  fp.run_ = runNumber_ == 111 ? irun : runNumber_;
83 
84  this->saveLumi(fp);
85 }
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 87 of file DQMFileSaverBase.cc.

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

87  {
88  std::unique_lock<std::mutex> lck(initial_fp_lock_);
89  FileParameters fp = initial_fp_;
90  lck.unlock();
91 
92  fp.run_ = runNumber_ == 111 ? iRun.id().run() : runNumber_;
93 
94  // empty
95  this->saveRun(fp);
96 }
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 63 of file DQMFileSaverBase.h.

Referenced by globalBeginRun().

63 {};

◆ 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 129 of file DQMFileSaverBase.cc.

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

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

129  {
130  // Report the file to job report service.
132  if (jr.isAvailable()) {
133  std::map<std::string, std::string> info;
134  info["Source"] = "DQMStore";
135  info["FileClass"] = "DQM";
137  }
138 }
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:509
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 64 of file DQMFileSaverBase.h.

Referenced by globalEndLuminosityBlock().

64 {};

◆ saveRun()

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

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

Definition at line 65 of file DQMFileSaverBase.h.

Referenced by globalEndRun().

65 {};

Member Data Documentation

◆ initial_fp_

FileParameters dqm::DQMFileSaverBase::initial_fp_
protected

Definition at line 75 of file DQMFileSaverBase.h.

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

◆ initial_fp_lock_

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

Definition at line 74 of file DQMFileSaverBase.h.

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

◆ lumigetter_

edm::GetterOfProducts<DQMToken> dqm::DQMFileSaverBase::lumigetter_
protected

Definition at line 78 of file DQMFileSaverBase.h.

Referenced by DQMFileSaverBase().

◆ rungetter_

edm::GetterOfProducts<DQMToken> dqm::DQMFileSaverBase::rungetter_
protected

Definition at line 79 of file DQMFileSaverBase.h.

Referenced by DQMFileSaverBase().

◆ runNumber_

int dqm::DQMFileSaverBase::runNumber_
protected

Definition at line 76 of file DQMFileSaverBase.h.

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