File indexing completed on 2024-04-06 12:31:36
0001 #ifndef TrackAssociator_TrackDetectorAssociator_h
0002 #define TrackAssociator_TrackDetectorAssociator_h 1
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020 #include "FWCore/Framework/interface/Event.h"
0021 #include "FWCore/Framework/interface/EventSetup.h"
0022 #include "FWCore/Framework/interface/ESWatcher.h"
0023
0024 #include "DataFormats/TrackReco/interface/TrackBase.h"
0025 #include "Geometry/CaloGeometry/interface/CaloGeometry.h"
0026 #include "TrackingTools/GeomPropagators/interface/Propagator.h"
0027 #include "MagneticField/Records/interface/IdealMagneticFieldRecord.h"
0028 #include "MagneticField/Engine/interface/MagneticField.h"
0029
0030 #include "TrackingTools/TrackAssociator/interface/DetIdAssociator.h"
0031 #include "TrackingTools/TrackAssociator/interface/TrackDetMatchInfo.h"
0032 #include "TrackingTools/TrackAssociator/interface/CachedTrajectory.h"
0033 #include "TrackingTools/TrackAssociator/interface/TrackAssociatorParameters.h"
0034
0035 #include "DataFormats/EcalRecHit/interface/EcalRecHit.h"
0036 #include "DataFormats/TrackReco/interface/Track.h"
0037 #include "DataFormats/TrackingRecHit/interface/RecSegment.h"
0038
0039 #include "SimDataFormats/Track/interface/SimTrack.h"
0040 #include "SimDataFormats/Vertex/interface/SimVertex.h"
0041
0042 #include "FWCore/Utilities/interface/Visibility.h"
0043
0044 class TrackDetectorAssociator {
0045 public:
0046 explicit TrackDetectorAssociator();
0047 ~TrackDetectorAssociator();
0048
0049 typedef TrackAssociatorParameters AssociatorParameters;
0050 enum Direction { Any, InsideOut, OutsideIn };
0051
0052
0053
0054
0055
0056
0057
0058
0059
0060
0061
0062
0063
0064
0065 TrackDetMatchInfo associate(const edm::Event&,
0066 const edm::EventSetup&,
0067 const FreeTrajectoryState&,
0068 const AssociatorParameters&);
0069
0070
0071 TrackDetMatchInfo associate(const edm::Event& iEvent,
0072 const edm::EventSetup& iSetup,
0073 const AssociatorParameters& parameters,
0074 const FreeTrajectoryState* innerState,
0075 const FreeTrajectoryState* outerState = nullptr);
0076
0077 TrackDetMatchInfo associate(const edm::Event&,
0078 const edm::EventSetup&,
0079 const reco::Track&,
0080 const AssociatorParameters&,
0081 Direction direction = Any);
0082
0083 TrackDetMatchInfo associate(
0084 const edm::Event&, const edm::EventSetup&, const SimTrack&, const SimVertex&, const AssociatorParameters&);
0085
0086 TrackDetMatchInfo associate(const edm::Event&,
0087 const edm::EventSetup&,
0088 const GlobalVector&,
0089 const GlobalPoint&,
0090 const int,
0091 const AssociatorParameters&);
0092
0093 const CachedTrajectory& getCachedTrajector() const { return cachedTrajectory_; }
0094
0095
0096 void setPropagator(const Propagator*);
0097
0098
0099 void useDefaultPropagator();
0100
0101
0102 static FreeTrajectoryState getFreeTrajectoryState(const MagneticField*, const reco::Track&);
0103 static FreeTrajectoryState getFreeTrajectoryState(const MagneticField*, const SimTrack&, const SimVertex&);
0104 static FreeTrajectoryState getFreeTrajectoryState(const MagneticField*,
0105 const GlobalVector&,
0106 const GlobalPoint&,
0107 const int);
0108
0109 static bool crossedIP(const reco::Track& track);
0110
0111 private:
0112 DetIdAssociator::MapRange getMapRange(const std::pair<float, float>& delta, const float dR) dso_internal;
0113
0114 void fillEcal(const edm::Event&, TrackDetMatchInfo&, const AssociatorParameters&) dso_internal;
0115
0116 void fillCaloTowers(const edm::Event&, TrackDetMatchInfo&, const AssociatorParameters&) dso_internal;
0117
0118 void fillHcal(const edm::Event&, TrackDetMatchInfo&, const AssociatorParameters&) dso_internal;
0119
0120 void fillHO(const edm::Event&, TrackDetMatchInfo&, const AssociatorParameters&) dso_internal;
0121
0122 void fillPreshower(const edm::Event& iEvent, TrackDetMatchInfo& info, const AssociatorParameters&) dso_internal;
0123
0124 void fillMuon(const edm::Event&, TrackDetMatchInfo&, const AssociatorParameters&) dso_internal;
0125
0126 void fillCaloTruth(const edm::Event&, TrackDetMatchInfo&, const AssociatorParameters&) dso_internal;
0127
0128 bool addTAMuonSegmentMatch(TAMuonChamberMatch&, const RecSegment*, const AssociatorParameters&) dso_internal;
0129
0130 void getTAMuonChamberMatches(std::vector<TAMuonChamberMatch>& matches,
0131 const AssociatorParameters& parameters,
0132 std::set<DetId> occupancy) dso_internal;
0133
0134 void init(const edm::EventSetup&, const AssociatorParameters&) dso_internal;
0135
0136 math::XYZPoint getPoint(const GlobalPoint& point) dso_internal {
0137 return math::XYZPoint(point.x(), point.y(), point.z());
0138 }
0139
0140 math::XYZPoint getPoint(const LocalPoint& point) dso_internal {
0141 return math::XYZPoint(point.x(), point.y(), point.z());
0142 }
0143
0144 math::XYZVector getVector(const GlobalVector& vec) dso_internal { return math::XYZVector(vec.x(), vec.y(), vec.z()); }
0145
0146 math::XYZVector getVector(const LocalVector& vec) dso_internal { return math::XYZVector(vec.x(), vec.y(), vec.z()); }
0147
0148 const Propagator* ivProp_;
0149 std::unique_ptr<Propagator> defProp_;
0150 CachedTrajectory cachedTrajectory_;
0151 bool useDefaultPropagator_;
0152
0153 const DetIdAssociator* ecalDetIdAssociator_;
0154 const DetIdAssociator* hcalDetIdAssociator_;
0155 const DetIdAssociator* hoDetIdAssociator_;
0156 const DetIdAssociator* caloDetIdAssociator_;
0157 const DetIdAssociator* muonDetIdAssociator_;
0158 const DetIdAssociator* preshowerDetIdAssociator_;
0159
0160 const CaloGeometry* theCaloGeometry_;
0161 const GlobalTrackingGeometry* theTrackingGeometry_;
0162
0163 edm::ESWatcher<IdealMagneticFieldRecord> theMagneticFieldWatcher_;
0164 };
0165 #endif