CMS 3D CMS Logo

List of all members | Classes | 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 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
 
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)
 
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 ESProduct , Transition Tr = Transition::Event>
auto esConsumes (eventsetup::EventSetupRecordKey const &, 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_
 

Additional Inherited Members

- Public Types inherited from edm::global::EDAnalyzerBase
typedef EDAnalyzerBase ModuleType
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 

Detailed Description

Definition at line 24 of file DQMFileSaverBase.h.

Constructor & Destructor Documentation

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

Definition at line 27 of file DQMFileSaverBase.cc.

References MessageLogger_cfi::cerr, dqm::DQMFileSaverBase::FileParameters::child_, 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_, DQMStore::SaveWithoutReference, DQMStore::SaveWithReference, 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  {
43  fp.saveReference_ = DQMStore::SaveWithoutReference;
44  }
45  else if (refsave == "all")
46  {
47  fp.saveReference_ = DQMStore::SaveWithReference;
48  }
49  else if (refsave == "qtests")
50  {
51  fp.saveReference_ = DQMStore::SaveWithReferenceForQTest;
52  }
53  else {
54  //edm::LogInfo("DQMFileSaverBase")
55  std::cerr
56  << "Invalid 'referenceHandling' parameter '" << refsave
57  << "'. Expected 'skip', 'all' or 'qtests'.";
58 
59  }
60 
61  // Check minimum required quality test result for which reference is saved.
62  fp.saveReferenceQMin_ = ps.getUntrackedParameter<int>("referenceRequireStatus", dqm::qstatus::STATUS_OK);
63 
64  std::unique_lock<std::mutex> lck(initial_fp_lock_);
65  initial_fp_ = fp;
66 }
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 84 of file DQMFileSaverBase.cc.

85  {
86  // not supported
87 }
const std::string DQMFileSaverBase::filename ( const FileParameters fp,
bool  useLumi = false 
)
staticprotected

Definition at line 120 of file DQMFileSaverBase.cc.

References dqm::DQMFileSaverBase::FileParameters::child_, FrontierConditions_GlobalTag_cff::file, dqm::DQMFileSaverBase::FileParameters::lumi_, callgraph::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().

120  {
121  char buf[256];
122  if (useLumi) {
123  snprintf(buf, 256, "%s_V%04d_%s_R%09ld_L%09ld%s", fp.producer_.c_str(),
124  fp.version_, fp.tag_.c_str(), fp.run_, fp.lumi_,
125  fp.child_.c_str());
126  } else {
127  snprintf(buf, 256, "%s_V%04d_%s_R%09ld%s", fp.producer_.c_str(), fp.version_,
128  fp.tag_.c_str(), fp.run_, fp.child_.c_str());
129  }
130  buf[255] = 0;
131 
132  namespace fs = boost::filesystem;
133  fs::path path(fp.path_);
134  fs::path file(buf);
135 
136  return (path / file).string();
137 }
void DQMFileSaverBase::fillDescription ( edm::ParameterSetDescription d)
static

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

159  {
160  desc.addUntracked<std::string>("tag", "UNKNOWN")
161  ->setComment("File tag, DQM_V000_<TAG>*, usually a subsytem name.");
162 
163  desc.addUntracked<std::string>("producer", "DQM")
164  ->setComment("Base prefix for files, <BASE>_V000_**, either 'DQM' or 'Playback'.");
165 
166  desc.addUntracked<std::string>("referenceHandling", "all")
167  ->setComment("saveReference_, passed to the DQMStore");
168 
169  desc.addUntracked<int>("referenceRequireStatus", dqm::qstatus::STATUS_OK)
170  ->setComment("saveReference_, passed to the DQMStore");
171 
172  desc.addUntracked<std::string>("path", "./")->setComment(
173  "Output path prefix.");
174 }
static const int STATUS_OK
std::shared_ptr< NoCache > DQMFileSaverBase::globalBeginLuminosityBlock ( const edm::LuminosityBlock l,
const edm::EventSetup  
) const
finalprotected

Definition at line 78 of file DQMFileSaverBase.cc.

79  {
80 
81  return nullptr;
82 }
std::shared_ptr< NoCache > DQMFileSaverBase::globalBeginRun ( const edm::Run r,
const edm::EventSetup  
) const
finalprotected

Definition at line 70 of file DQMFileSaverBase.cc.

References initRun().

71  {
72 
73  this->initRun();
74 
75  return nullptr;
76 }
virtual void initRun() const
void DQMFileSaverBase::globalEndLuminosityBlock ( const edm::LuminosityBlock iLS,
const edm::EventSetup  
) const
finalprotected

Definition at line 89 of file DQMFileSaverBase.cc.

References edm::LuminosityBlockBase::id(), initial_fp_, initial_fp_lock_, dqm::DQMFileSaverBase::FileParameters::lumi_, edm::LuminosityBlockID::luminosityBlock(), edm::LuminosityBlockID::run(), dqm::DQMFileSaverBase::FileParameters::run_, and saveLumi().

90  {
91  int ilumi = iLS.id().luminosityBlock();
92  int irun = iLS.id().run();
93 
94  std::unique_lock<std::mutex> lck(initial_fp_lock_);
95  FileParameters fp = initial_fp_;
96  lck.unlock();
97 
98  fp.lumi_ = ilumi;
99  fp.run_ = irun;
100 
101  this->saveLumi(fp);
102 
104  store->deleteUnusedLumiHistograms(store->mtEnabled() ? irun : 0, ilumi);
105 }
LuminosityBlockID id() const
virtual void saveLumi(const FileParameters &fp) const
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 107 of file DQMFileSaverBase.cc.

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

108  {
109 
110  std::unique_lock<std::mutex> lck(initial_fp_lock_);
111  FileParameters fp = initial_fp_;
112  lck.unlock();
113 
114  fp.run_ = iRun.id().run();
115 
116  // empty
117  this->saveRun(fp);
118 }
RunID const & id() const
Definition: RunBase.h:39
virtual void saveRun(const FileParameters &fp) const
RunNumber_t run() const
Definition: RunID.h:39
FileParameters initial_fp_
virtual void dqm::DQMFileSaverBase::initRun ( ) const
inlineprotectedvirtual

Reimplemented in dqm::DQMFileSaverPB.

Definition at line 67 of file DQMFileSaverBase.h.

Referenced by globalBeginRun().

67 {};
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 139 of file DQMFileSaverBase.cc.

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

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

140 {
141  // Report the file to job report service.
143  if (jr.isAvailable())
144  {
145  std::map<std::string, std::string> info;
146  info["Source"] = "DQMStore";
147  info["FileClass"] = "DQM";
148  jr->reportAnalysisFile(filename, info);
149  }
150 
151 }
static const TGPicture * info(bool iBackgroundIsBlack)
static const std::string filename(const FileParameters &fp, bool useLumi=false)
bool isAvailable() const
Definition: Service.h:46
void reportAnalysisFile(std::string const &fileName, std::map< std::string, std::string > const &fileData)
Definition: JobReport.cc:512
virtual void dqm::DQMFileSaverBase::saveLumi ( const FileParameters fp) const
inlineprotectedvirtual

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

Definition at line 68 of file DQMFileSaverBase.h.

Referenced by globalEndLuminosityBlock().

68 {};
virtual void dqm::DQMFileSaverBase::saveRun ( const FileParameters fp) const
inlineprotectedvirtual

Member Data Documentation

FileParameters dqm::DQMFileSaverBase::initial_fp_
protected

Definition at line 79 of file DQMFileSaverBase.h.

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

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

Definition at line 78 of file DQMFileSaverBase.h.

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