ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/MitPhysics/Mods/interface/PhotonTreeWriter.h
Revision: 1.8
Committed: Sat Dec 17 22:29:30 2011 UTC (13 years, 4 months ago) by bendavid
Content type: text/plain
Branch: MAIN
CVS Tags: Mit_025d
Changes since 1.7: +8 -2 lines
Log Message:
further small gamma gamma updates

File Contents

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