/
TrackAssociatorByPositionImpl.h
90 lines (72 loc) · 3.6 KB
/
TrackAssociatorByPositionImpl.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
#ifndef TrackAssociatorByPositionImpl_h
#define TrackAssociatorByPositionImpl_h
/** \class TrackAssociatorByPositionImpl
* Class that performs the association of reco::Tracks and TrackingParticles based on position in muon detector
*
* \author vlimant
*/
#include "SimDataFormats/Associations/interface/TrackToTrackingParticleAssociatorBaseImpl.h"
#include "SimDataFormats/Track/interface/SimTrackContainer.h"
#include "FWCore/Framework/interface/ESHandle.h"
#include "FWCore/Framework/interface/EventSetup.h"
#include "SimDataFormats/Vertex/interface/SimVertexContainer.h"
#include "FWCore/ParameterSet/interface/ParameterSet.h"
#include "FWCore/MessageLogger/interface/MessageLogger.h"
#include "TrackingTools/GeomPropagators/interface/Propagator.h"
#include "Geometry/CommonDetUnit/interface/GlobalTrackingGeometry.h"
#include "TrackingTools/TrajectoryState/interface/TrajectoryStateOnSurface.h"
#include "SimDataFormats/TrackingHit/interface/PSimHitContainer.h"
#include <map>
namespace edm {
class EDProductGetter;
}
//Note that the Association Map is filled with -ch2 and not chi2 because it is ordered using std::greater:
//the track with the lowest association chi2 will be the first in the output map.
class TrackAssociatorByPositionImpl : public reco::TrackToTrackingParticleAssociatorBaseImpl {
public:
typedef std::pair<TrackingParticleRef, TrackPSimHitRef> SimHitTPPair;
typedef std::vector<SimHitTPPair> SimHitTPAssociationList;
enum class Method { chi2, dist, momdr, posdr };
TrackAssociatorByPositionImpl(edm::EDProductGetter const& productGetter,
const TrackingGeometry* geo,
const Propagator* prop,
const SimHitTPAssociationList* assocList,
double qMinCut,
double qCut,
double positionMinimumDistance,
Method method,
bool minIfNoMatch,
bool considerAllSimHits)
: productGetter_(&productGetter),
theGeometry(geo),
thePropagator(prop),
theSimHitsTPAssoc(assocList),
theQminCut(qMinCut),
theQCut(qCut),
thePositionMinimumDistance(positionMinimumDistance),
theMethod(method),
theMinIfNoMatch(minIfNoMatch),
theConsiderAllSimHits(considerAllSimHits) {}
/// compare reco to sim the handle of reco::Track and TrackingParticle collections
reco::RecoToSimCollection associateRecoToSim(const edm::RefToBaseVector<reco::Track>&,
const edm::RefVector<TrackingParticleCollection>&) const override;
/// compare reco to sim the handle of reco::Track and TrackingParticle collections
reco::SimToRecoCollection associateSimToReco(const edm::RefToBaseVector<reco::Track>&,
const edm::RefVector<TrackingParticleCollection>&) const override;
private:
double quality(const TrajectoryStateOnSurface&, const TrajectoryStateOnSurface&) const;
edm::EDProductGetter const* productGetter_;
const TrackingGeometry* theGeometry;
const Propagator* thePropagator;
const SimHitTPAssociationList* theSimHitsTPAssoc;
double theQminCut;
double theQCut;
double thePositionMinimumDistance;
Method theMethod;
bool theMinIfNoMatch;
bool theConsiderAllSimHits;
FreeTrajectoryState getState(const reco::Track&) const;
TrajectoryStateOnSurface getState(const TrackingParticleRef&, const SimHitTPAssociationList& simHitsTPAssoc) const;
//edm::InputTag _simHitTpMapTag;
};
#endif