CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
DQMProtobufReader.cc
Go to the documentation of this file.
1 #include "DQMProtobufReader.h"
2 
6 
7 using namespace edm;
8 
10  InputSourceDescription const& desc)
11  : InputSource(pset, desc), fiterator_(pset, DQMFileIterator::JS_PROTOBUF) {
12 
13  flagSkipFirstLumis_ = pset.getUntrackedParameter<bool>("skipFirstLumis");
14  flagEndOfRunKills_ = pset.getUntrackedParameter<bool>("endOfRunKills");
15  flagDeleteDatFiles_ = pset.getUntrackedParameter<bool>("deleteDatFiles");
16 }
17 
19 
21  typedef DQMFileIterator::State State;
22  typedef DQMFileIterator::LumiEntry LumiEntry;
23 
24  fiterator_.logFileAction("getNextItemType");
25 
26  for (;;) {
27  // check for end of run file and force quit
28  if (flagEndOfRunKills_ && (fiterator_.state() != State::OPEN)) {
29  return InputSource::IsStop;
30  }
31 
32  // check for end of run and quit if everything has been processed.
33  // this is the clean exit
34  if ((!fiterator_.hasNext()) && (fiterator_.state() == State::EOR)) {
35 
36  return InputSource::IsStop;
37  }
38 
39  // skip to the next file if we have no files openned yet
40  if (fiterator_.hasNext()) {
41  return InputSource::IsLumi;
42  }
43 
44  fiterator_.delay();
46  }
47 
48  // this is unreachable
49 }
50 
51 boost::shared_ptr<edm::RunAuxiliary> DQMProtobufReader::readRunAuxiliary_() {
52  fiterator_.logFileAction("readRunAuxiliary_");
53 
56  return boost::shared_ptr<edm::RunAuxiliary>(aux);
57 };
58 
59 boost::shared_ptr<edm::LuminosityBlockAuxiliary>
61  fiterator_.logFileAction("readLuminosityBlockAuxiliary_");
62 
65  edm::Timestamp());
66 
67  return boost::shared_ptr<edm::LuminosityBlockAuxiliary>(aux);
68 };
69 
71  fiterator_.logFileAction("readRun_");
73 
75  std::vector<MonitorElement*> allMEs = store->getAllContents("");
76  for (auto const& ME : allMEs) {
77  ME->Reset();
78  }
79 }
80 
83 
84  fiterator_.logFileAction("readLuminosityBlock_");
86 
88  jr->reportInputLumiSection(lbCache.id().run(),
89  lbCache.id().luminosityBlock());
91 
92  // clear the old lumi histograms
93  std::vector<MonitorElement*> allMEs = store->getAllContents("");
94  for (auto const& ME : allMEs) {
95  // We do not want to reset Run Products here!
96  if (ME->getLumiFlag()) {
97  ME->Reset();
98  }
99  }
100 
101  // load the new file
104  if (! boost::filesystem::exists(p)) {
105  fiterator_.logFileAction("Data file is missing ", p);
106  fiterator_.pop();
107  return;
108  }
109 
110  fiterator_.logFileAction("Initiating request to open file ", p);
111  fiterator_.logFileAction("Successfully opened file ", p);
112  store->load(p);
113  fiterator_.logFileAction("Closed file ", p);
114  fiterator_.pop();
115 };
116 
118 
120  ConfigurationDescriptions& descriptions) {
122  desc.setComment(
123  "Creates runs and lumis and fills the dqmstore from protocol buffer "
124  "files.");
126 
127  desc.addUntracked<bool>("skipFirstLumis", false)->setComment(
128  "Skip (and ignore the minEventsPerLumi parameter) for the files "
129  "which have been available at the begining of the processing. "
130  "If set to true, the reader will open last available file for "
131  "processing.");
132 
133  desc.addUntracked<bool>("deleteDatFiles", false)->setComment(
134  "Delete data files after they have been closed, in order to "
135  "save disk space.");
136 
137  desc.addUntracked<bool>("endOfRunKills", false)->setComment(
138  "Kill the processing as soon as the end-of-run file appears, even if "
139  "there are/will be unprocessed lumisections.");
140 
142  descriptions.add("source", desc);
143 }
144 
T getUntrackedParameter(std::string const &, T const &) const
std::string make_path_data(const LumiEntry &lumi)
ParameterDescriptionBase * addUntracked(U const &iLabel, T const &value)
tuple lumi
Definition: fjr2json.py:35
virtual void readLuminosityBlock_(edm::LuminosityBlockPrincipal &lbCache) override
void fillRunPrincipal(ProcessHistoryRegistry const &processHistoryRegistry, DelayedReader *reader=0)
Definition: RunPrincipal.cc:22
Definition: ME.h:11
void setComment(std::string const &value)
std::vector< MonitorElement * > getAllContents(const std::string &path, uint32_t runNumber=0, uint32_t lumi=0) const
Definition: DQMStore.cc:1906
virtual void readRun_(edm::RunPrincipal &rpCache) override
void fillLuminosityBlockPrincipal(ProcessHistoryRegistry const &processHistoryRegistry, DelayedReader *reader=0)
virtual edm::InputSource::ItemType getNextItemType() override
#define DEFINE_FWK_INPUT_SOURCE(type)
const LumiEntry & front()
void reportInputLumiSection(unsigned int run, unsigned int lumiSectId)
Definition: JobReport.cc:544
void logFileAction(const std::string &msg, const std::string &fileName="") const
RunNumber_t run() const
static void fillDescription(ParameterSetDescription &d)
unsigned int runNumber()
static void fillDescriptions(ConfigurationDescriptions &descriptions)
virtual void readEvent_(edm::EventPrincipal &) override
DQMProtobufReader(ParameterSet const &, InputSourceDescription const &)
static void fillDescription(ParameterSetDescription &desc)
virtual boost::shared_ptr< edm::RunAuxiliary > readRunAuxiliary_() override
bool load(const std::string &filename, OpenRunDirs stripdirs=StripRunDirs, bool fileMustExist=true)
Definition: DQMStore.cc:2855
DQMFileIterator fiterator_
LuminosityBlockNumber_t luminosityBlock() const
void add(std::string const &label, ParameterSetDescription const &psetDescription)
ProcessHistoryRegistry & processHistoryRegistryForUpdate()
Non-const accessor for process history registry.
Definition: InputSource.h:174
virtual boost::shared_ptr< edm::LuminosityBlockAuxiliary > readLuminosityBlockAuxiliary_() override