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 (;;) {
28 
29  // check for end of run file and force quit
30  if (flagEndOfRunKills_ && (fiterator_.state() != State::OPEN)) {
31  return InputSource::IsStop;
32  }
33 
34  // check for end of run and quit if everything has been processed.
35  // this is the clean exit
36  if ((!fiterator_.lumiReady()) && (fiterator_.state() == State::EOR)) {
37 
38  return InputSource::IsStop;
39  }
40 
41  // skip to the next file if we have no files openned yet
42  if (fiterator_.lumiReady()) {
43  return InputSource::IsLumi;
44  }
45 
46  fiterator_.delay();
48  }
49 
50  // this is unreachable
51 }
52 
53 boost::shared_ptr<edm::RunAuxiliary> DQMProtobufReader::readRunAuxiliary_() {
54  fiterator_.logFileAction("readRunAuxiliary_");
55 
58  return boost::shared_ptr<edm::RunAuxiliary>(aux);
59 };
60 
61 boost::shared_ptr<edm::LuminosityBlockAuxiliary>
63  fiterator_.logFileAction("readLuminosityBlockAuxiliary_");
64 
67  edm::Timestamp());
68 
69  return boost::shared_ptr<edm::LuminosityBlockAuxiliary>(aux);
70 };
71 
73  fiterator_.logFileAction("readRun_");
75 
77  std::vector<MonitorElement*> allMEs = store->getAllContents("");
78  for (auto const& ME : allMEs) {
79  ME->Reset();
80  }
81 }
82 
85 
86  fiterator_.logFileAction("readLuminosityBlock_");
88 
90  jr->reportInputLumiSection(lbCache.id().run(),
91  lbCache.id().luminosityBlock());
93 
94  // clear the old lumi histograms
95  std::vector<MonitorElement*> allMEs = store->getAllContents("");
96  for (auto const& ME : allMEs) {
97  // We do not want to reset Run Products here!
98  if (ME->getLumiFlag()) {
99  ME->Reset();
100  }
101  }
102 
103  // load the new file
106  if (!boost::filesystem::exists(p)) {
107  fiterator_.logFileAction("Data file is missing ", p);
108  fiterator_.pop();
109  return;
110  }
111 
112  fiterator_.logFileAction("Initiating request to open file ", p);
113  fiterator_.logFileAction("Successfully opened file ", p);
114  store->load(p);
115  fiterator_.logFileAction("Closed file ", p);
116  fiterator_.pop();
117 };
118 
120 
122  ConfigurationDescriptions& descriptions) {
124  desc.setComment(
125  "Creates runs and lumis and fills the dqmstore from protocol buffer "
126  "files.");
128 
129  desc.addUntracked<bool>("skipFirstLumis", false)->setComment(
130  "Skip (and ignore the minEventsPerLumi parameter) for the files "
131  "which have been available at the begining of the processing. "
132  "If set to true, the reader will open last available file for "
133  "processing.");
134 
135  desc.addUntracked<bool>("deleteDatFiles", false)->setComment(
136  "Delete data files after they have been closed, in order to "
137  "save disk space.");
138 
139  desc.addUntracked<bool>("endOfRunKills", false)->setComment(
140  "Kill the processing as soon as the end-of-run file appears, even if "
141  "there are/will be unprocessed lumisections.");
142 
144  descriptions.add("source", desc);
145 }
146 
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