CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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 final
 
bool wantsGlobalRuns () const final
 
bool wantsInputProcessBlocks () const final
 
bool wantsProcessBlocks () 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
 
std::vector< ESProxyIndex > 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
 
bool registeredToConsumeMany (TypeID const &, 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::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)
 
template<BranchType B = InEvent>
EDConsumerBaseAdaptor< B > consumes (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 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<Transition Tr = Transition::Event>
constexpr auto esConsumes () noexcept
 
template<Transition Tr = Transition::Event>
auto esConsumes (ESInputTag tag) noexcept
 
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_
 
int runNumber_
 

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

References 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_, runNumber_, AlCaHLTBitMon_QueryRunRegistry::string, dqm::DQMFileSaverBase::FileParameters::tag_, and dqm::DQMFileSaverBase::FileParameters::version_.

29  {
30  FileParameters fp;
31 
32  fp.path_ = ps.getUntrackedParameter<std::string>("path");
33  fp.producer_ = ps.getUntrackedParameter<std::string>("producer");
34  fp.run_ = 0;
35  fp.tag_ = ps.getUntrackedParameter<std::string>("tag");
36  fp.lumi_ = 0;
37  fp.version_ = 1;
38  fp.child_ = "";
39 
40  std::unique_lock<std::mutex> lck(initial_fp_lock_);
41  initial_fp_ = fp;
42 
43  runNumber_ = ps.getUntrackedParameter<int>("runNumber", 111);
44 
45  // This makes sure a file saver runs in a very end
46  consumesMany<DQMToken, edm::InLumi>();
47  consumesMany<DQMToken, edm::InRun>();
48 }
T getUntrackedParameter(std::string const &, T const &) const
FileParameters initial_fp_
DQMFileSaverBase::~DQMFileSaverBase ( )
overridedefault

Member Function Documentation

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

Implements edm::global::EDAnalyzerBase.

Definition at line 63 of file DQMFileSaverBase.cc.

63  {
64  // not supported
65 }
const std::string DQMFileSaverBase::filename ( const FileParameters fp,
bool  useLumi = false 
)
staticprotected

Definition at line 92 of file DQMFileSaverBase.cc.

References visDQMUpload::buf, 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 dqm::DQMFileSaverOnline::makeSnapshot().

92  {
93  char buf[256];
94  if (useLumi) {
95  snprintf(buf,
96  256,
97  "%s_V%04d_%s_R%09ld_L%09ld%s",
98  fp.producer_.c_str(),
99  fp.version_,
100  fp.tag_.c_str(),
101  fp.run_,
102  fp.lumi_,
103  fp.child_.c_str());
104  } else {
105  snprintf(buf,
106  256,
107  "%s_V%04d_%s_R%09ld%s",
108  fp.producer_.c_str(),
109  fp.version_,
110  fp.tag_.c_str(),
111  fp.run_,
112  fp.child_.c_str());
113  }
114  buf[255] = 0;
115 
116  namespace fs = std::filesystem;
117  fs::path path(fp.path_);
118  fs::path file(buf);
119 
120  return (path / file).string();
121 }
void DQMFileSaverBase::fillDescription ( edm::ParameterSetDescription d)
static

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

139  {
140  desc.addUntracked<std::string>("tag", "UNKNOWN")->setComment("File tag, DQM_V000_<TAG>*, usually a subsytem name.");
141 
142  desc.addUntracked<std::string>("producer", "DQM")
143  ->setComment("Base prefix for files, <BASE>_V000_**, either 'DQM' or 'Playback'.");
144 
145  desc.addUntracked<std::string>("referenceHandling", "all")->setComment("saveReference_, passed to the DQMStore");
146 
147  desc.addUntracked<int>("referenceRequireStatus", dqm::qstatus::STATUS_OK)
148  ->setComment("saveReference_, passed to the DQMStore");
149 
150  desc.addUntracked<std::string>("path", "./")->setComment("Output path prefix.");
151 
152  desc.addUntracked<int>("runNumber", 111)
153  ->setComment("Run number passed in the configuration. Will appear in output file names.");
154 }
static const int STATUS_OK
std::shared_ptr< NoCache > DQMFileSaverBase::globalBeginLuminosityBlock ( const edm::LuminosityBlock l,
const edm::EventSetup  
) const
finalprotected

Definition at line 58 of file DQMFileSaverBase.cc.

59  {
60  return nullptr;
61 }
std::shared_ptr< NoCache > DQMFileSaverBase::globalBeginRun ( const edm::Run r,
const edm::EventSetup  
) const
finalprotected

Definition at line 52 of file DQMFileSaverBase.cc.

References initRun().

52  {
53  this->initRun();
54 
55  return nullptr;
56 }
virtual void initRun() const
void DQMFileSaverBase::globalEndLuminosityBlock ( const edm::LuminosityBlock iLS,
const edm::EventSetup  
) const
finalprotected

Definition at line 67 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_, runNumber_, and saveLumi().

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

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

81  {
82  std::unique_lock<std::mutex> lck(initial_fp_lock_);
83  FileParameters fp = initial_fp_;
84  lck.unlock();
85 
86  fp.run_ = runNumber_ == 111 ? iRun.id().run() : runNumber_;
87 
88  // empty
89  this->saveRun(fp);
90 }
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 59 of file DQMFileSaverBase.h.

Referenced by globalBeginRun().

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

Definition at line 134 of file DQMFileSaverBase.cc.

References MillePedeFileConverter_cfg::fileName, and edm::FlushMessageLog().

Referenced by dqm::DQMFileSaverOnline::appendSnapshot(), dqm::DQMFileSaverOnline::checkError(), and dqm::DQMFileSaverOnline::makeSnapshot().

134  {
135  edm::LogAbsolute("fileAction") << std::setprecision(0) << edm::TimeOfDay() << " " << msg << fileName;
137 }
void FlushMessageLog()
tuple msg
Definition: mps_check.py:285
Log< level::System, true > LogAbsolute
void DQMFileSaverBase::saveJobReport ( const std::string &  filename) const
protected

Definition at line 123 of file DQMFileSaverBase.cc.

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

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

123  {
124  // Report the file to job report service.
126  if (jr.isAvailable()) {
127  std::map<std::string, std::string> info;
128  info["Source"] = "DQMStore";
129  info["FileClass"] = "DQM";
130  jr->reportAnalysisFile(filename, info);
131  }
132 }
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 60 of file DQMFileSaverBase.h.

Referenced by globalEndLuminosityBlock().

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

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

Definition at line 61 of file DQMFileSaverBase.h.

Referenced by globalEndRun().

61 {};

Member Data Documentation

FileParameters dqm::DQMFileSaverBase::initial_fp_
protected

Definition at line 71 of file DQMFileSaverBase.h.

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

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

Definition at line 70 of file DQMFileSaverBase.h.

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

int dqm::DQMFileSaverBase::runNumber_
protected

Definition at line 72 of file DQMFileSaverBase.h.

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