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 //
32 // -- BeginJob
33 //
35 
38 }
39 //
40 // -- Event Filtering
41 //
43 
44  nEvents_++;
45  if (!fileOpened_) return false;
46 
47  edm::RunNumber_t runNb = iEvent.id().run();
48  edm::EventNumber_t evtNb = iEvent.id().event();
50  std::ostringstream eventid_str;
51  eventid_str << runNb << "_"<< evtNb << "_" << lumiNb;
52 
53  for (std::vector<std::string>::const_iterator ifolder = folderNames_.begin();
54  ifolder != folderNames_.end(); ifolder++) {
55  std::string path = "ParticleFlow/"+(*ifolder) + "/BadEvents";
56  MonitorElement* me = dqmStore_->get(path + "/" + eventid_str.str());
57  if (me) {
59  if ( verbose_ ) std::cout << " Total Events " << nEvents_
60  << " Selected Events " << nSelectedEvents_
61  << " Run # : " << runNb
62  << " Event # : " << evtNb
63  << " Luminosity Block # : " << lumiNb
64  << std::endl;
65  return true;
66  }
67  }
68  return false;
69 }
70 //
71 // -- End Job
72 //
74  if ( verbose_ ) std::cout << " Total Events " << nEvents_
75  << " Selected Events " << nSelectedEvents_
76  << std::endl;
77 }
78 //
79 // -- Open Input File
80 //
82  if (inputFileName_.size() == 0) return false;
83  edm::LogInfo("SiStripOfflineDQM") << "SiStripOfflineDQM::openInputFile: Accessing root File" << inputFileName_;
85  return true;
86 }
87 
90 
91 
RunNumber_t run() const
Definition: EventID.h:39
T getParameter(std::string const &) const
EventNumber_t event() const
Definition: EventID.h:41
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:17
unsigned long long EventNumber_t
LuminosityBlockNumber_t luminosityBlock() const
Definition: EventID.h:40
unsigned int LuminosityBlockNumber_t
int iEvent
Definition: GenABIO.cc:230
MonitorElement * get(const std::string &path) const
get ME from full pathname (e.g. "my/long/dir/my_histo")
Definition: DQMStore.cc:1807
PFDQMEventSelector(const edm::ParameterSet &)
std::vector< std::string > folderNames_
std::string inputFileName_
edm::EventID id() const
Definition: EventBase.h:60
bool open(const std::string &filename, bool overwrite=false, const std::string &path="", const std::string &prepend="", OpenRunDirs stripdirs=KeepRunDirs, bool fileMustExist=true)
Definition: DQMStore.cc:3025
unsigned int RunNumber_t
bool filter(edm::Event &, edm::EventSetup const &)