CMS 3D CMS Logo

EleTkIsolFromCands.h
Go to the documentation of this file.
1 #ifndef RECOEGAMMA_EGAMMAISOLATIONALGOS_ELETKISOLFROMCANDS_H
2 #define RECOEGAMMA_EGAMMAISOLATIONALGOS_ELETKISOLFROMCANDS_H
3 
9 
10 //author S. Harper (RAL)
11 //this class does a simple calculation of the track isolation for a track with eta,
12 //phi and z vtx (typically the GsfTrack of the electron). It uses
13 //PFPackedCandidates as proxies for the tracks. It now has been upgraded to
14 //take general tracks as input also
15 //
16 //Note: due to rounding and space saving issues, the isolation calculated on tracks and
17 //PFPackedCandidates will differ slightly even if the same cuts are used. These differences
18 //are thought to be inconsquencial but as such its important to remake the PFPackedCandidates
19 //in RECO/AOD if you want to be consistant with miniAOD
20 //
21 //The track version is more for variables that are stored in the electron rather than
22 //objects which are recomputed on the fly for AOD/miniAOD
23 //
24 //Note, the tracks in miniAOD have additional cuts on and are missing algo information so this
25 //has to be taken into account when using them
26 
27 //new for 9X:
28 // 1) its now possible to use generalTracks as input
29 // 2) adapted to 9X PF packed candidate improvements
30 // 2a) the PF packed candidates now store the pt of the track in addition to the pt of the
31 // candidate. This means there is no need to pass in the electron collection any more
32 // to try and undo the electron e/p combination when the candidate is an electron
33 // 2b) we now not only store the GsfTrack of the electron but also the general track of the electron
34 // there are three input collections now:
35 // packedPFCandidates : all PF candidates (with the track for ele candidates being the gsftrack)
36 // lostTracks : all tracks which were not made into a PFCandidate but passed some preselection
37 // lostTracks::eleTracks : KF electron tracks
38 // as such to avoid double counting the GSF and KF versions of an electron track, we now need to
39 // specify if the electron PF candidates are to be rejected in the sum over that collection or not.
40 // Note in all this, I'm not concerned about the electron in questions track, that will be rejected,
41 // I'm concerned about near by fake electrons which have been recoed by PF
42 // This is handled by the PIDVeto, which obviously is only used/required when using PFCandidates
43 
45 public:
46  enum class PIDVeto {
47  NONE = 0,
48  ELES,
49  NONELES,
50  };
51 
52 private:
53  struct TrkCuts {
54  float minPt;
55  float minDR2;
56  float maxDR2;
57  float minDEta;
58  float maxDZ;
59  float minHits;
60  float minPixelHits;
61  float maxDPtPt;
62  std::vector<reco::TrackBase::TrackQuality> allowedQualities;
63  std::vector<reco::TrackBase::TrackAlgorithm> algosToReject;
64  explicit TrkCuts(const edm::ParameterSet& para);
66  };
67 
69 
70 public:
71  explicit EleTkIsolFromCands(const edm::ParameterSet& para);
72  EleTkIsolFromCands(const EleTkIsolFromCands&) = default;
73  ~EleTkIsolFromCands() = default;
75 
77 
78  std::pair<int, double> calIsol(const reco::TrackBase& trk,
80  const PIDVeto = PIDVeto::NONE) const;
81  std::pair<int, double> calIsol(const double eleEta,
82  const double elePhi,
83  const double eleVZ,
85  const PIDVeto = PIDVeto::NONE) const;
86 
87  std::pair<int, double> calIsol(const reco::TrackBase& trk, const reco::TrackCollection& tracks) const;
88  std::pair<int, double> calIsol(const double eleEta,
89  const double elePhi,
90  const double eleVZ,
91  const reco::TrackCollection& tracks) const;
92 
93  //little helper function for the four calIsol functions for it to directly return the pt
94  template <typename... Args>
95  double calIsolPt(Args&&... args) const {
96  return calIsol(std::forward<Args>(args)...).second;
97  }
98 
99  static PIDVeto pidVetoFromStr(const std::string& vetoStr);
100  static bool passPIDVeto(const int pdgId, const EleTkIsolFromCands::PIDVeto pidVeto);
101 
102 private:
103  static bool passTrkSel(const reco::TrackBase& trk,
104  const double trkPt,
105  const TrkCuts& cuts,
106  const double eleEta,
107  const double elePhi,
108  const double eleVZ);
109  //no qualities specified, accept all, ORed
110  static bool passQual(const reco::TrackBase& trk, const std::vector<reco::TrackBase::TrackQuality>& quals);
111  static bool passAlgo(const reco::TrackBase& trk, const std::vector<reco::TrackBase::TrackAlgorithm>& algosToRej);
112 };
113 
114 #endif
writedatasetfile.args
args
Definition: writedatasetfile.py:18
PDWG_EXOHSCP_cff.tracks
tracks
Definition: PDWG_EXOHSCP_cff.py:28
EleTkIsolFromCands::TrkCuts::maxDPtPt
float maxDPtPt
Definition: EleTkIsolFromCands.h:61
EleTkIsolFromCands::passPIDVeto
static bool passPIDVeto(const int pdgId, const EleTkIsolFromCands::PIDVeto pidVeto)
Definition: EleTkIsolFromCands.cc:105
EleTkIsolFromCands::TrkCuts::minHits
float minHits
Definition: EleTkIsolFromCands.h:59
EleTkIsolFromCands::barrelCuts_
TrkCuts barrelCuts_
Definition: EleTkIsolFromCands.h:68
EleTkIsolFromCands::TrkCuts::allowedQualities
std::vector< reco::TrackBase::TrackQuality > allowedQualities
Definition: EleTkIsolFromCands.h:62
TrackBase.h
EleTkIsolFromCands::PIDVeto::NONE
EleTkIsolFromCands::pidVetoFromStr
static PIDVeto pidVetoFromStr(const std::string &vetoStr)
Definition: EleTkIsolFromCands.cc:125
EleTkIsolFromCands::TrkCuts::pSetDescript
static edm::ParameterSetDescription pSetDescript()
Definition: EleTkIsolFromCands.cc:28
edm::ParameterSetDescription
Definition: ParameterSetDescription.h:52
EleTkIsolFromCands::PIDVeto::NONELES
EleTkIsolFromCands::calIsol
std::pair< int, double > calIsol(const reco::TrackBase &trk, const pat::PackedCandidateCollection &cands, const PIDVeto=PIDVeto::NONE) const
Definition: EleTkIsolFromCands.cc:54
EleTkIsolFromCands::PIDVeto::ELES
EleTkIsolFromCands::TrkCuts::TrkCuts
TrkCuts(const edm::ParameterSet &para)
Definition: EleTkIsolFromCands.cc:5
EleTkIsolFromCands::PIDVeto
PIDVeto
Definition: EleTkIsolFromCands.h:46
TrackFwd.h
EleTkIsolFromCands::TrkCuts::maxDR2
float maxDR2
Definition: EleTkIsolFromCands.h:56
ParameterSetDescription.h
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
EleTkIsolFromCands::calIsolPt
double calIsolPt(Args &&... args) const
Definition: EleTkIsolFromCands.h:95
EleTkIsolFromCands::passQual
static bool passQual(const reco::TrackBase &trk, const std::vector< reco::TrackBase::TrackQuality > &quals)
Definition: EleTkIsolFromCands.cc:155
edm::ParameterSet
Definition: ParameterSet.h:36
EleTkIsolFromCands::TrkCuts::minDR2
float minDR2
Definition: EleTkIsolFromCands.h:55
PackedCandidate.h
EleTkIsolFromCands::operator=
EleTkIsolFromCands & operator=(const EleTkIsolFromCands &)=default
reco::TrackBase
Definition: TrackBase.h:62
EleTkIsolFromCands::passAlgo
static bool passAlgo(const reco::TrackBase &trk, const std::vector< reco::TrackBase::TrackAlgorithm > &algosToRej)
Definition: EleTkIsolFromCands.cc:167
EleTkIsolFromCands::pSetDescript
static edm::ParameterSetDescription pSetDescript()
Definition: EleTkIsolFromCands.cc:47
EgammaValidation_cff.pdgId
pdgId
Definition: EgammaValidation_cff.py:118
EleTkIsolFromCands::~EleTkIsolFromCands
~EleTkIsolFromCands()=default
pat::PackedCandidateCollection
std::vector< pat::PackedCandidate > PackedCandidateCollection
Definition: PackedCandidate.h:1130
EleTkIsolFromCands::TrkCuts::minPt
float minPt
Definition: EleTkIsolFromCands.h:54
EleTkIsolFromCands::passTrkSel
static bool passTrkSel(const reco::TrackBase &trk, const double trkPt, const TrkCuts &cuts, const double eleEta, const double elePhi, const double eleVZ)
Definition: EleTkIsolFromCands.cc:138
EleTkIsolFromCands::TrkCuts
Definition: EleTkIsolFromCands.h:53
EleTkIsolFromCands::TrkCuts::algosToReject
std::vector< reco::TrackBase::TrackAlgorithm > algosToReject
Definition: EleTkIsolFromCands.h:63
HLT_2018_cff.cands
cands
Definition: HLT_2018_cff.py:13762
EleTkIsolFromCands::EleTkIsolFromCands
EleTkIsolFromCands(const edm::ParameterSet &para)
Definition: EleTkIsolFromCands.cc:43
EleTkIsolFromCands::TrkCuts::maxDZ
float maxDZ
Definition: EleTkIsolFromCands.h:58
EleTkIsolFromCands
Definition: EleTkIsolFromCands.h:44
L1TMuonDQMOffline_cfi.cuts
cuts
Definition: L1TMuonDQMOffline_cfi.py:41
ParameterSet.h
EleTkIsolFromCands::endcapCuts_
TrkCuts endcapCuts_
Definition: EleTkIsolFromCands.h:68
reco::TrackCollection
std::vector< Track > TrackCollection
collection of Tracks
Definition: TrackFwd.h:14
EleTkIsolFromCands::TrkCuts::minDEta
float minDEta
Definition: EleTkIsolFromCands.h:57
EleTkIsolFromCands::TrkCuts::minPixelHits
float minPixelHits
Definition: EleTkIsolFromCands.h:60