CMS 3D CMS Logo

PFDQMEventSelector.cc
Go to the documentation of this file.
2 
6 
9 
10 #include <iostream>
11 
12 //
13 // -- Constructor
14 //
16  verbose_ = pset.getParameter<bool>("DebugOn");
17  inputFileName_ = pset.getParameter<std::string>("InputFileName");
18  folderNames_ = pset.getParameter<std::vector<std::string>>("FolderNames");
19 
20  nEvents_ = 0;
21  nSelectedEvents_ = 0;
22  fileOpened_ = false;
23 }
24 //
25 // -- Destructor
26 //
28 
29 //
30 // -- BeginJob
31 //
35 }
36 //
37 // -- Event Filtering
38 //
40  nEvents_++;
41  if (!fileOpened_)
42  return false;
43 
44  edm::RunNumber_t runNb = iEvent.id().run();
45  edm::EventNumber_t evtNb = iEvent.id().event();
46  edm::LuminosityBlockNumber_t lumiNb = iEvent.id().luminosityBlock();
47  std::ostringstream eventid_str;
48  eventid_str << runNb << "_" << evtNb << "_" << lumiNb;
49 
50  for (std::vector<std::string>::const_iterator ifolder = folderNames_.begin(); ifolder != folderNames_.end();
51  ifolder++) {
52  std::string path = "ParticleFlow/" + (*ifolder) + "/BadEvents";
53  MonitorElement *me = dqmStore_->get(path + "/" + eventid_str.str());
54  if (me) {
56  if (verbose_)
57  std::cout << " Total Events " << nEvents_ << " Selected Events " << nSelectedEvents_ << " Run # : " << runNb
58  << " Event # : " << evtNb << " Luminosity Block # : " << lumiNb << std::endl;
59  return true;
60  }
61  }
62  return false;
63 }
64 //
65 // -- End Job
66 //
68  if (verbose_)
69  std::cout << " Total Events " << nEvents_ << " Selected Events " << nSelectedEvents_ << std::endl;
70 }
71 //
72 // -- Open Input File
73 //
75  if (inputFileName_.empty())
76  return false;
77  edm::LogInfo("SiStripOfflineDQM") << "SiStripOfflineDQM::openInputFile: Accessing root File" << inputFileName_;
79  return true;
80 }
81 
~PFDQMEventSelector() override
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
unsigned long long EventNumber_t
unsigned int LuminosityBlockNumber_t
void beginJob() override
int iEvent
Definition: GenABIO.cc:224
bool filter(edm::Event &, edm::EventSetup const &) override
Log< level::Info, false > LogInfo
PFDQMEventSelector(const edm::ParameterSet &)
std::vector< std::string > folderNames_
void endJob() override
std::string inputFileName_
virtual MonitorElement * get(std::string const &fullpath) const
Definition: DQMStore.cc:673
unsigned int RunNumber_t
DQM_DEPRECATED 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:790