CMS 3D CMS Logo

SiStripFineDelayTLA.cc
Go to the documentation of this file.
1 #include <memory>
2 #include <string>
3 #include <iostream>
4 #include <TMath.h>
6 
24 
25 using namespace std;
27 
29  // get geometry
31  es.get<TrackerDigiGeometryRecord>().get(estracker);
32  tracker = &(*estracker);
33 }
34 
35 // Virtual destructor needed.
37 
38 std::vector<std::pair<std::pair<DetId, LocalPoint>, float> > SiStripFineDelayTLA::findtrackangle(
39  const std::vector<Trajectory>& trajVec) {
40  if (!trajVec.empty()) {
41  return findtrackangle(trajVec.front());
42  }
43  std::vector<std::pair<std::pair<DetId, LocalPoint>, float> > hitangleassociation;
44  return hitangleassociation;
45 }
46 
47 std::vector<std::pair<std::pair<DetId, LocalPoint>, float> > SiStripFineDelayTLA::findtrackangle(
48  const Trajectory& traj) {
49  std::vector<std::pair<std::pair<DetId, LocalPoint>, float> > hitangleassociation;
50  std::vector<TrajectoryMeasurement> TMeas = traj.measurements();
51  std::vector<TrajectoryMeasurement>::iterator itm;
52  for (itm = TMeas.begin(); itm != TMeas.end(); itm++) {
53  TrajectoryStateOnSurface tsos = itm->updatedState();
54  auto thit = itm->recHit();
55  const SiStripMatchedRecHit2D* matchedhit = dynamic_cast<const SiStripMatchedRecHit2D*>((*thit).hit());
56  const SiStripRecHit2D* hit = dynamic_cast<const SiStripRecHit2D*>((*thit).hit());
57  LocalVector trackdirection = tsos.localDirection();
58  if (matchedhit) { //if matched hit...
59  const GluedGeomDet* gdet = static_cast<const GluedGeomDet*>(tracker->idToDet(matchedhit->geographicalId()));
60  GlobalVector gtrkdir = gdet->toGlobal(trackdirection);
61  // trackdirection on mono det
62  // this the pointer to the mono hit of a matched hit
63  const SiStripRecHit2D monohit = matchedhit->monoHit();
64  const GeomDetUnit* monodet = gdet->monoDet();
65  LocalVector monotkdir = monodet->toLocal(gtrkdir);
66  if (monotkdir.z() != 0) {
67  // the local angle (mono)
68  float localpitch = static_cast<const StripTopology&>(monodet->topology()).localPitch(tsos.localPosition());
69  float thickness = ((((((monohit.geographicalId()) >> 25) & 0x7f) == 0xd) ||
70  ((((monohit.geographicalId()) >> 25) & 0x7f) == 0xe)) &&
71  ((((monohit.geographicalId()) >> 5) & 0x7) > 4))
72  ? 0.0500
73  : 0.0320;
74  float angle = computeAngleCorr(monotkdir, localpitch, thickness);
75  hitangleassociation.push_back(make_pair(make_pair(monohit.geographicalId(), monohit.localPosition()), angle));
76  // trackdirection on stereo det
77  // this the pointer to the stereo hit of a matched hit
78  const SiStripRecHit2D stereohit = matchedhit->stereoHit();
79  const GeomDetUnit* stereodet = gdet->stereoDet();
80  LocalVector stereotkdir = stereodet->toLocal(gtrkdir);
81  if (stereotkdir.z() != 0) {
82  // the local angle (stereo)
83  float localpitch = static_cast<const StripTopology&>(stereodet->topology()).localPitch(tsos.localPosition());
84  float thickness = ((((((stereohit.geographicalId()) >> 25) & 0x7f) == 0xd) ||
85  ((((stereohit.geographicalId()) >> 25) & 0x7f) == 0xe)) &&
86  ((((stereohit.geographicalId()) >> 5) & 0x7) > 4))
87  ? 0.0500
88  : 0.0320;
89  float angle = computeAngleCorr(stereotkdir, localpitch, thickness);
90  hitangleassociation.push_back(
91  make_pair(make_pair(stereohit.geographicalId(), stereohit.localPosition()), angle));
92  }
93  }
94  } else if (hit) {
95  const GeomDetUnit* det = tracker->idToDet(hit->geographicalId());
96  // hit= pointer to the rechit
97  if (trackdirection.z() != 0) {
98  // the local angle (single hit)
99  float localpitch = static_cast<const StripTopology&>(det->topology()).localPitch(tsos.localPosition());
100  float thickness =
101  ((((((hit->geographicalId()) >> 25) & 0x7f) == 0xd) || ((((hit->geographicalId()) >> 25) & 0x7f) == 0xe)) &&
102  ((((hit->geographicalId()) >> 5) & 0x7) > 4))
103  ? 0.0500
104  : 0.0320;
105  float angle = computeAngleCorr(trackdirection, localpitch, thickness);
106  hitangleassociation.push_back(make_pair(make_pair(hit->geographicalId(), hit->localPosition()), angle));
107  }
108  }
109  }
110  return hitangleassociation;
111 }
112 
113 double SiStripFineDelayTLA::computeAngleCorr(const LocalVector& v, double pitch, double thickness) {
114  double v_xy = sqrt(v.x() * v.x() + v.y() * v.y());
115  double L = fabs(thickness * v_xy / v.z());
116  double Lmax = fabs(pitch / v.x() * v_xy);
117  if (L < Lmax) {
118  LogDebug("SiStripFineDelayTLA ") << L << " vs " << Lmax << " Signal contained in strip. Correction is "
119  << v.z() / v.mag();
120  return v.z() / v.mag();
121  } else {
122  LogDebug("SiStripFineDelayTLA ") << L << " vs " << Lmax << " Signal not contained in strip. Correction is "
123  << thickness / pitch * v.x() / v_xy * v.z() / v.mag() << " instead of "
124  << v.z() / v.mag();
125  return thickness / pitch * v.x() / v_xy * v.z() / v.mag();
126  }
127 }
Vector3DBase< float, LocalTag >
TrackerGeometry::idToDet
const TrackerGeomDet * idToDet(DetId) const override
Definition: TrackerGeometry.cc:193
TrajectoryStateOnSurface.h
dttmaxenums::L
Definition: DTTMax.h:29
SiStripFineDelayTLA::init
void init(const edm::Event &e, const edm::EventSetup &c)
Definition: SiStripFineDelayTLA.cc:28
TrackerGeometry.h
GeomDet
Definition: GeomDet.h:27
ESHandle.h
SiStripFineDelayTLA::~SiStripFineDelayTLA
virtual ~SiStripFineDelayTLA()
Definition: SiStripFineDelayTLA.cc:36
SiStripFineDelayTLA.h
SiStripFineDelayTLA::findtrackangle
std::vector< std::pair< std::pair< DetId, LocalPoint >, float > > findtrackangle(const std::vector< Trajectory > &traj)
Definition: SiStripFineDelayTLA.cc:38
GluedGeomDet::monoDet
const GeomDetUnit * monoDet() const
Definition: GluedGeomDet.h:19
GluedGeomDet.h
GeomDet::topology
virtual const Topology & topology() const
Definition: GeomDet.cc:67
SiStripFineDelayTLA::SiStripFineDelayTLA
SiStripFineDelayTLA(const edm::ParameterSet &conf)
Definition: SiStripFineDelayTLA.cc:26
SiStripRecHit2D
Definition: SiStripRecHit2D.h:7
StripTopology.h
TransientTrack.h
findQualityFiles.v
v
Definition: findQualityFiles.py:179
TrackingRecHit::geographicalId
DetId geographicalId() const
Definition: TrackingRecHit.h:120
PV3DBase::z
T z() const
Definition: PV3DBase.h:61
TrajectoryStateOnSurface
Definition: TrajectoryStateOnSurface.h:16
TrackingRecHit.h
Track.h
edm::EventSetup::get
T get() const
Definition: EventSetup.h:80
TrajectoryStateOnSurface::localDirection
LocalVector localDirection() const
Definition: TrajectoryStateOnSurface.h:76
Calorimetry_cff.thickness
thickness
Definition: Calorimetry_cff.py:114
TrackerDigiGeometryRecord
Definition: TrackerDigiGeometryRecord.h:15
mathSSE::sqrt
T sqrt(T t)
Definition: SSEVec.h:19
edm::ESHandle< TrackerGeometry >
SiStripMatchedRecHit2D::stereoHit
SiStripRecHit2D stereoHit() const
Definition: SiStripMatchedRecHit2D.h:25
GeomDet::toLocal
LocalPoint toLocal(const GlobalPoint &gp) const
Conversion to the R.F. of the GeomDet.
Definition: GeomDet.h:58
TrajectorySeed.h
GluedGeomDet
Definition: GluedGeomDet.h:7
TrackerDigiGeometryRecord.h
TrajectoryStateOnSurface::localPosition
LocalPoint localPosition() const
Definition: TrajectoryStateOnSurface.h:74
GeomDet::toGlobal
GlobalPoint toGlobal(const Local2DPoint &lp) const
Conversion to the global R.F. from the R.F. of the GeomDet.
Definition: GeomDet.h:49
LogDebug
#define LogDebug(id)
Definition: MessageLogger.h:223
edm::ParameterSet
Definition: ParameterSet.h:47
SiStripMatchedRecHit2D::monoHit
SiStripRecHit2D monoHit() const
Definition: SiStripMatchedRecHit2D.h:26
edm::EventSetup
Definition: EventSetup.h:57
get
#define get
Trajectory::measurements
DataContainer const & measurements() const
Definition: Trajectory.h:178
GluedGeomDet::stereoDet
const GeomDetUnit * stereoDet() const
Definition: GluedGeomDet.h:20
Trajectory.h
GeomDet.h
std
Definition: JetResolutionObject.h:76
BaseTrackerRecHit::localPosition
LocalPoint localPosition() const override
Definition: BaseTrackerRecHit.h:56
SiStripMatchedRecHit2D
Definition: SiStripMatchedRecHit2D.h:8
Trajectory
Definition: Trajectory.h:38
SiStripFineDelayTLA::computeAngleCorr
double computeAngleCorr(const LocalVector &v, double pitch, double thickness)
Definition: SiStripFineDelayTLA.cc:113
angle
T angle(T x1, T y1, T z1, T x2, T y2, T z2)
Definition: angle.h:11
GlobalVector.h
EventSetup.h
SiStripMatchedRecHit2D.h
edm::Event
Definition: Event.h:73
LocalVector.h
Topology.h
hit
Definition: SiStripHitEffFromCalibTree.cc:88
SiStripFineDelayTLA::tracker
const TrackerGeometry * tracker
Definition: SiStripFineDelayTLA.h:33
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37