CMS 3D CMS Logo

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