CMS 3D CMS Logo

pTFrom2Stubs.cc
Go to the documentation of this file.
4 #include <cassert>
5 #include <cmath>
6 #include <iostream>
7 #include <memory>
8 
9 static constexpr float local_c_light = 0.00299792;
10 static constexpr float B_field = 3.8;
11 
12 namespace pTFrom2Stubs {
13 
14  //====================
16  const TrackerGeometry* tkGeometry) {
17  //vector of R, r and phi for each stub
18  std::vector<std::vector<float> > riPhiStubs(0);
19  //get stub reference
20  std::vector<edm::Ref<edmNew::DetSetVector<TTStub<Ref_Phase2TrackerDigi_> >, TTStub<Ref_Phase2TrackerDigi_> > >
21  vecStubRefs = trk->getStubRefs();
22 
23  //loop over L1Track's stubs
24  int rsize = vecStubRefs.size();
25  for (int j = 0; j < rsize; ++j) {
27  vecStubRefs.at(j);
28  const TTStub<Ref_Phase2TrackerDigi_>* stub = &(*stubRef);
29  MeasurementPoint localPos = stub->clusterRef(0)->findAverageLocalCoordinates();
30 
31  DetId detid = stub->clusterRef(0)->getDetId();
32 
33  if (detid.det() != DetId::Detector::Tracker)
34  continue;
35  if (detid.subdetId() != StripSubdetector::TOB && detid.subdetId() != StripSubdetector::TID)
36  continue;
37  const GeomDet* geomDet = tkGeometry->idToDet(detid);
38  if (geomDet) {
39  const GeomDetUnit* gDetUnit = tkGeometry->idToDetUnit(detid);
40  GlobalPoint stubPosition = geomDet->surface().toGlobal(gDetUnit->topology().localPosition(localPos));
41 
42  std::vector<float> tmp(0);
43  float Rad = sqrt(stubPosition.x() * stubPosition.x() + stubPosition.y() * stubPosition.y() + stubPosition.z() +
44  stubPosition.z());
45  float r_i = sqrt(stubPosition.x() * stubPosition.x() + stubPosition.y() * stubPosition.y());
46  float phi_i = stubPosition.phi();
47 
48  tmp.push_back(Rad);
49  tmp.push_back(r_i);
50  tmp.push_back(phi_i);
51 
52  riPhiStubs.push_back(tmp);
53  }
54  }
55 
56  std::sort(riPhiStubs.begin(), riPhiStubs.end());
57  //now calculate the curvature from first 2 stubs
58  float nr1 = (riPhiStubs[0])[1];
59  float nphi1 = (riPhiStubs[0])[2];
60 
61  float nr2 = (riPhiStubs[1])[1];
62  float nphi2 = (riPhiStubs[1])[2];
63 
64  float dPhi = reco::deltaPhi(nphi1, nphi2);
65 
66  float ndist = sqrt(nr2 * nr2 + nr1 * nr1 - 2 * nr1 * nr2 * cos(dPhi));
67 
68  float curvature = 2 * sin(dPhi) / ndist;
69  return curvature;
70  }
71  //====================
72  float pTFrom2(std::vector<TTTrack<Ref_Phase2TrackerDigi_> >::const_iterator trk, const TrackerGeometry* tkGeometry) {
73  float rinv = rInvFrom2(trk, tkGeometry);
74  return std::abs(local_c_light * B_field / rinv);
75  }
76  //====================
77 } // namespace pTFrom2Stubs
const edm::Ref< edmNew::DetSetVector< TTCluster< T > >, TTCluster< T > > & clusterRef(unsigned int hitStackMember) const
Clusters composing the Stub – see https://twiki.cern.ch/twiki/bin/viewauth/CMS/SLHCTrackerTriggerSWT...
Definition: TTStub.h:150
constexpr double deltaPhi(double phi1, double phi2)
Definition: deltaPhi.h:26
const TrackerGeomDet * idToDetUnit(DetId) const override
Return the pointer to the GeomDetUnit corresponding to a given DetId.
virtual LocalPoint localPosition(const MeasurementPoint &) const =0
T z() const
Definition: PV3DBase.h:61
virtual const Topology & topology() const
Definition: GeomDet.cc:67
Geom::Phi< T > phi() const
Definition: PV3DBase.h:66
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
static constexpr float B_field
Definition: pTFrom2Stubs.cc:10
constexpr Detector det() const
get the detector field from this detid
Definition: DetId.h:46
T curvature(T InversePt, const MagneticField &field)
T x() const
Definition: PV3DBase.h:59
T y() const
Definition: PV3DBase.h:60
float rInvFrom2(std::vector< TTTrack< Ref_Phase2TrackerDigi_ > >::const_iterator trk, const TrackerGeometry *tkGeometry)
Definition: pTFrom2Stubs.cc:15
T sqrt(T t)
Definition: SSEVec.h:23
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
constexpr int subdetId() const
get the contents of the subdetector field (not cast into any detector&#39;s numbering enum) ...
Definition: DetId.h:48
static constexpr auto TOB
Class to store the L1 Track Trigger stubs.
Definition: TTStub.h:22
const TrackerGeomDet * idToDet(DetId) const override
GlobalPoint toGlobal(const Point2DBase< Scalar, LocalTag > lp) const
Definition: Surface.h:79
Definition: DetId.h:17
const Plane & surface() const
The nominal surface of the GeomDet.
Definition: GeomDet.h:37
Class to store the L1 Track Trigger tracks.
Definition: TTTrack.h:29
double rinv(double phi1, double phi2, double r1, double r2)
Definition: Util.h:66
static constexpr float local_c_light
Definition: pTFrom2Stubs.cc:9
float pTFrom2(std::vector< TTTrack< Ref_Phase2TrackerDigi_ > >::const_iterator trk, const TrackerGeometry *tkGeometry)
Definition: pTFrom2Stubs.cc:72
tmp
align.sh
Definition: createJobs.py:716
static constexpr auto TID