ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/MitPhysics/Mods/interface/ElectronIDMod.h
Revision: 1.58
Committed: Wed May 2 16:33:50 2012 UTC (13 years ago) by fabstoec
Content type: text/plain
Branch: MAIN
CVS Tags: Mit_028, Mit_027, Mit_027a
Changes since 1.57: +10 -1 lines
Log Message:
made Rho choice changeable in the macros

File Contents

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