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
 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 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 23 of file DQMFileSaverBase.h.

Constructor & Destructor Documentation

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

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

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

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

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

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

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

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

Definition at line 79 of file DQMFileSaverBase.cc.

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

Definition at line 71 of file DQMFileSaverBase.cc.

References initRun().

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

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

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

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

109  {
110 
111  std::unique_lock<std::mutex> lck(initial_fp_lock_);
112  FileParameters fp = initial_fp_;
113  lck.unlock();
114 
115  fp.run_ = iRun.id().run();
116 
117  // empty
118  this->saveRun(fp);
119 }
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 66 of file DQMFileSaverBase.h.

Referenced by globalBeginRun().

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

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

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

141 {
142  // Report the file to job report service.
144  if (jr.isAvailable())
145  {
146  std::map<std::string, std::string> info;
147  info["Source"] = "DQMStore";
148  info["FileClass"] = "DQM";
149  jr->reportAnalysisFile(filename, info);
150  }
151 
152 }
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:507
virtual void dqm::DQMFileSaverBase::saveLumi ( const FileParameters fp) const
inlineprotectedvirtual

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

Definition at line 67 of file DQMFileSaverBase.h.

Referenced by globalEndLuminosityBlock().

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

Member Data Documentation

FileParameters dqm::DQMFileSaverBase::initial_fp_
protected

Definition at line 78 of file DQMFileSaverBase.h.

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

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

Definition at line 77 of file DQMFileSaverBase.h.

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