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
 
bool wantsGlobalLuminosityBlocks () const final
 
bool wantsGlobalRuns () 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
 
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::vector< ModuleDescription const * > &modules, 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
 
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)
 
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<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)
 

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_
 

Detailed Description

Definition at line 23 of file DQMFileSaverBase.h.

Member Typedef Documentation

Definition at line 26 of file DQMFileSaverBase.h.

Definition at line 25 of file DQMFileSaverBase.h.

Constructor & Destructor Documentation

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

Definition at line 27 of file DQMFileSaverBase.cc.

References beam_dqm_sourceclient-live_cfg::cerr, dqm::DQMFileSaverBase::FileParameters::child_, personalPlayback::fp, edm::ParameterSet::getUntrackedParameter(), initial_fp_, initial_fp_lock_, dqm::DQMFileSaverBase::FileParameters::lumi_, dqm::DQMFileSaverBase::FileParameters::path_, dqm::DQMFileSaverBase::FileParameters::producer_, dqm::DQMFileSaverBase::FileParameters::run_, dqm::DQMFileSaverBase::FileParameters::saveReference_, dqm::DQMFileSaverBase::FileParameters::saveReferenceQMin_, dqm::dqmstoreimpl::DQMStore::SaveWithoutReference, dqm::dqmstoreimpl::DQMStore::SaveWithReference, dqm::dqmstoreimpl::DQMStore::SaveWithReferenceForQTest, dqm::qstatus::STATUS_OK, AlCaHLTBitMon_QueryRunRegistry::string, dqm::DQMFileSaverBase::FileParameters::tag_, dqm::DQMFileSaverBase::FileParameters::version_, and ~DQMFileSaverBase().

27  {
28  FileParameters fp;
29 
30  fp.path_ = ps.getUntrackedParameter<std::string>("path");
31  fp.producer_ = ps.getUntrackedParameter<std::string>("producer");
32  fp.run_ = 0;
33  fp.tag_ = ps.getUntrackedParameter<std::string>("tag");
34  fp.lumi_ = 0;
35  fp.version_ = 1;
36  fp.child_ = "";
37 
38  fp.saveReference_ = DQMStore::SaveWithReference;
39  // Check how we should save the references.
40  std::string refsave = ps.getUntrackedParameter<std::string>("referenceHandling", "all");
41  if (refsave == "skip") {
42  fp.saveReference_ = DQMStore::SaveWithoutReference;
43  } else if (refsave == "all") {
44  fp.saveReference_ = DQMStore::SaveWithReference;
45  } else if (refsave == "qtests") {
46  fp.saveReference_ = DQMStore::SaveWithReferenceForQTest;
47  } else {
48  //edm::LogInfo("DQMFileSaverBase")
49  std::cerr << "Invalid 'referenceHandling' parameter '" << refsave << "'. Expected 'skip', 'all' or 'qtests'.";
50  }
51 
52  // Check minimum required quality test result for which reference is saved.
53  fp.saveReferenceQMin_ = ps.getUntrackedParameter<int>("referenceRequireStatus", dqm::qstatus::STATUS_OK);
54 
55  std::unique_lock<std::mutex> lck(initial_fp_lock_);
56  initial_fp_ = fp;
57 }
T getUntrackedParameter(std::string const &, T const &) const
FileParameters initial_fp_
static const int STATUS_OK
DQMFileSaverBase::~DQMFileSaverBase ( )
overridedefault

Referenced by DQMFileSaverBase().

Member Function Documentation

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

Definition at line 72 of file DQMFileSaverBase.cc.

72  {
73  // not supported
74 }
const std::string DQMFileSaverBase::filename ( const FileParameters fp,
bool  useLumi = false 
)
staticprotected

Definition at line 104 of file DQMFileSaverBase.cc.

References dqm::DQMFileSaverBase::FileParameters::child_, FrontierConditions_GlobalTag_cff::file, dqm::DQMFileSaverBase::FileParameters::lumi_, castor_dqm_sourceclient_file_cfg::path, dqm::DQMFileSaverBase::FileParameters::path_, dqm::DQMFileSaverBase::FileParameters::producer_, dqm::DQMFileSaverBase::FileParameters::run_, dqm::DQMFileSaverBase::FileParameters::tag_, and dqm::DQMFileSaverBase::FileParameters::version_.

Referenced by dqm::DQMFileSaverOnline::makeSnapshot(), and Vispa.Plugins.ConfigEditor.ConfigDataAccessor.ConfigDataAccessor::properties().

104  {
105  char buf[256];
106  if (useLumi) {
107  snprintf(buf,
108  256,
109  "%s_V%04d_%s_R%09ld_L%09ld%s",
110  fp.producer_.c_str(),
111  fp.version_,
112  fp.tag_.c_str(),
113  fp.run_,
114  fp.lumi_,
115  fp.child_.c_str());
116  } else {
117  snprintf(buf,
118  256,
119  "%s_V%04d_%s_R%09ld%s",
120  fp.producer_.c_str(),
121  fp.version_,
122  fp.tag_.c_str(),
123  fp.run_,
124  fp.child_.c_str());
125  }
126  buf[255] = 0;
127 
128  namespace fs = boost::filesystem;
129  fs::path path(fp.path_);
130  fs::path file(buf);
131 
132  return (path / file).string();
133 }
void DQMFileSaverBase::fillDescription ( edm::ParameterSetDescription d)
static

Definition at line 151 of file DQMFileSaverBase.cc.

