CMS 3D CMS Logo

DQMFileReader.cc
Go to the documentation of this file.
1 #include "DQMFileReader.h"
3 #include <iostream>
4 
6  pset_ = ps;
7 
9 
10  filenames_.clear();
11  filenames_ = pset_.getUntrackedParameter<std::vector<std::string> >("FileNames");
12  referenceFileName_ = pset_.getUntrackedParameter<std::string>("referenceFileName", "");
13 }
14 
16 
18  if (!referenceFileName_.empty()) {
19  const std::string override = "";
20  std::vector<std::string> in;
21  in.push_back(referenceFileName_);
22  edm::InputFileCatalog catalog(in, override, true);
23 
24  std::string ff = catalog.fileNames()[0];
25  std::cout << "DQMFileReader: reading reference file '" << ff << "'\n";
26 
27  // now open file, quietly continuing if it does not exist
28  if (dbe_->open(ff, true, "", "Reference", DQMStore::StripRunDirs, false)) {
29  dbe_->cd();
30  dbe_->setCurrentFolder("Info/ProvInfo");
31  dbe_->bookString("referenceFileName", ff);
32  std::cout << "DQMFileReader: reference file '" << ff << "' successfully read in \n";
33  } else {
34  dbe_->cd();
35  dbe_->setCurrentFolder("Info/ProvInfo");
36  dbe_->bookString("referenceFileName", "non-existent:" + ff);
37  std::cout << "DQMFileReader: reference file '" << ff << "' does not exist \n";
38  }
39  dbe_->cd();
40  return;
41  }
42 
43  dbe_->bookString("referenceFileName", "no reference file specified");
44  dbe_->cd();
45 
46  // read in files, stripping off Run Summary and Run <number> folders
47 
48  for (auto const& filename : filenames_) {
49  std::cout << "DQMFileReader::beginJob: loading" << filename << std::endl;
50  if (dbe_)
51  dbe_->load(filename);
52  }
53 }
54 
56 
MonitorElement * bookString(char_string const &name, char_string const &value)
Book string.
Definition: DQMStore.cc:1100
T getUntrackedParameter(std::string const &, T const &) const
DQMFileReader(const edm::ParameterSet &)
Definition: DQMFileReader.cc:5
~DQMFileReader() override
DQMStore * dbe_
Definition: DQMFileReader.h:35
edm::ParameterSet pset_
Definition: DQMFileReader.h:36
void analyze(const edm::Event &, const edm::EventSetup &) override
bool load(std::string const &filename, OpenRunDirs stripdirs=StripRunDirs, bool fileMustExist=true)
Definition: DQMStore.cc:2639
void cd()
go to top directory (ie. root)
Definition: DQMStore.cc:621
std::vector< std::string > filenames_
Definition: DQMFileReader.h:38
int iEvent
Definition: GenABIO.cc:224
void endJob() override
std::vector< std::string > const & fileNames() const
void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:639
void beginJob() override
bool open(std::string const &filename, bool overwrite=false, std::string const &path="", std::string const &prepend="", OpenRunDirs stripdirs=KeepRunDirs, bool fileMustExist=true)
Definition: DQMStore.cc:2626
std::string referenceFileName_
Definition: DQMFileReader.h:39