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

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 Exception, TTTrack< T >::getRInv(), TTTrack< T >::getStubRefs(), TrackerGeometry::idToDet(), TrackerGeometry::idToDetUnit(), GeomDetEnumerators::isBarrel(), Topology::localPosition(), SiStripPI::max, min(), TrackerTopology::partnerDetId(), PV3DBase< T, PVType, FrameType >::perp(), PixelTopology::pitch(), GeomDet::position(), PixelGeomDetUnit::specificTopology(), mathSSE::sqrt(), DetId::subdetId(), GeomDet::surface(), StripSubdetector::TOB, TrackerTopology::tobSide(), Surface::toGlobal(), GeomDet::topology(), csvLumiCalc::unit, and PV3DBase< T, PVType, FrameType >::z().

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