ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/MitPhysics/Mods/interface/PhotonTreeWriter.h
Revision: 1.9
Committed: Thu Mar 29 23:41:56 2012 UTC (13 years, 1 month ago) by paus
Content type: text/plain
Branch: MAIN
CVS Tags: Mit_025e
Changes since 1.8: +69 -75 lines
Log Message:
Version with working skimming and last 4.4 tag.

File Contents

# Content
1 //--------------------------------------------------------------------------------------------------
2 // $Id: PhotonTreeWriter.h,v 1.8 2011/12/17 22:29:30 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 //quantities from second basic cluster, if present
125 Float_t ebc2;
126 Float_t etabc2;
127 Float_t phibc2;
128 Int_t ietabc2;
129 Int_t iphibc2;
130 Int_t ixbc2;
131 Int_t iybc2;
132 Float_t etacrybc2;
133 Float_t phicrybc2;
134 Float_t xcrybc2;
135 Float_t ycrybc2;
136 Float_t thetaaxisbc2;
137 Float_t phiaxisbc2;
138 Float_t sigietaietabc2;
139 Float_t sigiphiphibc2;
140 Float_t covietaiphibc2;
141 Float_t e3x3bc2;
142 Float_t e5x5bc2;
143 Float_t emaxbc2;
144 Float_t e2ndbc2;
145 Float_t etopbc2;
146 Float_t ebottombc2;
147 Float_t eleftbc2;
148 Float_t erightbc2;
149 Float_t e1x3bc2;
150 Float_t e3x1bc2;
151 Float_t e1x5bc2;
152 Float_t e2x2bc2;
153 Float_t e4x4bc2;
154 Float_t e2x5maxbc2;
155 Float_t e2x5topbc2;
156 Float_t e2x5bottombc2;
157 Float_t e2x5leftbc2;
158 Float_t e2x5rightbc2;
159 Float_t xbc2bc2;
160 Float_t ybc2bc2;
161 Float_t zbc2bc2;
162 UInt_t nhitsbc2;
163
164 //quantities from lowest energy basic cluster if present
165 Float_t ebclast;
166 Float_t etabclast;
167 Float_t phibclast;
168 Int_t ietabclast;
169 Int_t iphibclast;
170 Int_t ixbclast;
171 Int_t iybclast;
172 Float_t etacrybclast;
173 Float_t phicrybclast;
174 Float_t xcrybclast;
175 Float_t ycrybclast;
176 Float_t thetaaxisbclast;
177 Float_t phiaxisbclast;
178 Float_t sigietaietabclast;
179 Float_t sigiphiphibclast;
180 Float_t covietaiphibclast;
181 Float_t e3x3bclast;
182 Float_t e5x5bclast;
183 UInt_t nhitsbclast;
184
185 //quantities from second lowest energy basic cluster if present
186 Float_t ebclast2;
187 Float_t etabclast2;
188 Float_t phibclast2;
189 Int_t ietabclast2;
190 Int_t iphibclast2;
191 Int_t ixbclast2;
192 Int_t iybclast2;
193 Float_t etacrybclast2;
194 Float_t phicrybclast2;
195 Float_t xcrybclast2;
196 Float_t ycrybclast2;
197 Float_t thetaaxisbclast2;
198 Float_t phiaxisbclast2;
199 Float_t sigietaietabclast2;
200 Float_t sigiphiphibclast2;
201 Float_t covietaiphibclast2;
202 Float_t e3x3bclast2;
203 Float_t e5x5bclast2;
204 UInt_t nhitsbclast2;
205
206 //energy correction quantities from PhotonFix
207 Float_t ecor;
208 Float_t ecorerr;
209 Float_t ecorele;
210 Float_t ecoreleerr;
211 Float_t etac;
212 Float_t etas;
213 Float_t etam;
214 Float_t phic;
215 Float_t phis;
216 Float_t phim;
217 Float_t xz;
218 Float_t xc;
219 Float_t xs;
220 Float_t xm;
221 Float_t yz;
222 Float_t yc;
223 Float_t ys;
224 Float_t ym;
225
226 //conversion quantities
227 UChar_t hasconversion;
228 Float_t convp;
229 Float_t convpt;
230 Float_t conveta;
231 Float_t convphi;
232 Float_t convdeta;
233 Float_t convdphi;
234 Float_t convvtxrho;
235 Float_t convvtxz;
236 Float_t convvtxphi;
237 Float_t convleadpt;
238 Float_t convtrailpt;
239 Float_t convleadtrackpt;
240 Char_t convleadtrackalgo;
241 Char_t convleadtrackalgos;
242 Char_t convleadtrackcharge;
243 Float_t convtrailtrackpt;
244 Char_t convtrailtrackalgo;
245 Char_t convtrailtrackalgos;
246 Char_t trailtrackcharge;
247
248 //electron quantities
249 UChar_t haselectron;
250 UChar_t eleisecaldriven;
251 UChar_t eleistrackerdriven;
252 Float_t elee;
253 Float_t elept;
254 Float_t eleeta;
255 Float_t elephi;
256 Char_t elecharge;
257 Float_t elefbrem;
258 Float_t eledeta;
259 Float_t eledphi;
260 Float_t elep;
261 Float_t elepin;
262 Float_t elepout;
263
264 //pf supercluster quantities
265 UChar_t haspfsc;
266 Float_t pfsce;
267 Float_t pfscrawe;
268 Float_t pfsceta;
269 Float_t pfscphi;
270
271 //generator level quantities
272 UChar_t ispromptgen;
273 Float_t gene;
274 Float_t genpt;
275 Float_t geneta;
276 Float_t genphi;
277 Float_t genz;
278 Int_t pdgid;
279 Int_t motherpdgid;
280 };
281
282 class PhotonTreeWriterDiphotonEvent
283 {
284 public:
285 Float_t rho;
286 Float_t genHiggspt;
287 Float_t genHiggsZ;
288 Float_t genmass;
289 Float_t gencostheta;
290 Float_t bsX;
291 Float_t bsY;
292 Float_t bsZ;
293 Float_t bsSigmaZ;
294 Float_t vtxX;
295 Float_t vtxY;
296 Float_t vtxZ;
297 Int_t nVtx;
298 Int_t numPU;
299 Int_t numPUminus;
300 Int_t numPUplus;
301 Float_t mass;
302 Float_t masserr;
303 Float_t masserrsmeared;
304 Float_t masserrwrongvtx;
305 Float_t masserrsmearedwrongvtx;
306 Float_t vtxprob;
307 Float_t deltamvtx;
308 Float_t ptgg;
309 Float_t etagg;
310 Float_t phigg;
311 Float_t costheta;
312 Float_t massele;
313 Float_t ptee;
314 Float_t costhetaele;
315 Float_t mt;
316 Float_t cosphimet;
317 Float_t mtele;
318 Float_t cosphimetele;
319 UInt_t evt;
320 UInt_t run;
321 UInt_t lumi;
322 UChar_t evtcat;
323 UInt_t nobj;
324 Float_t pfmet;
325 Float_t pfmetphi;
326 Float_t pfmetx;
327 Float_t pfmety;
328 UChar_t ismc;
329
330 //corrected quantities from PhotonFix corrections
331 Float_t masscor;
332 Float_t masscorerr;
333 Float_t masscorele;
334 Float_t masscoreleerr;
335
336 //jet quantities
337 Float_t jet1pt;
338 Float_t jet1eta;
339 Float_t jet1phi;
340 Float_t jet1mass;
341 Float_t jet2pt;
342 Float_t jet2eta;
343 Float_t jet2phi;
344 Float_t jet2mass;
345 Float_t jetcentralpt;
346 Float_t jetcentraleta;
347 Float_t jetcentralphi;
348 Float_t jetcentralmass;
349 Float_t dijetpt;
350 Float_t dijeteta;
351 Float_t dijetphi;
352 Float_t dijetmass;
353 Float_t jetetaplus;
354 Float_t jetetaminus;
355
356 Float_t zeppenfeld;
357 Float_t dphidijetgg;
358
359 PhotonTreeWriterPhoton photons[2];
360 };
361
362 class PhotonTreeWriter : public BaseMod
363 {
364 public:
365 PhotonTreeWriter(const char *name ="PhotonTreeWriter",
366 const char *title="Selecting PhotonPairs");
367
368 ~PhotonTreeWriter();
369
370 // setting all the input Names
371 void SetInputPhotonsName(const char *n){ fPhotonBranchName= n; }
372 void SetPhotonsFromBranch(bool b) { fPhotonsFromBranch = b; }
373 void SetTrackName(const char *n) { fTrackBranchName = n; }
374 void SetElectronName(const char *n) { fElectronName = n; }
375 void SetConversionName(const char *n) { fConversionName = n; }
376 void SetPUDensityName(const char *n) { fPileUpDenName = n; }
377 void SetPVName(const char *n) { fPVName = n; }
378 void SetPVFromBranch(bool b) { fPVFromBranch = b; }
379 void SetMCParticle(const char *n) { fMCParticleName = n; }
380 void SetPUInfoName(const char *n) { fPileUpName = n; }
381 void SetBeamspotName(const char *n) { fBeamspotName = n; }
382 void SetPFCandName(const char *n) { fPFCandName = n; }
383 void SetSuperClusterName(const char *n) { fSuperClusterName = n; }
384 void SetPFJetName(const char *n) { fPFJetName = n; }
385 void SetPFJetsFromBranch(Bool_t b) { fPFJetsFromBranch = b; }
386 void SetEnableJets(Bool_t b) { fEnableJets = b; }
387 void SetPhFixDataFile(const char *n) { fPhFixDataFile = n; }
388
389
390 // set basic Cut variables (FOR PRE-SELECTION)
391
392 // is Data Or Not?
393 void SetIsData (Bool_t b) { fIsData = b; };
394
395
396 void SetApplyElectronVeto(Bool_t b) { fApplyElectronVeto = b; }
397
398 void SetTupleName(const char* c) { fTupleName = c; }
399 void SetGoodElectronsFromBranch(Bool_t b) { fGoodElectronsFromBranch = b; }
400 void SetGoodElectronName(TString name) { fGoodElectronName = name; }
401 void SetWriteDiphotonTree(Bool_t b) { fWriteDiphotonTree = b; }
402 void SetWriteSingleTree(Bool_t b) { fWriteSingleTree = b; }
403 void SetLoopOnGoodElectrons(Bool_t b) { fLoopOnGoodElectrons = b; }
404 void SetExcludeSinglePrompt(Bool_t b) { fExcludeSinglePrompt = b; }
405 void SetExcludeDoublePrompt(Bool_t b) { fExcludeDoublePrompt = b; }
406
407 protected:
408 void Process();
409 void SlaveBegin();
410 // Private auxiliary methods...
411 void FindHiggsPtAndZ(Float_t& pt, Float_t& z, Float_t& mass);
412 Float_t GetEventCat (PhotonTools::CiCBaseLineCats cat1,
413 PhotonTools::CiCBaseLineCats cat2);
414
415 // Names for the input Collections
416 TString fPhotonBranchName;
417 TString fElectronName;
418 TString fGoodElectronName;
419 TString fConversionName;
420 TString fTrackBranchName;
421 TString fPileUpDenName;
422 TString fPVName;
423 TString fBeamspotName;
424 TString fPFCandName;
425 TString fMCParticleName;
426 TString fPileUpName;
427 TString fSuperClusterName;
428 TString fPFMetName;
429 TString fPFJetName;
430
431 // is it Data or MC?
432 Bool_t fIsData;
433
434 // in case there's some PV pre-selection
435 Bool_t fPhotonsFromBranch;
436 Bool_t fPVFromBranch;
437 Bool_t fGoodElectronsFromBranch;
438 Bool_t fPFJetsFromBranch;
439
440 const PhotonCol *fPhotons;
441 const ElectronCol *fElectrons;
442 const ElectronCol *fGoodElectrons;
443 const DecayParticleCol *fConversions;
444 const TrackCol *fTracks;
445 const PileupEnergyDensityCol *fPileUpDen;
446 const VertexCol *fPV;
447 const BeamSpotCol *fBeamspot;
448 const PFCandidateCol *fPFCands;
449 const MCParticleCol *fMCParticles;
450 const PileupInfoCol *fPileUp;
451 const SuperClusterCol *fSuperClusters;
452 const PFMetCol *fPFMet;
453 const JetCol *fPFJets;
454
455 // --------------------------------
456 Bool_t fLoopOnGoodElectrons; //loop over good elecs instead of photons
457 Bool_t fApplyElectronVeto; //invert elec veto (for cic sel. only atm)
458 Bool_t fWriteDiphotonTree;
459 Bool_t fWriteSingleTree;
460
461 Bool_t fExcludeSinglePrompt;
462 Bool_t fExcludeDoublePrompt;
463
464 Bool_t fEnableJets;
465
466 TString fPhFixDataFile;
467 PhotonFix fPhfixph;
468 PhotonFix fPhfixele;
469
470 // --------------------------------
471 // validation Tuple
472 TString fTupleName;
473 PhotonTreeWriterDiphotonEvent* fDiphotonEvent;
474 PhotonTreeWriterPhoton* fSinglePhoton;
475 TTree* hCiCTuple;
476 TTree* hCiCTupleSingle;
477
478 ClassDef(PhotonTreeWriter, 1) // Photon identification module
479 };
480 }
481 #endif