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  usesResource("DQMStore");
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();
47  edm::LuminosityBlockNumber_t lumiNb = iEvent.id().luminosityBlock();
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 
~PFDQMEventSelector() override
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
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
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:712
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:830