CMS 3D CMS Logo

QcdHighPtDQM.cc
Go to the documentation of this file.
1 /*
2  * See header file for a description of this class.
3  *
4  * \author S. Bolognesi, Eric - CERN
5  */
6 
8 
13 
16 
19 #include <vector>
20 
21 #include <string>
22 #include <cmath>
23 
24 using namespace std;
25 using namespace edm;
26 using namespace reco;
27 using namespace math;
28 
29 // Get Jets and MET (no MET plots yet pending converging w/JetMET group)
30 
32  : jetToken_(consumes<CaloJetCollection>(iConfig.getUntrackedParameter<edm::InputTag>("jetTag"))),
33  metToken1_(consumes<CaloMETCollection>(iConfig.getUntrackedParameter<edm::InputTag>("metTag1"))),
34  metToken2_(consumes<CaloMETCollection>(iConfig.getUntrackedParameter<edm::InputTag>("metTag2"))),
35  metToken3_(consumes<CaloMETCollection>(iConfig.getUntrackedParameter<edm::InputTag>("metTag3"))),
36  metToken4_(consumes<CaloMETCollection>(iConfig.getUntrackedParameter<edm::InputTag>("metTag4"))) {}
37 
39 
41  iBooker.setCurrentFolder("Physics/QcdHighPt");
42 
43  MEcontainer_["dijet_mass"] =
44  iBooker.book1D("dijet_mass", "dijet resonance invariant mass, barrel region", 100, 0, 1000);
45  MEcontainer_["njets"] = iBooker.book1D("njets", "jet multiplicity", 10, 0, 10);
46  MEcontainer_["etaphi"] = iBooker.book2D("etaphi", "eta/phi distribution", 83, -42, 42, 72, -M_PI, M_PI);
47  MEcontainer_["njets30"] = iBooker.book1D("njets30", "jet multiplicity, pt > 30 GeV", 10, 0, 10);
48 
49  // book histograms for inclusive jet quantities
50  MEcontainer_["inclusive_jet_pt"] = iBooker.book1D("inclusive_jet_pt", "inclusive jet Pt spectrum", 100, 0, 1000);
51  MEcontainer_["inclusive_jet_pt_barrel"] =
52  iBooker.book1D("inclusive_jet_pt_barrel", "inclusive jet Pt, eta < 1.3", 100, 0, 1000);
53  MEcontainer_["inclusive_jet_pt_forward"] =
54  iBooker.book1D("inclusive_jet_pt_forward", "inclusive jet Pt, 3.0 < eta < 5.0", 100, 0, 1000);
55  MEcontainer_["inclusive_jet_pt_endcap"] =
56  iBooker.book1D("inclusive_jet_pt_endcap", "inclusive jet Pt, 1.3 < eta < 3.0", 100, 0, 1000);
57 
58  // book histograms for leading jet quantities
59  MEcontainer_["leading_jet_pt"] = iBooker.book1D("leading_jet_pt", "leading jet Pt", 100, 0, 1000);
60  MEcontainer_["leading_jet_pt_barrel"] =
61  iBooker.book1D("leading_jet_pt_barrel", "leading jet Pt, eta < 1.3", 100, 0, 1000);
62  MEcontainer_["leading_jet_pt_forward"] =
63  iBooker.book1D("leading_jet_pt_forward", "leading jet Pt, 3.0 < eta < 5.0", 100, 0, 1000);
64  MEcontainer_["leading_jet_pt_endcap"] =
65  iBooker.book1D("leading_jet_pt_endcap", "leading jet Pt, 1.3 < eta < 3.0", 100, 0, 1000);
66 
67  // book histograms for met over sum et and met over leading jet pt for various
68  // flavors of MET
69  MEcontainer_["movers_met"] = iBooker.book1D("movers_met", "MET over Sum ET for basic MET collection", 50, 0, 1);
70  MEcontainer_["moverl_met"] =
71  iBooker.book1D("moverl_met", "MET over leading jet Pt for basic MET collection", 50, 0, 2);
72 
73  MEcontainer_["movers_metho"] = iBooker.book1D("movers_metho", "MET over Sum ET for MET HO collection", 50, 0, 1);
74  MEcontainer_["moverl_metho"] =
75  iBooker.book1D("moverl_metho", "MET over leading jet Pt for MET HO collection", 50, 0, 2);
76 
77  MEcontainer_["movers_metnohf"] =
78  iBooker.book1D("movers_metnohf", "MET over Sum ET for MET no HF collection", 50, 0, 1);
79  MEcontainer_["moverl_metnohf"] =
80  iBooker.book1D("moverl_metnohf", "MET over leading jet Pt for MET no HF collection", 50, 0, 2);
81 
82  MEcontainer_["movers_metnohfho"] =
83  iBooker.book1D("movers_metnohfho", "MET over Sum ET for MET no HF HO collection", 50, 0, 1);
84  MEcontainer_["moverl_metnohfho"] =
85  iBooker.book1D("moverl_metnohfho", "MET over leading jet Pt for MET no HF HO collection", 50, 0, 2);
86 
87  // book histograms for EMF fraction for all jets and first 3 jets
88  MEcontainer_["inclusive_jet_EMF"] = iBooker.book1D("inclusive_jet_EMF", "inclusive jet EMF", 50, -1, 1);
89  MEcontainer_["leading_jet_EMF"] = iBooker.book1D("leading_jet_EMF", "leading jet EMF", 50, -1, 1);
90  MEcontainer_["second_jet_EMF"] = iBooker.book1D("second_jet_EMF", "second jet EMF", 50, -1, 1);
91  MEcontainer_["third_jet_EMF"] = iBooker.book1D("third_jet_EMF", "third jet EMF", 50, -1, 1);
92 }
93 
94 // method to calculate MET over Sum ET from a particular MET collection
95 float QcdHighPtDQM::movers(const CaloMETCollection &metcollection) {
96  float metovers = 0;
97  CaloMETCollection::const_iterator met_iter;
98  for (met_iter = metcollection.begin(); met_iter != metcollection.end(); ++met_iter) {
99  float mex = met_iter->momentum().x();
100  float mey = met_iter->momentum().y();
101  float met = sqrt(mex * mex + mey * mey);
102  float sumet = met_iter->sumEt();
103  metovers = (met / sumet);
104  }
105  return metovers;
106 }
107 
108 // method to calculate MET over Leading jet PT for a particular MET collection
109 float QcdHighPtDQM::moverl(const CaloMETCollection &metcollection, float &ljpt) {
110  float metoverl = 0;
111  CaloMETCollection::const_iterator met_iter;
112  for (met_iter = metcollection.begin(); met_iter != metcollection.end(); ++met_iter) {
113  float mex = met_iter->momentum().x();
114  float mey = met_iter->momentum().y();
115  float met = sqrt(mex * mex + mey * mey);
116  metoverl = (met / ljpt);
117  }
118  return metoverl;
119 }
120 
121 void QcdHighPtDQM::analyze(const Event &iEvent, const EventSetup &iSetup) {
122  // Get Jets
124  iEvent.getByToken(jetToken_, jetHandle);
125  const CaloJetCollection &jets = *jetHandle;
126  CaloJetCollection::const_iterator jet_iter;
127 
128  // Get MET collections
130  iEvent.getByToken(metToken1_, metHandle);
131  const CaloMETCollection &met = *metHandle;
132 
133  edm::Handle<CaloMETCollection> metHOHandle;
134  iEvent.getByToken(metToken2_, metHOHandle);
135  const CaloMETCollection &metHO = *metHOHandle;
136 
137  edm::Handle<CaloMETCollection> metNoHFHandle;
138  iEvent.getByToken(metToken3_, metNoHFHandle);
139  const CaloMETCollection &metNoHF = *metNoHFHandle;
140 
141  edm::Handle<CaloMETCollection> metNoHFHOHandle;
142  iEvent.getByToken(metToken4_, metNoHFHOHandle);
143  const CaloMETCollection &metNoHFHO = *metNoHFHOHandle;
144 
145  // initialize leading jet value and jet multiplicity counter
146  int njets = 0;
147  int njets30 = 0;
148  float leading_jetpt = 0;
149  float leading_jeteta = 0;
150 
151  // initialize variables for picking out leading 2 barrel jets
152  reco::CaloJet leadingbarreljet;
153  reco::CaloJet secondbarreljet;
154  int nbarreljets = 0;
155 
156  // get bins in eta.
157  // Bins correspond to calotower regions.
158 
159  const float etabins[83] = {
160  -5.191, -4.889, -4.716, -4.538, -4.363, -4.191, -4.013, -3.839, -3.664, -3.489, -3.314, -3.139, -2.964, -2.853,
161  -2.650, -2.500, -2.322, -2.172, -2.043, -1.930, -1.830, -1.740, -1.653, -1.566, -1.479, -1.392, -1.305, -1.218,
162  -1.131, -1.044, -.957, -.879, -.783, -.696, -.609, -.522, -.435, -.348, -.261, -.174, -.087, 0,
163  .087, .174, .261, .348, .435, .522, .609, .696, .783, .879, .957, 1.044, 1.131, 1.218,
164  1.305, 1.392, 1.479, 1.566, 1.653, 1.740, 1.830, 1.930, 2.043, 2.172, 2.322, 2.500, 2.650, 2.853,
165  2.964, 3.139, 3.314, 3.489, 3.664, 3.839, 4.013, 4.191, 4.363, 4.538, 4.889, 5.191};
166 
167  for (jet_iter = jets.begin(); jet_iter != jets.end(); ++jet_iter) {
168  njets++;
169 
170  // get Jet stats
171  float jet_pt = jet_iter->pt();
172  float jet_eta = jet_iter->eta();
173  float jet_phi = jet_iter->phi();
174 
175  // fill jet Pt and jet EMF
176  MEcontainer_["inclusive_jet_pt"]->Fill(jet_pt);
177  MEcontainer_["inclusive_jet_EMF"]->Fill(jet_iter->emEnergyFraction());
178 
179  // pick out up to the first 2 leading barrel jets
180  // for use in calculating dijet mass in barrel region
181  // also fill jet Pt histogram for barrel
182 
183  if (jet_eta <= 1.3) {
184  MEcontainer_["inclusive_jet_pt_barrel"]->Fill(jet_pt);
185  if (nbarreljets == 0) {
186  leadingbarreljet = jets[(njets - 1)];
187  nbarreljets++;
188  } else if (nbarreljets == 1) {
189  secondbarreljet = jets[(njets - 1)];
190  nbarreljets++;
191  }
192 
193  }
194 
195  // fill jet Pt for endcap and forward regions
196  else if (jet_eta <= 3.0 && jet_eta > 1.3) {
197  MEcontainer_["inclusive_jet_pt_endcap"]->Fill(jet_pt);
198  } else if (jet_eta <= 5.0 && jet_eta > 3.0) {
199  MEcontainer_["inclusive_jet_pt_forward"]->Fill(jet_pt);
200  }
201 
202  // count jet multiplicity for jets with Pt > 30
203  if ((jet_pt) > 30)
204  njets30++;
205 
206  // check leading jet quantities
207  if (jet_pt > leading_jetpt) {
208  leading_jetpt = jet_pt;
209  leading_jeteta = jet_eta;
210  }
211 
212  // fill eta-phi plot
213  for (int eit = 0; eit < 81; eit++) {
214  for (int pit = 0; pit < 72; pit++) {
215  float low_eta = etabins[eit];
216  float high_eta = etabins[eit + 1];
217  float low_phi = (-M_PI) + pit * (M_PI / 36);
218  float high_phi = low_phi + (M_PI / 36);
219  if (jet_eta > low_eta && jet_eta < high_eta && jet_phi > low_phi && jet_phi < high_phi) {
220  MEcontainer_["etaphi"]->Fill((eit - 41), jet_phi);
221  }
222  }
223  }
224  }
225 
226  // after iterating over all jets, fill leading jet quantity histograms
227  // and jet multiplicity histograms
228 
229  MEcontainer_["leading_jet_pt"]->Fill(leading_jetpt);
230 
231  if (leading_jeteta <= 1.3) {
232  MEcontainer_["leading_jet_pt_barrel"]->Fill(leading_jetpt);
233  } else if (leading_jeteta <= 3.0 && leading_jeteta > 1.3) {
234  MEcontainer_["leading_jet_pt_endcap"]->Fill(leading_jetpt);
235  } else if (leading_jeteta <= 5.0 && leading_jeteta > 3.0) {
236  MEcontainer_["leading_jet_pt_forward"]->Fill(leading_jetpt);
237  }
238 
239  MEcontainer_["njets"]->Fill(njets);
240 
241  MEcontainer_["njets30"]->Fill(njets30);
242 
243  // fill MET over Sum ET and Leading jet PT for all MET flavors
244  MEcontainer_["movers_met"]->Fill(movers(met));
245  MEcontainer_["moverl_met"]->Fill(movers(met), leading_jetpt);
246  MEcontainer_["movers_metho"]->Fill(movers(metHO));
247  MEcontainer_["moverl_metho"]->Fill(movers(metHO), leading_jetpt);
248  MEcontainer_["movers_metnohf"]->Fill(movers(metNoHF));
249  MEcontainer_["moverl_metnohf"]->Fill(movers(metNoHF), leading_jetpt);
250  MEcontainer_["movers_metnohfho"]->Fill(movers(metNoHFHO));
251  MEcontainer_["moverl_metnohfho"]->Fill(movers(metNoHFHO), leading_jetpt);
252 
253  // fetch first 3 jet EMF
254 
255  if (!jets.empty()) {
256  MEcontainer_["leading_jet_EMF"]->Fill(jets[0].emEnergyFraction());
257  if (jets.size() >= 2) {
258  MEcontainer_["second_jet_EMF"]->Fill(jets[1].emEnergyFraction());
259  if (jets.size() >= 3) {
260  MEcontainer_["third_jet_EMF"]->Fill(jets[2].emEnergyFraction());
261  }
262  }
263  }
264 
265  // if 2 nontrivial barrel jets, reconstruct dijet mass
266 
267  if (nbarreljets == 2) {
268  if (leadingbarreljet.energy() > 0 && secondbarreljet.energy() > 0) {
269  math::XYZTLorentzVector DiJet = leadingbarreljet.p4() + secondbarreljet.p4();
270  float dijet_mass = DiJet.mass();
271  MEcontainer_["dijet_mass"]->Fill(dijet_mass);
272  }
273  }
274 }
275 
276 // Local Variables:
277 // show-trailing-whitespace: t
278 // truncate-lines: t
279 // End:
reco::CaloJet
Jets made from CaloTowers.
Definition: CaloJet.h:27
Handle.h
QcdHighPtDQM::movers
float movers(const reco::CaloMETCollection &metcollection)
Definition: QcdHighPtDQM.cc:95
QcdHighPtDQM::jetToken_
edm::EDGetTokenT< reco::CaloJetCollection > jetToken_
Definition: QcdHighPtDQM.h:30
MessageLogger.h
QcdHighPtDQM::metToken4_
edm::EDGetTokenT< reco::CaloMETCollection > metToken4_
Definition: QcdHighPtDQM.h:34
edm::Run
Definition: Run.h:45
QcdHighPtDQM::analyze
void analyze(const edm::Event &, const edm::EventSetup &) override
Definition: QcdHighPtDQM.cc:121
edm
HLT enums.
Definition: AlignableModifier.h:19
QcdHighPtDQM::moverl
float moverl(const reco::CaloMETCollection &metcollection, float &ljpt)
Definition: QcdHighPtDQM.cc:109
dqm::implementation::NavigatorBase::setCurrentFolder
virtual void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:32
DQMStore.h
singleTopDQM_cfi.jets
jets
Definition: singleTopDQM_cfi.py:42
reco
fixed size matrix
Definition: AlignmentAlgorithmBase.h:45
edm::Handle
Definition: AssociativeIterator.h:50
QcdHighPtDQM::MEcontainer_
std::map< std::string, MonitorElement * > MEcontainer_
Definition: QcdHighPtDQM.h:37
BTaggingMonitor_cfi.met
met
Definition: BTaggingMonitor_cfi.py:84
QcdHighPtDQM::QcdHighPtDQM
QcdHighPtDQM(const edm::ParameterSet &)
Definition: QcdHighPtDQM.cc:31
CaloMET.h
Service.h
mathSSE::sqrt
T sqrt(T t)
Definition: SSEVec.h:19
QcdHighPtDQM::metToken1_
edm::EDGetTokenT< reco::CaloMETCollection > metToken1_
Definition: QcdHighPtDQM.h:31
edm::ParameterSet
Definition: ParameterSet.h:47
Event.h
iEvent
int iEvent
Definition: GenABIO.cc:224
QcdHighPtDQM::~QcdHighPtDQM
~QcdHighPtDQM() override
Definition: QcdHighPtDQM.cc:38
reco::CaloJetCollection
std::vector< CaloJet > CaloJetCollection
collection of CaloJet objects
Definition: CaloJetCollection.h:15
reco::LeafCandidate::p4
const LorentzVector & p4() const final
four-momentum Lorentz vector
Definition: LeafCandidate.h:114
M_PI
#define M_PI
Definition: BXVectorInputProducer.cc:49
QcdHighPtDQM::bookHistograms
void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
Definition: QcdHighPtDQM.cc:40
edm::EventSetup
Definition: EventSetup.h:57
particlelevel_cff.njets30
njets30
Definition: particlelevel_cff.py:167
QcdHighPtDQM::metToken2_
edm::EDGetTokenT< reco::CaloMETCollection > metToken2_
Definition: QcdHighPtDQM.h:32
std
Definition: JetResolutionObject.h:76
BTaggingMonitoring_cff.njets
njets
Definition: BTaggingMonitoring_cff.py:10
math
Definition: choleskyInversion.h:19
math::XYZTLorentzVector
XYZTLorentzVectorD XYZTLorentzVector
Lorentz vector with cylindrical internal representation using pseudorapidity.
Definition: LorentzVector.h:29
dqm::implementation::IBooker::book2D
MonitorElement * book2D(TString const &name, TString const &title, int nchX, double lowX, double highX, int nchY, double lowY, double highY, FUNC onbooking=NOOP())
Definition: DQMStore.h:177
EventSetup.h
dqm::implementation::IBooker
Definition: DQMStore.h:43
reco::LeafCandidate::energy
double energy() const final
energy
Definition: LeafCandidate.h:125
CaloMETCollection
Collection of Calo MET.
ParameterSet.h
edm::Event
Definition: Event.h:73
QcdHighPtDQM.h
defaults_cfi.etabins
etabins
Definition: defaults_cfi.py:7
edm::InputTag
Definition: InputTag.h:15
dqm::implementation::IBooker::book1D
MonitorElement * book1D(TString const &name, TString const &title, int const nchX, double const lowX, double const highX, FUNC onbooking=NOOP())
Definition: DQMStore.h:98
QcdHighPtDQM::metToken3_
edm::EDGetTokenT< reco::CaloMETCollection > metToken3_
Definition: QcdHighPtDQM.h:33