CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
PFJetDQMAnalyzer.cc
Go to the documentation of this file.
2 
4 
9 
15 
19 //
20 // -- Constructor
21 //
23 
24 {
25  pSet_ = parameterSet;
26  inputLabel_ = pSet_.getParameter<edm::InputTag>("InputCollection");
27  matchLabel_ = pSet_.getParameter<edm::InputTag>("MatchCollection");
28  benchmarkLabel_ = pSet_.getParameter<std::string>("BenchmarkLabel");
29 
30  pfJetMonitor_.setParameters(parameterSet);
31 
32 }
33 //
34 // -- BeginJob
35 //
37 
39  // part of the following could be put in the base class
40  std::string path = "ParticleFlow/" + benchmarkLabel_;
41  Benchmark::DQM_->setCurrentFolder(path.c_str());
42  edm::LogInfo("PFJetDQMAnalyzer") << " PFJetDQMAnalyzer::beginJob " << "Histogram Folder path set to "<< path;
44 
45 }
46 //
47 // -- Analyze
48 //
50  edm::EventSetup const& iSetup) {
51  edm::Handle< edm::View<reco::Jet> > jetCollection;
52  iEvent.getByLabel(inputLabel_, jetCollection);
53 
54  edm::Handle< edm::View<reco::Jet> > matchedJetCollection;
55  iEvent.getByLabel( matchLabel_, matchedJetCollection);
56 
57  float maxRes = 0.0;
58  float minRes = 99.99;
59  if (jetCollection.isValid() && matchedJetCollection.isValid()) {
60  pfJetMonitor_.fill( *jetCollection, *matchedJetCollection, minRes, maxRes);
61 
62  edm::ParameterSet skimPS = pSet_.getParameter<edm::ParameterSet>("SkimParameter");
63  if (skimPS.getParameter<bool>("switchOn")) {
64  if ( minRes < skimPS.getParameter<double>("lowerCutOffOnResolution")) storeBadEvents(iEvent,minRes);
65  else if (maxRes > skimPS.getParameter<double>("upperCutOffOnResolution")) storeBadEvents(iEvent,maxRes);
66  }
67  }
68 }
70  unsigned int runNb = iEvent.id().run();
71  unsigned int evtNb = iEvent.id().event();
72  unsigned int lumiNb = iEvent.id().luminosityBlock();
73 
74  std::string path = "ParticleFlow/" + benchmarkLabel_ + "/BadEvents";
75  Benchmark::DQM_->setCurrentFolder(path.c_str());
76  std::ostringstream eventid_str;
77  eventid_str << runNb << "_"<< evtNb << "_" << lumiNb;
78  MonitorElement* me = Benchmark::DQM_->get(path + "/" + eventid_str.str());
79  if (me) me->Reset();
80  else me = Benchmark::DQM_->bookFloat(eventid_str.str());
81  me->Fill(val);
82 }
83 //
84 // -- EndJob
85 //
87 }
RunNumber_t run() const
Definition: EventID.h:42
T getParameter(std::string const &) const
EventNumber_t event() const
Definition: EventID.h:44
void storeBadEvents(edm::Event const &, float &val)
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:17
edm::InputTag inputLabel_
PFJetMonitor pfJetMonitor_
void fill(const T &jetCollection, const C &matchedJetCollection, float &minVal, float &maxVal)
fill histograms with all particle
Definition: PFJetMonitor.h:65
LuminosityBlockNumber_t luminosityBlock() const
Definition: EventID.h:43
static DQMStore * DQM_
Definition: Benchmark.h:39
MonitorElement * bookFloat(const char *name)
Book float.
Definition: DQMStore.cc:456
void Fill(long long x)
int path() const
Definition: HLTadd.h:3
int iEvent
Definition: GenABIO.cc:243
void setup()
book histograms
Definition: PFJetMonitor.cc:53
std::string benchmarkLabel_
MonitorElement * get(const std::string &path) const
get ME from full pathname (e.g. &quot;my/long/dir/my_histo&quot;)
Definition: DQMStore.cc:1270
bool isValid() const
Definition: HandleBase.h:76
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:359
edm::ParameterSet pSet_
void setParameters(const edm::ParameterSet &parameterSet)
set the parameters
Definition: PFJetMonitor.cc:16
edm::InputTag matchLabel_
edm::EventID id() const
Definition: EventBase.h:56
void analyze(edm::Event const &, edm::EventSetup const &)
void Reset(void)
reset ME (ie. contents, errors, etc)
PFJetDQMAnalyzer(const edm::ParameterSet &parameterSet)
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:237