ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/MitPhysics/Mods/interface/PhotonTreeWriter.h
Revision: 1.52
Committed: Mon Dec 16 16:52:47 2013 UTC (11 years, 4 months ago) by mingyang
Content type: text/plain
Branch: MAIN
CVS Tags: HEAD
Changes since 1.51: +12 -2 lines
Log Message:
r9 rescale added

File Contents

# User Rev Content
1 bendavid 1.1 //--------------------------------------------------------------------------------------------------
2 mingyang 1.52 // $Id: PhotonTreeWriter.h,v 1.51 2013/12/12 17:14:08 veverka Exp $
3 bendavid 1.1 //
4     // PhotonTreeWriter
5     //
6 veverka 1.30 // Authors: J. Bendavid, J. Veverka
7 bendavid 1.1 //--------------------------------------------------------------------------------------------------
8    
9 veverka 1.38 /**
10     * TODO
11     * - Factor out taggers (VHLep, VHHad, ttH) into separate classes
12     * - Factor out transient diphoton-final-state data (phHard, phSoft, selvtx, ..)
13     * into a separate class.
14     */
15    
16    
17 bendavid 1.1 #ifndef MITPHYSICS_MODS_PHOTONTREEWRITER_H
18     #define MITPHYSICS_MODS_PHOTONTREEWRITER_H
19    
20 veverka 1.47
21     #include <utility> // provides std::pair
22     #include <vector>
23 bendavid 1.1 #include "MitAna/TreeMod/interface/BaseMod.h"
24     #include "MitAna/DataTree/interface/PhotonFwd.h"
25     #include "MitAna/DataTree/interface/TrackCol.h"
26     #include "MitAna/DataTree/interface/VertexCol.h"
27     #include "MitAna/DataTree/interface/BeamSpotCol.h"
28     #include "MitAna/DataTree/interface/PFCandidateCol.h"
29     #include "MitAna/DataTree/interface/PileupEnergyDensityCol.h"
30     #include "MitAna/DataTree/interface/DecayParticleCol.h"
31     #include "MitAna/DataTree/interface/ElectronCol.h"
32 fabstoec 1.10 #include "MitAna/DataTree/interface/MuonCol.h"
33 bendavid 1.1 #include "MitAna/DataTree/interface/DecayParticleCol.h"
34     #include "MitAna/DataTree/interface/PileupInfoCol.h"
35     #include "MitAna/DataTree/interface/MCParticleCol.h"
36 bendavid 1.25 #include "MitAna/DataTree/interface/MCEventInfo.h"
37 bendavid 1.2 #include "MitAna/DataTree/interface/SuperClusterCol.h"
38     #include "MitAna/DataTree/interface/PFMetCol.h"
39 bendavid 1.5 #include "MitAna/DataTree/interface/JetCol.h"
40 fabstoec 1.13 #include "MitAna/DataTree/interface/PFJetCol.h"
41     #include "MitAna/DataTree/interface/GenJetCol.h"
42 veverka 1.35 #include "MitAna/DataTree/interface/Particle.h"
43 bendavid 1.2 #include "MitPhysics/Utils/interface/PhotonFix.h"
44 bendavid 1.1 #include "MitPhysics/Utils/interface/PhotonTools.h"
45 bendavid 1.17 #include "MitPhysics/Utils/interface/MVAMet.h"
46 mingyang 1.24 #include "MitPhysics/Utils/interface/MVAVBF.h"
47 bendavid 1.1
48 fabstoec 1.26 #include "MitPhysics/Utils/interface/VertexTools.h"
49     #include "MitPhysics/Utils/interface/ElectronIDMVA.h"
50    
51 bendavid 1.1 class TNtuple;
52     class TRandom3;
53    
54     namespace mithep
55     {
56 veverka 1.42
57     class PhotonTreeWriterDiphotonEvent;
58 bendavid 1.18
59     class PhotonTreeWriterVtx
60     {
61    
62     public:
63     void SetVars(const Vertex *v, const Photon *p1, const Photon *p2, const PFCandidateCol *pfcands, Int_t idx, Int_t numvtx, Float_t genvtxz);
64    
65     private:
66     Int_t n;
67     Int_t nvtx;
68     Float_t ptgg;
69     Float_t phigg;
70     Float_t etagg;
71     Float_t pxgg;
72     Float_t pygg;
73     Float_t pzgg;
74     Float_t mgg;
75     Float_t zgen;
76     Float_t x;
77     Float_t y;
78     Float_t z;
79     Float_t pt;
80     Float_t phi;
81     Float_t eta;
82     Float_t px;
83     Float_t py;
84     Float_t pz;
85     Float_t sumpt;
86     Float_t sumptsq;
87     Int_t nchalltoward;
88     Int_t nchalltransverse;
89     Int_t nchallaway;
90     Int_t nchcuttoward;
91     Int_t nchcuttransverse;
92     Int_t nchcutaway;
93     };
94    
95 mingyang 1.21 template <int NClus=16>//ming: what's template
96 bendavid 1.1 class PhotonTreeWriterPhoton
97     {
98     public:
99 veverka 1.39 void SetVars(const Photon *p,
100     const DecayParticle *c,
101     const Electron *ele,
102     const SuperCluster *pfsc,
103     const MCParticle *m,
104     PhotonFix &phfixph,
105     PhotonFix &phfixele,
106     const TrackCol* trackCol,
107     const VertexCol* vtxCol,
108     const PFCandidateCol* candCol,
109     Double_t _tRho,
110     Bool_t fillclusterarrays,
111     const PhotonCol* ps,
112     const SuperClusterCol* scs,
113     const ElectronCol* els,
114     const DecayParticleCol *convs,
115 mingyang 1.52 const BaseVertex *bs,bool isdata,
116     bool dor9rescale, double p0b, double p1b, double p0e, double p1e,
117 veverka 1.39 Bool_t applyElectronVeto=kTRUE,
118     const Vertex* realVtx = NULL);
119 bendavid 1.1 Float_t Ecor() const { return ecor; };
120     Float_t Ecorerr() const { return ecorerr; };
121 bendavid 1.2 Float_t Ecorele() const { return ecorele; };
122 veverka 1.30 Float_t Ecoreleerr() const { return ecoreleerr; };
123 veverka 1.33 Float_t Pt() const {return pt;};
124    
125 bendavid 1.1 private:
126 bendavid 1.5 UChar_t hasphoton;
127 veverka 1.39 UInt_t index;
128 bendavid 1.1 Float_t e;
129     Float_t pt;
130     Float_t eta;
131     Float_t phi;
132     Float_t r9;
133     Float_t e3x3;
134     Float_t e5x5;
135 veverka 1.39 UInt_t scindex;
136 bendavid 1.1 Float_t sce;
137     Float_t scrawe;
138     Float_t scpse;
139 bendavid 1.17 Float_t scpssigmaxx;
140     Float_t scpssigmayy;
141 bendavid 1.1 Float_t sceta;
142     Float_t scphi;
143 paus 1.9 UInt_t scnclusters;
144     UInt_t scnhits;
145 bendavid 1.2 Float_t scetawidth;
146     Float_t scphiwidth;
147 bendavid 1.1 Float_t hovere;
148 bendavid 1.17 Float_t hoveretower;
149 bendavid 1.1 Float_t sigietaieta;
150 paus 1.9 Bool_t isbarrel;
151     Bool_t isr9reco;
152     Bool_t isr9cat;
153     Char_t phcat;
154 bendavid 1.2 Float_t eerr;
155     Float_t eerrsmeared;
156 bendavid 1.3 Float_t esmearing;
157 bendavid 1.46 Float_t eerrsmearing;
158 veverka 1.51 Float_t escale;
159 bendavid 1.5 Float_t idmva;
160     Float_t ecalisodr03;
161     Float_t hcalisodr03;
162     Float_t trkisohollowdr03;
163 bendavid 1.8 Float_t ecalisodr04;
164     Float_t hcalisodr04;
165 veverka 1.42 Float_t trkisohollowdr04;
166 bendavid 1.8 Float_t trackiso1;
167     Float_t trackiso2;
168     Float_t combiso1;
169     Float_t combiso2;
170 bendavid 1.23 Bool_t passeleveto;
171    
172 bendavid 1.5 //quantities from seed basic cluster
173 bendavid 1.2 Float_t eseed;
174 bendavid 1.4 Float_t etaseed;
175     Float_t phiseed;
176 paus 1.9 Int_t ietaseed;
177     Int_t iphiseed;
178     Int_t ixseed;
179     Int_t iyseed;
180 bendavid 1.4 Float_t etacryseed;
181     Float_t phicryseed;
182     Float_t xcryseed;
183     Float_t ycryseed;
184     Float_t thetaaxisseed;
185     Float_t phiaxisseed;
186 bendavid 1.5 Float_t sigietaietaseed;
187     Float_t sigiphiphiseed;
188     Float_t covietaiphiseed;
189     Float_t e3x3seed;
190     Float_t e5x5seed;
191     Float_t emaxseed;
192     Float_t e2ndseed;
193     Float_t etopseed;
194     Float_t ebottomseed;
195     Float_t eleftseed;
196     Float_t erightseed;
197     Float_t e1x3seed;
198     Float_t e3x1seed;
199     Float_t e1x5seed;
200     Float_t e2x2seed;
201     Float_t e4x4seed;
202     Float_t e2x5maxseed;
203     Float_t e2x5topseed;
204     Float_t e2x5bottomseed;
205     Float_t e2x5leftseed;
206     Float_t e2x5rightseed;
207     Float_t xseedseed;
208     Float_t yseedseed;
209     Float_t zseedseed;
210     UInt_t nhitsseed;
211    
212 bendavid 1.4 //quantities from second basic cluster, if present
213     Float_t ebc2;
214     Float_t etabc2;
215     Float_t phibc2;
216 paus 1.9 Int_t ietabc2;
217     Int_t iphibc2;
218     Int_t ixbc2;
219     Int_t iybc2;
220 bendavid 1.4 Float_t etacrybc2;
221     Float_t phicrybc2;
222     Float_t xcrybc2;
223     Float_t ycrybc2;
224     Float_t thetaaxisbc2;
225 bendavid 1.5 Float_t phiaxisbc2;
226     Float_t sigietaietabc2;
227     Float_t sigiphiphibc2;
228     Float_t covietaiphibc2;
229     Float_t e3x3bc2;
230     Float_t e5x5bc2;
231     Float_t emaxbc2;
232     Float_t e2ndbc2;
233     Float_t etopbc2;
234     Float_t ebottombc2;
235     Float_t eleftbc2;
236     Float_t erightbc2;
237     Float_t e1x3bc2;
238     Float_t e3x1bc2;
239     Float_t e1x5bc2;
240     Float_t e2x2bc2;
241     Float_t e4x4bc2;
242     Float_t e2x5maxbc2;
243     Float_t e2x5topbc2;
244     Float_t e2x5bottombc2;
245     Float_t e2x5leftbc2;
246     Float_t e2x5rightbc2;
247     Float_t xbc2bc2;
248     Float_t ybc2bc2;
249     Float_t zbc2bc2;
250     UInt_t nhitsbc2;
251    
252     //quantities from lowest energy basic cluster if present
253     Float_t ebclast;
254     Float_t etabclast;
255     Float_t phibclast;
256 paus 1.9 Int_t ietabclast;
257     Int_t iphibclast;
258     Int_t ixbclast;
259     Int_t iybclast;
260 bendavid 1.5 Float_t etacrybclast;
261     Float_t phicrybclast;
262     Float_t xcrybclast;
263     Float_t ycrybclast;
264     Float_t thetaaxisbclast;
265     Float_t phiaxisbclast;
266     Float_t sigietaietabclast;
267     Float_t sigiphiphibclast;
268     Float_t covietaiphibclast;
269     Float_t e3x3bclast;
270     Float_t e5x5bclast;
271     UInt_t nhitsbclast;
272    
273     //quantities from second lowest energy basic cluster if present
274     Float_t ebclast2;
275     Float_t etabclast2;
276     Float_t phibclast2;
277 paus 1.9 Int_t ietabclast2;
278     Int_t iphibclast2;
279     Int_t ixbclast2;
280     Int_t iybclast2;
281 bendavid 1.5 Float_t etacrybclast2;
282     Float_t phicrybclast2;
283     Float_t xcrybclast2;
284     Float_t ycrybclast2;
285     Float_t thetaaxisbclast2;
286     Float_t phiaxisbclast2;
287     Float_t sigietaietabclast2;
288     Float_t sigiphiphibclast2;
289     Float_t covietaiphibclast2;
290     Float_t e3x3bclast2;
291     Float_t e5x5bclast2;
292     UInt_t nhitsbclast2;
293 bendavid 1.1
294     //energy correction quantities from PhotonFix
295     Float_t ecor;
296     Float_t ecorerr;
297 bendavid 1.2 Float_t ecorele;
298     Float_t ecoreleerr;
299 bendavid 1.1 Float_t etac;
300     Float_t etas;
301     Float_t etam;
302     Float_t phic;
303     Float_t phis;
304     Float_t phim;
305     Float_t xz;
306     Float_t xc;
307     Float_t xs;
308     Float_t xm;
309     Float_t yz;
310     Float_t yc;
311     Float_t ys;
312     Float_t ym;
313    
314     //conversion quantities
315 bendavid 1.5 UChar_t hasconversion;
316 bendavid 1.1 Float_t convp;
317     Float_t convpt;
318     Float_t conveta;
319     Float_t convphi;
320     Float_t convdeta;
321     Float_t convdphi;
322     Float_t convvtxrho;
323     Float_t convvtxz;
324     Float_t convvtxphi;
325     Float_t convleadpt;
326     Float_t convtrailpt;
327     Float_t convleadtrackpt;
328 paus 1.9 Char_t convleadtrackalgo;
329     Char_t convleadtrackalgos;
330     Char_t convleadtrackcharge;
331 bendavid 1.1 Float_t convtrailtrackpt;
332 paus 1.9 Char_t convtrailtrackalgo;
333     Char_t convtrailtrackalgos;
334     Char_t trailtrackcharge;
335 bendavid 1.1
336 bendavid 1.2 //electron quantities
337 bendavid 1.5 UChar_t haselectron;
338     UChar_t eleisecaldriven;
339     UChar_t eleistrackerdriven;
340 bendavid 1.2 Float_t elee;
341     Float_t elept;
342     Float_t eleeta;
343     Float_t elephi;
344 paus 1.9 Char_t elecharge;
345 bendavid 1.2 Float_t elefbrem;
346     Float_t eledeta;
347     Float_t eledphi;
348     Float_t elep;
349     Float_t elepin;
350     Float_t elepout;
351    
352     //pf supercluster quantities
353 bendavid 1.5 UChar_t haspfsc;
354 bendavid 1.2 Float_t pfsce;
355     Float_t pfscrawe;
356     Float_t pfsceta;
357     Float_t pfscphi;
358 bendavid 1.17 UInt_t pfscnclusters;
359     UInt_t pfscnhits;
360     Float_t pfscetawidth;
361     Float_t pfscphiwidth;
362     UInt_t pfscnpsclusters;
363 bendavid 1.1
364     //generator level quantities
365 bendavid 1.5 UChar_t ispromptgen;
366 bendavid 1.1 Float_t gene;
367     Float_t genpt;
368     Float_t geneta;
369     Float_t genphi;
370     Float_t genz;
371 bendavid 1.5 Int_t pdgid;
372     Int_t motherpdgid;
373 bendavid 1.17
374 fabstoec 1.19 // -----------------------------------------------------
375     // PF-CiC4 Debug Stuff
376     Float_t pfcic4_tIso1;
377     Float_t pfcic4_tIso2;
378     Float_t pfcic4_tIso3;
379     Float_t pfcic4_covIEtaIEta;
380     Float_t pfcic4_HoE;
381     Float_t pfcic4_R9;
382     Float_t pfcic4_wVtxInd;
383     Float_t pfcic4_ecalIso3;
384     Float_t pfcic4_ecalIso4;
385     Float_t pfcic4_trackIsoSel03;
386     Float_t pfcic4_trackIsoWorst04;
387     Float_t pfcic4_combIso1;
388     Float_t pfcic4_combIso2;
389     // -----------------------------------------------------
390    
391 mingyang 1.21 // -----------------------------------------------------
392     //id mva
393     //2011
394     Float_t idmva_tIso1abs;
395     Float_t idmva_tIso2abs;
396     Float_t idmva_tIso3abs;
397     Float_t idmva_absIsoEcal;
398     Float_t idmva_absIsoHcal;
399     //2012
400     Float_t idmva_CoviEtaiPhi;
401     Float_t idmva_s4ratio;
402     Float_t idmva_GammaIso;
403     Float_t idmva_ChargedIso_selvtx;
404 fabstoec 1.26 Float_t idmva_ChargedIso_0p2_selvtx;
405 mingyang 1.21 Float_t idmva_ChargedIso_worstvtx;
406     Float_t idmva_PsEffWidthSigmaRR;
407    
408 veverka 1.33 Float_t ebcs[NClus];
409 bendavid 1.17 Float_t etabcs[NClus];
410     Float_t phibcs[NClus];
411     Int_t ietabcs[NClus];
412     Int_t iphibcs[NClus];
413     Int_t ixbcs[NClus];
414     Int_t iybcs[NClus];
415     Float_t etacrybcs[NClus];
416     Float_t phicrybcs[NClus];
417     Float_t xcrybcs[NClus];
418     Float_t ycrybcs[NClus];
419     Float_t sigietaietabcs[NClus];
420     Float_t sigiphiphibcs[NClus];
421     Float_t covietaiphibcs[NClus];
422     Float_t sigetaetabcs[NClus];
423     Float_t sigphiphibcs[NClus];
424     Float_t covetaphibcs[NClus];
425     Float_t e3x3bcs[NClus];
426     Float_t e5x5bcs[NClus];
427     Float_t emaxbcs[NClus];
428     Float_t e2ndbcs[NClus];
429     Float_t etopbcs[NClus];
430     Float_t ebottombcs[NClus];
431     Float_t eleftbcs[NClus];
432     Float_t erightbcs[NClus];
433     Float_t e1x3bcs[NClus];
434     Float_t e3x1bcs[NClus];
435     Float_t e1x5bcs[NClus];
436     Float_t e2x2bcs[NClus];
437     Float_t e4x4bcs[NClus];
438     Float_t e2x5maxbcs[NClus];
439     Float_t e2x5topbcs[NClus];
440     Float_t e2x5bottombcs[NClus];
441     Float_t e2x5leftbcs[NClus];
442     Float_t e2x5rightbcs[NClus];
443     UInt_t nhitsbcs[NClus];
444    
445     Float_t epfbcs[NClus];
446     Float_t etapfbcs[NClus];
447     Float_t phipfbcs[NClus];
448     Int_t ietapfbcs[NClus];
449     Int_t iphipfbcs[NClus];
450     Int_t ixpfbcs[NClus];
451     Int_t iypfbcs[NClus];
452     Float_t etacrypfbcs[NClus];
453     Float_t phicrypfbcs[NClus];
454     Float_t xcrypfbcs[NClus];
455     Float_t ycrypfbcs[NClus];
456     Float_t sigietaietapfbcs[NClus];
457     Float_t sigiphiphipfbcs[NClus];
458     Float_t covietaiphipfbcs[NClus];
459     Float_t sigetaetapfbcs[NClus];
460     Float_t sigphiphipfbcs[NClus];
461     Float_t covetaphipfbcs[NClus];
462     Float_t e3x3pfbcs[NClus];
463     Float_t e5x5pfbcs[NClus];
464     Float_t emaxpfbcs[NClus];
465     Float_t e2ndpfbcs[NClus];
466     Float_t etoppfbcs[NClus];
467     Float_t ebottompfbcs[NClus];
468     Float_t eleftpfbcs[NClus];
469     Float_t erightpfbcs[NClus];
470     Float_t e1x3pfbcs[NClus];
471     Float_t e3x1pfbcs[NClus];
472     Float_t e1x5pfbcs[NClus];
473     Float_t e2x2pfbcs[NClus];
474     Float_t e4x4pfbcs[NClus];
475     Float_t e2x5maxpfbcs[NClus];
476     Float_t e2x5toppfbcs[NClus];
477     Float_t e2x5bottompfbcs[NClus];
478     Float_t e2x5leftpfbcs[NClus];
479     Float_t e2x5rightpfbcs[NClus];
480     UInt_t nhitspfbcs[NClus];
481    
482     Float_t epsc[100];
483     Float_t etapsc[100];
484     Float_t phipsc[100];
485     UChar_t planepsc[100];
486    
487    
488 bendavid 1.1 };
489    
490     class PhotonTreeWriterDiphotonEvent
491     {
492     public:
493 fabstoec 1.12 // ------------ BTAG STUFF -------------------
494 fabstoec 1.15 Float_t btagJet1;
495     Float_t btagJet1Pt;
496     Float_t btagJet1Eta;
497     Float_t btagJet2;
498     Float_t btagJet2Pt;
499     Float_t btagJet2Eta;
500 veverka 1.38 // ----------- VH/LEPTON TAG STUFF -------------
501 veverka 1.34 Int_t leptonTag; // flavor-based, Moriond 2013
502 veverka 1.35 Int_t VHLepTag; // MET-based, since legacy paper 2013
503 veverka 1.38 Int_t VHHadTag; // VH hadronic tag
504     // ----------- VERTEX SYNCHING STUFF -------
505 fabstoec 1.26
506     Int_t vtxInd1;
507     Int_t vtxInd2;
508     Int_t vtxInd3;
509    
510     Float_t vtxBestPtbal ;
511     Float_t vtxBestPtasym ;
512     Float_t vtxBestSumpt2 ;
513     Float_t vtxBestP2Conv ;
514    
515     Float_t vtxMva1Z ;
516     Float_t vtxMva2Z ;
517     Float_t vtxMva3Z ;
518    
519     Float_t vtxMva1 ;
520     Float_t vtxMva2 ;
521     Float_t vtxMva3 ;
522    
523     Int_t vtxNleg1 ;
524     Int_t vtxNleg2 ;
525     Int_t vtxConvIdx1 ;
526     Int_t vtxConvIdx2 ;
527     Int_t vtxNconv ;
528    
529     Float_t vtxConv1Z ;
530     Float_t vtxConv1DZ ;
531     Float_t vtxConv1Prob ;
532    
533     Float_t vtxConv2Z ;
534     Float_t vtxConv2DZ ;
535     Float_t vtxConv2Prob ;
536    
537    
538 fabstoec 1.11 // ---------- MUON STUFF --------------------
539     Float_t muonPt;
540     Float_t muonEta;
541 veverka 1.42 Float_t muonPhi;
542 fabstoec 1.11 Float_t muDR1;
543     Float_t muDR2;
544     Float_t muIso1;
545     Float_t muIso2;
546     Float_t muIso3;
547     Float_t muIso4;
548     Float_t muD0;
549     Float_t muDZ;
550     Int_t muNhits;
551     Float_t muChi2;
552     Int_t muNpixhits;
553     Int_t muNegs;
554 veverka 1.42 Int_t muNMatch;
555     // ------------ DIMUON STUFF ---------------
556     Float_t mu1Pt;
557     Float_t mu1Eta;
558     Float_t mu1Phi;
559     Float_t mu2Pt;
560     Float_t mu2Eta;
561     Float_t mu2Phi;
562    
563 fabstoec 1.11 // ----------- ELECTRON STUFF --------------
564     Float_t elePt;
565     Float_t eleEta;
566 veverka 1.42 Float_t elePhi;
567 fabstoec 1.11 Float_t eleSCEta;
568     Float_t eleIso1;
569     Float_t eleIso2;
570     Float_t eleIso3;
571     Float_t eleIso4;
572     Float_t eleDist;
573     Float_t eleDcot;
574     Float_t eleCoviee;
575     Float_t eleDphiin;
576     Float_t eleDetain;
577     Float_t eleDR1;
578     Float_t eleDR2;
579     Float_t eleMass1;
580     Float_t eleMass2;
581     Int_t eleNinnerHits;
582 fabstoec 1.26 Float_t eleIdMva;
583 veverka 1.42 // ------------ DIELECTRON STUFF -------------
584     Float_t ele1Pt;
585     Float_t ele1Eta;
586     Float_t ele1Phi;
587     Float_t ele2Pt;
588     Float_t ele2Eta;
589     Float_t ele2Phi;
590 fabstoec 1.11 // -----------------------------------------
591 bendavid 1.1 Float_t rho;
592 bendavid 1.17 Float_t rho25;
593     Float_t rhoold;
594 bendavid 1.1 Float_t genHiggspt;
595     Float_t genHiggsZ;
596     Float_t genmass;
597     Float_t gencostheta;
598 bendavid 1.23 Float_t genz;
599 bendavid 1.2 Float_t bsX;
600     Float_t bsY;
601     Float_t bsZ;
602 bendavid 1.7 Float_t bsSigmaZ;
603 bendavid 1.2 Float_t vtxX;
604     Float_t vtxY;
605 bendavid 1.1 Float_t vtxZ;
606     Int_t nVtx;
607     Int_t numPU;
608     Int_t numPUminus;
609     Int_t numPUplus;
610     Float_t mass;
611 bendavid 1.2 Float_t masserr;
612     Float_t masserrsmeared;
613 bendavid 1.4 Float_t masserrwrongvtx;
614     Float_t masserrsmearedwrongvtx;
615     Float_t vtxprob;
616 bendavid 1.5 Float_t deltamvtx;
617 bendavid 1.1 Float_t ptgg;
618 bendavid 1.5 Float_t etagg;
619     Float_t phigg;
620 bendavid 1.1 Float_t costheta;
621 bendavid 1.2 Float_t massele;
622     Float_t ptee;
623     Float_t costhetaele;
624     Float_t mt;
625     Float_t cosphimet;
626     Float_t mtele;
627     Float_t cosphimetele;
628 bendavid 1.1 UInt_t evt;
629     UInt_t run;
630     UInt_t lumi;
631     UChar_t evtcat;
632 bendavid 1.2 UInt_t nobj;
633 fabstoec 1.13 Double_t fromZ; //added: Heng 2/14/2012
634     Double_t fromW; //added: Heng
635     Float_t zpt; //added: Heng
636     Float_t allZpt; //added: Heng
637     Float_t zEta; //added: Heng
638     Float_t allZEta; //added: Heng
639 fabstoec 1.16
640     //Met stuff
641 fabstoec 1.13 Float_t corrpfmet;
642     Float_t corrpfmetphi;
643     Float_t corrpfmetx;
644     Float_t corrpfmety;
645     Double_t dphiMetgg;
646     Double_t cosdphiMetgg;
647     Double_t dphiPhPh;
648 bendavid 1.2 Float_t pfmet;
649     Float_t pfmetphi;
650     Float_t pfmetx;
651     Float_t pfmety;
652 mtouch 1.20
653 bendavid 1.17
654     Float_t mvametsel;
655     Float_t mvametselphi;
656     Float_t mvametselx;
657     Float_t mvametsely;
658     Float_t mvametselsig;
659    
660     Float_t mvametfirst;
661     Float_t mvametfirstphi;
662     Float_t mvametfirstx;
663     Float_t mvametfirsty;
664     Float_t mvametfirstsig;
665    
666 fabstoec 1.16 Double_t spfMet;
667 bendavid 1.17
668 veverka 1.42 // ----------- VH HAD TAG STUFF -----------
669     Float_t costhetastar;
670    
671 mingyang 1.24 // ----------- VBF TAG STUFF -------------
672     Int_t vbfTag;
673     Float_t vbfbdt;
674 mtouch 1.20
675 veverka 1.30 // ----------- TTH TAG STUFF -------------
676     Int_t tthTag;
677 veverka 1.42 Int_t numJets;
678     Int_t numBJets;
679 veverka 1.48 Float_t bjetcsv;
680 veverka 1.30
681 mingyang 1.24 // ----------------------------------------
682 bendavid 1.5 UChar_t ismc;
683 bendavid 1.25 Int_t mcprocid;
684 bendavid 1.32 Double_t mcweight;
685 bendavid 1.1
686     //corrected quantities from PhotonFix corrections
687     Float_t masscor;
688     Float_t masscorerr;
689 bendavid 1.2 Float_t masscorele;
690     Float_t masscoreleerr;
691 mingyang 1.28
692     //jet quantities for met phi cut
693     Float_t jetleadNoIDpt;
694     Float_t jetleadNoIDeta;
695     Float_t jetleadNoIDphi;
696     Float_t jetleadNoIDmass;
697    
698 bendavid 1.5 //jet quantities
699     Float_t jet1pt;
700     Float_t jet1eta;
701     Float_t jet1phi;
702     Float_t jet1mass;
703     Float_t jet2pt;
704     Float_t jet2eta;
705     Float_t jet2phi;
706     Float_t jet2mass;
707     Float_t jetcentralpt;
708     Float_t jetcentraleta;
709     Float_t jetcentralphi;
710     Float_t jetcentralmass;
711     Float_t dijetpt;
712     Float_t dijeteta;
713     Float_t dijetphi;
714     Float_t dijetmass;
715     Float_t jetetaplus;
716     Float_t jetetaminus;
717    
718 fabstoec 1.16 // Float_t uncorrjet1pt;
719     // Float_t uncorrjet1eta;
720     // Float_t uncorrjet1phi;
721     // Float_t uncorrjet1mass;
722     // Float_t uncorrjet2pt;
723     // Float_t uncorrjet2eta;
724     // Float_t uncorrjet2phi;
725     // Float_t uncorrjet2mass;
726     // Float_t uncorrjetcentralpt;
727     // Float_t uncorrjetcentraleta;
728     // Float_t uncorrjetcentralphi;
729     // Float_t uncorrjetcentralmass;
730     // Float_t diuncorrjetpt;
731     // Float_t diuncorrjeteta;
732     // Float_t diuncorrjetphi;
733     // Float_t diuncorrjetmass;
734     // Float_t uncorrjetetaplus;
735     // Float_t uncorrjetetaminus;
736    
737 bendavid 1.5 Float_t zeppenfeld;
738     Float_t dphidijetgg;
739    
740 bendavid 1.17 PhotonTreeWriterPhoton<16> photons[2];
741 veverka 1.34 }; // PhotonTreeWriterDiphotonEvent
742 bendavid 1.1
743 veverka 1.36
744 bendavid 1.1 class PhotonTreeWriter : public BaseMod
745     {
746     public:
747 veverka 1.35 enum CounterFlag {kCountNotDefined = -1};
748 veverka 1.47 typedef std::pair<const Particle*, double> DeltaRVeto;
749     typedef std::vector<DeltaRVeto> DeltaRVetoVector;
750     typedef std::vector<const PFJet*> PFJetVector;
751     PhotonTreeWriter(const char *name ="PhotonTreeWriter",
752     const char *title="Selecting PhotonPairs");
753 bendavid 1.1
754     ~PhotonTreeWriter();
755    
756     // setting all the input Names
757     void SetInputPhotonsName(const char *n){ fPhotonBranchName= n; }
758     void SetPhotonsFromBranch(bool b) { fPhotonsFromBranch = b; }
759     void SetTrackName(const char *n) { fTrackBranchName = n; }
760     void SetElectronName(const char *n) { fElectronName = n; }
761     void SetConversionName(const char *n) { fConversionName = n; }
762     void SetPUDensityName(const char *n) { fPileUpDenName = n; }
763     void SetPVName(const char *n) { fPVName = n; }
764     void SetPVFromBranch(bool b) { fPVFromBranch = b; }
765     void SetMCParticle(const char *n) { fMCParticleName = n; }
766     void SetPUInfoName(const char *n) { fPileUpName = n; }
767     void SetBeamspotName(const char *n) { fBeamspotName = n; }
768     void SetPFCandName(const char *n) { fPFCandName = n; }
769 veverka 1.39 void SetPFSuperClusterName(const char *n) { fPFSuperClusterName = n; }
770 bendavid 1.5 void SetPFJetName(const char *n) { fPFJetName = n; }
771 fabstoec 1.13 void SetGenJetName(const char *n) { fGenJetName = n; }
772     void SetuncorrPFJetName(const char *n) { funcorrPFJetName = n; }
773 veverka 1.38 void SetPFNoPileUpName(const char *n) { fPFNoPileUpName = n; }
774     void SetPFPileUpName(const char *n) { fPFPileUpName = n; }
775 fabstoec 1.22
776 fabstoec 1.13
777 bendavid 1.5 void SetPFJetsFromBranch(Bool_t b) { fPFJetsFromBranch = b; }
778     void SetEnableJets(Bool_t b) { fEnableJets = b; }
779 veverka 1.38 void SetEnableGenJets(Bool_t b) { fEnableGenJets = b; }
780 bendavid 1.18 void SetApplyJetId(Bool_t b) { fApplyJetId = b; }
781 fabstoec 1.10 void SetApplyLeptonTag(Bool_t b) { fApplyLeptonTag = b; }
782 veverka 1.38 void SetApplyVHLepTag(Bool_t b) { fApplyVHLepTag = b; }
783     void SetApplyVHHadTag(Bool_t b) { fApplyVHHadTag = b; }
784 mingyang 1.24 void SetApplyVBFTag(Bool_t b) { fApplyVBFTag = b; }
785 veverka 1.30 void SetApplyTTHTag(Bool_t b) { fApplyTTHTag = b; }
786 fabstoec 1.12 void SetApplyBTag(Bool_t b) { fApplyBTag = b; }
787 fabstoec 1.14 void SetApplyPFMetCorr(Bool_t b) { fApplyPFMetCorrections = b; }
788 bendavid 1.2 void SetPhFixDataFile(const char *n) { fPhFixDataFile = n; }
789 veverka 1.50 void SetVerbosityLevel(Int_t b) { fVerbosityLevel = b; }
790 bendavid 1.1
791 fabstoec 1.16
792 fabstoec 1.22
793    
794 bendavid 1.1 // set basic Cut variables (FOR PRE-SELECTION)
795    
796     // is Data Or Not?
797 veverka 1.43 void SetIsData (Bool_t b) { fIsData = b; };
798     void SetIsCutBased (Bool_t b) { fIsCutBased = b; };
799 bendavid 1.1
800    
801 bendavid 1.6 void SetApplyElectronVeto(Bool_t b) { fApplyElectronVeto = b; }
802 bendavid 1.1
803 paus 1.9 void SetTupleName(const char* c) { fTupleName = c; }
804 bendavid 1.1 void SetGoodElectronsFromBranch(Bool_t b) { fGoodElectronsFromBranch = b; }
805 paus 1.9 void SetGoodElectronName(TString name) { fGoodElectronName = name; }
806     void SetWriteDiphotonTree(Bool_t b) { fWriteDiphotonTree = b; }
807     void SetWriteSingleTree(Bool_t b) { fWriteSingleTree = b; }
808     void SetLoopOnGoodElectrons(Bool_t b) { fLoopOnGoodElectrons = b; }
809 bendavid 1.17 void SetEnablePFPhotons(Bool_t b) { fEnablePFPhotons = b; }
810 paus 1.9 void SetExcludeSinglePrompt(Bool_t b) { fExcludeSinglePrompt = b; }
811     void SetExcludeDoublePrompt(Bool_t b) { fExcludeDoublePrompt = b; }
812 bendavid 1.1
813 fabstoec 1.10 void SetLeptonTagElectronsName(TString name) { fLeptonTagElectronsName = name; }
814     void SetLeptonTagMuonsName (TString name) { fLeptonTagMuonsName = name; }
815 veverka 1.35 void SetLeptonTagSoftElectronsName(TString name) { fLeptonTagSoftElectronsName = name; }
816     void SetLeptonTagSoftMuonsName (TString name) { fLeptonTagSoftMuonsName = name; }
817 fabstoec 1.22 void SetFillClusterArrays(Bool_t b) { fFillClusterArrays = b; }
818 fabstoec 1.10
819 fabstoec 1.22 void SetDo2012LepTag(Bool_t b) { fDo2012LepTag = b; }
820 bendavid 1.17
821 bendavid 1.23 void SetBeamspotWidth(Double_t x) { fBeamspotWidth = x; }
822 fabstoec 1.26
823 veverka 1.39 void SetElectronMVAWeightsSubdet0Pt10To20(TString s)
824     { fElectronMVAWeights_Subdet0Pt10To20 = s; }
825     void SetElectronMVAWeightsSubdet1Pt10To20(TString s)
826     { fElectronMVAWeights_Subdet1Pt10To20 = s; }
827     void SetElectronMVAWeightsSubdet2Pt10To20(TString s)
828     { fElectronMVAWeights_Subdet2Pt10To20 = s; }
829     void SetElectronMVAWeightsSubdet0Pt20ToInf(TString s)
830     { fElectronMVAWeights_Subdet0Pt20ToInf = s; }
831     void SetElectronMVAWeightsSubdet1Pt20ToInf(TString s)
832     { fElectronMVAWeights_Subdet1Pt20ToInf = s; }
833     void SetElectronMVAWeightsSubdet2Pt20ToInf(TString s)
834     { fElectronMVAWeights_Subdet2Pt20ToInf = s; }
835    
836     void SetDoSynching(bool b) {fDoSynching = b;}
837    
838     template<typename Element, typename Collection>
839     static UInt_t IndexOfElementInCollection(
840     const Element *element,
841     const Collection *collection
842     );
843 fabstoec 1.26
844 veverka 1.40 static UInt_t IndexOfNearestSuperClusterInCollection(
845     const SuperCluster *element,
846     const SuperClusterCol *collection
847     );
848    
849     static double SuperClusterPairMass(
850     const SuperCluster *sc1,
851     const SuperCluster *sc2
852     );
853    
854     static FourVectorM SuperClusterFourVectorM(const SuperCluster *sc1);
855    
856 mingyang 1.52 void SetR9Rescale(bool dor9rescale, double p0b, double p1b, double p0e, double p1e) {fdor9rescale = dor9rescale; fp0b = p0b; fp1b = p1b; fp0e = p0e; fp1e = p1e;}
857    
858 bendavid 1.1 protected:
859     void Process();
860     void SlaveBegin();
861 veverka 1.38 void SlaveTerminate();
862 veverka 1.33 void Terminate();
863 paus 1.9 // Private auxiliary methods...
864 bendavid 1.1 void FindHiggsPtAndZ(Float_t& pt, Float_t& z, Float_t& mass);
865 paus 1.9 Float_t GetEventCat (PhotonTools::CiCBaseLineCats cat1,
866     PhotonTools::CiCBaseLineCats cat2);
867 veverka 1.34 void ApplyLeptonTag(const Photon *phHard,
868     const Photon *phSoft,
869     const Vertex *selvtx);
870 veverka 1.35 const Muon * GetLeptonTagMuon(const Photon *phHard,
871     const Photon *phSoft);
872     void SetLeptonTagMuonVars(const Photon *phHard,
873     const Photon *phSoft,
874     const Muon *muon);
875     const Electron * GetLeptonTagElectron(const Photon *phHard,
876     const Photon *phSoft);
877     bool MassOfPairIsWithinWindowAroundMZ(
878     const Particle * particle1,
879     const Particle * particle2,
880     Float_t halfWindowSize,
881     Float_t MZ = 91.19
882     );
883     void ApplyVHLepTag(const Photon *phHard,
884     const Photon *phSoft,
885     const Vertex *selvtx);
886 veverka 1.38 void ApplyVHHadTag(const Photon *phHard,
887     const Photon *phSoft,
888 veverka 1.42 const Vertex *selvtx,
889     const Jet *jet1,
890     const Jet *jet2);
891 veverka 1.38 void ApplyTTHTag(const Photon *phHard,
892     const Photon *phSoft,
893     const Vertex *selvtx);
894     bool VHLepHasDielectron(const Photon *phHard,
895     const Photon *phSoft);
896     bool VHLepHasDimuon(const Photon *phHard,
897 veverka 1.47 const Photon *phSoft);
898 veverka 1.38 UInt_t VHLepNumberOfJets(const Photon *phHard,
899     const Photon *phSoft,
900     const Vertex *selvtx,
901     const Particle *lepton);
902 veverka 1.45 UInt_t NumberOfJets(const Photon *phHard,
903     const Photon *phSoft,
904     const Vertex *selvtx,
905     const double minJetPt,
906     const double maxAbsEta);
907     UInt_t NumberOfBJets(const Photon *phHard,
908     const Photon *phSoft,
909     const Vertex *selvtx,
910     const double minJetPt,
911     const double maxAbsEta);
912 veverka 1.48 PFJetVector * GetSelectedPFJets(const DeltaRVetoVector &drVetos,
913     const Vertex &vertex,
914     const double minJetPt,
915     const double maxJetAbsEta);
916     PFJetVector * GetSelectedPFBJets(const PFJetVector &pfjets);
917 veverka 1.44 const Particle * TTHSelectLepton(const Photon *phHard,
918     const Photon *phSoft,
919     const Vertex *selvtx);
920     const Electron * TTHSelectElectron(const Photon *phHard,
921     const Photon *phSoft,
922     const Vertex *selvtx);
923     const Muon * TTHSelectMuon(const Photon *phHard,
924     const Photon *phSoft,
925     const Vertex *selvtx);
926 veverka 1.41 void LogEventInfo();
927 veverka 1.44 double GetElectronIdMva(const Electron *electron);
928 bendavid 1.1 // Names for the input Collections
929     TString fPhotonBranchName;
930 bendavid 1.17 TString fPFPhotonName;
931 bendavid 1.1 TString fElectronName;
932     TString fGoodElectronName;
933     TString fConversionName;
934 fabstoec 1.26 TString fPFConversionName;
935 bendavid 1.1 TString fTrackBranchName;
936 veverka 1.39 TString fPileUpDenName;
937 bendavid 1.1 TString fPVName;
938     TString fBeamspotName;
939     TString fPFCandName;
940 fabstoec 1.22 TString fPFNoPileUpName; //name of pfnpu collection
941     TString fPFPileUpName; //name of pfpu collection
942    
943 bendavid 1.1 TString fMCParticleName;
944 bendavid 1.25 TString fMCEventInfoName;
945 veverka 1.39
946 bendavid 1.1 TString fPileUpName;
947 veverka 1.39 TString fPFSuperClusterName;
948 bendavid 1.2 TString fPFMetName;
949 bendavid 1.5 TString fPFJetName;
950 fabstoec 1.10
951 fabstoec 1.16 TString funcorrPFJetName;
952 fabstoec 1.13 TString fGenJetName; //added to do pfmet correction 05/01/2012
953    
954 fabstoec 1.10 TString fLeptonTagElectronsName;
955     TString fLeptonTagMuonsName;
956 veverka 1.35 TString fLeptonTagSoftElectronsName;
957     TString fLeptonTagSoftMuonsName;
958 fabstoec 1.10
959 bendavid 1.1
960     // is it Data or MC?
961     Bool_t fIsData;
962 veverka 1.43 // Is it cut-based? "false" means mass-factorized.
963     Bool_t fIsCutBased;
964 bendavid 1.1
965     // in case there's some PV pre-selection
966     Bool_t fPhotonsFromBranch;
967     Bool_t fPVFromBranch;
968     Bool_t fGoodElectronsFromBranch;
969 bendavid 1.5 Bool_t fPFJetsFromBranch;
970 bendavid 1.1
971 fabstoec 1.26 Bool_t fDoSynching;
972    
973 paus 1.9 const PhotonCol *fPhotons;
974 bendavid 1.17 const PhotonCol *fPFPhotons;
975 paus 1.9 const ElectronCol *fElectrons;
976     const ElectronCol *fGoodElectrons;
977     const DecayParticleCol *fConversions;
978 fabstoec 1.26 const DecayParticleCol *fPFConversions;
979 paus 1.9 const TrackCol *fTracks;
980     const PileupEnergyDensityCol *fPileUpDen;
981     const VertexCol *fPV;
982     const BeamSpotCol *fBeamspot;
983     const PFCandidateCol *fPFCands;
984     const MCParticleCol *fMCParticles;
985 bendavid 1.25 const MCEventInfo *fMCEventInfo;
986 paus 1.9 const PileupInfoCol *fPileUp;
987 veverka 1.39 const SuperClusterCol *fPFSuperClusters;
988 paus 1.9 const PFMetCol *fPFMet;
989     const JetCol *fPFJets;
990 fabstoec 1.13 const GenJetCol *fGenJets;
991     const PFJetCol *funcorrPFJets;
992 bendavid 1.2
993 fabstoec 1.10 const ElectronCol *fLeptonTagElectrons;
994     const MuonCol *fLeptonTagMuons;
995 veverka 1.35 const ElectronCol *fLeptonTagSoftElectrons;
996     const MuonCol *fLeptonTagSoftMuons;
997 fabstoec 1.22 const PFCandidateCol *fPFNoPileUpCands; //!pfnpu collection
998     const PFCandidateCol *fPFPileUpCands; //!pfpu collection
999 fabstoec 1.10
1000 bendavid 1.1 // --------------------------------
1001 paus 1.9 Bool_t fLoopOnGoodElectrons; //loop over good elecs instead of photons
1002     Bool_t fApplyElectronVeto; //invert elec veto (for cic sel. only atm)
1003     Bool_t fWriteDiphotonTree;
1004     Bool_t fWriteSingleTree;
1005 bendavid 1.1
1006 bendavid 1.17 Bool_t fEnablePFPhotons;
1007    
1008 paus 1.9 Bool_t fExcludeSinglePrompt;
1009     Bool_t fExcludeDoublePrompt;
1010 bendavid 1.2
1011 paus 1.9 Bool_t fEnableJets;
1012 mingyang 1.29 Bool_t fEnableGenJets;
1013 bendavid 1.18 Bool_t fApplyJetId;
1014 fabstoec 1.10
1015     Bool_t fApplyLeptonTag;
1016 veverka 1.35 Bool_t fApplyVHLepTag;
1017 veverka 1.38 Bool_t fApplyVHHadTag;
1018 mingyang 1.24 Bool_t fApplyVBFTag;
1019 veverka 1.30 Bool_t fApplyTTHTag;
1020 fabstoec 1.12 Bool_t fApplyBTag;
1021 fabstoec 1.14 Bool_t fApplyPFMetCorrections;
1022 fabstoec 1.12
1023 bendavid 1.17 Bool_t fFillClusterArrays;
1024 bendavid 1.18 Bool_t fFillVertexTree;
1025 bendavid 1.17
1026 fabstoec 1.22 Bool_t fDo2012LepTag;
1027 veverka 1.30
1028     Int_t fVerbosityLevel;
1029 fabstoec 1.22
1030 paus 1.9 TString fPhFixDataFile;
1031     PhotonFix fPhfixph;
1032     PhotonFix fPhfixele;
1033 bendavid 1.23
1034     Double_t fBeamspotWidth;
1035 veverka 1.30
1036 veverka 1.33 TFile *fTmpFile;
1037 veverka 1.41
1038 bendavid 1.1 // --------------------------------
1039 mingyang 1.24 // variables for vbf
1040     float jet1pt_vbf;
1041     float jet2pt_vbf;
1042     float deltajeteta_vbf;
1043     float dijetmass_vbf;
1044     float zeppenfeld_vbf;
1045     float dphidijetgg_vbf;
1046     float diphoptOverdiphomass_vbf;
1047     float pho1ptOverdiphomass_vbf;
1048     float pho2ptOverdiphomass_vbf;
1049    
1050     // --------------------------------
1051 bendavid 1.1 // validation Tuple
1052 paus 1.9 TString fTupleName;
1053 bendavid 1.1 PhotonTreeWriterDiphotonEvent* fDiphotonEvent;
1054 bendavid 1.17 PhotonTreeWriterPhoton<16>* fSinglePhoton;
1055 paus 1.9 TTree* hCiCTuple;
1056     TTree* hCiCTupleSingle;
1057 bendavid 1.1
1058 bendavid 1.18 PhotonTreeWriterVtx *fDiphotonVtx;
1059     TTree *hVtxTree;
1060    
1061 bendavid 1.17 MVAMet fMVAMet;
1062 bendavid 1.18 JetIDMVA fJetId;
1063 mingyang 1.24 MVAVBF fMVAVBF;
1064 bendavid 1.17
1065 fabstoec 1.26 VertexTools fVtxTools;
1066    
1067     ElectronIDMVA *fElectronIDMVA;
1068     TString fElectronMVAWeights_Subdet0Pt10To20;
1069     TString fElectronMVAWeights_Subdet1Pt10To20;
1070     TString fElectronMVAWeights_Subdet2Pt10To20;
1071     TString fElectronMVAWeights_Subdet0Pt20ToInf;
1072     TString fElectronMVAWeights_Subdet1Pt20ToInf;
1073     TString fElectronMVAWeights_Subdet2Pt20ToInf;
1074    
1075 mingyang 1.52 //R9 rescale
1076     bool fdor9rescale;
1077     double fp0b;
1078     double fp1b;
1079     double fp0e;
1080     double fp1e;
1081    
1082 fabstoec 1.26 RhoUtilities::RhoType fTheRhoType;
1083 veverka 1.41 UInt_t fProcessedEvents;
1084 fabstoec 1.26
1085 bendavid 1.1 ClassDef(PhotonTreeWriter, 1) // Photon identification module
1086 mingyang 1.24 };
1087 bendavid 1.1 }
1088     #endif