ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/MitPhysics/Mods/interface/ElectronIDMod.h
Revision: 1.60
Committed: Thu Jul 12 17:04:56 2012 UTC (12 years, 9 months ago) by fabstoec
Content type: text/plain
Branch: MAIN
Changes since 1.59: +3 -1 lines
Log Message:
added 2012 Hgg LeptonTag

File Contents

# User Rev Content
1 loizides 1.1 //--------------------------------------------------------------------------------------------------
2 fabstoec 1.60 // $Id: ElectronIDMod.h,v 1.59 2012/05/19 14:59:19 ceballos Exp $
3 loizides 1.1 //
4     // ElectronIDMod
5     //
6 loizides 1.4 // This module applies electron identification criteria and exports a pointer to a collection
7 loizides 1.5 // of "good electrons" according to the specified identification scheme.
8 loizides 1.1 //
9 loizides 1.13 // See http://indico.cern.ch/contributionDisplay.py?contribId=1&confId=42251
10     //
11 loizides 1.4 // Authors: S.Xie, C.Loizides
12 loizides 1.1 //--------------------------------------------------------------------------------------------------
13    
14 loizides 1.4 #ifndef MITPHYSICS_MODS_ELECTRONIDMOD_H
15     #define MITPHYSICS_MODS_ELECTRONIDMOD_H
16 loizides 1.1
17     #include "MitAna/TreeMod/interface/BaseMod.h"
18 loizides 1.20 #include "MitAna/DataTree/interface/ElectronFwd.h"
19     #include "MitAna/DataTree/interface/VertexFwd.h"
20 ceballos 1.41 #include "MitAna/DataTree/interface/TrackFwd.h"
21 loizides 1.20 #include "MitAna/DataTree/interface/DecayParticleFwd.h"
22 sixie 1.31 #include "MitPhysics/Utils/interface/ElectronTools.h"
23 ceballos 1.41 #include "MitPhysics/Utils/interface/IsolationTools.h"
24 ceballos 1.42 #include "MitPhysics/ElectronLikelihood/interface/ElectronLikelihood.h"
25     #include "MitPhysics/ElectronLikelihood/interface/LikelihoodSwitches.h"
26     #include "MitPhysics/ElectronLikelihood/interface/LikelihoodMeasurements.h"
27 sixie 1.53 #include "MitPhysics/Utils/interface/ElectronIDMVA.h"
28 ceballos 1.44 #include "MitAna/DataTree/interface/PileupEnergyDensityCol.h"
29 ceballos 1.42 #include <TFile.h>
30     #include <TDirectory.h>
31 sixie 1.53 #include "TMVA/Reader.h"
32 loizides 1.1
33 fabstoec 1.58 // for Rho definitons
34     #include "MitPhysics/Utils/interface/RhoUtilities.h"
35    
36 loizides 1.1 namespace mithep
37     {
38     class ElectronIDMod : public BaseMod
39     {
40     public:
41     ElectronIDMod(const char *name="ElectronIDMod",
42 loizides 1.4 const char *title="Electron identification module");
43    
44 ceballos 1.34 Bool_t GetApplyConversionFilterType1() const { return fApplyConvFilterType1; }
45     Bool_t GetApplyConversionFilterType2() const { return fApplyConvFilterType2; }
46     Bool_t GetApplySpikeRemoval() const { return fApplySpikeRemoval; }
47     Bool_t GetApplyD0Cut() const { return fApplyD0Cut; }
48 ceballos 1.45 Bool_t GetApplyDZCut() const { return fApplyDZCut; }
49 ceballos 1.34 Double_t GetCaloIsoCut() const { return fCaloIsolationCut; }
50     Double_t GetEcalJurIsoCut() const { return fEcalJuraIsoCut; }
51     Double_t GetCombIsoCut() const { return fCombIsolationCut; }
52 fabstoec 1.49 Double_t GetPFIsoCut() const { return fPFIsolationCut; }
53 ceballos 1.34 const char *GetGoodName() const { return GetGoodElectronsName(); }
54     const char *GetGoodElectronsName() const { return fGoodElectronsName; }
55     Double_t GetHcalIsoCut() const { return fHcalIsolationCut; }
56     Double_t GetIDLikelihoodCut() const { return fIDLikelihoodCut; }
57     const char *GetIDType() const { return fElectronIDType; }
58     const char *GetInputName() const { return fElectronBranchName; }
59     const char *GetIsoType() const { return fElectronIsoType; }
60     const char *GetOutputName() const { return GetGoodElectronsName(); }
61     Double_t GetPtMin() const { return fElectronPtMin; }
62 ceballos 1.37 Double_t GetEtaMax() const { return fElectronEtaMax; }
63 bendavid 1.35 Bool_t GetApplyTriggerMatching() const { return fApplyTriggerMatching; }
64 ceballos 1.34 Double_t GetTrackIsoCut() const { return fTrackIsolationCut; }
65     Bool_t GetChargeFilter() const { return fChargeFilter; }
66 sixie 1.53 Bool_t PassLikelihoodID(const Electron *ele) const;
67     Bool_t PassMVAID(const Electron *el, ElectronTools::EElIdType idType,
68 sixie 1.54 const Vertex *vertex, const PFCandidateCol *PFCands,
69     const PileupEnergyDensityCol *PileupEnergyDensity) const;
70 sixie 1.53 Bool_t PassIDCut(const Electron *el, ElectronTools::EElIdType idType,
71     const Vertex *vertex) const;
72 ceballos 1.41 Bool_t PassIsolationCut(const Electron *el, ElectronTools::EElIsoType isoType,
73 ceballos 1.44 const TrackCol *tracks, const Vertex *vertex,
74 ceballos 1.59 const Double_t rho,
75     ElectronTools::EElIdType idType = ElectronTools::kNoId) const;
76 ceballos 1.34 Bool_t GetCombinedIdCut() const { return fCombinedIdCut; }
77 sixie 1.55 void SetPrintMVADebugInfo(Bool_t b) { fPrintMVADebugInfo = b; }
78 ceballos 1.34 void SetApplyConversionFilterType1(Bool_t b){ fApplyConvFilterType1 = b; }
79     void SetApplyConversionFilterType2(Bool_t b){ fApplyConvFilterType2 = b; }
80 ceballos 1.50 void SetNExpectedHitsInnerCut(Int_t cut) { fNExpectedHitsInnerCut = cut;}
81     void SetInvertNExpectedHitsInnerCut(Bool_t b){ fInvertNExpectedHitsInnerCut = b;}
82 ceballos 1.34 void SetApplySpikeRemoval(Bool_t b) { fApplySpikeRemoval = b; }
83     void SetApplyD0Cut(Bool_t b) { fApplyD0Cut = b; }
84 ceballos 1.45 void SetApplyDZCut(Bool_t b) { fApplyDZCut = b; }
85 ceballos 1.34 void SetCaloIsoCut(Double_t cut) { fCaloIsolationCut = cut; }
86 fabstoec 1.49 void SetCombIsoCut(Double_t cut) { fCombIsolationCut = cut; }
87 fabstoec 1.56 void SetCombRelativeIsoCut(Double_t cut, Double_t cut_EE = -1.) {
88     fCombRelativeIsolationCut = cut;
89     if ( cut_EE < 0. )
90     fCombRelativeIsolationCut_EE = cut;
91     else
92     fCombRelativeIsolationCut_EE = cut_EE;
93     }
94 fabstoec 1.49 void SetPFIsoCut(Double_t cut) { fPFIsolationCut = cut; }
95 ceballos 1.34 void SetD0Cut(Double_t cut) { fD0Cut = cut; }
96 ceballos 1.45 void SetDZCut(Double_t cut) { fDZCut = cut; }
97     void SetWhichVertex(Int_t d) { fWhichVertex = d; }
98 ceballos 1.34 void SetEcalJurIsoCut(Double_t cut) { fEcalJuraIsoCut = cut; }
99     void SetGoodElectronsName(const char *n) { fGoodElectronsName = n; }
100 ceballos 1.43 void SetOldMuonsName(const char *n) { fNonIsolatedMuonsName = n; }
101     void SetOldElectronsName(const char *n) { fNonIsolatedElectronsName = n;}
102 ceballos 1.34 void SetGoodName(const char *n) { SetGoodElectronsName(n); }
103     void SetHcalIsoCut(Double_t cut) { fHcalIsolationCut = cut; }
104     void SetIDLikelihoodCut(Double_t cut) { fIDLikelihoodCut = cut; }
105     void SetIDType(const char *type) { fElectronIDType = type; }
106     void SetInputName(const char *n) { fElectronBranchName = n; }
107     void SetIsoType(const char *type) { fElectronIsoType = type; }
108 bendavid 1.36 void SetTriggerObjectsName(const char *n) { fTrigObjectsName = n; }
109 ceballos 1.34 void SetOutputName(const char *n) { SetGoodElectronsName(n); }
110     void SetPtMin(Double_t pt) { fElectronPtMin = pt; }
111 bendavid 1.38 void SetEtMin(Double_t et) { fElectronEtMin = et; }
112     void SetEtaMax(Double_t eta) { fElectronEtaMax = eta; }
113 ceballos 1.37 void SetApplyTriggerMatching(Bool_t b) { fApplyTriggerMatching = b; }
114 ceballos 1.34 void SetTrackIsoCut(Double_t cut) { fTrackIsolationCut = cut; }
115     void SetChargeFilter(Bool_t b) { fChargeFilter = b; }
116 bendavid 1.40 void SetNWrongHitsMax(UInt_t n) { fNWrongHitsMax = n; }
117 ceballos 1.34 void SetCombinedIdCut(Bool_t b) { fCombinedIdCut = b; }
118 bendavid 1.38 void SetApplyEcalFiducial(Bool_t b) { fApplyEcalFiducial = b; }
119     void SetApplyEcalSeeded(Bool_t b) { fApplyEcalSeeded = b; }
120     void SetApplyCombinedIso(Bool_t b) { fApplyCombinedIso = b; }
121 dkralph 1.39 void SetElectronsFromBranch(Bool_t b) { fElectronsFromBranch = b; }
122 ceballos 1.42 void SetLH(ElectronLikelihood *l) { fLH = l; }
123 bendavid 1.47 void SetVertexName(TString name) { fVertexName = name; }
124 ceballos 1.52 void SetIntRadius(Double_t dr) { fIntRadius = dr; }
125 fabstoec 1.60 void SetPFNoPileUpName(const char *n) { fPFNoPileUpName = n; }
126 ceballos 1.27 void Setup();
127 sixie 1.53
128     void SetElectronMVAWeightsSubdet0Pt10To20(TString s)
129     { fElectronMVAWeights_Subdet0Pt10To20 = s; }
130     void SetElectronMVAWeightsSubdet1Pt10To20(TString s)
131     { fElectronMVAWeights_Subdet1Pt10To20 = s; }
132     void SetElectronMVAWeightsSubdet2Pt10To20(TString s)
133     { fElectronMVAWeights_Subdet2Pt10To20 = s; }
134     void SetElectronMVAWeightsSubdet0Pt20ToInf(TString s)
135     { fElectronMVAWeights_Subdet0Pt20ToInf = s; }
136     void SetElectronMVAWeightsSubdet1Pt20ToInf(TString s)
137     { fElectronMVAWeights_Subdet1Pt20ToInf = s; }
138     void SetElectronMVAWeightsSubdet2Pt20ToInf(TString s)
139     { fElectronMVAWeights_Subdet2Pt20ToInf = s; }
140 loizides 1.4
141 fabstoec 1.58 void SetRhoType(RhoUtilities::RhoType type) { fTheRhoType = type; };
142    
143    
144 loizides 1.1 protected:
145 sixie 1.26 void Process();
146     void SlaveBegin();
147 ceballos 1.42 void Terminate();
148 loizides 1.7
149 sixie 1.55 Bool_t fPrintMVADebugInfo; //print MVA debug information
150 sixie 1.31 TString fElectronBranchName; //name of electron collection (input)
151     TString fConversionBranchName; //name of electron collection (input)
152     TString fGoodElectronsName; //name of exported "good electrons" col
153 ceballos 1.43 TString fNonIsolatedMuonsName; //name of imported "old muon" collection
154     TString fNonIsolatedElectronsName;//name of imported "old electron" collection
155 sixie 1.31 TString fVertexName; //name of vertex collection
156 bendavid 1.40 TString fBeamSpotName; //name of beamspot collection
157 ceballos 1.41 TString fTrackName; //name of track collection
158     TString fPFCandidatesName; //name of pfcandidates collection
159 fabstoec 1.60 TString fPFNoPileUpName; //name of pfcandidates collection
160 sixie 1.31 TString fElectronIDType; //type of electron ID we impose
161     TString fElectronIsoType; //type of electron Isolation we impose
162 bendavid 1.35 TString fTrigObjectsName; //name of trigger object collection
163 sixie 1.31 Double_t fElectronPtMin; //min pt cut
164 bendavid 1.38 Double_t fElectronEtMin; //min pt cut
165 ceballos 1.37 Double_t fElectronEtaMax; //max eta cut
166 sixie 1.31 Double_t fIDLikelihoodCut; //cut value for ID likelihood
167     Double_t fTrackIsolationCut; //cut value for track isolation
168     Double_t fCaloIsolationCut; //cut value for calo isolation
169     Double_t fEcalJuraIsoCut; //cut value for ecal jurassic isolation
170     Double_t fHcalIsolationCut; //cut value for hcal isolation
171     Double_t fCombIsolationCut; //cut value for combined isolation
172 sixie 1.51 Double_t fCombRelativeIsolationCut; //cut value for combined relative isolation
173 fabstoec 1.56 Double_t fCombRelativeIsolationCut_EE; //cut value for combined relative isolation (EE)
174 fabstoec 1.49 Double_t fPFIsolationCut; //cut value for PF isolation, default -1.0
175 ceballos 1.34 Bool_t fApplyConvFilterType1; //whether remove conversions using fit method
176     Bool_t fApplyConvFilterType2; //whether remove conversions using DCotTheta method
177 bendavid 1.40 UInt_t fNWrongHitsMax; //whether to use wrong hits req
178 sixie 1.31 //for conversion removal
179 ceballos 1.50 Int_t fNExpectedHitsInnerCut; //cut value for NExpectedHitsInner maximum
180     Bool_t fInvertNExpectedHitsInnerCut; //whether to invert NExpectedHitsInner cut
181 ceballos 1.33 Bool_t fCombinedIdCut; //whether to use full combined id
182 ceballos 1.45 Bool_t fApplySpikeRemoval; //whether spike removal
183 sixie 1.31 Bool_t fApplyD0Cut; //whether apply d0 cut
184 ceballos 1.45 Bool_t fApplyDZCut; //whether apply dz cut
185 sixie 1.31 Bool_t fChargeFilter; //whether apply GSF and CFT equal requirement
186     Double_t fD0Cut; //max d0
187 ceballos 1.45 Double_t fDZCut; //max dz
188     Int_t fWhichVertex; //vertex to use (-2: beamspot, -1: closest in Z)
189 bendavid 1.35 Bool_t fApplyTriggerMatching; //match to hlt electron (default=0)
190 bendavid 1.38 Bool_t fApplyEcalSeeded; //require ecal seeded flag
191     Bool_t fApplyCombinedIso; //apply combined isolation
192     Bool_t fApplyEcalFiducial; //apply ecal fiducial cuts on supercluster eta
193 dkralph 1.39 Bool_t fElectronsFromBranch; //where to get input electrons
194 sixie 1.31 ElectronTools::EElIdType fElIdType; //!identification scheme
195     ElectronTools::EElIsoType fElIsoType; //!isolation scheme
196     const ElectronCol *fElectrons; //!electron collection
197     const DecayParticleCol *fConversions; //!conversion collection
198     const VertexCol *fVertices; //!vertices branches
199 bendavid 1.40 const BeamSpotCol *fBeamSpot; //!beamspot branch
200 ceballos 1.41 const TrackCol *fTracks; //!Track branch
201     const PFCandidateCol *fPFCandidates; //!pfcandidate branch
202 ceballos 1.57 PFCandidateCol *fPFNoPileUpCands; //!pfcandidate branch with PFNoPU
203 ceballos 1.52 Double_t fIntRadius; //!min IntRadius cut in pf isolation
204 ceballos 1.43 MuonCol *fNonIsolatedMuons; //!pointer to old muon collection
205     ElectronCol *fNonIsolatedElectrons; //!pointer to old electron collection
206 ceballos 1.48 ElectronLikelihood *fLH; //LH
207 ceballos 1.44 TString fPileupEnergyDensityName;
208     const PileupEnergyDensityCol *fPileupEnergyDensity;
209 sixie 1.53 ElectronIDMVA *fElectronIDMVA;
210     TString fElectronMVAWeights_Subdet0Pt10To20;
211     TString fElectronMVAWeights_Subdet1Pt10To20;
212     TString fElectronMVAWeights_Subdet2Pt10To20;
213     TString fElectronMVAWeights_Subdet0Pt20ToInf;
214     TString fElectronMVAWeights_Subdet1Pt20ToInf;
215     TString fElectronMVAWeights_Subdet2Pt20ToInf;
216 ceballos 1.44
217 fabstoec 1.58 RhoUtilities::RhoType fTheRhoType;
218    
219    
220 loizides 1.8 ClassDef(ElectronIDMod, 1) // Electron identification module
221 loizides 1.1 };
222     }
223     #endif