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 
22 
23 using namespace std;
25  : conf_(conf), tkGeomToken_(iC.esConsumes<TrackerGeometry, TrackerDigiGeometryRecord>()) {}
26 
28 
29 // Virtual destructor needed.
31 
32 std::vector<std::pair<std::pair<DetId, LocalPoint>, float> > SiStripFineDelayTLA::findtrackangle(
33  const std::vector<Trajectory>& trajVec) {
34  if (!trajVec.empty()) {
35  return findtrackangle(trajVec.front());
36  }
37  std::vector<std::pair<std::pair<DetId, LocalPoint>, float> > hitangleassociation;
38  return hitangleassociation;
39 }
40 
41 std::vector<std::pair<std::pair<DetId, LocalPoint>, float> > SiStripFineDelayTLA::findtrackangle(
42  const Trajectory& traj) {
43  std::vector<std::pair<std::pair<DetId, LocalPoint>, float> > hitangleassociation;
44  std::vector<TrajectoryMeasurement> TMeas = traj.measurements();
45  std::vector<TrajectoryMeasurement>::iterator itm;
46  for (itm = TMeas.begin(); itm != TMeas.end(); itm++) {
47  TrajectoryStateOnSurface tsos = itm->updatedState();
48  auto thit = itm->recHit();
49  const SiStripMatchedRecHit2D* matchedhit = dynamic_cast<const SiStripMatchedRecHit2D*>((*thit).hit());
50  const SiStripRecHit2D* hit = dynamic_cast<const SiStripRecHit2D*>((*thit).hit());
51  LocalVector trackdirection = tsos.localDirection();
52  if (matchedhit) { //if matched hit...
53  const GluedGeomDet* gdet = static_cast<const GluedGeomDet*>(tracker->idToDet(matchedhit->geographicalId()));
54  GlobalVector gtrkdir = gdet->toGlobal(trackdirection);
55  // trackdirection on mono det
56  // this the pointer to the mono hit of a matched hit
57  const SiStripRecHit2D monohit = matchedhit->monoHit();
58  const GeomDetUnit* monodet = gdet->monoDet();
59  LocalVector monotkdir = monodet->toLocal(gtrkdir);
60  if (monotkdir.z() != 0) {
61  // the local angle (mono)
62  float localpitch = static_cast<const StripTopology&>(monodet->topology()).localPitch(tsos.localPosition());
63  float thickness = ((((((monohit.geographicalId()) >> 25) & 0x7f) == 0xd) ||
64  ((((monohit.geographicalId()) >> 25) & 0x7f) == 0xe)) &&
65  ((((monohit.geographicalId()) >> 5) & 0x7) > 4))
66  ? 0.0500
67  : 0.0320;
68  float angle = computeAngleCorr(monotkdir, localpitch, thickness);
69  hitangleassociation.push_back(make_pair(make_pair(monohit.geographicalId(), monohit.localPosition()), angle));
70  // trackdirection on stereo det
71  // this the pointer to the stereo hit of a matched hit
72  const SiStripRecHit2D stereohit = matchedhit->stereoHit();
73  const GeomDetUnit* stereodet = gdet->stereoDet();
74  LocalVector stereotkdir = stereodet->toLocal(gtrkdir);
75  if (stereotkdir.z() != 0) {
76  // the local angle (stereo)
77  float localpitch = static_cast<const StripTopology&>(stereodet->topology()).localPitch(tsos.localPosition());
78  float thickness = ((((((stereohit.geographicalId()) >> 25) & 0x7f) == 0xd) ||
79  ((((stereohit.geographicalId()) >> 25) & 0x7f) == 0xe)) &&
80  ((((stereohit.geographicalId()) >> 5) & 0x7) > 4))
81  ? 0.0500
82  : 0.0320;
83  float angle = computeAngleCorr(stereotkdir, localpitch, thickness);
84  hitangleassociation.push_back(
85  make_pair(make_pair(stereohit.geographicalId(), stereohit.localPosition()), angle));
86  }
87  }
88  } else if (hit) {
89  const GeomDetUnit* det = tracker->idToDet(hit->geographicalId());
90  // hit= pointer to the rechit
91  if (trackdirection.z() != 0) {
92  // the local angle (single hit)
93  float localpitch = static_cast<const StripTopology&>(det->topology()).localPitch(tsos.localPosition());
94  float thickness =
95  ((((((hit->geographicalId()) >> 25) & 0x7f) == 0xd) || ((((hit->geographicalId()) >> 25) & 0x7f) == 0xe)) &&
96  ((((hit->geographicalId()) >> 5) & 0x7) > 4))
97  ? 0.0500
98  : 0.0320;
99  float angle = computeAngleCorr(trackdirection, localpitch, thickness);
100  hitangleassociation.push_back(make_pair(make_pair(hit->geographicalId(), hit->localPosition()), angle));
101  }
102  }
103  }
104  return hitangleassociation;
105 }
106 
107 double SiStripFineDelayTLA::computeAngleCorr(const LocalVector& v, double pitch, double thickness) {
108  double v_xy = sqrt(v.x() * v.x() + v.y() * v.y());
109  double L = fabs(thickness * v_xy / v.z());
110  double Lmax = fabs(pitch / v.x() * v_xy);
111  if (L < Lmax) {
112  LogDebug("SiStripFineDelayTLA ") << L << " vs " << Lmax << " Signal contained in strip. Correction is "
113  << v.z() / v.mag();
114  return v.z() / v.mag();
115  } else {
116  LogDebug("SiStripFineDelayTLA ") << L << " vs " << Lmax << " Signal not contained in strip. Correction is "
117  << thickness / pitch * v.x() / v_xy * v.z() / v.mag() << " instead of "
118  << v.z() / v.mag();
119  return thickness / pitch * v.x() / v_xy * v.z() / v.mag();
120  }
121 }
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:27
GeomDet
Definition: GeomDet.h:27
SiStripFineDelayTLA::~SiStripFineDelayTLA
virtual ~SiStripFineDelayTLA()
Definition: SiStripFineDelayTLA.cc:30
SiStripFineDelayTLA.h
SiStripFineDelayTLA::findtrackangle
std::vector< std::pair< std::pair< DetId, LocalPoint >, float > > findtrackangle(const std::vector< Trajectory > &traj)
Definition: SiStripFineDelayTLA.cc:32
GluedGeomDet::monoDet
const GeomDetUnit * monoDet() const
Definition: GluedGeomDet.h:19
GluedGeomDet.h
GeomDet::topology
virtual const Topology & topology() const
Definition: GeomDet.cc:67
SiStripRecHit2D
Definition: SiStripRecHit2D.h:7
SiStripFineDelayTLA::tkGeomToken_
edm::ESGetToken< TrackerGeometry, TrackerDigiGeometryRecord > tkGeomToken_
Definition: SiStripFineDelayTLA.h:37
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
TrajectoryStateOnSurface::localDirection
LocalVector localDirection() const
Definition: TrajectoryStateOnSurface.h:76
Calorimetry_cff.thickness
thickness
Definition: Calorimetry_cff.py:115
TrackerDigiGeometryRecord
Definition: TrackerDigiGeometryRecord.h:15
mathSSE::sqrt
T sqrt(T t)
Definition: SSEVec.h:19
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
SiStripFineDelayTLA::SiStripFineDelayTLA
SiStripFineDelayTLA(const edm::ParameterSet &conf, edm::ConsumesCollector iC)
Definition: SiStripFineDelayTLA.cc:24
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:233
edm::ParameterSet
Definition: ParameterSet.h:47
SiStripMatchedRecHit2D::monoHit
SiStripRecHit2D monoHit() const
Definition: SiStripMatchedRecHit2D.h:26
edm::EventSetup
Definition: EventSetup.h:58
Trajectory::measurements
DataContainer const & measurements() const
Definition: Trajectory.h:178
edm::EventSetup::getData
bool getData(T &iHolder) const
Definition: EventSetup.h:127
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:107
angle
T angle(T x1, T y1, T z1, T x2, T y2, T z2)
Definition: angle.h:11
GlobalVector.h
EventSetup.h
ConsumesCollector.h
SiStripMatchedRecHit2D.h
DeDxTools::esConsumes
ESGetTokenH3DDVariant esConsumes(std::string const &Reccord, edm::ConsumesCollector &)
Definition: DeDxTools.cc:283
edm::Event
Definition: Event.h:73
LocalVector.h
Topology.h
edm::ConsumesCollector
Definition: ConsumesCollector.h:45
hit
Definition: SiStripHitEffFromCalibTree.cc:88
SiStripFineDelayTLA::tracker
const TrackerGeometry * tracker
Definition: SiStripFineDelayTLA.h:36
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37
TrackerGeometry
Definition: TrackerGeometry.h:14