CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
QcdHighPtDQM.cc
Go to the documentation of this file.
1 /*
2  * See header file for a description of this class.
3  *
4  * $Date: 2012/01/11 13:53:29 $
5  * $Revision: 1.5 $
6  * \author S. Bolognesi, Eric - CERN
7  */
8 
10 
15 
19 
22 #include <vector>
23 
24 #include <string>
25 #include <cmath>
26 
27 using namespace std;
28 using namespace edm;
29 using namespace reco;
30 using namespace math;
31 
32 
33 //Get Jets and MET (no MET plots yet pending converging w/JetMET group)
34 
36  jetLabel_(iConfig.getUntrackedParameter<edm::InputTag>("jetTag")),
37  metLabel1_(iConfig.getUntrackedParameter<edm::InputTag>("metTag1")),
38  metLabel2_(iConfig.getUntrackedParameter<edm::InputTag>("metTag2")),
39  metLabel3_(iConfig.getUntrackedParameter<edm::InputTag>("metTag3")),
40  metLabel4_(iConfig.getUntrackedParameter<edm::InputTag>("metTag4"))
41 {
42 
44 
45 }
46 
48 
49 
50 }
51 
52 
54 
55 
56  //Book MEs
57 
58  theDbe->setCurrentFolder("Physics/QcdHighPt");
59 
60  MEcontainer_["dijet_mass"] = theDbe->book1D("dijet_mass", "dijet resonance invariant mass, barrel region", 100, 0, 1000);
61  MEcontainer_["njets"] = theDbe->book1D("njets", "jet multiplicity", 10, 0, 10);
62  MEcontainer_["etaphi"] = theDbe->book2D("etaphi", "eta/phi distribution", 83, -42, 42, 72, -M_PI, M_PI);
63  MEcontainer_["njets30"] = theDbe->book1D("njets30", "jet multiplicity, pt > 30 GeV", 10, 0, 10);
64 
65  //book histograms for inclusive jet quantities
66  MEcontainer_["inclusive_jet_pt"] = theDbe->book1D("inclusive_jet_pt", "inclusive jet Pt spectrum", 100, 0, 1000);
67  MEcontainer_["inclusive_jet_pt_barrel"] = theDbe->book1D("inclusive_jet_pt_barrel", "inclusive jet Pt, eta < 1.3", 100, 0, 1000);
68  MEcontainer_["inclusive_jet_pt_forward"] = theDbe->book1D("inclusive_jet_pt_forward", "inclusive jet Pt, 3.0 < eta < 5.0", 100, 0, 1000);
69  MEcontainer_["inclusive_jet_pt_endcap"] = theDbe->book1D("inclusive_jet_pt_endcap", "inclusive jet Pt, 1.3 < eta < 3.0", 100, 0, 1000);
70 
71  //book histograms for leading jet quantities
72  MEcontainer_["leading_jet_pt"] = theDbe->book1D("leading_jet_pt", "leading jet Pt", 100, 0, 1000);
73  MEcontainer_["leading_jet_pt_barrel"] = theDbe->book1D("leading_jet_pt_barrel", "leading jet Pt, eta < 1.3", 100, 0, 1000);
74  MEcontainer_["leading_jet_pt_forward"] = theDbe->book1D("leading_jet_pt_forward", "leading jet Pt, 3.0 < eta < 5.0", 100, 0, 1000);
75  MEcontainer_["leading_jet_pt_endcap"] = theDbe->book1D("leading_jet_pt_endcap", "leading jet Pt, 1.3 < eta < 3.0", 100, 0, 1000);
76 
77  //book histograms for met over sum et and met over leading jet pt for various
78  //flavors of MET
79  MEcontainer_["movers_met"] = theDbe->book1D("movers_met", "MET over Sum ET for basic MET collection", 50, 0, 1);
80  MEcontainer_["moverl_met"] = theDbe->book1D("moverl_met", "MET over leading jet Pt for basic MET collection", 50, 0, 2);
81 
82  MEcontainer_["movers_metho"] = theDbe->book1D("movers_metho", "MET over Sum ET for MET HO collection", 50, 0, 1);
83  MEcontainer_["moverl_metho"] = theDbe->book1D("moverl_metho", "MET over leading jet Pt for MET HO collection", 50, 0, 2);
84 
85  MEcontainer_["movers_metnohf"] = theDbe->book1D("movers_metnohf", "MET over Sum ET for MET no HF collection", 50, 0, 1);
86  MEcontainer_["moverl_metnohf"] = theDbe->book1D("moverl_metnohf", "MET over leading jet Pt for MET no HF collection", 50, 0, 2);
87 
88  MEcontainer_["movers_metnohfho"] = theDbe->book1D("movers_metnohfho", "MET over Sum ET for MET no HF HO collection", 50, 0, 1);
89  MEcontainer_["moverl_metnohfho"] = theDbe->book1D("moverl_metnohfho", "MET over leading jet Pt for MET no HF HO collection", 50, 0, 2);
90 
91  //book histograms for EMF fraction for all jets and first 3 jets
92  MEcontainer_["inclusive_jet_EMF"] = theDbe->book1D("inclusive_jet_EMF", "inclusive jet EMF", 50, -1, 1);
93  MEcontainer_["leading_jet_EMF"] = theDbe->book1D("leading_jet_EMF", "leading jet EMF", 50, -1, 1);
94  MEcontainer_["second_jet_EMF"] = theDbe->book1D("second_jet_EMF", "second jet EMF", 50, -1, 1);
95  MEcontainer_["third_jet_EMF"] = theDbe->book1D("third_jet_EMF", "third jet EMF", 50, -1, 1);
96 
97 
98 
99 
100 }
101 
103 
104 }
105 
106 // method to calculate MET over Sum ET from a particular MET collection
107 float QcdHighPtDQM::movers(const CaloMETCollection &metcollection) {
108 
109  float metovers = 0;
110  CaloMETCollection::const_iterator met_iter;
111  for(met_iter = metcollection.begin(); met_iter!= metcollection.end(); ++met_iter)
112  {
113  float mex = met_iter->momentum().x();
114  float mey = met_iter->momentum().y();
115  float met = sqrt(mex*mex+mey*mey);
116  float sumet = met_iter->sumEt();
117  metovers = (met / sumet);
118  }
119  return metovers;
120 }
121 
122 
123 // method to calculate MET over Leading jet PT for a particular MET collection
124 float QcdHighPtDQM::moverl(const CaloMETCollection &metcollection, float &ljpt) {
125  float metoverl = 0;
126  CaloMETCollection::const_iterator met_iter;
127  for(met_iter = metcollection.begin(); met_iter!= metcollection.end(); ++met_iter)
128  {
129  float mex = met_iter->momentum().x();
130  float mey = met_iter->momentum().y();
131  float met = sqrt(mex*mex+mey*mey);
132  metoverl = (met / ljpt);
133  }
134  return metoverl;
135 }
136 
137 
138 void QcdHighPtDQM::analyze(const Event& iEvent, const EventSetup& iSetup) {
139 
140  //Get Jets
142  iEvent.getByLabel(jetLabel_,jetHandle);
143  const CaloJetCollection & jets = *jetHandle;
144  CaloJetCollection::const_iterator jet_iter;
145 
146  //Get MET collections
148  iEvent.getByLabel(metLabel1_, metHandle);
149  const CaloMETCollection &met = *metHandle;
150 
151  edm::Handle<CaloMETCollection> metHOHandle;
152  iEvent.getByLabel(metLabel2_, metHOHandle);
153  const CaloMETCollection &metHO = *metHOHandle;
154 
155  edm::Handle<CaloMETCollection> metNoHFHandle;
156  iEvent.getByLabel(metLabel3_, metNoHFHandle);
157  const CaloMETCollection &metNoHF = *metNoHFHandle;
158 
159  edm::Handle<CaloMETCollection> metNoHFHOHandle;
160  iEvent.getByLabel(metLabel4_, metNoHFHOHandle);
161  const CaloMETCollection &metNoHFHO = *metNoHFHOHandle;
162 
163  //initialize leading jet value and jet multiplicity counter
164  int njets = 0;
165  int njets30 = 0;
166  float leading_jetpt = 0;
167  float leading_jeteta = 0;
168 
169  //initialize variables for picking out leading 2 barrel jets
170  reco::CaloJet leadingbarreljet;
171  reco::CaloJet secondbarreljet;
172  int nbarreljets = 0;
173 
174  //get bins in eta.
175  //Bins correspond to calotower regions.
176 
177  const float etabins[83] = {-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, -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, -1.131, -1.044, -.957, -.879, -.783, -.696, -.609, -.522, -.435, -.348, -.261, -.174, -.087, 0, .087, .174, .261, .348, .435, .522, .609, .696, .783, .879, .957, 1.044, 1.131, 1.218, 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, 2.964, 3.139, 3.314, 3.489, 3.664, 3.839, 4.013, 4.191, 4.363, 4.538, 4.889, 5.191};
178 
179  for(jet_iter = jets.begin(); jet_iter!= jets.end(); ++jet_iter){
180  njets++;
181 
182  //get Jet stats
183  float jet_pt = jet_iter->pt();
184  float jet_eta = jet_iter->eta();
185  float jet_phi = jet_iter->phi();
186 
187  //fill jet Pt and jet EMF
188  MEcontainer_["inclusive_jet_pt"]->Fill(jet_pt);
189  MEcontainer_["inclusive_jet_EMF"]->Fill(jet_iter->emEnergyFraction());
190 
191  // pick out up to the first 2 leading barrel jets
192  // for use in calculating dijet mass in barrel region
193  // also fill jet Pt histogram for barrel
194 
195  if(jet_eta <= 1.3){
196  MEcontainer_["inclusive_jet_pt_barrel"]->Fill(jet_pt);
197  if(nbarreljets == 0){
198  leadingbarreljet = jets[(njets-1)];
199  nbarreljets++;
200  }
201  else if(nbarreljets == 1){
202  secondbarreljet = jets[(njets-1)];
203  nbarreljets++;
204  }
205 
206  }
207 
208  // fill jet Pt for endcap and forward regions
209  else if(jet_eta <= 3.0 && jet_eta > 1.3){MEcontainer_["inclusive_jet_pt_endcap"]->Fill(jet_pt);}
210 
211  else if(jet_eta <= 5.0 && jet_eta > 3.0){MEcontainer_["inclusive_jet_pt_forward"]->Fill(jet_pt);}
212 
213 
214  // count jet multiplicity for jets with Pt > 30
215  if((jet_pt) > 30) njets30++;
216 
217  // check leading jet quantities
218  if(jet_pt > leading_jetpt){
219  leading_jetpt = jet_pt;
220  leading_jeteta = jet_eta;
221  }
222 
223  //fill eta-phi plot
224  for (int eit = 0; eit < 81; eit++){
225  for(int pit = 0; pit < 72; pit++){
226  float low_eta = etabins[eit];
227  float high_eta = etabins[eit+1];
228  float low_phi = (-M_PI) + pit*(M_PI/36);
229  float high_phi = low_phi + (M_PI/36);
230  if(jet_eta > low_eta && jet_eta < high_eta && jet_phi > low_phi && jet_phi < high_phi){
231  MEcontainer_["etaphi"]->Fill((eit - 41), jet_phi);}
232 
233 
234  }
235  }
236  }
237 
238  // after iterating over all jets, fill leading jet quantity histograms
239  // and jet multiplicity histograms
240 
241  MEcontainer_["leading_jet_pt"]->Fill(leading_jetpt);
242 
243  if(leading_jeteta <= 1.3){MEcontainer_["leading_jet_pt_barrel"]->Fill(leading_jetpt);}
244 
245  else if(leading_jeteta <= 3.0 && leading_jeteta > 1.3){MEcontainer_["leading_jet_pt_endcap"]->Fill(leading_jetpt);}
246 
247  else if(leading_jeteta <= 5.0 && leading_jeteta > 3.0){MEcontainer_["leading_jet_pt_forward"]->Fill(leading_jetpt);}
248 
249  MEcontainer_["njets"]->Fill(njets);
250 
251  MEcontainer_["njets30"]->Fill(njets30);
252 
253  // fill MET over Sum ET and Leading jet PT for all MET flavors
254  MEcontainer_["movers_met"]->Fill(movers(met));
255  MEcontainer_["moverl_met"]->Fill(movers(met), leading_jetpt);
256  MEcontainer_["movers_metho"]->Fill(movers(metHO));
257  MEcontainer_["moverl_metho"]->Fill(movers(metHO), leading_jetpt);
258  MEcontainer_["movers_metnohf"]->Fill(movers(metNoHF));
259  MEcontainer_["moverl_metnohf"]->Fill(movers(metNoHF), leading_jetpt);
260  MEcontainer_["movers_metnohfho"]->Fill(movers(metNoHFHO));
261  MEcontainer_["moverl_metnohfho"]->Fill(movers(metNoHFHO), leading_jetpt);
262 
263 
264  // fetch first 3 jet EMF
265 
266  if(jets.size() >= 1){
267  MEcontainer_["leading_jet_EMF"]->Fill(jets[0].emEnergyFraction());
268  if(jets.size() >=2){
269  MEcontainer_["second_jet_EMF"]->Fill(jets[1].emEnergyFraction());
270  if(jets.size() >= 3){
271  MEcontainer_["third_jet_EMF"]->Fill(jets[2].emEnergyFraction());
272  }
273  }
274  }
275 
276  // if 2 nontrivial barrel jets, reconstruct dijet mass
277 
278  if(nbarreljets == 2){
279  if(leadingbarreljet.energy() > 0 && secondbarreljet.energy() > 0){
280  math::XYZTLorentzVector DiJet = leadingbarreljet.p4() + secondbarreljet.p4();
281  float dijet_mass = DiJet.mass();
282  MEcontainer_["dijet_mass"]->Fill(dijet_mass);
283  }
284  }
285 
286 
287 }
288 
289 
290 
291 
292 
293 
294 
295 
296 
297 
298 
299 
300 
float moverl(const reco::CaloMETCollection &metcollection, float &ljpt)
edm::InputTag metLabel2_
Definition: QcdHighPtDQM.h:55
void analyze(const edm::Event &, const edm::EventSetup &)
Get the analysis.
Jets made from CaloTowers.
Definition: CaloJet.h:30
MonitorElement * book1D(const char *name, const char *title, int nchX, double lowX, double highX)
Book 1D histogram.
Definition: DQMStore.cc:717
DQMStore * theDbe
Definition: QcdHighPtDQM.h:50
edm::InputTag jetLabel_
Definition: QcdHighPtDQM.h:53
edm::InputTag metLabel1_
Definition: QcdHighPtDQM.h:54
tuple metNoHF
Definition: CaloMET_cfi.py:50
std::map< std::string, MonitorElement * > MEcontainer_
Definition: QcdHighPtDQM.h:60
Collection of Calo MET.
XYZTLorentzVectorD XYZTLorentzVector
Lorentz vector with cylindrical internal representation using pseudorapidity.
Definition: LorentzVector.h:30
virtual double energy() const
energy
int iEvent
Definition: GenABIO.cc:243
T sqrt(T t)
Definition: SSEVec.h:46
tuple metNoHFHO
Definition: CaloMET_cfi.py:62
vector< PseudoJet > jets
edm::InputTag metLabel3_
Definition: QcdHighPtDQM.h:56
void beginJob()
Inizialize parameters for histo binning.
Definition: QcdHighPtDQM.cc:53
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:356
float movers(const reco::CaloMETCollection &metcollection)
#define M_PI
Definition: BFit3D.cc:3
edm::InputTag metLabel4_
Definition: QcdHighPtDQM.h:57
virtual double pt() const
transverse momentum
void endJob(void)
QcdHighPtDQM(const edm::ParameterSet &)
Constructor.
Definition: QcdHighPtDQM.cc:35
tuple metHO
Definition: CaloMET_cfi.py:30
MonitorElement * book2D(const char *name, const char *title, int nchX, double lowX, double highX, int nchY, double lowY, double highY)
Book 2D histogram.
Definition: DQMStore.cc:845
virtual const LorentzVector & p4() const
four-momentum Lorentz vector
virtual ~QcdHighPtDQM()
Destructor.
Definition: QcdHighPtDQM.cc:47
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:429
std::vector< CaloJet > CaloJetCollection
collection of CaloJet objects