ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/MitPhysics/Mods/interface/PhotonTreeWriter.h
Revision: 1.14
Committed: Thu May 3 15:49:34 2012 UTC (13 years ago) by fabstoec
Content type: text/plain
Branch: MAIN
CVS Tags: Mit_028, Mit_027, Mit_027a
Changes since 1.13: +3 -2 lines
Log Message:
update on PFMetCorrections (Hgg MET tag analysis)

File Contents

# Content
1 //--------------------------------------------------------------------------------------------------
2 // $Id: PhotonTreeWriter.h,v 1.13 2012/05/03 12:02:27 fabstoec Exp $
3 //
4 // PhotonTreeWriter
5 //
6 // Authors: J. Bendavid
7 //--------------------------------------------------------------------------------------------------
8
9 #ifndef MITPHYSICS_MODS_PHOTONTREEWRITER_H
10 #define MITPHYSICS_MODS_PHOTONTREEWRITER_H
11
12 #include "MitAna/TreeMod/interface/BaseMod.h"
13 #include "MitAna/DataTree/interface/PhotonFwd.h"
14 #include "MitAna/DataTree/interface/TrackCol.h"
15 #include "MitAna/DataTree/interface/VertexCol.h"
16 #include "MitAna/DataTree/interface/BeamSpotCol.h"
17 #include "MitAna/DataTree/interface/PFCandidateCol.h"
18 #include "MitAna/DataTree/interface/PileupEnergyDensityCol.h"
19 #include "MitAna/DataTree/interface/DecayParticleCol.h"
20 #include "MitAna/DataTree/interface/ElectronCol.h"
21 #include "MitAna/DataTree/interface/MuonCol.h"
22 #include "MitAna/DataTree/interface/DecayParticleCol.h"
23 #include "MitAna/DataTree/interface/PileupInfoCol.h"
24 #include "MitAna/DataTree/interface/MCParticleCol.h"
25 #include "MitAna/DataTree/interface/SuperClusterCol.h"
26 #include "MitAna/DataTree/interface/PFMetCol.h"
27 #include "MitAna/DataTree/interface/JetCol.h"
28 #include "MitAna/DataTree/interface/PFJetCol.h"
29 #include "MitAna/DataTree/interface/GenJetCol.h"
30 #include "MitPhysics/Utils/interface/PhotonFix.h"
31 #include "MitPhysics/Utils/interface/PhotonTools.h"
32
33 class TNtuple;
34 class TRandom3;
35
36 namespace mithep
37 {
38
39 class PhotonTreeWriterPhoton
40 {
41 public:
42 void SetVars(const Photon *p, const DecayParticle *c, const Electron *ele, const SuperCluster *pfsc, const MCParticle *m, PhotonFix &phfixph, PhotonFix &phfixele, const TrackCol* trackCol,const VertexCol* vtxCol,Double_t _tRho, const ElectronCol* els=0, Bool_t applyElectronVeto=kTRUE);
43 Float_t Ecor() const { return ecor; };
44 Float_t Ecorerr() const { return ecorerr; };
45 Float_t Ecorele() const { return ecorele; };
46 Float_t Ecoreleerr() const { return ecoreleerr; };
47
48 private:
49 UChar_t hasphoton;
50 Float_t e;
51 Float_t pt;
52 Float_t eta;
53 Float_t phi;
54 Float_t r9;
55 Float_t e3x3;
56 Float_t e5x5;
57 Float_t sce;
58 Float_t scrawe;
59 Float_t scpse;
60 Float_t sceta;
61 Float_t scphi;
62 UInt_t scnclusters;
63 UInt_t scnhits;
64 Float_t scetawidth;
65 Float_t scphiwidth;
66 Float_t hovere;
67 Float_t sigietaieta;
68 Bool_t isbarrel;
69 Bool_t isr9reco;
70 Bool_t isr9cat;
71 Char_t phcat;
72 Float_t eerr;
73 Float_t eerrsmeared;
74 Float_t esmearing;
75 Float_t idmva;
76 Float_t ecalisodr03;
77 Float_t hcalisodr03;
78 Float_t trkisohollowdr03;
79 Float_t ecalisodr04;
80 Float_t hcalisodr04;
81 Float_t trkisohollowdr04;
82 Float_t trackiso1;
83 Float_t trackiso2;
84 Float_t combiso1;
85 Float_t combiso2;
86
87 //quantities from seed basic cluster
88 Float_t eseed;
89 Float_t etaseed;
90 Float_t phiseed;
91 Int_t ietaseed;
92 Int_t iphiseed;
93 Int_t ixseed;
94 Int_t iyseed;
95 Float_t etacryseed;
96 Float_t phicryseed;
97 Float_t xcryseed;
98 Float_t ycryseed;
99 Float_t thetaaxisseed;
100 Float_t phiaxisseed;
101 Float_t sigietaietaseed;
102 Float_t sigiphiphiseed;
103 Float_t covietaiphiseed;
104 Float_t e3x3seed;
105 Float_t e5x5seed;
106 Float_t emaxseed;
107 Float_t e2ndseed;
108 Float_t etopseed;
109 Float_t ebottomseed;
110 Float_t eleftseed;
111 Float_t erightseed;
112 Float_t e1x3seed;
113 Float_t e3x1seed;
114 Float_t e1x5seed;
115 Float_t e2x2seed;
116 Float_t e4x4seed;
117 Float_t e2x5maxseed;
118 Float_t e2x5topseed;
119 Float_t e2x5bottomseed;
120 Float_t e2x5leftseed;
121 Float_t e2x5rightseed;
122 Float_t xseedseed;
123 Float_t yseedseed;
124 Float_t zseedseed;
125 UInt_t nhitsseed;
126
127 //quantities from second basic cluster, if present
128 Float_t ebc2;
129 Float_t etabc2;
130 Float_t phibc2;
131 Int_t ietabc2;
132 Int_t iphibc2;
133 Int_t ixbc2;
134 Int_t iybc2;
135 Float_t etacrybc2;
136 Float_t phicrybc2;
137 Float_t xcrybc2;
138 Float_t ycrybc2;
139 Float_t thetaaxisbc2;
140 Float_t phiaxisbc2;
141 Float_t sigietaietabc2;
142 Float_t sigiphiphibc2;
143 Float_t covietaiphibc2;
144 Float_t e3x3bc2;
145 Float_t e5x5bc2;
146 Float_t emaxbc2;
147 Float_t e2ndbc2;
148 Float_t etopbc2;
149 Float_t ebottombc2;
150 Float_t eleftbc2;
151 Float_t erightbc2;
152 Float_t e1x3bc2;
153 Float_t e3x1bc2;
154 Float_t e1x5bc2;
155 Float_t e2x2bc2;
156 Float_t e4x4bc2;
157 Float_t e2x5maxbc2;
158 Float_t e2x5topbc2;
159 Float_t e2x5bottombc2;
160 Float_t e2x5leftbc2;
161 Float_t e2x5rightbc2;
162 Float_t xbc2bc2;
163 Float_t ybc2bc2;
164 Float_t zbc2bc2;
165 UInt_t nhitsbc2;
166
167 //quantities from lowest energy basic cluster if present
168 Float_t ebclast;
169 Float_t etabclast;
170 Float_t phibclast;
171 Int_t ietabclast;
172 Int_t iphibclast;
173 Int_t ixbclast;
174 Int_t iybclast;
175 Float_t etacrybclast;
176 Float_t phicrybclast;
177 Float_t xcrybclast;
178 Float_t ycrybclast;
179 Float_t thetaaxisbclast;
180 Float_t phiaxisbclast;
181 Float_t sigietaietabclast;
182 Float_t sigiphiphibclast;
183 Float_t covietaiphibclast;
184 Float_t e3x3bclast;
185 Float_t e5x5bclast;
186 UInt_t nhitsbclast;
187
188 //quantities from second lowest energy basic cluster if present
189 Float_t ebclast2;
190 Float_t etabclast2;
191 Float_t phibclast2;
192 Int_t ietabclast2;
193 Int_t iphibclast2;
194 Int_t ixbclast2;
195 Int_t iybclast2;
196 Float_t etacrybclast2;
197 Float_t phicrybclast2;
198 Float_t xcrybclast2;
199 Float_t ycrybclast2;
200 Float_t thetaaxisbclast2;
201 Float_t phiaxisbclast2;
202 Float_t sigietaietabclast2;
203 Float_t sigiphiphibclast2;
204 Float_t covietaiphibclast2;
205 Float_t e3x3bclast2;
206 Float_t e5x5bclast2;
207 UInt_t nhitsbclast2;
208
209 //energy correction quantities from PhotonFix
210 Float_t ecor;
211 Float_t ecorerr;
212 Float_t ecorele;
213 Float_t ecoreleerr;
214 Float_t etac;
215 Float_t etas;
216 Float_t etam;
217 Float_t phic;
218 Float_t phis;
219 Float_t phim;
220 Float_t xz;
221 Float_t xc;
222 Float_t xs;
223 Float_t xm;
224 Float_t yz;
225 Float_t yc;
226 Float_t ys;
227 Float_t ym;
228
229 //conversion quantities
230 UChar_t hasconversion;
231 Float_t convp;
232 Float_t convpt;
233 Float_t conveta;
234 Float_t convphi;
235 Float_t convdeta;
236 Float_t convdphi;
237 Float_t convvtxrho;
238 Float_t convvtxz;
239 Float_t convvtxphi;
240 Float_t convleadpt;
241 Float_t convtrailpt;
242 Float_t convleadtrackpt;
243 Char_t convleadtrackalgo;
244 Char_t convleadtrackalgos;
245 Char_t convleadtrackcharge;
246 Float_t convtrailtrackpt;
247 Char_t convtrailtrackalgo;
248 Char_t convtrailtrackalgos;
249 Char_t trailtrackcharge;
250
251 //electron quantities
252 UChar_t haselectron;
253 UChar_t eleisecaldriven;
254 UChar_t eleistrackerdriven;
255 Float_t elee;
256 Float_t elept;
257 Float_t eleeta;
258 Float_t elephi;
259 Char_t elecharge;
260 Float_t elefbrem;
261 Float_t eledeta;
262 Float_t eledphi;
263 Float_t elep;
264 Float_t elepin;
265 Float_t elepout;
266
267 //pf supercluster quantities
268 UChar_t haspfsc;
269 Float_t pfsce;
270 Float_t pfscrawe;
271 Float_t pfsceta;
272 Float_t pfscphi;
273
274 //generator level quantities
275 UChar_t ispromptgen;
276 Float_t gene;
277 Float_t genpt;
278 Float_t geneta;
279 Float_t genphi;
280 Float_t genz;
281 Int_t pdgid;
282 Int_t motherpdgid;
283 };
284
285 class PhotonTreeWriterDiphotonEvent
286 {
287 public:
288 // ------------ BTAG STUFF -------------------
289 Float_t btag;
290 Float_t btagJetPt;
291 Float_t btagJetEta;
292 // ----------- LEPTON TAG STUFF -------------
293 Int_t leptonTag;
294 // ---------- MUON STUFF --------------------
295 Float_t muonPt;
296 Float_t muonEta;
297 Float_t muDR1;
298 Float_t muDR2;
299 Float_t muIso1;
300 Float_t muIso2;
301 Float_t muIso3;
302 Float_t muIso4;
303 Float_t muD0;
304 Float_t muDZ;
305 Int_t muNhits;
306 Float_t muChi2;
307 Int_t muNpixhits;
308 Int_t muNegs;
309 Int_t muNMatch;
310 // ----------- ELECTRON STUFF --------------
311 Float_t elePt;
312 Float_t eleEta;
313 Float_t eleSCEta;
314 Float_t eleIso1;
315 Float_t eleIso2;
316 Float_t eleIso3;
317 Float_t eleIso4;
318 Float_t eleDist;
319 Float_t eleDcot;
320 Float_t eleCoviee;
321 Float_t eleDphiin;
322 Float_t eleDetain;
323 Float_t eleDR1;
324 Float_t eleDR2;
325 Float_t eleMass1;
326 Float_t eleMass2;
327 Int_t eleNinnerHits;
328 // -----------------------------------------
329 Float_t rho;
330 Float_t genHiggspt;
331 Float_t genHiggsZ;
332 Float_t genmass;
333 Float_t gencostheta;
334 Float_t bsX;
335 Float_t bsY;
336 Float_t bsZ;
337 Float_t bsSigmaZ;
338 Float_t vtxX;
339 Float_t vtxY;
340 Float_t vtxZ;
341 Int_t nVtx;
342 Int_t numPU;
343 Int_t numPUminus;
344 Int_t numPUplus;
345 Float_t mass;
346 Float_t masserr;
347 Float_t masserrsmeared;
348 Float_t masserrwrongvtx;
349 Float_t masserrsmearedwrongvtx;
350 Float_t vtxprob;
351 Float_t deltamvtx;
352 Float_t ptgg;
353 Float_t etagg;
354 Float_t phigg;
355 Float_t costheta;
356 Float_t massele;
357 Float_t ptee;
358 Float_t costhetaele;
359 Float_t mt;
360 Float_t cosphimet;
361 Float_t mtele;
362 Float_t cosphimetele;
363 UInt_t evt;
364 UInt_t run;
365 UInt_t lumi;
366 UChar_t evtcat;
367 UInt_t nobj;
368 Double_t fromZ; //added: Heng 2/14/2012
369 Double_t fromW; //added: Heng
370 Float_t zpt; //added: Heng
371 Float_t allZpt; //added: Heng
372 Float_t zEta; //added: Heng
373 Float_t allZEta; //added: Heng
374 Float_t corrpfmet;
375 Float_t corrpfmetphi;
376 Float_t corrpfmetx;
377 Float_t corrpfmety;
378 Double_t dphiMetgg;
379 Double_t cosdphiMetgg;
380 Double_t dphiPhPh;
381 Float_t pfmet;
382 Float_t pfmetphi;
383 Float_t pfmetx;
384 Float_t pfmety;
385 UChar_t ismc;
386
387 //corrected quantities from PhotonFix corrections
388 Float_t masscor;
389 Float_t masscorerr;
390 Float_t masscorele;
391 Float_t masscoreleerr;
392
393 //jet quantities
394 Float_t jet1pt;
395 Float_t jet1eta;
396 Float_t jet1phi;
397 Float_t jet1mass;
398 Float_t jet2pt;
399 Float_t jet2eta;
400 Float_t jet2phi;
401 Float_t jet2mass;
402 Float_t jetcentralpt;
403 Float_t jetcentraleta;
404 Float_t jetcentralphi;
405 Float_t jetcentralmass;
406 Float_t dijetpt;
407 Float_t dijeteta;
408 Float_t dijetphi;
409 Float_t dijetmass;
410 Float_t jetetaplus;
411 Float_t jetetaminus;
412
413 Float_t zeppenfeld;
414 Float_t dphidijetgg;
415
416 PhotonTreeWriterPhoton photons[2];
417 };
418
419 class PhotonTreeWriter : public BaseMod
420 {
421 public:
422 PhotonTreeWriter(const char *name ="PhotonTreeWriter",
423 const char *title="Selecting PhotonPairs");
424
425 ~PhotonTreeWriter();
426
427 // setting all the input Names
428 void SetInputPhotonsName(const char *n){ fPhotonBranchName= n; }
429 void SetPhotonsFromBranch(bool b) { fPhotonsFromBranch = b; }
430 void SetTrackName(const char *n) { fTrackBranchName = n; }
431 void SetElectronName(const char *n) { fElectronName = n; }
432 void SetConversionName(const char *n) { fConversionName = n; }
433 void SetPUDensityName(const char *n) { fPileUpDenName = n; }
434 void SetPVName(const char *n) { fPVName = n; }
435 void SetPVFromBranch(bool b) { fPVFromBranch = b; }
436 void SetMCParticle(const char *n) { fMCParticleName = n; }
437 void SetPUInfoName(const char *n) { fPileUpName = n; }
438 void SetBeamspotName(const char *n) { fBeamspotName = n; }
439 void SetPFCandName(const char *n) { fPFCandName = n; }
440 void SetSuperClusterName(const char *n) { fSuperClusterName = n; }
441 void SetPFJetName(const char *n) { fPFJetName = n; }
442 void SetGenJetName(const char *n) { fGenJetName = n; }
443 void SetuncorrPFJetName(const char *n) { funcorrPFJetName = n; }
444
445 void SetPFJetsFromBranch(Bool_t b) { fPFJetsFromBranch = b; }
446 void SetEnableJets(Bool_t b) { fEnableJets = b; }
447 void SetApplyLeptonTag(Bool_t b) { fApplyLeptonTag = b; }
448 void SetApplyBTag(Bool_t b) { fApplyBTag = b; }
449 void SetApplyPFMetCorr(Bool_t b) { fApplyPFMetCorrections = b; }
450 void SetPhFixDataFile(const char *n) { fPhFixDataFile = n; }
451
452 // set basic Cut variables (FOR PRE-SELECTION)
453
454 // is Data Or Not?
455 void SetIsData (Bool_t b) { fIsData = b; };
456
457
458 void SetApplyElectronVeto(Bool_t b) { fApplyElectronVeto = b; }
459
460 void SetTupleName(const char* c) { fTupleName = c; }
461 void SetGoodElectronsFromBranch(Bool_t b) { fGoodElectronsFromBranch = b; }
462 void SetGoodElectronName(TString name) { fGoodElectronName = name; }
463 void SetWriteDiphotonTree(Bool_t b) { fWriteDiphotonTree = b; }
464 void SetWriteSingleTree(Bool_t b) { fWriteSingleTree = b; }
465 void SetLoopOnGoodElectrons(Bool_t b) { fLoopOnGoodElectrons = b; }
466 void SetExcludeSinglePrompt(Bool_t b) { fExcludeSinglePrompt = b; }
467 void SetExcludeDoublePrompt(Bool_t b) { fExcludeDoublePrompt = b; }
468
469 void SetLeptonTagElectronsName(TString name) { fLeptonTagElectronsName = name; }
470 void SetLeptonTagMuonsName (TString name) { fLeptonTagMuonsName = name; }
471
472 protected:
473 void Process();
474 void SlaveBegin();
475 // Private auxiliary methods...
476 void FindHiggsPtAndZ(Float_t& pt, Float_t& z, Float_t& mass);
477 Float_t GetEventCat (PhotonTools::CiCBaseLineCats cat1,
478 PhotonTools::CiCBaseLineCats cat2);
479
480 // Names for the input Collections
481 TString fPhotonBranchName;
482 TString fElectronName;
483 TString fGoodElectronName;
484 TString fConversionName;
485 TString fTrackBranchName;
486 TString fPileUpDenName;
487 TString fPVName;
488 TString fBeamspotName;
489 TString fPFCandName;
490 TString fMCParticleName;
491 TString fPileUpName;
492 TString fSuperClusterName;
493 TString fPFMetName;
494 TString fPFJetName;
495
496 TString fGenJetName; //added to do pfmet correction 05/01/2012
497 TString funcorrPFJetName;
498
499 TString fLeptonTagElectronsName;
500 TString fLeptonTagMuonsName;
501
502
503 // is it Data or MC?
504 Bool_t fIsData;
505
506 // in case there's some PV pre-selection
507 Bool_t fPhotonsFromBranch;
508 Bool_t fPVFromBranch;
509 Bool_t fGoodElectronsFromBranch;
510 Bool_t fPFJetsFromBranch;
511
512 const PhotonCol *fPhotons;
513 const ElectronCol *fElectrons;
514 const ElectronCol *fGoodElectrons;
515 const DecayParticleCol *fConversions;
516 const TrackCol *fTracks;
517 const PileupEnergyDensityCol *fPileUpDen;
518 const VertexCol *fPV;
519 const BeamSpotCol *fBeamspot;
520 const PFCandidateCol *fPFCands;
521 const MCParticleCol *fMCParticles;
522 const PileupInfoCol *fPileUp;
523 const SuperClusterCol *fSuperClusters;
524 const PFMetCol *fPFMet;
525 const JetCol *fPFJets;
526 const GenJetCol *fGenJets;
527 const PFJetCol *funcorrPFJets;
528
529 const ElectronCol *fLeptonTagElectrons;
530 const MuonCol *fLeptonTagMuons;
531
532 // --------------------------------
533 Bool_t fLoopOnGoodElectrons; //loop over good elecs instead of photons
534 Bool_t fApplyElectronVeto; //invert elec veto (for cic sel. only atm)
535 Bool_t fWriteDiphotonTree;
536 Bool_t fWriteSingleTree;
537
538 Bool_t fExcludeSinglePrompt;
539 Bool_t fExcludeDoublePrompt;
540
541 Bool_t fEnableJets;
542
543 Bool_t fApplyLeptonTag;
544 Bool_t fApplyBTag;
545 Bool_t fApplyPFMetCorrections;
546
547 TString fPhFixDataFile;
548 PhotonFix fPhfixph;
549 PhotonFix fPhfixele;
550
551 // --------------------------------
552 // validation Tuple
553 TString fTupleName;
554 PhotonTreeWriterDiphotonEvent* fDiphotonEvent;
555 PhotonTreeWriterPhoton* fSinglePhoton;
556 TTree* hCiCTuple;
557 TTree* hCiCTupleSingle;
558
559 ClassDef(PhotonTreeWriter, 1) // Photon identification module
560 };
561 }
562 #endif