1 |
kukartse |
1.1 |
// -*- C++ -*-
|
2 |
|
|
//
|
3 |
|
|
// Package: PlotReco
|
4 |
|
|
// Class: PlotReco
|
5 |
|
|
//
|
6 |
|
|
/**\class PlotReco PlotReco.h LJMet/Utils/interface/PlotReco.h
|
7 |
|
|
|
8 |
|
|
Description: quick look at the RECO data
|
9 |
|
|
|
10 |
|
|
Implementation:
|
11 |
|
|
Keep this class as simple and fast as possible
|
12 |
|
|
*/
|
13 |
|
|
//
|
14 |
|
|
// Original Author: "Gena Kukartsev"
|
15 |
|
|
// Created: Tue Nov 10 13:39:12 CDT 2009
|
16 |
|
|
// $Id: PlotReco.h,v 1.1 2009/10/27 23:24:11 kukartse Exp $
|
17 |
|
|
//
|
18 |
|
|
//
|
19 |
|
|
|
20 |
|
|
#include "LJMet/Utils/interface/PlotReco.h"
|
21 |
|
|
#include "FWCore/Framework/interface/TriggerNames.h"
|
22 |
|
|
#include "DataFormats/Common/interface/TriggerResults.h"
|
23 |
|
|
#include "DataFormats/PatCandidates/interface/Jet.h"
|
24 |
|
|
#include "DataFormats/PatCandidates/interface/Electron.h"
|
25 |
|
|
#include "DataFormats/PatCandidates/interface/Muon.h"
|
26 |
|
|
#include "DataFormats/PatCandidates/interface/MET.h"
|
27 |
|
|
#include "DataFormats/PatCandidates/interface/TriggerPath.h"
|
28 |
|
|
#include "DataFormats/BeamSpot/interface/BeamSpot.h"
|
29 |
|
|
#include "DataFormats/EgammaCandidates/interface/GsfElectron.h"
|
30 |
|
|
#include "DataFormats/Math/interface/deltaR.h"
|
31 |
|
|
|
32 |
|
|
using namespace edm;
|
33 |
|
|
|
34 |
|
|
PlotReco::PlotReco(const edm::ParameterSet& iConfig){
|
35 |
|
|
std::cout << "=======>: PlotReco::PlotReco()" << std::endl;
|
36 |
|
|
}
|
37 |
|
|
|
38 |
|
|
|
39 |
|
|
PlotReco::~PlotReco()
|
40 |
|
|
{
|
41 |
|
|
std::cout << "=======>: PlotReco::~PlotReco()" << std::endl;
|
42 |
|
|
}
|
43 |
|
|
|
44 |
|
|
|
45 |
|
|
void
|
46 |
|
|
PlotReco::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup)
|
47 |
|
|
{
|
48 |
|
|
std::cout << "=======>: PlotReco::analyze()" << std::endl;
|
49 |
|
|
//
|
50 |
|
|
//_____ event book keeping
|
51 |
|
|
//
|
52 |
|
|
unsigned int irun = (unsigned int)iEvent.id().run();
|
53 |
|
|
// this will work starting with CMSSW_340:
|
54 |
|
|
//unsigned int ilumi = (unsigned int)iEvent.id().luminosityBlock();
|
55 |
|
|
unsigned int ilumi = (unsigned int)iEvent.getLuminosityBlock().luminosityBlock();
|
56 |
|
|
unsigned int ievent = (unsigned int)iEvent.id().event();
|
57 |
|
|
cout << std::endl << "===> Provenance: " << std::endl;
|
58 |
|
|
cout << "Run, lumi, event: " << irun << ", " << ilumi << ", "<< ievent << std::endl;
|
59 |
|
|
//
|
60 |
|
|
//_____ check PAT jets _______________________________________________
|
61 |
|
|
//
|
62 |
|
|
std::cout << std::endl << "===> Check PAT jets: " << std::endl;
|
63 |
|
|
Handle< vector< reco::CaloJet > > jets;
|
64 |
|
|
iEvent . getByLabel( "kt4CaloJets", jets );
|
65 |
|
|
int jet_coll_size = jets->size();
|
66 |
|
|
cout << "jet collection size: "<< jet_coll_size << endl;
|
67 |
|
|
if (jet_coll_size>0){
|
68 |
|
|
double _pt = (*jets)[0].pt();
|
69 |
|
|
double _eta = (*jets)[0].eta();
|
70 |
|
|
cout << "pT= " << _pt << ", eta=" << _eta << std::endl;
|
71 |
|
|
}
|
72 |
|
|
//
|
73 |
|
|
//_____ check trigger
|
74 |
|
|
//
|
75 |
|
|
cout << std::endl << "===> Check trigger: " << std::endl;
|
76 |
|
|
Handle<TriggerResults> hltresults;
|
77 |
|
|
iEvent.getByLabel("TriggerResults", hltresults);
|
78 |
|
|
int ntrigs=hltresults->size();
|
79 |
|
|
edm::TriggerNames triggerNames_;
|
80 |
|
|
triggerNames_.init(*hltresults);
|
81 |
|
|
for (int itrig = 0; itrig < ntrigs; ++itrig) {
|
82 |
|
|
cout << "Trigger name and number: " << triggerNames_.triggerName(itrig) << ", " << itrig;
|
83 |
|
|
cout << " passed: " << hltresults->accept(itrig) << endl;
|
84 |
|
|
}
|
85 |
|
|
//
|
86 |
|
|
//_____ check Beam spot _____________________________________________________
|
87 |
|
|
//
|
88 |
|
|
cout << std::endl << "===> Check Beam spot: " << std::endl;
|
89 |
|
|
Handle< reco::BeamSpot > beamSpotHandle;
|
90 |
|
|
iEvent . getByLabel( "offlineBeamSpot", beamSpotHandle);
|
91 |
|
|
reco::BeamSpot beamSpot;
|
92 |
|
|
if ( beamSpotHandle.isValid() ){
|
93 |
|
|
beamSpot = *beamSpotHandle;
|
94 |
|
|
cout << "beam spot present in the Event..." << std::endl;
|
95 |
|
|
}
|
96 |
|
|
else{
|
97 |
|
|
edm::LogInfo("TtLJetsAnalyzer")
|
98 |
|
|
<< "No beam spot available in the event \n";
|
99 |
|
|
}
|
100 |
|
|
cout << beamSpot.x0() << " " << beamSpot.y0() << " " << beamSpot.z0() << std::endl;
|
101 |
|
|
}
|
102 |
|
|
|
103 |
|
|
|
104 |
|
|
void
|
105 |
|
|
PlotReco::beginJob()
|
106 |
|
|
{
|
107 |
|
|
std::cout << "=======>: PlotReco::beginJob()" << std::endl;
|
108 |
|
|
}
|
109 |
|
|
|
110 |
|
|
|
111 |
|
|
void
|
112 |
|
|
PlotReco::endJob() {
|
113 |
|
|
std::cout << "=======>: PlotReco::endJob()" << std::endl;
|
114 |
|
|
}
|
115 |
|
|
|
116 |
|
|
|
117 |
|
|
|
118 |
|
|
//define this as a plug-in
|
119 |
|
|
DEFINE_FWK_MODULE(PlotReco);
|