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.

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 * fabs(stub_z) / stub_r + intercept;
62  else if (isBarrel)
63  correction = 1;
64  else
65  correction = fabs(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()

References pfMETCorrectionType0_cfi::correction, Exception, TTTrack< T >::getStubRefs(), TrackerGeometry::idToDet(), TrackerGeometry::idToDetUnit(), PixelPluginsPhase0_cfi::isBarrel, Topology::localPosition(), SiStripPI::max, 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().

GeomDet::position
const Surface::PositionType & position() const
The position (origin of the R.F.)
Definition: GeomDet.h:43
TrackerGeometry::idToDet
const TrackerGeomDet * idToDet(DetId) const override
Definition: TrackerGeometry.cc:193
Point2DBase
Definition: Point2DBase.h:9
GeomDet
Definition: GeomDet.h:27
min
T min(T a, T b)
Definition: MathUtil.h:58
PixelTopology::pitch
virtual std::pair< float, float > pitch() const =0
GeomDet::topology
virtual const Topology & topology() const
Definition: GeomDet.cc:67
Topology::localPosition
virtual LocalPoint localPosition(const MeasurementPoint &) const =0
TTTrack::rInv
double rInv() const
Track curvature.
Definition: TTTrack.h:300
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
HcalResponse_cfi.nPar
nPar
Definition: HcalResponse_cfi.py:33
DetId
Definition: DetId.h:17
TTTrack::getStubRefs
std::vector< edm::Ref< edmNew::DetSetVector< TTStub< T > >, TTStub< T > > > getStubRefs() const
Track components.
Definition: TTTrack.h:93
GeomDet::surface
const Plane & surface() const
The nominal surface of the GeomDet.
Definition: GeomDet.h:37
PixelGeomDetUnit
Definition: PixelGeomDetUnit.h:15
mathSSE::sqrt
T sqrt(T t)
Definition: SSEVec.h:19
Surface::toGlobal
GlobalPoint toGlobal(const Point2DBase< Scalar, LocalTag > lp) const
Definition: Surface.h:79
TrackerTopology::partnerDetId
DetId partnerDetId(const DetId &id) const
Definition: TrackerTopology.cc:233
Point3DBase< float, GlobalTag >
PixelTopology
Definition: PixelTopology.h:10
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
PixelPluginsPhase0_cfi.isBarrel
isBarrel
Definition: PixelPluginsPhase0_cfi.py:17
SiStripPI::max
Definition: SiStripPayloadInspectorHelper.h:169
pfMETCorrectionType0_cfi.correction
correction
Definition: pfMETCorrectionType0_cfi.py:39
unit
Basic3DVector unit() const
Definition: Basic3DVectorLD.h:162
Exception
Definition: hltDiff.cc:245
StripSubdetector::TOB
static constexpr auto TOB
Definition: StripSubdetector.h:18
PV3DBase::perp
T perp() const
Definition: PV3DBase.h:69
TrackerTopology::tobSide
unsigned int tobSide(const DetId &id) const
Definition: TrackerTopology.h:180