File indexing completed on 2023-03-17 11:26:31
0001 #ifndef TrackAssociator_CachedTrajectory_h
0002 #define TrackAssociator_CachedTrajectory_h 1
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024 #include "TrackingTools/TrackAssociator/interface/DetIdAssociator.h"
0025 #include "TrackingTools/TrackAssociator/interface/TAMuonChamberMatch.h"
0026 #include "TrackingTools/TrackAssociator/interface/FiducialVolume.h"
0027 #include "TrackPropagation/SteppingHelixPropagator/interface/SteppingHelixStateInfo.h"
0028 #include "Geometry/CommonDetUnit/interface/GlobalTrackingGeometry.h"
0029 #include "Geometry/CommonDetUnit/interface/GeomDet.h"
0030 #include "DataFormats/DetId/interface/DetId.h"
0031 #include <deque>
0032 #include "FWCore/Utilities/interface/Visibility.h"
0033
0034 std::vector<SteppingHelixStateInfo> propagateThoughFromIP(const SteppingHelixStateInfo& state,
0035 const Propagator* prop,
0036 const FiducialVolume& volume,
0037 int nsteps,
0038 float step,
0039 float minR,
0040 float minZ,
0041 float maxR,
0042 float maxZ);
0043
0044 class CachedTrajectory {
0045 public:
0046 const std::vector<SteppingHelixStateInfo>& getEcalTrajectory() const;
0047 const std::vector<SteppingHelixStateInfo>& getHcalTrajectory() const;
0048 const std::vector<SteppingHelixStateInfo>& getHOTrajectory() const;
0049 const std::vector<SteppingHelixStateInfo>& getPreshowerTrajectory() const;
0050
0051 private:
0052 friend class TrackDetectorAssociator;
0053 friend std::vector<SteppingHelixStateInfo> propagateThoughFromIP(const SteppingHelixStateInfo& state,
0054 const Propagator* ptr,
0055 const FiducialVolume& volume,
0056 int nsteps,
0057 float step,
0058 float minR,
0059 float minZ,
0060 float maxR,
0061 float maxZ);
0062
0063 CachedTrajectory();
0064 enum TrajectorType { IpToEcal, IpToHcal, IpToHO, FullTrajectory };
0065 enum WideTrajectoryType { Ecal, Hcal, HO };
0066
0067 void reset_trajectory() dso_internal;
0068
0069
0070 bool propagateAll(const SteppingHelixStateInfo& initialState) dso_internal;
0071
0072 void propagateForward(SteppingHelixStateInfo& state, float distance) dso_internal;
0073 void propagate(SteppingHelixStateInfo& state, const Plane& plane) dso_internal;
0074 void propagate(SteppingHelixStateInfo& state, const Cylinder& cylinder) dso_internal;
0075
0076
0077 TrajectoryStateOnSurface propagate(const Plane* plane) dso_internal;
0078
0079
0080
0081 std::pair<float, float> trajectoryDelta(TrajectorType) dso_internal;
0082
0083 void setPropagator(const Propagator* ptr) dso_internal { propagator_ = ptr; }
0084 void setStateAtIP(const SteppingHelixStateInfo& state) dso_internal { stateAtIP_ = state; }
0085
0086
0087
0088
0089 void getTrajectory(std::vector<SteppingHelixStateInfo>&, const FiducialVolume&, int steps = 4) dso_internal;
0090
0091 void findEcalTrajectory(const FiducialVolume&) dso_internal;
0092 void findHcalTrajectory(const FiducialVolume&) dso_internal;
0093 void findHOTrajectory(const FiducialVolume&) dso_internal;
0094 void findPreshowerTrajectory(const FiducialVolume&) dso_internal;
0095
0096 std::vector<GlobalPoint>* getWideTrajectory(const std::vector<SteppingHelixStateInfo>&,
0097 WideTrajectoryType) dso_internal;
0098
0099 SteppingHelixStateInfo getStateAtEcal() dso_internal;
0100 SteppingHelixStateInfo getStateAtPreshower() dso_internal;
0101 SteppingHelixStateInfo getStateAtHcal() dso_internal;
0102 SteppingHelixStateInfo getStateAtHO() dso_internal;
0103
0104
0105 SteppingHelixStateInfo getInnerState() dso_internal;
0106
0107 SteppingHelixStateInfo getOuterState() dso_internal;
0108
0109
0110
0111
0112
0113 void setMaxDetectorRadius(float r = 800.) dso_internal { maxRho_ = r; }
0114 void setMaxDetectorLength(float l = 2200.) dso_internal { maxZ_ = l / 2.; }
0115 void setMaxHORadius(float r = 800.) dso_internal { HOmaxRho_ = r; }
0116 void setMaxHOLength(float l = 2200.) dso_internal { HOmaxZ_ = l / 2.; }
0117 void setMinDetectorRadius(float r = 0.) dso_internal { minRho_ = r; }
0118 void setMinDetectorLength(float l = 0.) dso_internal { minZ_ = l / 2.; }
0119
0120 void setPropagationStep(float s = 20.) { step_ = s; }
0121 float getPropagationStep() const dso_internal { return step_; }
0122
0123 protected:
0124 static int sign(float number) dso_internal {
0125 if (number == 0)
0126 return 0;
0127 if (number > 0)
0128 return 1;
0129 else
0130 return -1;
0131 }
0132
0133 std::pair<float, float> delta(const double& theta1, const double& theta2, const double& phi1, const double& phi2)
0134 dso_internal;
0135
0136 float distance(const Plane* plane, int index) dso_internal {
0137 if (index < 0 || fullTrajectory_.empty() || (unsigned int)index >= fullTrajectory_.size())
0138 return 0;
0139 return plane->localZ(fullTrajectory_[index].position());
0140 }
0141
0142 std::deque<SteppingHelixStateInfo> fullTrajectory_;
0143 std::vector<SteppingHelixStateInfo> ecalTrajectory_;
0144 std::vector<SteppingHelixStateInfo> hcalTrajectory_;
0145 std::vector<SteppingHelixStateInfo> hoTrajectory_;
0146 std::vector<SteppingHelixStateInfo> preshowerTrajectory_;
0147 std::vector<GlobalPoint> wideEcalTrajectory_;
0148 std::vector<GlobalPoint> wideHcalTrajectory_;
0149 std::vector<GlobalPoint> wideHOTrajectory_;
0150 SteppingHelixStateInfo stateAtIP_;
0151
0152 bool fullTrajectoryFilled_;
0153
0154 const Propagator* propagator_;
0155
0156 float maxRho_;
0157 float maxZ_;
0158 float HOmaxRho_;
0159 float HOmaxZ_;
0160 float minRho_;
0161 float minZ_;
0162 float step_;
0163 };
0164 #endif