CMS 3D CMS Logo

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