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  //====================
15  float rInvFrom2(std::vector<TTTrack<Ref_Phase2TrackerDigi_> >::const_iterator trk,
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
TrackerGeometry::idToDet
const TrackerGeomDet * idToDet(DetId) const override
Definition: TrackerGeometry.cc:193
Point2DBase
Definition: Point2DBase.h:9
GeomDet
Definition: GeomDet.h:27
PV3DBase::x
T x() const
Definition: PV3DBase.h:59
reco::deltaPhi
constexpr double deltaPhi(double phi1, double phi2)
Definition: deltaPhi.h:26
B_field
static constexpr float B_field
Definition: pTFrom2Stubs.cc:10
DetId::det
constexpr Detector det() const
get the detector field from this detid
Definition: DetId.h:46
TTTrack
Class to store the L1 Track Trigger tracks.
Definition: TTTrack.h:26
GeomDet::topology
virtual const Topology & topology() const
Definition: GeomDet.cc:67
Topology::localPosition
virtual LocalPoint localPosition(const MeasurementPoint &) const =0
PixelRecoUtilities::curvature
T curvature(T InversePt, const edm::EventSetup &iSetup)
Definition: PixelRecoUtilities.h:42
createJobs.tmp
tmp
align.sh
Definition: createJobs.py:716
edm::Ref
Definition: AssociativeIterator.h:58
funct::sin
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
align::Tracker
Definition: StructureType.h:70
TrackerGeometry::idToDetUnit
const TrackerGeomDet * idToDetUnit(DetId) const override
Return the pointer to the GeomDetUnit corresponding to a given DetId.
Definition: TrackerGeometry.cc:183
PV3DBase::z
T z() const
Definition: PV3DBase.h:61
pTFrom2Stubs::rInvFrom2
float rInvFrom2(std::vector< TTTrack< Ref_Phase2TrackerDigi_ > >::const_iterator trk, const TrackerGeometry *tkGeometry)
Definition: pTFrom2Stubs.cc:15
TTStub::clusterRef
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/SLHCTrackerTriggerSWTo...
Definition: TTStub.h:150
DetId
Definition: DetId.h:17
GeomDet::surface
const Plane & surface() const
The nominal surface of the GeomDet.
Definition: GeomDet.h:37
funct::cos
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
pTFrom2Stubs
Definition: pTFrom2Stubs.h:7
mathSSE::sqrt
T sqrt(T t)
Definition: SSEVec.h:19
local_c_light
static constexpr float local_c_light
Definition: pTFrom2Stubs.cc:9
TTStub
Class to store the L1 Track Trigger stubs.
Definition: TTStub.h:22
Surface::toGlobal
GlobalPoint toGlobal(const Point2DBase< Scalar, LocalTag > lp) const
Definition: Surface.h:79
HLT_2018_cff.dPhi
dPhi
Definition: HLT_2018_cff.py:12290
Point3DBase< float, GlobalTag >
DetId::subdetId
constexpr int subdetId() const
get the contents of the subdetector field (not cast into any detector's numbering enum)
Definition: DetId.h:48
trklet::rinv
double rinv(double phi1, double phi2, double r1, double r2)
Definition: Util.h:167
pTFrom2Stubs::pTFrom2
float pTFrom2(std::vector< TTTrack< Ref_Phase2TrackerDigi_ > >::const_iterator trk, const TrackerGeometry *tkGeometry)
Definition: pTFrom2Stubs.cc:72
PV3DBase::y
T y() const
Definition: PV3DBase.h:60
StripSubdetector::TOB
static constexpr auto TOB
Definition: StripSubdetector.h:18
funct::abs
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
dqmiolumiharvest.j
j
Definition: dqmiolumiharvest.py:66
Topology.h
PV3DBase::phi
Geom::Phi< T > phi() const
Definition: PV3DBase.h:66
pTFrom2Stubs.h
StripSubdetector::TID
static constexpr auto TID
Definition: StripSubdetector.h:17
deltaPhi.h
TrackerGeometry
Definition: TrackerGeometry.h:14