ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/MitPhysics/Mods/interface/PhotonTreeWriter.h
Revision: 1.48
Committed: Mon Dec 2 21:08:18 2013 UTC (11 years, 5 months ago) by veverka
Content type: text/plain
Branch: MAIN
Changes since 1.47: +7 -5 lines
Log Message:
Relaxed minimum jet pt for the numJets varible. Started a common jet selector

File Contents

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