test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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 ()
 
- Public Member Functions inherited from edm::global::EDAnalyzer< edm::RunCache< NoCache >, edm::LuminosityBlockCache< NoCache > >
 EDAnalyzer ()=default
 
- Public Member Functions inherited from edm::global::EDAnalyzerBase
 EDAnalyzerBase ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDAnalyzerBase ()
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
 EDConsumerBase ()
 
ProductHolderIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
std::vector
< ProductHolderIndexAndSkipBit >
const & 
itemsToGetFromEvent () const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesDependentUpon (std::string const &iProcessName, std::string const &iModuleLabel, bool iPrint, std::vector< char const * > &oModuleLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

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

virtual void analyze (edm::StreamID, const edm::Event &e, const edm::EventSetup &) const overridefinal
 
virtual std::shared_ptr< NoCacheglobalBeginLuminosityBlock (const edm::LuminosityBlock &, const edm::EventSetup &) const overridefinal
 
virtual std::shared_ptr< NoCacheglobalBeginRun (const edm::Run &, const edm::EventSetup &) const overridefinal
 
virtual void globalEndLuminosityBlock (const edm::LuminosityBlock &, const edm::EventSetup &) const overridefinal
 
virtual void globalEndRun (const edm::Run &, const edm::EventSetup &) const overridefinal
 
virtual void initRun (void) const
 
void logFileAction (const std::string &msg, const std::string &fileName) const
 
virtual void postForkReacquireResources (unsigned int childIndex, unsigned int numberOfChildren)
 
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 ecal_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_, DQMStore::SaveWithoutReference, DQMStore::SaveWithReference, DQMStore::SaveWithReferenceForQTest, dqm::qstatus::STATUS_OK, AlCaHLTBitMon_QueryRunRegistry::string, dqm::DQMFileSaverBase::FileParameters::tag_, and dqm::DQMFileSaverBase::FileParameters::version_.

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 ( )

Definition at line 69 of file DQMFileSaverBase.cc.

69 {}

Member Function Documentation

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

Implements edm::global::EDAnalyzerBase.

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

References dqm::DQMFileSaverBase::FileParameters::child_, mergeVDriftHistosByStation::file, dqm::DQMFileSaverBase::FileParameters::lumi_, fed_dqm_sourceclient-live_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 cuy.ValElement::__init__(), dqm::DQMFileSaverOnline::makeSnapshot(), and Vispa.Plugins.ConfigEditor.ConfigDataAccessor.ConfigDataAccessor::properties().

141  {
142  char buf[256];
143  if (useLumi) {
144  snprintf(buf, 256, "%s_V%04d_%s_R%09ld_L%09ld%s", fp.producer_.c_str(),
145  fp.version_, fp.tag_.c_str(), fp.run_, fp.lumi_,
146  fp.child_.c_str());
147  } else {
148  snprintf(buf, 256, "%s_V%04d_%s_R%09ld%s", fp.producer_.c_str(), fp.version_,
149  fp.tag_.c_str(), fp.run_, fp.child_.c_str());
150  }
151  buf[255] = 0;
152 
153  namespace fs = boost::filesystem;
154  fs::path path(fp.path_);
155  fs::path file(buf);
156 
157  return (path / file).string();
158 }
void DQMFileSaverBase::fillDescription ( edm::ParameterSetDescription d)
static

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

180  {
181  desc.addUntracked<std::string>("tag", "UNKNOWN")
182  ->setComment("File tag, DQM_V000_<TAG>*, usually a subsytem name.");
183 
184  desc.addUntracked<std::string>("producer", "DQM")
185  ->setComment("Base prefix for files, <BASE>_V000_**, either 'DQM' or 'Playback'.");
186 
187  desc.addUntracked<std::string>("referenceHandling", "all")
188  ->setComment("saveReference_, passed to the DQMStore");
189 
190  desc.addUntracked<int>("referenceRequireStatus", dqm::qstatus::STATUS_OK)
191  ->setComment("saveReference_, passed to the DQMStore");
192 
193  desc.addUntracked<std::string>("path", "./")->setComment(
194  "Output path prefix.");
195 }
static const int STATUS_OK
std::shared_ptr< NoCache > DQMFileSaverBase::globalBeginLuminosityBlock ( const edm::LuminosityBlock l,
const edm::EventSetup  
) const
finaloverrideprotectedvirtual

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
finaloverrideprotectedvirtual

Definition at line 71 of file DQMFileSaverBase.cc.

References initRun().

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

Definition at line 90 of file DQMFileSaverBase.cc.

References personalPlayback::fp, 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
finaloverrideprotectedvirtual

Definition at line 108 of file DQMFileSaverBase.cc.

References personalPlayback::fp, 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 ( void  ) const
inlineprotectedvirtual

Reimplemented in dqm::DQMFileSaverPB.

Definition at line 69 of file DQMFileSaverBase.h.

Referenced by globalBeginRun().

69 {};
void DQMFileSaverBase::logFileAction ( const std::string &  msg,
const std::string &  fileName 
) const
protected
void DQMFileSaverBase::postForkReacquireResources ( unsigned int  childIndex,
unsigned int  numberOfChildren 
)
protectedvirtual

Reimplemented from edm::global::EDAnalyzerBase.

Definition at line 121 of file DQMFileSaverBase.cc.

References dqm::DQMFileSaverBase::FileParameters::child_, initial_fp_, initial_fp_lock_, and AlCaHLTBitMon_QueryRunRegistry::string.

122  {
123  // this is copied from IOPool/Output/src/PoolOutputModule.cc, for consistency
124  unsigned int digits = 0;
125  while (numberOfChildren != 0) {
126  ++digits;
127  numberOfChildren /= 10;
128  }
129  // protect against zero numberOfChildren
130  if (digits == 0) {
131  digits = 3;
132  }
133 
134  char buffer[digits + 2];
135  snprintf(buffer, digits + 2, "_F%0*d", digits, childIndex);
136 
137  std::unique_lock<std::mutex> lck(initial_fp_lock_);
138  initial_fp_.child_ = std::string(buffer);
139 }
FileParameters initial_fp_
void DQMFileSaverBase::saveJobReport ( const std::string &  filename) const
protected

Definition at line 160 of file DQMFileSaverBase.cc.

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

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

161 {
162  // Report the file to job report service.
164  if (jr.isAvailable())
165  {
166  std::map<std::string, std::string> info;
167  info["Source"] = "DQMStore";
168  info["FileClass"] = "DQM";
169  jr->reportAnalysisFile(filename, info);
170  }
171 
172 }
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:559
virtual void dqm::DQMFileSaverBase::saveLumi ( const FileParameters fp) const
inlineprotectedvirtual

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

Definition at line 70 of file DQMFileSaverBase.h.

Referenced by globalEndLuminosityBlock().

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

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

Definition at line 71 of file DQMFileSaverBase.h.

Referenced by globalEndRun().

71 {};

Member Data Documentation

FileParameters dqm::DQMFileSaverBase::initial_fp_
protected
std::mutex dqm::DQMFileSaverBase::initial_fp_lock_
mutableprotected