-
Notifications
You must be signed in to change notification settings - Fork 4.3k
/
LowPtGsfElectronSeedProducer.h
138 lines (115 loc) · 6.32 KB
/
LowPtGsfElectronSeedProducer.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
#ifndef RecoEgamma_EgammaElectronProducers_LowPtGsfElectronSeedProducer_h
#define RecoEgamma_EgammaElectronProducers_LowPtGsfElectronSeedProducer_h
#include "DataFormats/BeamSpot/interface/BeamSpot.h"
#include "DataFormats/Common/interface/Handle.h"
#include "DataFormats/Common/interface/RefProd.h"
#include "DataFormats/EcalRecHit/interface/EcalRecHitCollections.h"
#include "DataFormats/EgammaReco/interface/ElectronSeed.h"
#include "DataFormats/EgammaReco/interface/ElectronSeedFwd.h"
#include "DataFormats/ParticleFlowReco/interface/PFCluster.h"
#include "DataFormats/ParticleFlowReco/interface/PFClusterFwd.h"
#include "DataFormats/ParticleFlowReco/interface/PFRecTrack.h"
#include "DataFormats/ParticleFlowReco/interface/PFRecTrackFwd.h"
#include "DataFormats/ParticleFlowReco/interface/PreId.h"
#include "DataFormats/ParticleFlowReco/interface/PreIdFwd.h"
#include "DataFormats/TrackReco/interface/Track.h"
#include "DataFormats/TrackReco/interface/TrackFwd.h"
#include "FWCore/Framework/interface/ESHandle.h"
#include "FWCore/Framework/interface/stream/EDProducer.h"
#include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h"
#include "MagneticField/Engine/interface/MagneticField.h"
#include "RecoEcal/EgammaCoreTools/interface/EcalClusterLazyTools.h"
#include "TrackingTools/PatternTools/interface/TrajectorySmoother.h"
#include "TrackingTools/TrackFitters/interface/TrajectoryFitter.h"
#include "LowPtGsfElectronSeedHeavyObjectCache.h"
class LowPtGsfElectronSeedProducer final
: public edm::stream::EDProducer<edm::GlobalCache<lowptgsfeleseed::HeavyObjectCache> > {
public:
using TrackIndxMap = std::unordered_map<reco::TrackRef::key_type, size_t>;
explicit LowPtGsfElectronSeedProducer(const edm::ParameterSet&, const lowptgsfeleseed::HeavyObjectCache*);
~LowPtGsfElectronSeedProducer() override;
static std::unique_ptr<lowptgsfeleseed::HeavyObjectCache> initializeGlobalCache(const edm::ParameterSet& conf) {
return std::make_unique<lowptgsfeleseed::HeavyObjectCache>(lowptgsfeleseed::HeavyObjectCache(conf));
}
static void globalEndJob(lowptgsfeleseed::HeavyObjectCache const*) {}
void beginLuminosityBlock(edm::LuminosityBlock const&, edm::EventSetup const&) override;
void produce(edm::Event&, const edm::EventSetup&) override;
static void fillDescriptions(edm::ConfigurationDescriptions&);
private: // member functions
template <typename T>
void loop(const edm::Handle<std::vector<T> >& handle,
edm::Handle<reco::PFClusterCollection>& hcalClusters,
reco::ElectronSeedCollection& seeds,
reco::PreIdCollection& ecalPreIds,
reco::PreIdCollection& hcalPreIds,
TrackIndxMap& trksToPreIdIndx,
edm::Event&,
const edm::EventSetup&);
// Overloaded methods to retrieve reco::TrackRef
reco::TrackRef getBaseRef(edm::Handle<std::vector<reco::Track> > handle, int idx) const;
reco::TrackRef getBaseRef(edm::Handle<std::vector<reco::PFRecTrack> > handle, int idx) const;
// Overloaded methods to populate PreIds (using PF or KF tracks)
void propagateTrackToCalo(const reco::PFRecTrackRef& pfTrackRef,
const edm::Handle<reco::PFClusterCollection>& ecalClusters,
const edm::Handle<reco::PFClusterCollection>& hcalClusters,
std::vector<int>& matchedEcalClusters,
std::vector<int>& matchedHcalClusters,
reco::PreId& ecalPreId,
reco::PreId& hcalPreId);
void propagateTrackToCalo(const reco::PFRecTrackRef& pfTrackRef,
const edm::Handle<reco::PFClusterCollection>& clusters,
std::vector<int>& matchedClusters,
reco::PreId& preId,
bool ecal);
void propagateTrackToCalo(const reco::TrackRef& pfTrack,
const edm::Handle<reco::PFClusterCollection>& ecalClusters,
const edm::Handle<reco::PFClusterCollection>& hcalClusters,
std::vector<int>& matchedEcalClusters,
std::vector<int>& matchedHcalClusters,
reco::PreId& ecalPreId,
reco::PreId& hcalPreId);
template <typename CollType>
void fillPreIdRefValueMap(edm::Handle<CollType> tracksHandle,
const TrackIndxMap& trksToPreIdIndx,
const edm::OrphanHandle<reco::PreIdCollection>& preIdHandle,
edm::ValueMap<reco::PreIdRef>::Filler& filler);
// Overloaded methods to evaluate BDTs (using PF or KF tracks)
bool decision(const reco::PFRecTrackRef& pfTrackRef,
reco::PreId& ecal,
reco::PreId& hcal,
double rho,
const reco::BeamSpot& spot,
noZS::EcalClusterLazyTools& ecalTools);
bool decision(const reco::TrackRef& kfTrackRef,
reco::PreId& ecal,
reco::PreId& hcal,
double rho,
const reco::BeamSpot& spot,
noZS::EcalClusterLazyTools& ecalTools);
// Perform lightweight GSF tracking
bool lightGsfTracking(reco::PreId&, const reco::TrackRef&, const reco::ElectronSeed&, const edm::EventSetup&);
private: // member data
edm::ESHandle<MagneticField> field_;
std::unique_ptr<TrajectoryFitter> fitterPtr_;
std::unique_ptr<TrajectorySmoother> smootherPtr_;
edm::EDGetTokenT<reco::TrackCollection> kfTracks_;
edm::EDGetTokenT<reco::PFRecTrackCollection> pfTracks_;
const edm::EDGetTokenT<reco::PFClusterCollection> ecalClusters_;
edm::EDGetTokenT<reco::PFClusterCollection> hcalClusters_;
const edm::EDGetTokenT<EcalRecHitCollection> ebRecHits_;
const edm::EDGetTokenT<EcalRecHitCollection> eeRecHits_;
const edm::EDGetTokenT<double> rho_;
const edm::EDGetTokenT<reco::BeamSpot> beamSpot_;
const std::string fitter_;
const std::string smoother_;
const std::string builder_;
const bool passThrough_;
const bool usePfTracks_;
const double minPtThreshold_;
const double maxPtThreshold_;
// pow( sinh(1.65), 2. )
static constexpr double boundary_ = 2.50746495928 * 2.50746495928;
// pow( ele_mass, 2. )
static constexpr double mass_ = 0.000511 * 0.000511;
};
#endif // RecoEgamma_EgammaElectronProducers_LowPtGsfElectronSeedProducer_h