CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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  unsigned int runNb = iEvent.id().run();
48  unsigned int evtNb = iEvent.id().event();
49  unsigned int lumiNb = iEvent.id().luminosityBlock();
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:42
T getParameter(std::string const &) const
EventNumber_t event() const
Definition: EventID.h:44
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:17
LuminosityBlockNumber_t luminosityBlock() const
Definition: EventID.h:43
int iEvent
Definition: GenABIO.cc:243
MonitorElement * get(const std::string &path) const
get ME from full pathname (e.g. &quot;my/long/dir/my_histo&quot;)
Definition: DQMStore.cc:1473
PFDQMEventSelector(const edm::ParameterSet &)
std::vector< std::string > folderNames_
std::string inputFileName_
edm::EventID id() const
Definition: EventBase.h:56
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:2437
tuple cout
Definition: gather_cfg.py:121
bool filter(edm::Event &, edm::EventSetup const &)