ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/MitPhysics/Mods/src/MakeNtuple.cc
Revision: 1.2
Committed: Fri May 25 19:41:50 2012 UTC (12 years, 11 months ago) by bendavid
Content type: text/plain
Branch: MAIN
CVS Tags: Mit_028a, Mit_028
Changes since 1.1: +20 -20 lines
Log Message:
adapt to new pf iso

File Contents

# User Rev Content
1 mingyang 1.1 //$Id:MakeNtuple.cc,v 1.1 2011/07/12 Mingming Yang
2     #include <iostream>
3     #include <sstream>
4     #include <fstream>
5     #include <vector>
6     #include <algorithm>
7     #include <TMath.h>
8     #include <TNtuple.h>
9     #include <TFile.h>
10     #include <TRandom3.h>
11     #include "MitAna/DataUtil/interface/Debug.h"
12     #include "MitAna/DataCont/interface/ObjArray.h"
13     #include "MitAna/DataTree/interface/Names.h"
14     #include "MitPhysics/Utils/interface/VertexTools.h"
15     #include "MitPhysics/Utils/interface/ElectronTools.h"
16     #include "MitPhysics/Utils/interface/IsolationTools.h"
17     #include "MitAna/DataTree/interface/StableData.h"
18     #include "MitPhysics/Utils/interface/PhotonTools.h"
19     #include "MitCommon/MathTools/interface/MathUtils.h"
20     #include "MitPhysics/Utils/interface/GeneratorTools.h"//tools to get the generator level information
21     #include "MitAna/DataTree/interface/PFCandidateCol.h"
22     #include "MitPhysics/Mods/interface/MakeNtuple.h"
23    
24     using namespace mithep;
25     using namespace TMath;
26    
27     ClassImp(mithep::MakeNtuple)
28    
29     //---------------------------------------------------------------------------
30     MakeNtuple::MakeNtuple(const char *name, const char *title):
31     BaseMod (name,title),
32     //-------------------------------
33     fTrigObjsName (Names::gkHltObjBrn),
34     //-------------------------------
35     fPhotonName (Names::gkPhotonBrn),
36     fElectronName ("Electrons"),
37     fTrackBranchName (Names::gkTrackBrn),
38     fPVName (Names::gkPVBeamSpotBrn),
39     fPileUpDenName (Names::gkPileupEnergyDensityBrn),
40     fPhotonsFromBranch (kTRUE),
41     //-------------------------------
42     fIsData (kTRUE),
43     //----scale removal--------------
44     fOverlapCut (-1.0),
45     //----MC Info--------------------
46     fMcEventInfoName (Names::gkMCEvtInfoBrn),
47     fMcParticleName (Names::gkMCPartBrn),
48     fPileupInfoName (Names::gkPileupInfoBrn),
49     //----PF-------------------------
50     fPFCandName (Names::gkPFCandidatesBrn),
51     //-------------------------------
52     fPhotons (0),
53     fElectrons (0),
54     fMcParticles (0),
55     fMcEventInfo (0),
56     fPileupInfos (0),
57     fPFCands (0),
58     //-------------------------------
59     fPhotonPtMin (25.0),
60     fApplyElectronVeto (kTRUE),
61     finvertElectronVeto(kFALSE),
62     //-------------------------------
63     fBeamSpotName(Names::gkBeamSpotBrn),
64     fConversionName(Names::gkMvfConversionBrn),
65     fBeamSpot(0),
66     fConversions(0),
67     fIsSignal(kTRUE)
68     {
69     //constructor
70     }
71     //----------------------------------------------------------------------------
72     void MakeNtuple::Process()
73     {
74     // count the events we have processed
75     IncNEventsProcessed();
76    
77     // access the MC Information if needed
78     if (!fIsData) {
79     LoadBranch(fMcEventInfoName);
80     LoadBranch(fMcParticleName);
81     LoadBranch(fPileupInfoName);
82     fprocessid = fMcEventInfo->ProcessId();
83     for (UInt_t i=0; i<fPileupInfos->GetEntries(); ++i) {
84     const PileupInfo *puinfo = fPileupInfos->At(i);
85     if (puinfo->GetBunchCrossing()==0) fNVertexesGenPile= puinfo->GetPU_NumInteractions();
86     }
87     if (fOverlapCut > 0. && fMcEventInfo->Scale() > fOverlapCut) {
88     MDB(kModules,1)
89     printf(" Reject event with scale %f above cut: %f\n",fMcEventInfo->Scale(),fOverlapCut);
90     return;
91     }
92     if( fMcParticles != NULL && fMcParticles->GetEntries()>0){
93     printf("fMcParticles exists!\n");
94     }
95     }
96    
97     //load branch
98     LoadEventObject(fPhotonName,fPhotons);
99     LoadEventObject(fElectronName,fElectrons);
100     LoadEventObject(fTrackBranchName,fTracks);
101     LoadEventObject(fPVName,fPV);
102     LoadEventObject(fPileUpDenName,fPileUpDen);
103     LoadEventObject(fPFCandName, fPFCands);
104     LoadBranch(fBeamSpotName);
105     LoadBranch(fConversionName);
106    
107     Float_t _pth = -100.;
108     Float_t _decayZ = -100.;
109     Float_t _genmass = -100.;
110    
111     //select photon
112     if(!fIsData){
113     FindHiggsPtAndZ(_pth, _decayZ, _genmass);
114     Float_t EventNum=GetEventHeader()->EvtNum();
115     if(fIsSignal){
116     int PhotonColSize=fPhotons->GetEntries();
117     if(PhotonColSize>=2){
118     Float_t ptmax1=0;
119     Float_t ptmax2=0;
120     int imax1=0;
121     int imax2=0;
122     for(int i=0;i<PhotonColSize;i++){
123     if((fPhotons->At(i)->Pt())>ptmax1){
124     ptmax1=fPhotons->At(i)->Pt();
125     imax1=i;
126     }
127     }
128     for (int i=0;i<PhotonColSize;i++) {
129     if(((fPhotons->At(i)->Pt())>ptmax2)&&((fPhotons->At(i)->Pt()<ptmax1))){
130     ptmax2=fPhotons->At(i)->Pt();
131     imax2=i;}
132     }
133     const Photon *p1= fPhotons->At(imax1);
134     const Photon *p2= fPhotons->At(imax2);
135     Float_t GenPhotonID1=-999;
136     Float_t GenPhotonMotherID1=-999;
137     Float_t GenPhotonID2=-999;
138     Float_t GenPhotonMotherID2=-999;
139     int match1=0;
140     int match2=0;
141     match1=MatchRecPhotonsToGenPhotonsReal(p1);
142     if(match1==1){
143     GenPhotonID1=fMatchedGenPhotonID;
144     GenPhotonMotherID1=fMatchedGenPhotonMotherID;
145     }
146     match2=MatchRecPhotonsToGenPhotonsReal(p2);
147     if(match2==1){
148     GenPhotonID2=fMatchedGenPhotonID;
149     GenPhotonMotherID2=fMatchedGenPhotonMotherID;
150     }
151     int p1real=0;
152     int p2real=0;
153     if( PhotonTools::MatchMC(p1,fMcParticles,kFALSE)){p1real=1;}
154     if( PhotonTools::MatchMC(p2,fMcParticles,kFALSE)){p2real=1;}
155    
156     if(p1real==1 && p2real==1 && ptmax1>25 && ptmax2>25){
157     Double_t VtxProb = 1.0;
158     const Vertex* SelVtx = fVtxTools.findVtxBasicRanking(p1,p2,fBeamSpot->At(0),fPV,fConversions,kTRUE,VtxProb);
159     //printf("VtxProb:%f\n",VtxProb);
160     VtxProb = (Float_t)VtxProb;
161     FillPhotonTree(p1,p2,SelVtx,fPFCands,GenPhotonID1,GenPhotonMotherID1,VtxProb,EventNum,_decayZ);
162     FillPhotonTree(p2,p1,SelVtx,fPFCands,GenPhotonID2,GenPhotonMotherID2,VtxProb,EventNum,_decayZ);
163     }
164     }
165     }
166    
167     if(!fIsSignal){
168     int PhotonColSize=fPhotons->GetEntries();
169     if(PhotonColSize>=2){
170     Float_t ptmax1=0;
171     Float_t ptmax2=0;
172     int imax1=0;
173     int imax2=0;
174     for(int i=0;i<PhotonColSize;i++){
175     if((fPhotons->At(i)->Pt())>ptmax1){
176     ptmax1=fPhotons->At(i)->Pt();
177     imax1=i;
178     }
179     }
180     for (int i=0;i<PhotonColSize;i++) {
181     if(((fPhotons->At(i)->Pt())>ptmax2)&&((fPhotons->At(i)->Pt()<ptmax1))){
182     ptmax2=fPhotons->At(i)->Pt();
183     imax2=i;}
184     }
185     const Photon *p1= fPhotons->At(imax1);
186     const Photon *p2= fPhotons->At(imax2);
187     Float_t GenPhotonID1=-999;
188     Float_t GenPhotonMotherID1=-999;
189     Float_t GenPhotonID2=-999;
190     Float_t GenPhotonMotherID2=-999;
191     int match1=0;
192     int match2=0;
193     match1=MatchRecPhotonsToGenPhotonsReal(p1);
194     if(match1==1){
195     GenPhotonID1=fMatchedGenPhotonID;
196     GenPhotonMotherID1=fMatchedGenPhotonMotherID;
197     }
198     match2=MatchRecPhotonsToGenPhotonsReal(p2);
199     if(match2==1){
200     GenPhotonID2=fMatchedGenPhotonID;
201     GenPhotonMotherID2=fMatchedGenPhotonMotherID;
202     }
203     //printf("GenPhotonID1:%f ",GenPhotonID1);
204     //printf("GenPhotonMotherID1:%f ",GenPhotonMotherID1);
205     //printf("GenPhotonID2:%f ",GenPhotonID2);
206     //printf("GenPhotonMotherID2:%f ",GenPhotonMotherID2);
207     int p1real=0;
208     int p2real=0;
209     if( PhotonTools::MatchMC(p1,fMcParticles,kFALSE)){p1real=1;}
210     if( PhotonTools::MatchMC(p2,fMcParticles,kFALSE)){p2real=1;}
211     int p1p2=p1real+p2real;
212     if(p1p2==1 && ptmax1>25 && ptmax2>25){
213     Double_t VtxProb = 1.0;
214     const Vertex* SelVtx = fVtxTools.findVtxBasicRanking(p1,p2,fBeamSpot->At(0),fPV,fConversions,kTRUE,VtxProb);
215     // printf("VtxProb:%f\n",VtxProb);
216     VtxProb = (Float_t)VtxProb;
217     if(p1real==0){
218     FillPhotonTree(p1,p2,SelVtx,fPFCands,GenPhotonID1,GenPhotonMotherID1,VtxProb,EventNum,_decayZ);
219     }
220     if(p2real==0){
221     FillPhotonTree(p2,p1,SelVtx,fPFCands,GenPhotonID2,GenPhotonMotherID2,VtxProb,EventNum,_decayZ);
222     }
223     }
224     }
225     }
226     }
227    
228     if(fIsData){
229     Float_t EventNum=GetEventHeader()->EvtNum();
230     int PhotonColSize=fPhotons->GetEntries();
231     if(PhotonColSize>=2){
232     Float_t ptmax1=0;
233     Float_t ptmax2=0;
234     int imax1=0;
235     int imax2=0;
236     for(int i=0;i<PhotonColSize;i++){
237     if((fPhotons->At(i)->Pt())>ptmax1){
238     ptmax1=fPhotons->At(i)->Pt();
239     imax1=i;
240     }
241     }
242     for (int i=0;i<PhotonColSize;i++) {
243     if(((fPhotons->At(i)->Pt())>ptmax2)&&((fPhotons->At(i)->Pt()<ptmax1))){
244     ptmax2=fPhotons->At(i)->Pt();
245     imax2=i;}
246     }
247     const Photon *p1= fPhotons->At(imax1);
248     const Photon *p2= fPhotons->At(imax2);
249     Float_t GenPhotonID1=-999;
250     Float_t GenPhotonMotherID1=-999;
251     Float_t GenPhotonID2=-999;
252     Float_t GenPhotonMotherID2=-999;
253     int match1=0;
254     int match2=0;
255     if(ptmax1>25 && ptmax2>25){
256     Double_t VtxProb = 1.0;
257     const Vertex* SelVtx = fVtxTools.findVtxBasicRanking(p1,p2,fBeamSpot->At(0),fPV,fConversions,kTRUE,VtxProb);
258     VtxProb = (Float_t)VtxProb;
259     FillPhotonTree(p1,p2,SelVtx,fPFCands,GenPhotonID1,GenPhotonMotherID1,VtxProb,EventNum,_decayZ);
260     FillPhotonTree(p2,p1,SelVtx,fPFCands,GenPhotonID2,GenPhotonMotherID2,VtxProb,EventNum,_decayZ);
261     }
262     }
263    
264     }
265     }
266     //-----------------------------------------------------------------------------
267     void MakeNtuple::SlaveBegin()
268     {
269     //require brunch
270     ReqEventObject(fPhotonName,fPhotons,fPhotonsFromBranch);
271     ReqEventObject(fElectronName, fElectrons, kTRUE);
272     ReqEventObject(fTrackBranchName, fTracks, kTRUE);
273     ReqEventObject(fPVName, fPV, kTRUE);
274     ReqEventObject(fPileUpDenName, fPileUpDen, kTRUE);
275     ReqEventObject(fPileupInfoName, fPileupInfos, kTRUE);
276     ReqEventObject(fPFCandName, fPFCands, true);
277     ReqBranch(fBeamSpotName,fBeamSpot);
278     ReqBranch(fConversionName,fConversions);
279    
280     // for MC only to adjust potential overlaps from generation
281     if (! fIsData) {
282     ReqBranch(fMcEventInfoName,fMcEventInfo);
283     printf(" Monte Carlo Information block %p\n",(void*) fMcEventInfo);
284     printf(" --> this is no data. Access the McEventInfo.\n\n");
285    
286     ReqBranch(fMcParticleName,fMcParticles);
287    
288     }
289     else
290     printf(" --> this is data. Drop the McEventInfo.\n\n");
291    
292     //book ntuple
293     hPhotonNtuple = new TNtuple("hPhotonNtuple","hPhotonNtuple","fprocessid:MatchGenPhotonID:MatchGenPhotonMotherID:Category:PassOfficial:PassElectronVeto:PassEleVetoConvRecovery:dRTrack:Pt:Eta:ScEta:ScPhi:ScEta_accompany:Et:EcalIsoDr03:HcalIsoDr03:TrkIsoHollowDr03:HoE:R9:covIEtaIEta:sigIEtaIEta:tIso1:tIso2:tIso3:tIso1abs:tIso2abs:tIso3abs:RelIsoEcal:RelIsoHcal:RelEMax:RelETop:RelEBottom:RelELeft:RelERight:RelE2x5Max:RelE2x5Top:RelE2x5Bottom:RelE2x5Left:RelE2x5Right:RelE5x5:RelE1x3:RelE3x1:RelE1x5:RelE2x2:RelE3x2:RelE4X4:EtaWidth:PhiWidth:RelPreshowerEnergy:CoviEtaiPhi:CoviPhiiPhi:NVertexes:_tRho:_NewRho_42:_RhoKt6PFJets:VtxProb:fNVertexesGenPile:EventNum:passpre:RawEnergy:AbsIsoEcal:AbsIsoHcal:GammaIso_DR0045To0p01:GammaIso_DR007To0p01:GammaIso_DR0To0p001:GammaIso_DR001To0p002:GammaIso_DR002To0p005:GammaIso_DR005To0p01:GammaIso_DR01To0p02:GammaIso_DR02To0p03:GammaIso_DR03To0p04:GammaIso_DR04To0p05:GammaIso_DR05To0p06:NeutralHadronIso_DR0To0p001:NeutralHadronIso_DR001To0p002:NeutralHadronIso_DR002To0p005:NeutralHadronIso_DR005To0p01:NeutralHadronIso_DR01To0p02:NeutralHadronIso_DR02To0p03:NeutralHadronIso_DR03To0p04:NeutralHadronIso_DR04To0p05:NeutralHadronIso_DR05To0p06:ChargedIso_selvtx_DR0To0p001:ChargedIso_selvtx_DR001To0p002:ChargedIso_selvtx_DR002To0p005:ChargedIso_selvtx_DR005To0p01:ChargedIso_selvtx_DR01To0p02:ChargedIso_selvtx_DR02To0p03:ChargedIso_selvtx_DR03To0p04:ChargedIso_selvtx_DR04To0p05:ChargedIso_selvtx_DR05To0p06:ChargedIso_selvtx_DR002To0p01:ChargedIso_worstvtx_DR0To0p001:ChargedIso_worstvtx_DR001To0p002:ChargedIso_worstvtx_DR002To0p005:ChargedIso_worstvtx_DR005To0p01:ChargedIso_worstvtx_DR01To0p02:ChargedIso_worstvtx_DR02To0p03:ChargedIso_worstvtx_DR03To0p04:ChargedIso_worstvtx_DR04To0p05:ChargedIso_worstvtx_DR05To0p06:ChargedIso_worstvtx_DR002To0p01:ChargedCount_selvtx_DR0To0p001:ChargedCount_selvtx_DR001To0p002:ChargedCount_selvtx_DR002To0p005:ChargedCount_selvtx_DR005To0p01:ChargedCount_selvtx_DR01To0p02:ChargedCount_selvtx_DR02To0p03:ChargedCount_selvtx_DR03To0p04:ChargedCount_selvtx_DR04To0p05:ChargedCount_selvtx_DR05To0p06:ChargedCount_selvtx_DR002To0p01:ChargedCount_worstvtx_DR0To0p001:ChargedCount_worstvtx_DR001To0p002:ChargedCount_worstvtx_DR002To0p005:ChargedCount_worstvtx_DR005To0p01:ChargedCount_worstvtx_DR01To0p02:ChargedCount_worstvtx_DR02To0p03:ChargedCount_worstvtx_DR03To0p04:ChargedCount_worstvtx_DR04To0p05:ChargedCount_worstvtx_DR05To0p06:ChargedCount_worstvtx_DR002To0p01:DiphotonMass:RelEmaxOverE33:RelE22:CovEtaPhi:PsEffWidthSigmaXX:PsEffWidthSigmaYY:vtxZ:_decayZ:s4ratio:lambdaratio");
294    
295     AddOutput(hPhotonNtuple);
296    
297     fVtxTools.InitP();
298     }
299    
300     //-----------------------------------------------------------------------------------------------------------
301     int MakeNtuple::MatchRecPhotonsToGenPhotonsReal(const Photon *photonRec)//ming: match the reconstructed photon to the generated photon
302     {
303     int MatchReal=0;
304    
305     Float_t MinDeltaR=0.3;
306     int MinDeltaRj=-1;
307     Float_t photonRec_pt=photonRec->Pt();
308    
309     // loop through all generated photons and try to find a match for the reconstructed photon being considerated
310     for(UInt_t j=0; j<fMcParticles->GetEntries(); j++){
311     const MCParticle *photonGen =fMcParticles->At(j);
312     const MCParticle *Mother=photonGen->DistinctMother();
313     if(photonGen->AbsPdgId()==22 && photonGen->IsGenerated()){//photon PdgId=22
314     Float_t photonGen_pt=photonGen->Pt();
315     Float_t diffPtRatio=fabs(photonGen_pt-photonRec_pt)/photonRec_pt;
316     Float_t deltaR=MathUtils::DeltaR(*photonRec,*photonGen);
317     if (deltaR<MinDeltaR && diffPtRatio<0.5) {
318     MinDeltaR=deltaR;
319     MinDeltaRj=j;
320     }
321     }
322     }
323    
324     if(MinDeltaRj!=-1){
325     const MCParticle *MatchedGenPhoton=fMcParticles->At(MinDeltaRj);
326     const MCParticle *MatchedGenPhotonMother=MatchedGenPhoton->DistinctMother();
327     fMatchedGenPhotonID=MatchedGenPhoton->PdgId();
328     fMatchedGenPhotonMotherID=MatchedGenPhotonMother->PdgId();
329     if(fabs(fMatchedGenPhotonMotherID)==25 ||(fabs(fMatchedGenPhotonMotherID)>0 && fabs(fMatchedGenPhotonMotherID)<10) || fabs(fMatchedGenPhotonMotherID)==21){
330     MatchReal=1;
331     }
332     }
333     return MatchReal;
334     }
335    
336     void MakeNtuple::FillPhotonTree(const Photon *p,const Photon *p_accompany,const Vertex *SelVtx,const PFCandidateCol *fPFCands,Float_t GenPhotonID,Float_t GenPhotonMotherID,Float_t VtxProb, Float_t EventNum,Float_t _decayZ) {
337    
338     // these values are taken from the H2GGlobe code... (actually from Marco/s mail)
339     float cic4_allcuts_temp_sublead[] = {
340     3.8, 2.2, 1.77, 1.29,
341     11.7, 3.4, 3.9, 1.84,
342     3.5, 2.2, 2.3, 1.45,
343     0.0106, 0.0097, 0.028, 0.027,
344     0.082, 0.062, 0.065, 0.048,
345     0.94, 0.36, 0.94, 0.32,
346     1., 0.062, 0.97, 0.97,
347     1.5, 1.5, 1.5, 1.5 }; // the last line is PixelmatchVeto and un-used
348    
349     Float_t DiphotonMass=0;
350     Float_t vtxZ=SelVtx->Z();
351    
352     Float_t MatchGenPhotonID=GenPhotonID;
353     Float_t MatchGenPhotonMotherID=GenPhotonMotherID;
354     Float_t Category=0;
355     Float_t PassOfficial=0;
356     Float_t PassElectronVeto=0;
357     Float_t PassEleVetoConvRecovery=0;
358     Float_t dRTrack=0;
359     Float_t Pt=0;
360     Float_t Eta=0;
361     Float_t ScEta=0;
362     Float_t ScPhi=0;
363     Float_t ScEta_accompany=0;
364     Float_t Et=0;
365     Float_t EcalIsoDr03=0;
366     Float_t HcalIsoDr03=0;
367     Float_t TrkIsoHollowDr03=0;
368     Float_t HoE=0;
369     Float_t R9=0;
370     Float_t covIEtaIEta=0;
371     Float_t sigIEtaIEta=0;
372     Float_t tIso1=0;
373     Float_t tIso2=0;
374     Float_t tIso3=0;
375     Float_t tIso1abs=0;
376     Float_t tIso2abs=0;
377     Float_t tIso3abs=0;
378     Float_t RelIsoEcal=0;
379     Float_t RelIsoHcal=0;
380     Float_t RelEMax=0;
381     Float_t RelETop=0;
382     Float_t RelEBottom=0;
383     Float_t RelELeft=0;
384     Float_t RelERight=0;
385     Float_t RelE2x5Max=0;
386     Float_t RelE2x5Top=0;
387     Float_t RelE2x5Bottom=0;
388     Float_t RelE2x5Left=0;
389     Float_t RelE2x5Right=0;
390     Float_t RelE5x5=0;
391     Float_t RelE1x3=0;
392     Float_t RelE3x1=0;
393     Float_t RelE1x5=0;
394     Float_t RelE2x2=0;
395     Float_t RelE3x2=0;
396     Float_t RelE4X4=0;
397     Float_t EtaWidth=0;
398     Float_t PhiWidth=0;
399     Float_t RelPreshowerEnergy=0;
400     Float_t CoviEtaiPhi=0;
401     Float_t CoviPhiiPhi=0;
402     Float_t NVertexes=0;
403     Float_t _tRho=0;
404     Float_t _NewRho_42=0;
405     Float_t _RhoKt6PFJets=0;
406     Float_t AbsIsoEcal=0;
407     Float_t AbsIsoHcal=0;
408    
409     //get the variables used to compute MVA variables
410     Float_t ecalIso3 = p->EcalRecHitIsoDr03();
411     Float_t ecalIso4 = p->EcalRecHitIsoDr04();
412     Float_t hcalIso4 = p->HcalTowerSumEtDr04();
413     unsigned int wVtxInd = 0;
414     Float_t trackIso1 = IsolationTools::CiCTrackIsolation(p,SelVtx, 0.3, 0.02, 0.0, 0.0, 0.1, 1.0, fTracks);
415     Float_t trackIso2 = IsolationTools::CiCTrackIsolation(p,SelVtx, 0.4, 0.02, 0.0, 0.0, 0.1, 1.0, fTracks, &wVtxInd,fPV);
416     Float_t trackIso3 = IsolationTools::CiCTrackIsolation(p,SelVtx, 0.3, 0.02, 0.0, 0.0, 0.1, 1.0, fTracks);
417     _tRho = (Float_t) fPileUpDen->At(0)->RhoRandomLowEta();
418     _NewRho_42 = (Float_t) fPileUpDen->At(0)->Rho();
419     _RhoKt6PFJets = (Float_t) fPileUpDen->At(0)->RhoKt6PFJets();
420     Float_t combIso1 = ecalIso3+hcalIso4+trackIso1 - 0.17*_tRho;
421     Float_t combIso2 = ecalIso4+hcalIso4+trackIso2 - 0.52*_tRho;
422     Float_t RawEnergy = p->SCluster()->RawEnergy();
423    
424     //mass
425     DiphotonMass=(p->Mom()+p_accompany->Mom()).M();
426    
427     //preselection variables
428     Et=p->Et();
429     EcalIsoDr03=p->EcalRecHitIsoDr03();
430     HcalIsoDr03=p->HcalTowerSumEtDr03();
431     TrkIsoHollowDr03=p->HollowConeTrkIsoDr03();
432    
433     //compute MVA variables
434     HoE = p->HadOverEm();
435     covIEtaIEta = p->CoviEtaiEta();
436     sigIEtaIEta = sqrt(p->SCluster()->Seed()->CoviEtaiEta());
437     dRTrack = PhotonTools::ElectronVetoCiC(p,fElectrons);
438     tIso1 = (combIso1) *50./p->Et();
439     tIso3 = (trackIso3)*50./p->Et();
440     tIso2 = (combIso2) *50./(p->MomVtx(fPV->At(wVtxInd)->Position()).Pt());
441     tIso1abs = (combIso1);
442     tIso3abs = (trackIso3);
443     tIso2abs = (combIso2);
444     R9 = p->R9();
445    
446     //newly added MVA variables 1
447     RelIsoEcal=(ecalIso3-0.17*_tRho)/p->Et();
448     RelIsoHcal=(hcalIso4-0.17*_tRho)/p->Et();
449    
450     AbsIsoEcal=ecalIso3;
451     AbsIsoHcal=hcalIso4;
452    
453     RelEMax=p->SCluster()->Seed()->EMax()/RawEnergy;
454     RelETop=p->SCluster()->Seed()->ETop()/RawEnergy;
455     RelEBottom=p->SCluster()->Seed()->EBottom()/RawEnergy;
456     RelELeft=p->SCluster()->Seed()->ELeft()/RawEnergy;
457     RelERight=p->SCluster()->Seed()->ERight()/RawEnergy;
458     RelE2x5Max=p->SCluster()->Seed()->E2x5Max()/RawEnergy;
459     RelE2x5Top=p->SCluster()->Seed()->E2x5Top()/RawEnergy;
460     RelE2x5Bottom=p->SCluster()->Seed()->E2x5Bottom()/RawEnergy;
461     RelE2x5Left=p->SCluster()->Seed()->E2x5Left()/RawEnergy;
462     RelE2x5Right=p->SCluster()->Seed()->E2x5Right()/RawEnergy;
463     RelE5x5=p->SCluster()->Seed()->E5x5()/RawEnergy;
464    
465     //newly added MVA variables 2
466     EtaWidth=p->SCluster()->EtaWidth();
467     PhiWidth=p->SCluster()->PhiWidth();
468     RelPreshowerEnergy=p->SCluster()->PreshowerEnergy()/RawEnergy;
469    
470     CoviEtaiPhi=p->SCluster()->Seed()->CoviEtaiPhi();
471     CoviPhiiPhi=p->SCluster()->Seed()->CoviPhiiPhi();
472    
473     RelE1x3=p->SCluster()->Seed()->E1x3()/RawEnergy;
474     RelE3x1=p->SCluster()->Seed()->E3x1()/RawEnergy;
475     RelE1x5=p->SCluster()->Seed()->E1x5()/RawEnergy;
476     RelE2x2=p->SCluster()->Seed()->E2x2()/RawEnergy;
477     RelE3x2=p->SCluster()->Seed()->E3x2()/RawEnergy;
478     RelE4X4=p->SCluster()->Seed()->E4x4()/RawEnergy;
479    
480     //spectator variables 1
481     Pt=p->Pt();
482     Eta=p->Eta();
483     ScEta=p->SCluster()->Eta();
484     ScPhi=p->SCluster()->Phi();
485     ScEta_accompany=p_accompany->SCluster()->Eta();;
486     NVertexes=fPV->GetEntries();//not for mva yet
487    
488     //Official selection variables
489     if(fabs(ScEta)<1.4442 && p->R9()>=0.94){
490     Category=1;
491     if( PhotonTools::PassCiCSelection(p, SelVtx, fTracks, fElectrons, fPV, _tRho, fPhotonPtMin, fApplyElectronVeto) ){
492     PassOfficial=1;
493     }
494     }
495     if(fabs(ScEta)<1.4442 && p->R9()<0.94){
496     Category=2;
497     if( PhotonTools::PassCiCSelection(p, SelVtx, fTracks, fElectrons, fPV, _tRho, fPhotonPtMin, fApplyElectronVeto) ){
498     PassOfficial=1;
499     }
500     }
501     if(fabs(ScEta)>1.566 && fabs(ScEta)<2.5 && p->R9()>=0.94){
502     Category=3;
503     if( PhotonTools::PassCiCSelection(p, SelVtx, fTracks, fElectrons, fPV, _tRho, fPhotonPtMin, fApplyElectronVeto) ){
504     PassOfficial=1;
505     }
506    
507     }
508     if(fabs(ScEta)>1.566 && fabs(ScEta)<2.5 && p->R9()<0.94){
509     Category=4;
510     if( PhotonTools::PassCiCSelection(p, SelVtx, fTracks, fElectrons, fPV, _tRho, fPhotonPtMin, fApplyElectronVeto) ){
511     PassOfficial=1;
512     }
513     }
514    
515     //cic ele veto
516     Bool_t isbarrel = (fabs(ScEta)<1.4442);
517     int _tCat = 1;
518     if ( !isbarrel ) _tCat = 3;
519     if ( R9 < 0.94 ) _tCat++;
520     if(dRTrack > cic4_allcuts_temp_sublead[_tCat-1+6*4]){
521     PassElectronVeto=1;
522     }
523    
524     //mit ele veto
525     if(PhotonTools::PassElectronVetoConvRecovery(p,fElectrons,fConversions,fBeamSpot->At(0))){
526     PassEleVetoConvRecovery=1;
527     }
528    
529     float passpre=0;
530    
531     if(PhotonTools::PassSinglePhotonPresel(p,fElectrons,fConversions,fBeamSpot->At(0), fTracks,SelVtx,_tRho,fApplyElectronVeto,finvertElectronVeto)){
532     passpre=1;
533     }
534    
535     //PF ISO
536     //photon
537     Float_t GammaIso_DR0To0p001=0;
538     Float_t GammaIso_DR001To0p002=0;
539     Float_t GammaIso_DR002To0p005=0;
540     Float_t GammaIso_DR005To0p01=0;
541     Float_t GammaIso_DR01To0p02=0;
542     Float_t GammaIso_DR02To0p03=0;
543     Float_t GammaIso_DR03To0p04=0;
544     Float_t GammaIso_DR04To0p05=0;
545     Float_t GammaIso_DR05To0p06=0;
546    
547     Float_t GammaIso_DR0045To0p01=0;
548     Float_t GammaIso_DR007To0p01=0;
549    
550     //Neutral Hadron
551     Float_t NeutralHadronIso_DR0To0p001=0;
552     Float_t NeutralHadronIso_DR001To0p002=0;
553     Float_t NeutralHadronIso_DR002To0p005=0;
554     Float_t NeutralHadronIso_DR005To0p01=0;
555     Float_t NeutralHadronIso_DR01To0p02=0;
556     Float_t NeutralHadronIso_DR02To0p03=0;
557     Float_t NeutralHadronIso_DR03To0p04=0;
558     Float_t NeutralHadronIso_DR04To0p05=0;
559     Float_t NeutralHadronIso_DR05To0p06=0;
560     //Charged iso
561     Float_t ChargedIso_selvtx_DR0To0p001=0;
562     Float_t ChargedIso_selvtx_DR001To0p002=0;
563     Float_t ChargedIso_selvtx_DR002To0p005=0;
564     Float_t ChargedIso_selvtx_DR005To0p01=0;
565     Float_t ChargedIso_selvtx_DR01To0p02=0;
566     Float_t ChargedIso_selvtx_DR02To0p03=0;
567     Float_t ChargedIso_selvtx_DR03To0p04=0;
568     Float_t ChargedIso_selvtx_DR04To0p05=0;
569     Float_t ChargedIso_selvtx_DR05To0p06=0;
570     Float_t ChargedIso_selvtx_DR002To0p01=0;
571    
572     Float_t ChargedIso_worstvtx_DR0To0p001=0;
573     Float_t ChargedIso_worstvtx_DR001To0p002=0;
574     Float_t ChargedIso_worstvtx_DR002To0p005=0;
575     Float_t ChargedIso_worstvtx_DR005To0p01=0;
576     Float_t ChargedIso_worstvtx_DR01To0p02=0;
577     Float_t ChargedIso_worstvtx_DR02To0p03=0;
578     Float_t ChargedIso_worstvtx_DR03To0p04=0;
579     Float_t ChargedIso_worstvtx_DR04To0p05=0;
580     Float_t ChargedIso_worstvtx_DR05To0p06=0;
581     Float_t ChargedIso_worstvtx_DR002To0p01=0;
582    
583     //Charged count
584     Float_t ChargedCount_selvtx_DR0To0p001=0;
585     Float_t ChargedCount_selvtx_DR001To0p002=0;
586     Float_t ChargedCount_selvtx_DR002To0p005=0;
587     Float_t ChargedCount_selvtx_DR005To0p01=0;
588     Float_t ChargedCount_selvtx_DR01To0p02=0;
589     Float_t ChargedCount_selvtx_DR02To0p03=0;
590     Float_t ChargedCount_selvtx_DR03To0p04=0;
591     Float_t ChargedCount_selvtx_DR04To0p05=0;
592     Float_t ChargedCount_selvtx_DR05To0p06=0;
593     Float_t ChargedCount_selvtx_DR002To0p01=0;
594    
595     Float_t ChargedCount_worstvtx_DR0To0p001=0;
596     Float_t ChargedCount_worstvtx_DR001To0p002=0;
597     Float_t ChargedCount_worstvtx_DR002To0p005=0;
598     Float_t ChargedCount_worstvtx_DR005To0p01=0;
599     Float_t ChargedCount_worstvtx_DR01To0p02=0;
600     Float_t ChargedCount_worstvtx_DR02To0p03=0;
601     Float_t ChargedCount_worstvtx_DR03To0p04=0;
602     Float_t ChargedCount_worstvtx_DR04To0p05=0;
603     Float_t ChargedCount_worstvtx_DR05To0p06=0;
604     Float_t ChargedCount_worstvtx_DR002To0p01=0;
605    
606     //new shower shape
607     Float_t RelEmaxOverE33=0;
608     Float_t RelE22=0;
609     Float_t CovEtaPhi=0;
610     Float_t PsEffWidthSigmaXX=0;
611     Float_t PsEffWidthSigmaYY=0;
612    
613     Float_t s4ratio=0;
614     Float_t lambdaratio=0;
615    
616     for(UInt_t i=0; i<fPFCands->GetEntries(); i++){
617    
618     const PFCandidate *pf= fPFCands->At(i);
619     Float_t dr = mithep::MathUtils::DeltaR(p->Phi(),p->Eta(), pf->Phi(), pf->Eta());
620     Float_t deta = fabs(p->Eta()-pf->Eta());
621    
622     if(deta>0.015 && (fabs(ScEta)<1.4442 && pf->Pt()>0.08) || (fabs(ScEta)>1.566 && fabs(ScEta)<2.5 && pf->Pt()>0.1) ){
623     if(pf->PFType()==PFCandidate::eGamma){
624     if(dr>0 && dr<=0.01) GammaIso_DR0To0p001+=pf->Pt();
625     if(dr>0.01 && dr<=0.02) GammaIso_DR001To0p002+=pf->Pt();
626     if(dr>0.02 && dr<=0.05) GammaIso_DR002To0p005+=pf->Pt();
627     if(dr>0.05 && dr<=0.1) GammaIso_DR005To0p01+=pf->Pt();
628     if(dr>0.1 && dr<=0.2) GammaIso_DR01To0p02+=pf->Pt();
629     if(dr>0.2 && dr<=0.3) GammaIso_DR02To0p03+=pf->Pt();
630     if(dr>0.3 && dr<=0.4) GammaIso_DR03To0p04+=pf->Pt();
631     if(dr>0.4 && dr<=0.5) GammaIso_DR04To0p05+=pf->Pt();
632     if(dr>0.5 && dr<=0.6) GammaIso_DR05To0p06+=pf->Pt();
633    
634     if(dr>0.045 && dr<=0.1) GammaIso_DR0045To0p01+=pf->Pt();
635     if(dr>0.07 && dr<=0.1) GammaIso_DR007To0p01+=pf->Pt();
636     }
637     }
638    
639     if(pf->PFType()==PFCandidate::eNeutralHadron){
640     if(dr>0 && dr<=0.01) NeutralHadronIso_DR0To0p001+=pf->Pt();
641     if(dr>0.01 && dr<=0.02) NeutralHadronIso_DR001To0p002+=pf->Pt();
642     if(dr>0.02 && dr<=0.05) NeutralHadronIso_DR002To0p005+=pf->Pt();
643     if(dr>0.05 && dr<=0.1) NeutralHadronIso_DR005To0p01+=pf->Pt();
644     if(dr>0.1 && dr<=0.2) NeutralHadronIso_DR01To0p02+=pf->Pt();
645     if(dr>0.2 && dr<=0.3) NeutralHadronIso_DR02To0p03+=pf->Pt();
646     if(dr>0.3 && dr<=0.4) NeutralHadronIso_DR03To0p04+=pf->Pt();
647     if(dr>0.4 && dr<=0.5) NeutralHadronIso_DR04To0p05+=pf->Pt();
648     if(dr>0.5 && dr<=0.6) NeutralHadronIso_DR05To0p06+=pf->Pt();
649     }
650     }
651    
652     //iso
653 bendavid 1.2 ChargedIso_selvtx_DR0To0p001=IsolationTools::PFChargedIsolation(p,SelVtx, 0.01, 0.,fPFCands);
654     ChargedIso_selvtx_DR001To0p002=IsolationTools::PFChargedIsolation(p,SelVtx, 0.02, 0.01, fPFCands);
655     ChargedIso_selvtx_DR002To0p005=IsolationTools::PFChargedIsolation(p,SelVtx, 0.05, 0.02, fPFCands);
656     ChargedIso_selvtx_DR005To0p01=IsolationTools::PFChargedIsolation(p,SelVtx, 0.1, 0.05, fPFCands);
657     ChargedIso_selvtx_DR01To0p02=IsolationTools::PFChargedIsolation(p,SelVtx, 0.2, 0.1, fPFCands);
658     ChargedIso_selvtx_DR02To0p03=IsolationTools::PFChargedIsolation(p,SelVtx, 0.3, 0.2, fPFCands);
659     ChargedIso_selvtx_DR03To0p04=IsolationTools::PFChargedIsolation(p,SelVtx, 0.4, 0.3, fPFCands);
660     ChargedIso_selvtx_DR04To0p05=IsolationTools::PFChargedIsolation(p,SelVtx, 0.5, 0.4, fPFCands);
661     ChargedIso_selvtx_DR05To0p06=IsolationTools::PFChargedIsolation(p,SelVtx, 0.6, 0.5, fPFCands);
662     ChargedIso_selvtx_DR002To0p01=IsolationTools::PFChargedIsolation(p,SelVtx, 0.1, 0.02, fPFCands);
663 mingyang 1.1
664 bendavid 1.2 ChargedIso_worstvtx_DR0To0p001=IsolationTools::PFChargedIsolation(p,SelVtx, 0.01, 0., fPFCands,&wVtxInd,fPV);
665     ChargedIso_worstvtx_DR001To0p002=IsolationTools::PFChargedIsolation(p,SelVtx, 0.02, 0.01, fPFCands,&wVtxInd,fPV);
666     ChargedIso_worstvtx_DR002To0p005=IsolationTools::PFChargedIsolation(p,SelVtx, 0.05, 0.02, fPFCands,&wVtxInd,fPV);
667     ChargedIso_worstvtx_DR005To0p01=IsolationTools::PFChargedIsolation(p,SelVtx, 0.1, 0.05, fPFCands, &wVtxInd,fPV);
668     ChargedIso_worstvtx_DR01To0p02=IsolationTools::PFChargedIsolation(p,SelVtx, 0.2, 0.1, fPFCands, &wVtxInd,fPV);
669     ChargedIso_worstvtx_DR02To0p03=IsolationTools::PFChargedIsolation(p,SelVtx, 0.3, 0.2, fPFCands, &wVtxInd,fPV);
670     ChargedIso_worstvtx_DR03To0p04=IsolationTools::PFChargedIsolation(p,SelVtx, 0.4, 0.3, fPFCands, &wVtxInd,fPV);
671     ChargedIso_worstvtx_DR04To0p05=IsolationTools::PFChargedIsolation(p,SelVtx, 0.5, 0.4, fPFCands, &wVtxInd,fPV);
672     ChargedIso_worstvtx_DR05To0p06=IsolationTools::PFChargedIsolation(p,SelVtx, 0.6, 0.5, fPFCands, &wVtxInd,fPV);
673     ChargedIso_worstvtx_DR002To0p01=IsolationTools::PFChargedIsolation(p,SelVtx, 0.1, 0.02,fPFCands, &wVtxInd,fPV);
674 mingyang 1.1
675     //count
676     ChargedCount_selvtx_DR0To0p001=IsolationTools::PFChargedCount(p,SelVtx, 0.01, 0,1.6, 0.0, 0.1, 0.2,fPFCands);
677     ChargedCount_selvtx_DR001To0p002=IsolationTools::PFChargedCount(p,SelVtx, 0.02, 0.01, 1.6, 0.0, 0.1, 0.2,fPFCands);
678     ChargedCount_selvtx_DR002To0p005=IsolationTools::PFChargedCount(p,SelVtx, 0.05, 0.02, 1.6, 0.0, 0.1, 0.2,fPFCands);
679     ChargedCount_selvtx_DR005To0p01=IsolationTools::PFChargedCount(p,SelVtx, 0.1, 0.05, 1.6, 0.0, 0.1, 0.2,fPFCands);
680     ChargedCount_selvtx_DR01To0p02=IsolationTools::PFChargedCount(p,SelVtx, 0.2, 0.1, 1.6, 0.0, 0.1, 0.2,fPFCands);
681     ChargedCount_selvtx_DR02To0p03=IsolationTools::PFChargedCount(p,SelVtx, 0.3, 0.2, 1.6, 0.0, 0.1, 0.2,fPFCands);
682     ChargedCount_selvtx_DR03To0p04=IsolationTools::PFChargedCount(p,SelVtx, 0.4, 0.3, 1.6, 0.0, 0.1, 0.2,fPFCands);
683     ChargedCount_selvtx_DR04To0p05=IsolationTools::PFChargedCount(p,SelVtx, 0.5, 0.4, 1.6, 0.0, 0.1, 0.2,fPFCands);
684     ChargedCount_selvtx_DR05To0p06=IsolationTools::PFChargedCount(p,SelVtx, 0.6, 0.5, 1.6, 0.0, 0.1, 0.2,fPFCands);
685     ChargedCount_selvtx_DR002To0p01=IsolationTools::PFChargedCount(p,SelVtx, 0.1, 0.02, 1.6, 0.0, 0.1, 0.2,fPFCands);
686    
687     ChargedCount_worstvtx_DR0To0p001=IsolationTools::PFChargedCount(p,SelVtx, 0.01, 0,1.6, 0.0, 0.1, 0.2,fPFCands,&wVtxInd,fPV);
688     ChargedCount_worstvtx_DR001To0p002=IsolationTools::PFChargedCount(p,SelVtx, 0.02, 0.01, 1.6, 0.0, 0.1, 0.2,fPFCands,&wVtxInd,fPV);
689     ChargedCount_worstvtx_DR002To0p005=IsolationTools::PFChargedCount(p,SelVtx, 0.05, 0.02, 1.6, 0.0, 0.1, 0.2,fPFCands,&wVtxInd,fPV);
690     ChargedCount_worstvtx_DR005To0p01=IsolationTools::PFChargedCount(p,SelVtx, 0.1, 0.05, 1.6, 0.0, 0.1, 0.2,fPFCands, &wVtxInd,fPV);
691     ChargedCount_worstvtx_DR01To0p02=IsolationTools::PFChargedCount(p,SelVtx, 0.2, 0.1, 1.6, 0.0, 0.1, 0.2,fPFCands, &wVtxInd,fPV);
692     ChargedCount_worstvtx_DR02To0p03=IsolationTools::PFChargedCount(p,SelVtx, 0.3, 0.2, 1.6, 0.0, 0.1, 0.2,fPFCands, &wVtxInd,fPV);
693     ChargedCount_worstvtx_DR03To0p04=IsolationTools::PFChargedCount(p,SelVtx, 0.4, 0.3, 1.6, 0.0, 0.1, 0.2,fPFCands, &wVtxInd,fPV);
694     ChargedCount_worstvtx_DR04To0p05=IsolationTools::PFChargedCount(p,SelVtx, 0.5, 0.4, 1.6, 0.0, 0.1, 0.2,fPFCands, &wVtxInd,fPV);
695     ChargedCount_worstvtx_DR05To0p06=IsolationTools::PFChargedCount(p,SelVtx, 0.6, 0.5, 1.6, 0.0, 0.1, 0.2,fPFCands, &wVtxInd,fPV);
696     ChargedCount_worstvtx_DR002To0p01=IsolationTools::PFChargedCount(p,SelVtx, 0.1, 0.02, 1.6, 0.0, 0.1, 0.2,fPFCands, &wVtxInd,fPV);
697    
698    
699     RelEmaxOverE33=p->SCluster()->Seed()->EMax()/p->SCluster()->Seed()->E3x3();
700     RelE22=p->SCluster()->Seed()->E2x2()/p->SCluster()->RawEnergy();
701     CovEtaPhi=p->SCluster()->Seed()->CovEtaPhi();
702     PsEffWidthSigmaXX=p->SCluster()->PsEffWidthSigmaXX();
703     PsEffWidthSigmaYY=p->SCluster()->PsEffWidthSigmaYY();
704    
705     s4ratio=p->SCluster()->Seed()->E2x2()/p->SCluster()->Seed()->E5x5();
706    
707     Float_t CovEtaEta=p->SCluster()->Seed()->CovEtaEta();
708     Float_t CovPhiPhi=p->SCluster()->Seed()->CovPhiPhi();
709    
710     lambdaratio=(CovEtaEta+CovPhiPhi-sqrt((CovEtaEta-CovPhiPhi)*(CovEtaEta-CovPhiPhi) +4*CovEtaPhi*CovEtaPhi))/(CovEtaEta+CovPhiPhi+sqrt((CovEtaEta-CovPhiPhi)*(CovEtaEta-CovPhiPhi)+4*CovEtaPhi*CovEtaPhi));
711    
712     //fill the ntuple
713     Float_t fillPhotonMatchRealGenTree[]={fprocessid,MatchGenPhotonID,MatchGenPhotonMotherID,Category,PassOfficial,PassElectronVeto,PassEleVetoConvRecovery,dRTrack,Pt,Eta,ScEta,ScPhi,ScEta_accompany,Et,EcalIsoDr03,HcalIsoDr03,TrkIsoHollowDr03,HoE,R9,covIEtaIEta,sigIEtaIEta,tIso1,tIso2,tIso3,tIso1abs,tIso2abs,tIso3abs,RelIsoEcal,RelIsoHcal,RelEMax,RelETop,RelEBottom,RelELeft,RelERight,RelE2x5Max,RelE2x5Top,RelE2x5Bottom,RelE2x5Left,RelE2x5Right,RelE5x5,RelE1x3,RelE3x1,RelE1x5,RelE2x2,RelE3x2,RelE4X4,EtaWidth,PhiWidth,RelPreshowerEnergy,CoviEtaiPhi,CoviPhiiPhi,NVertexes,_tRho,_NewRho_42,_RhoKt6PFJets,VtxProb,fNVertexesGenPile,EventNum,passpre,RawEnergy,AbsIsoEcal,AbsIsoHcal,GammaIso_DR0045To0p01,GammaIso_DR007To0p01,GammaIso_DR0To0p001,GammaIso_DR001To0p002,GammaIso_DR002To0p005,GammaIso_DR005To0p01,GammaIso_DR01To0p02,GammaIso_DR02To0p03,GammaIso_DR03To0p04,GammaIso_DR04To0p05,GammaIso_DR05To0p06,NeutralHadronIso_DR0To0p001,NeutralHadronIso_DR001To0p002,NeutralHadronIso_DR002To0p005,NeutralHadronIso_DR005To0p01,NeutralHadronIso_DR01To0p02,NeutralHadronIso_DR02To0p03,NeutralHadronIso_DR03To0p04,NeutralHadronIso_DR04To0p05,NeutralHadronIso_DR05To0p06,ChargedIso_selvtx_DR0To0p001,ChargedIso_selvtx_DR001To0p002,ChargedIso_selvtx_DR002To0p005,ChargedIso_selvtx_DR005To0p01,ChargedIso_selvtx_DR01To0p02,ChargedIso_selvtx_DR02To0p03,ChargedIso_selvtx_DR03To0p04,ChargedIso_selvtx_DR04To0p05,ChargedIso_selvtx_DR05To0p06,ChargedIso_selvtx_DR002To0p01,ChargedIso_worstvtx_DR0To0p001,ChargedIso_worstvtx_DR001To0p002,ChargedIso_worstvtx_DR002To0p005,ChargedIso_worstvtx_DR005To0p01,ChargedIso_worstvtx_DR01To0p02,ChargedIso_worstvtx_DR02To0p03,ChargedIso_worstvtx_DR03To0p04,ChargedIso_worstvtx_DR04To0p05,ChargedIso_worstvtx_DR05To0p06,ChargedIso_worstvtx_DR002To0p01,ChargedCount_selvtx_DR0To0p001,ChargedCount_selvtx_DR001To0p002,ChargedCount_selvtx_DR002To0p005,ChargedCount_selvtx_DR005To0p01,ChargedCount_selvtx_DR01To0p02,ChargedCount_selvtx_DR02To0p03,ChargedCount_selvtx_DR03To0p04,ChargedCount_selvtx_DR04To0p05,ChargedCount_selvtx_DR05To0p06,ChargedCount_selvtx_DR002To0p01,ChargedCount_worstvtx_DR0To0p001,ChargedCount_worstvtx_DR001To0p002,ChargedCount_worstvtx_DR002To0p005,ChargedCount_worstvtx_DR005To0p01,ChargedCount_worstvtx_DR01To0p02,ChargedCount_worstvtx_DR02To0p03,ChargedCount_worstvtx_DR03To0p04,ChargedCount_worstvtx_DR04To0p05,ChargedCount_worstvtx_DR05To0p06,ChargedCount_worstvtx_DR002To0p01,DiphotonMass,RelEmaxOverE33,RelE22,CovEtaPhi,PsEffWidthSigmaXX,PsEffWidthSigmaYY,vtxZ,_decayZ,s4ratio,lambdaratio};
714    
715     hPhotonNtuple->Fill(fillPhotonMatchRealGenTree);
716     }
717    
718     void MakeNtuple::FindHiggsPtAndZ(Float_t& pt, Float_t& decayZ, Float_t& mass)
719     {
720     pt = -999.;
721     decayZ = -999.;
722     mass = -999.;
723    
724     // loop over all GEN particles and look for status 1 photons
725     for(UInt_t i=0; i<fMcParticles->GetEntries(); ++i) {
726     const MCParticle* p = fMcParticles->At(i);
727     if (p->Is(MCParticle::kH) || (!fApplyElectronVeto &&
728     (p->AbsPdgId()==23 || p->AbsPdgId()==24))) {
729     pt = p->Pt();
730     decayZ = p->DecayVertex().Z();
731     mass = p->Mass();
732     break;
733     }
734     }
735    
736     return;
737     }