ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/MitPhysics/Mods/interface/PhotonTreeWriter.h
Revision: 1.51
Committed: Thu Dec 12 17:14:08 2013 UTC (11 years, 5 months ago) by veverka
Content type: text/plain
Branch: MAIN
Changes since 1.50: +2 -1 lines
Log Message:
Adding escale back in

File Contents

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