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