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 
11 
12 //author S. Harper (RAL)
13 //this class does a simple calculation of the track isolation for a track with eta,
14 //phi and z vtx (typically the GsfTrack of the electron). It uses
15 //PFPackedCandidates as proxies for the tracks. It now has been upgraded to
16 //take general tracks as input also
17 //
18 //Note: due to rounding and space saving issues, the isolation calculated on tracks and
19 //PFPackedCandidates will differ slightly even if the same cuts are used. These differences
20 //are thought to be inconsquencial but as such its important to remake the PFPackedCandidates
21 //in RECO/AOD if you want to be consistant with miniAOD
22 //
23 //The track version is more for variables that are stored in the electron rather than
24 //objects which are recomputed on the fly for AOD/miniAOD
25 //
26 //Note, the tracks in miniAOD have additional cuts on and are missing algo information so this
27 //has to be taken into account when using them
28 
29 //new for 9X:
30 // 1) its now possible to use generalTracks as input
31 // 2) adapted to 9X PF packed candidate improvements
32 // 2a) the PF packed candidates now store the pt of the track in addition to the pt of the
33 // candidate. This means there is no need to pass in the electron collection any more
34 // to try and undo the electron e/p combination when the candidate is an electron
35 // 2b) we now not only store the GsfTrack of the electron but also the general track of the electron
36 // there are three input collections now:
37 // packedPFCandidates : all PF candidates (with the track for ele candidates being the gsftrack)
38 // lostTracks : all tracks which were not made into a PFCandidate but passed some preselection
39 // lostTracks::eleTracks : KF electron tracks
40 // as such to avoid double counting the GSF and KF versions of an electron track, we now need to
41 // specify if the electron PF candidates are to be rejected in the sum over that collection or not.
42 // Note in all this, I'm not concerned about the electron in questions track, that will be rejected,
43 // I'm concerned about near by fake electrons which have been recoed by PF
44 // This is handled by the PIDVeto, which obviously is only used/required when using PFCandidates
45 
47 public:
48  struct TrkCuts {
49  float minPt;
50  float minDR2;
51  float maxDR2;
52  float minDEta;
53  float maxDZ;
54  float minHits;
55  float minPixelHits;
56  float maxDPtPt;
57  std::vector<reco::TrackBase::TrackQuality> allowedQualities;
58  std::vector<reco::TrackBase::TrackAlgorithm> algosToReject;
59  explicit TrkCuts(const edm::ParameterSet& para);
61  };
62 
63  struct Configuration {
64  explicit Configuration(const edm::ParameterSet& para)
65  : barrelCuts(para.getParameter<edm::ParameterSet>("barrelCuts")),
66  endcapCuts(para.getParameter<edm::ParameterSet>("endcapCuts")) {}
69  };
70 
71  enum class PIDVeto {
72  NONE = 0,
73  ELES,
74  NONELES,
75  };
76 
78  : cfg_{cfg}, tracks_{&tracks} {}
81  PIDVeto pidVeto = PIDVeto::NONE)
82  : cfg_{cfg}, cands_{&cands}, pidVeto_{pidVeto} {}
83 
85 
86  static PIDVeto pidVetoFromStr(const std::string& vetoStr);
87 
88  struct Output {
89  const int nTracks;
90  const float ptSum;
91  };
92 
93  Output operator()(const reco::TrackBase& electronTrack);
94 
95 private:
96  // For each electron, we want to try out which tracks are in a cone around
97  // it. However, this will get expensive if there are many electrons and
98  // tracks (Phase II conditions). In particular, calling
99  // reco::TrackBase::eta() many times is costy because eta is not precomputed.
100  // To solve this, we first cache the tracks in a simpler data structure in
101  // which eta is already computed (TrackTable). Furthermore, the tracks are
102  // preselected by the cuts that can already be applied without considering
103  // the electron. Note that this has to be done twice, because the required
104  // preselection is different for barrel and endcap electrons.
105 
107 
108  static bool passPIDVeto(const int pdgId, const EleTkIsolFromCands::PIDVeto pidVeto);
109 
112  TrkCuts const& cuts,
114 
115  static bool passTrackPreselection(const reco::TrackBase& trk, float trkPt, const TrkCuts& cuts);
116 
117  //no qualities specified, accept all, ORed
118  static bool passQual(const reco::TrackBase& trk, const std::vector<reco::TrackBase::TrackQuality>& quals);
119  static bool passAlgo(const reco::TrackBase& trk, const std::vector<reco::TrackBase::TrackAlgorithm>& algosToRej);
120 
122 
124 
125  // All of these member variables are related to the caching of preselected tracks
126  reco::TrackCollection const* tracks_ = nullptr;
133 };
134 
135 #endif
EleTkIsolFromCands::passTrackPreselection
static bool passTrackPreselection(const reco::TrackBase &trk, float trkPt, const TrkCuts &cuts)
Definition: EleTkIsolFromCands.cc:163
EleTkIsolFromCands::Configuration::Configuration
Configuration(const edm::ParameterSet &para)
Definition: EleTkIsolFromCands.h:64
EleTkIsolFromCands::TrkCuts::maxDPtPt
float maxDPtPt
Definition: EleTkIsolFromCands.h:56
EleTkIsolFromCands::Output::nTracks
const int nTracks
Definition: EleTkIsolFromCands.h:89
cuts
const TkSoA *__restrict__ CAHitNtupletGeneratorKernelsGPU::QualityCuts cuts
Definition: CAHitNtupletGeneratorKernelsImpl.h:416
EleTkIsolFromCands::passPIDVeto
static bool passPIDVeto(const int pdgId, const EleTkIsolFromCands::PIDVeto pidVeto)
Definition: EleTkIsolFromCands.cc:130
EleTkIsolFromCands::preselectTracks
static TrackTable preselectTracks(reco::TrackCollection const &tracks, TrkCuts const &cuts)
Definition: EleTkIsolFromCands.cc:50
EleTkIsolFromCands::TrkCuts::minHits
float minHits
Definition: EleTkIsolFromCands.h:54
EleTkIsolFromCands::TrkCuts::allowedQualities
std::vector< reco::TrackBase::TrackQuality > allowedQualities
Definition: EleTkIsolFromCands.h:57
TrackBase.h
edm
HLT enums.
Definition: AlignableModifier.h:19
EleTkIsolFromCands::PIDVeto::NONE
EleTkIsolFromCands::pidVetoFromStr
static PIDVeto pidVetoFromStr(const std::string &vetoStr)
Definition: EleTkIsolFromCands.cc:150
EleTkIsolFromCands::TrkCuts::pSetDescript
static edm::ParameterSetDescription pSetDescript()
Definition: EleTkIsolFromCands.cc:28
edm::ParameterSetDescription
Definition: ParameterSetDescription.h:52
EleTkIsolFromCands::PIDVeto::NONELES
EleTkIsolFromCands::PIDVeto::ELES
EleTkIsolFromCands::TrkCuts::TrkCuts
TrkCuts(const edm::ParameterSet &para)
Definition: EleTkIsolFromCands.cc:5
EleTkIsolFromCands::Output
Definition: EleTkIsolFromCands.h:88
EleTkIsolFromCands::PIDVeto
PIDVeto
Definition: EleTkIsolFromCands.h:71
TrackFwd.h
EleTkIsolFromCands::TrkCuts::maxDR2
float maxDR2
Definition: EleTkIsolFromCands.h:51
EleTkIsolFromCands::EleTkIsolFromCands
EleTkIsolFromCands(Configuration const &cfg, reco::TrackCollection const &tracks)
Definition: EleTkIsolFromCands.h:77
EleTkIsolFromCands::preselectTracksFromCands
static TrackTable preselectTracksFromCands(pat::PackedCandidateCollection const &cands, TrkCuts const &cuts, PIDVeto=PIDVeto::NONE)
Definition: EleTkIsolFromCands.cc:74
ParameterSetDescription.h
EleTkIsolFromCands::Configuration
Definition: EleTkIsolFromCands.h:63
EleTkIsolFromCands::getPreselectedTracks
TrackTable const & getPreselectedTracks(bool isBarrel)
Definition: EleTkIsolFromCands.cc:186
PixelPluginsPhase0_cfi.isBarrel
isBarrel
Definition: PixelPluginsPhase0_cfi.py:17
HLT_FULL_cff.cands
cands
Definition: HLT_FULL_cff.py:15161
EleTkIsolFromCands::operator()
Output operator()(const reco::TrackBase &electronTrack)
Definition: EleTkIsolFromCands.cc:102
EleTkIsolFromCands::passQual
static bool passQual(const reco::TrackBase &trk, const std::vector< reco::TrackBase::TrackQuality > &quals)
Definition: EleTkIsolFromCands.cc:169
edm::ParameterSet
Definition: ParameterSet.h:47
EleTkIsolFromCands::TrkCuts::minDR2
float minDR2
Definition: EleTkIsolFromCands.h:50
EleTkIsolFromCands::cfg_
Configuration const & cfg_
Definition: EleTkIsolFromCands.h:123
EleTkIsolFromCands::tracksCachedForBarrelCuts_
bool tracksCachedForBarrelCuts_
Definition: EleTkIsolFromCands.h:131
tracks
const uint32_t *__restrict__ const HitContainer *__restrict__ TkSoA *__restrict__ tracks
Definition: CAHitNtupletGeneratorKernelsImpl.h:176
ParameterSet
Definition: Functions.h:16
EleTkIsolFromCands::Output::ptSum
const float ptSum
Definition: EleTkIsolFromCands.h:90
PackedCandidate.h
EleTkIsolFromCands::Configuration::barrelCuts
const TrkCuts barrelCuts
Definition: EleTkIsolFromCands.h:67
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:181
EleTkIsolFromCands::pSetDescript
static edm::ParameterSetDescription pSetDescript()
Definition: EleTkIsolFromCands.cc:43
EgammaValidation_cff.pdgId
pdgId
Definition: EgammaValidation_cff.py:117
EleTkIsolFromCands::Configuration::endcapCuts
const TrkCuts endcapCuts
Definition: EleTkIsolFromCands.h:68
AlCaHLTBitMon_QueryRunRegistry.string
string string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
looper.cfg
cfg
Definition: looper.py:296
pat::PackedCandidateCollection
std::vector< pat::PackedCandidate > PackedCandidateCollection
Definition: PackedCandidate.h:1131
EleTkIsolFromCands::TrkCuts::minPt
float minPt
Definition: EleTkIsolFromCands.h:49
KinematicColumns.h
EleTkIsolFromCands::cands_
pat::PackedCandidateCollection const * cands_
Definition: EleTkIsolFromCands.h:127
EleTkIsolFromCands::EleTkIsolFromCands
EleTkIsolFromCands(Configuration const &cfg, pat::PackedCandidateCollection const &cands, PIDVeto pidVeto=PIDVeto::NONE)
Definition: EleTkIsolFromCands.h:79
EleTkIsolFromCands::TrkCuts
Definition: EleTkIsolFromCands.h:48
EleTkIsolFromCands::preselectedTracksWithBarrelCuts_
TrackTable preselectedTracksWithBarrelCuts_
Definition: EleTkIsolFromCands.h:129
edm::soa::Table< edm::soa::col::Pt, edm::soa::col::Eta, edm::soa::col::Phi, edm::soa::col::Vz >
EleTkIsolFromCands::TrkCuts::algosToReject
std::vector< reco::TrackBase::TrackAlgorithm > algosToReject
Definition: EleTkIsolFromCands.h:58
EleTkIsolFromCands::TrkCuts::maxDZ
float maxDZ
Definition: EleTkIsolFromCands.h:53
EleTkIsolFromCands
Definition: EleTkIsolFromCands.h:46
EleTkIsolFromCands::preselectedTracksWithEndcapCuts_
TrackTable preselectedTracksWithEndcapCuts_
Definition: EleTkIsolFromCands.h:130
ParameterSet.h
Table.h
reco::TrackCollection
std::vector< Track > TrackCollection
collection of Tracks
Definition: TrackFwd.h:14
EleTkIsolFromCands::TrkCuts::minDEta
float minDEta
Definition: EleTkIsolFromCands.h:52
EleTkIsolFromCands::tracks_
reco::TrackCollection const * tracks_
Definition: EleTkIsolFromCands.h:126
EleTkIsolFromCands::tracksCachedForEndcapCuts_
bool tracksCachedForEndcapCuts_
Definition: EleTkIsolFromCands.h:132
EleTkIsolFromCands::pidVeto_
const PIDVeto pidVeto_
Definition: EleTkIsolFromCands.h:128
EleTkIsolFromCands::TrkCuts::minPixelHits
float minPixelHits
Definition: EleTkIsolFromCands.h:55