CMS 3D CMS Logo

Functions
StubPtConsistency Namespace Reference

Functions

float getConsistency (TTTrack< Ref_Phase2TrackerDigi_ > aTrack, const TrackerGeometry *theTrackerGeom, const TrackerTopology *tTopo, double mMagneticFieldStrength, int nPar)
 

Function Documentation

◆ getConsistency()

float StubPtConsistency::getConsistency ( TTTrack< Ref_Phase2TrackerDigi_ aTrack,
const TrackerGeometry theTrackerGeom,
const TrackerTopology tTopo,
double  mMagneticFieldStrength,
int  nPar 
)

Definition at line 9 of file StubPtConsistency.cc.

References funct::abs(), pfMETCorrectionType0_cfi::correction, Exception, TTTrack< T >::getStubRefs(), TrackerGeometry::idToDet(), TrackerGeometry::idToDetUnit(), PixelPluginsPhase0_cfi::isBarrel, Topology::localPosition(), SiStripPI::max, SiStripPI::min, HcalResponse_cfi::nPar, TrackerTopology::partnerDetId(), PV3DBase< T, PVType, FrameType >::perp(), PixelTopology::pitch(), GeomDet::position(), TTTrack< T >::rInv(), mathSSE::sqrt(), DetId::subdetId(), GeomDet::surface(), StripSubdetector::TOB, TrackerTopology::tobSide(), Surface::toGlobal(), GeomDet::topology(), unit(), and PV3DBase< T, PVType, FrameType >::z().

Referenced by L1FPGATrackProducer::produce().

13  {
14  if (!(nPar == 4 || nPar == 5))
15  throw cms::Exception("IncorrectInput") << "Not a valid nPar option!";
16 
17  double trk_bendchi2 = 0.0;
18  double bend_resolution = 0.483;
19  // B*c/2E11 - converts q/pt to track angle at some radius from beamline
20  float speedOfLightConverted = CLHEP::c_light / 1.0E5;
21 
22  // Need the pT signed in order to determine if bend is positive or negative
23  // P(MeV/c) = (c/10^9)·Q·B(kG)·R(cm)
24  float trk_signedPt = speedOfLightConverted * mMagneticFieldStrength / aTrack.rInv();
25 
26  // loop over stubs
27  const auto& stubRefs = aTrack.getStubRefs();
28  int nStubs = stubRefs.size();
29 
30  for (const auto& stubRef : stubRefs) {
31  DetId detIdStub = theTrackerGeom->idToDet((stubRef->clusterRef(0))->getDetId())->geographicalId();
32  MeasurementPoint coords = stubRef->clusterRef(0)->findAverageLocalCoordinatesCentered();
33  const GeomDet* theGeomDet = theTrackerGeom->idToDet(detIdStub);
34  Global3DPoint posStub = theGeomDet->surface().toGlobal(theGeomDet->topology().localPosition(coords));
35 
36  float stub_r = posStub.perp();
37  float stub_z = posStub.z();
38 
39  bool isBarrel = (detIdStub.subdetId() == StripSubdetector::TOB);
40 
41  const GeomDetUnit* det0 = theTrackerGeom->idToDetUnit(detIdStub);
42  const GeomDetUnit* det1 = theTrackerGeom->idToDetUnit(tTopo->partnerDetId(detIdStub));
43  const PixelGeomDetUnit* unit = reinterpret_cast<const PixelGeomDetUnit*>(det0);
44  const PixelTopology& topo = unit->specificTopology();
45 
46  // Calculation of snesor spacing obtained from TMTT: https://github.com/CMS-TMTT/cmssw/blob/TMTT_938/L1Trigger/TrackFindingTMTT/src/Stub.cc#L138-L146
47  float stripPitch = topo.pitch().first;
48 
49  float modMinR = std::min(det0->position().perp(), det1->position().perp());
50  float modMaxR = std::max(det0->position().perp(), det1->position().perp());
51  float modMinZ = std::min(det0->position().z(), det1->position().z());
52  float modMaxZ = std::max(det0->position().z(), det1->position().z());
53  float sensorSpacing = sqrt((modMaxR - modMinR) * (modMaxR - modMinR) + (modMaxZ - modMinZ) * (modMaxZ - modMinZ));
54 
55  // Approximation of phiOverBendCorrection, from TMTT: https://github.com/CMS-TMTT/cmssw/blob/TMTT_938/L1Trigger/TrackFindingTMTT/src/Stub.cc#L440-L448
56  bool tiltedBarrel = (isBarrel && tTopo->tobSide(detIdStub) != 3);
57  float gradient = 0.886454;
58  float intercept = 0.504148;
59  float correction;
60  if (tiltedBarrel)
61  correction = gradient * std::abs(stub_z) / stub_r + intercept;
62  else if (isBarrel)
63  correction = 1;
64  else
65  correction = std::abs(stub_z) / stub_r;
66 
67  float stubBend = stubRef->bendFE();
68  if (!isBarrel && stub_z < 0.0)
69  stubBend = -stubBend; // flip sign of bend if in negative end cap
70 
71  float trackBend = -(sensorSpacing * stub_r * mMagneticFieldStrength * (speedOfLightConverted / 2)) /
72  (stripPitch * trk_signedPt * correction);
73  float bendDiff = trackBend - stubBend;
74 
75  trk_bendchi2 += (bendDiff * bendDiff) / (bend_resolution * bend_resolution);
76  } // end loop over stubs
77 
78  float bendchi2 = trk_bendchi2 / nStubs;
79  return bendchi2;
80  } //end getConsistency()
T perp() const
Definition: PV3DBase.h:69
unsigned int tobSide(const DetId &id) const
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
T sqrt(T t)
Definition: SSEVec.h:19
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
double rInv() const
Track curvature.
Definition: TTTrack.h:300
constexpr int subdetId() const
get the contents of the subdetector field (not cast into any detector&#39;s numbering enum) ...
Definition: DetId.h:48
DetId partnerDetId(const DetId &id) const
static constexpr auto TOB
Basic3DVector unit() const
const TrackerGeomDet * idToDet(DetId) const override
std::vector< edm::Ref< edmNew::DetSetVector< TTStub< T > >, TTStub< T > > > getStubRefs() const
Track components.
Definition: TTTrack.h:93
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
const Surface::PositionType & position() const
The position (origin of the R.F.)
Definition: GeomDet.h:43
virtual std::pair< float, float > pitch() const =0