References edm::ParameterSetDescription::addUntracked(), dqm::qstatus::STATUS_OK, and AlCaHLTBitMon_QueryRunRegistry::string.

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

151  {
152  desc.addUntracked<std::string>("tag", "UNKNOWN")->setComment("File tag, DQM_V000_<TAG>*, usually a subsytem name.");
153 
154  desc.addUntracked<std::string>("producer", "DQM")
155  ->setComment("Base prefix for files, <BASE>_V000_**, either 'DQM' or 'Playback'.");
156 
157  desc.addUntracked<std::string>("referenceHandling", "all")->setComment("saveReference_, passed to the DQMStore");
158 
159  desc.addUntracked<int>("referenceRequireStatus", dqm::qstatus::STATUS_OK)
160  ->setComment("saveReference_, passed to the DQMStore");
161 
162  desc.addUntracked<std::string>("path", "./")->setComment("Output path prefix.");
163 }
static const int STATUS_OK
std::shared_ptr< NoCache > DQMFileSaverBase::globalBeginLuminosityBlock ( const edm::LuminosityBlock l,
const edm::EventSetup  
) const
finalprotected

Definition at line 67 of file DQMFileSaverBase.cc.

68  {
69  return nullptr;
70 }
std::shared_ptr< NoCache > DQMFileSaverBase::globalBeginRun ( const edm::Run r,
const edm::EventSetup  
) const
finalprotected

Definition at line 61 of file DQMFileSaverBase.cc.

References initRun().

61  {
62  this->initRun();
63 
64  return nullptr;
65 }
virtual void initRun() const
void DQMFileSaverBase::globalEndLuminosityBlock ( const edm::LuminosityBlock iLS,
const edm::EventSetup  
) const
finalprotected

Definition at line 76 of file DQMFileSaverBase.cc.

References dqm::dqmstoreimpl::DQMStore::deleteUnusedLumiHistograms(), personalPlayback::fp, edm::LuminosityBlockBase::id(), initial_fp_, initial_fp_lock_, dqm::DQMFileSaverBase::FileParameters::lumi_, edm::LuminosityBlockID::luminosityBlock(), dqm::dqmstoreimpl::DQMStore::mtEnabled(), edm::LuminosityBlockID::run(), dqm::DQMFileSaverBase::FileParameters::run_, and saveLumi().

76  {
77  int ilumi = iLS.id().luminosityBlock();
78  int irun = iLS.id().run();
79 
80  std::unique_lock<std::mutex> lck(initial_fp_lock_);
81  FileParameters fp = initial_fp_;
82  lck.unlock();
83 
84  fp.lumi_ = ilumi;
85  fp.run_ = irun;
86 
87  this->saveLumi(fp);
88 
90  store->deleteUnusedLumiHistograms(store->mtEnabled() ? irun : 0, ilumi);
91 }
LuminosityBlockID id() const
virtual void saveLumi(const FileParameters &fp) const
void deleteUnusedLumiHistograms(uint32_t run, uint32_t lumi)
Definition: DQMStore.cc:1836
RunNumber_t run() const
LuminosityBlockNumber_t luminosityBlock() const
FileParameters initial_fp_
void DQMFileSaverBase::globalEndRun ( const edm::Run iRun,
const edm::EventSetup  
) const
finalprotected

Definition at line 93 of file DQMFileSaverBase.cc.

References personalPlayback::fp, edm::RunBase::id(), initial_fp_, initial_fp_lock_, edm::RunID::run(), dqm::DQMFileSaverBase::FileParameters::run_, and saveRun().

93  {
94  std::unique_lock<std::mutex> lck(initial_fp_lock_);
95  FileParameters fp = initial_fp_;
96  lck.unlock();
97 
98  fp.run_ = iRun.id().run();
99 
100  // empty
101  this->saveRun(fp);
102 }
RunID const & id() const
Definition: RunBase.h:39
virtual void saveRun(const FileParameters &fp) const
RunNumber_t run() const
Definition: RunID.h:36
FileParameters initial_fp_
virtual void dqm::DQMFileSaverBase::initRun ( ) const
inlineprotectedvirtual

Reimplemented in dqm::DQMFileSaverPB.

Definition at line 63 of file DQMFileSaverBase.h.

Referenced by globalBeginRun().

63 {};
void DQMFileSaverBase::logFileAction ( const std::string &  msg,
const std::string &  fileName 
) const
protected
void DQMFileSaverBase::saveJobReport ( const std::string &  filename) const
protected

Definition at line 135 of file DQMFileSaverBase.cc.

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

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

135  {
136  // Report the file to job report service.
138  if (jr.isAvailable()) {
139  std::map<std::string, std::string> info;
140  info["Source"] = "DQMStore";
141  info["FileClass"] = "DQM";
142  jr->reportAnalysisFile(filename, info);
143  }
144 }
static const TGPicture * info(bool iBackgroundIsBlack)
static const std::string filename(const FileParameters &fp, bool useLumi=false)
bool isAvailable() const
Definition: Service.h:40
void reportAnalysisFile(std::string const &fileName, std::map< std::string, std::string > const &fileData)
Definition: JobReport.cc:473
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 {};
virtual void dqm::DQMFileSaverBase::saveRun ( const FileParameters fp) const
inlineprotectedvirtual

Member Data Documentation

FileParameters dqm::DQMFileSaverBase::initial_fp_
protected

Definition at line 75 of file DQMFileSaverBase.h.

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

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

Definition at line 74 of file DQMFileSaverBase.h.

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