CMS 3D CMS Logo

DQMFileSaverBase.cc
Go to the documentation of this file.
11 
12 #include "DQMFileSaverBase.h"
13 
14 #include <sys/stat.h>
15 #include <sys/types.h>
16 #include <unistd.h>
17 #include <iostream>
18 #include <vector>
19 #include <string>
20 #include <fstream>
21 #include <utility>
22 #include <TString.h>
23 #include <TSystem.h>
24 
25 using namespace dqm;
26 
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  std::unique_lock<std::mutex> lck(initial_fp_lock_);
39  initial_fp_ = fp;
40 }
41 
43 
44 std::shared_ptr<NoCache> DQMFileSaverBase::globalBeginRun(const edm::Run &r, const edm::EventSetup &) const {
45  this->initRun();
46 
47  return nullptr;
48 }
49 
51  const edm::EventSetup &) const {
52  return nullptr;
53 }
54 
56  // not supported
57 }
58 
60  int ilumi = iLS.id().luminosityBlock();
61  int irun = iLS.id().run();
62 
63  std::unique_lock<std::mutex> lck(initial_fp_lock_);
65  lck.unlock();
66 
67  fp.lumi_ = ilumi;
68  fp.run_ = irun;
69 
70  this->saveLumi(fp);
71 }
72 
73 void DQMFileSaverBase::globalEndRun(const edm::Run &iRun, const edm::EventSetup &) const {
74  std::unique_lock<std::mutex> lck(initial_fp_lock_);
76  lck.unlock();
77 
78  fp.run_ = iRun.id().run();
79 
80  // empty
81  this->saveRun(fp);
82 }
83 
85  char buf[256];
86  if (useLumi) {
87  snprintf(buf,
88  256,
89  "%s_V%04d_%s_R%09ld_L%09ld%s",
90  fp.producer_.c_str(),
91  fp.version_,
92  fp.tag_.c_str(),
93  fp.run_,
94  fp.lumi_,
95  fp.child_.c_str());
96  } else {
97  snprintf(buf,
98  256,
99  "%s_V%04d_%s_R%09ld%s",
100  fp.producer_.c_str(),
101  fp.version_,
102  fp.tag_.c_str(),
103  fp.run_,
104  fp.child_.c_str());
105  }
106  buf[255] = 0;
107 
108  namespace fs = boost::filesystem;
109  fs::path path(fp.path_);
110  fs::path file(buf);
111 
112  return (path / file).string();
113 }
114 
116  // Report the file to job report service.
118  if (jr.isAvailable()) {
119  std::map<std::string, std::string> info;
120  info["Source"] = "DQMStore";
121  info["FileClass"] = "DQM";
123  }
124 }
125 
127  edm::LogAbsolute("fileAction") << std::setprecision(0) << edm::TimeOfDay() << " " << msg << fileName;
129 }
130 
132  desc.addUntracked<std::string>("tag", "UNKNOWN")->setComment("File tag, DQM_V000_<TAG>*, usually a subsytem name.");
133 
134  desc.addUntracked<std::string>("producer", "DQM")
135  ->setComment("Base prefix for files, <BASE>_V000_**, either 'DQM' or 'Playback'.");
136 
137  desc.addUntracked<std::string>("referenceHandling", "all")->setComment("saveReference_, passed to the DQMStore");
138 
139  desc.addUntracked<int>("referenceRequireStatus", dqm::qstatus::STATUS_OK)
140  ->setComment("saveReference_, passed to the DQMStore");
141 
142  desc.addUntracked<std::string>("path", "./")->setComment("Output path prefix.");
143 }
DQMFileSaverBase.h
edm::LogAbsolute
Definition: MessageLogger.h:469
edm::StreamID
Definition: StreamID.h:30
dqm::DQMFileSaverBase::FileParameters
Definition: DQMFileSaverBase.h:33
MessageLogger.h
dqm::DQMFileSaverBase::globalEndLuminosityBlock
void globalEndLuminosityBlock(const edm::LuminosityBlock &, const edm::EventSetup &) const final
Definition: DQMFileSaverBase.cc:59
edm::TimeOfDay
Definition: TimeOfDay.h:9
dqm::DQMFileSaverBase::logFileAction
void logFileAction(const std::string &msg, const std::string &fileName) const
Definition: DQMFileSaverBase.cc:126
dqm::DQMFileSaverBase::saveLumi
virtual void saveLumi(const FileParameters &fp) const
Definition: DQMFileSaverBase.h:60
edm::LuminosityBlock
Definition: LuminosityBlock.h:50
edm::RunID::run
RunNumber_t run() const
Definition: RunID.h:36
edm::Run
Definition: Run.h:45
LuminosityBlock.h
dqm::DQMFileSaverBase::filename
static const std::string filename(const FileParameters &fp, bool useLumi=false)
Definition: DQMFileSaverBase.cc:84
edm::JobReport::reportAnalysisFile
void reportAnalysisFile(std::string const &fileName, std::map< std::string, std::string > const &fileData)
Definition: JobReport.cc:473
edm::ParameterSetDescription
Definition: ParameterSetDescription.h:52
dqm::DQMFileSaverBase::analyze
void analyze(edm::StreamID, const edm::Event &e, const edm::EventSetup &) const final
Definition: DQMFileSaverBase.cc:55
DQMStore.h
info
static const TGPicture * info(bool iBackgroundIsBlack)
Definition: FWCollectionSummaryWidget.cc:152
personalPlayback.fp
fp
Definition: personalPlayback.py:523
mps_check.msg
tuple msg
Definition: mps_check.py:285
edm::ParameterSet::getUntrackedParameter
T getUntrackedParameter(std::string const &, T const &) const
MillePedeFileConverter_cfg.fileName
fileName
Definition: MillePedeFileConverter_cfg.py:32
edm::Service::isAvailable
bool isAvailable() const
Definition: Service.h:40
dqm::DQMFileSaverBase::~DQMFileSaverBase
~DQMFileSaverBase() override
dqm::DQMFileSaverBase::initRun
virtual void initRun() const
Definition: DQMFileSaverBase.h:59
dqm::DQMFileSaverBase::initial_fp_lock_
std::mutex initial_fp_lock_
Definition: DQMFileSaverBase.h:70
dqm::DQMFileSaverBase::saveRun
virtual void saveRun(const FileParameters &fp) const
Definition: DQMFileSaverBase.h:61
Service.h
Run.h
corrVsCorr.filename
filename
Definition: corrVsCorr.py:123
dqm::DQMFileSaverBase::saveJobReport
void saveJobReport(const std::string &filename) const
Definition: DQMFileSaverBase.cc:115
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
dqm::DQMFileSaverBase::globalBeginLuminosityBlock
std::shared_ptr< NoCache > globalBeginLuminosityBlock(const edm::LuminosityBlock &, const edm::EventSetup &) const final
Definition: DQMFileSaverBase.cc:50
edm::ParameterSetDescription::addUntracked
ParameterDescriptionBase * addUntracked(U const &iLabel, T const &value)
Definition: ParameterSetDescription.h:100
edm::FlushMessageLog
void FlushMessageLog()
Definition: MessageLogger.cc:94
edm::ParameterSet
Definition: ParameterSet.h:36
GetReleaseVersion.h
Event.h
dqm::DQMFileSaverBase::initial_fp_
FileParameters initial_fp_
Definition: DQMFileSaverBase.h:71
edm::Service
Definition: Service.h:30
FrontierConditions_GlobalTag_cff.file
file
Definition: FrontierConditions_GlobalTag_cff.py:13
edm::LuminosityBlockID::luminosityBlock
LuminosityBlockNumber_t luminosityBlock() const
Definition: LuminosityBlockID.h:42
edm::LuminosityBlockBase::id
LuminosityBlockID id() const
Definition: LuminosityBlockBase.h:44
edm::EventSetup
Definition: EventSetup.h:57
visDQMUpload.buf
buf
Definition: visDQMUpload.py:154
cmsLHEtoEOSManager.l
l
Definition: cmsLHEtoEOSManager.py:193
alignCSCRings.r
r
Definition: alignCSCRings.py:93
dqm::DQMFileSaverBase::globalBeginRun
std::shared_ptr< NoCache > globalBeginRun(const edm::Run &, const edm::EventSetup &) const final
Definition: DQMFileSaverBase.cc:44
dqm::DQMFileSaverBase::globalEndRun
void globalEndRun(const edm::Run &, const edm::EventSetup &) const final
Definition: DQMFileSaverBase.cc:73
dqm::qstatus::STATUS_OK
static const int STATUS_OK
Definition: MonitorElement.h:52
edm::LuminosityBlockID::run
RunNumber_t run() const
Definition: LuminosityBlockID.h:41
dqm::DQMFileSaverBase::DQMFileSaverBase
DQMFileSaverBase(const edm::ParameterSet &ps)
Definition: DQMFileSaverBase.cc:27
castor_dqm_sourceclient_file_cfg.path
path
Definition: castor_dqm_sourceclient_file_cfg.py:37
dqm
Definition: DQMStore.h:18
JobReport.h
ParameterSet.h
TimeOfDay.h
dqm::DQMFileSaverBase::fillDescription
static void fillDescription(edm::ParameterSetDescription &d)
Definition: DQMFileSaverBase.cc:131
edm::Event
Definition: Event.h:73
edm::RunBase::id
RunID const & id() const
Definition: RunBase.h:39
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37