CMS 3D CMS Logo

TTStubAlgorithm_official.cc
Go to the documentation of this file.
1 
12 
14 template< >
16  int &aDisplacement,
17  int &anOffset,
18  const TTStub< Ref_Phase2TrackerDigi_ > &aTTStub ) const
19 {
21  // These are already corrected for being at the center of each pixel
22  MeasurementPoint mp0 = aTTStub.getClusterRef(0)->findAverageLocalCoordinates();
23  MeasurementPoint mp1 = aTTStub.getClusterRef(1)->findAverageLocalCoordinates();
24 
26  bool isPS = (theTrackerGeom_->getDetectorType(aTTStub.getDetId())==TrackerGeometry::ModuleType::Ph2PSP);
27  // TODO temporary: should use a method from the topology
28  DetId stDetId( aTTStub.getDetId() );
29  const GeomDetUnit* det0 = theTrackerGeom_->idToDetUnit( stDetId+1 );
30  const GeomDetUnit* det1 = theTrackerGeom_->idToDetUnit( stDetId+2 );
31 
33  const PixelGeomDetUnit* pix0 = dynamic_cast< const PixelGeomDetUnit* >( det0 );
34  const PixelGeomDetUnit* pix1 = dynamic_cast< const PixelGeomDetUnit* >( det1 );
35  const PixelTopology* top0 = dynamic_cast< const PixelTopology* >( &(pix0->specificTopology()) );
36  const PixelTopology* top1 = dynamic_cast< const PixelTopology* >( &(pix1->specificTopology()) );
37  std::pair< float, float > pitch0 = top0->pitch();
38  std::pair< float, float > pitch1 = top1->pitch();
39 
41  int cols0 = top0->ncolumns();
42  int cols1 = top1->ncolumns();
43  int ratio = cols0/cols1;
44  int segment0 = floor( mp0.y() / ratio );
45 
46 // if ( ratio == 1 ) /// 2S Modules
47  if (!isPS)
48  {
49  if ( mPerformZMatching2S && ( segment0 != floor( mp1.y() ) ) )
50  return;
51  }
52  else
53  {
54  if ( mPerformZMatchingPS && ( segment0 != floor( mp1.y() ) ) )
55  return;
56  }
57 
59  double R0 = det0->position().perp();
60  double R1 = det1->position().perp();
61  double Z0 = det0->position().z();
62  double Z1 = det1->position().z();
63 
64  double DR = R1-R0;
65  double DZ = Z1-Z0;
66 
67  double alpha = atan2(DR,DZ);
68  double delta = sqrt(DR*DR+DZ*DZ)/(R0*sin(alpha)+Z0*cos(alpha));
69 
70  int window=0;
71 
76 
77 
88  double dispD = 2 * (mp1.x() - mp0.x()) * (pitch0.first / pitch1.first);
89  int dispI = ((dispD>0)-(dispD<0))*floor(std::abs(dispD));
90 
95  double offsetD = 2 * delta * ( mp0.x() - (top0->nrows()/2 - 0.5) ) * (pitch0.first / pitch1.first);
96  int offsetI = ((offsetD>0)-(offsetD<0))*floor(std::abs(offsetD));
97 
98  if (stDetId.subdetId()==StripSubdetector::TOB)
99  {
100  int layer = theTrackerTopo_->layer(stDetId);
101  int ladder = theTrackerTopo_->tobRod(stDetId);
102  int type = 2*theTrackerTopo_->tobSide(stDetId)-3; // -1 for tilted-, 1 for tilted+, 3 for flat
103  double corr=0;
104 
105  if (type<3) // Only for tilted modules
106  {
107  corr = (barrelNTilt.at(layer)+1)/2.;
108  ladder = corr-(corr-ladder)*type; // Corrected ring number, bet 0 and barrelNTilt.at(layer), in ascending |z|
109  window = 2*(tiltedCut.at(layer)).at(ladder);
110  }
111  else // Classis barrel window otherwise
112  {
113  window = 2*barrelCut.at( layer );
114  }
115 
116  }
117  else if (stDetId.subdetId()==StripSubdetector::TID)
118  {
119  window = 2*(ringCut.at( theTrackerTopo_->tidWheel(stDetId))).at(theTrackerTopo_->tidRing(stDetId));
120  }
121 
123  if ( std::abs(dispI - offsetI) <= window )
124  {
125  aConfirmation = true;
126  aDisplacement = dispI;
127  anOffset = offsetI;
128  }
129 
130 }
dbl * delta
Definition: mlp_gen.cc:36
type
Definition: HCALResponse.h:21
virtual int nrows() const =0
float alpha
Definition: AMPTWrapper.h:95
T y() const
Definition: PV2DBase.h:46
static const double Z0
T perp() const
Definition: PV3DBase.h:72
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
virtual std::pair< float, float > pitch() const =0
DetId getDetId() const
Detector element.
Definition: TTStub.h:40
const Surface::PositionType & position() const
The position (origin of the R.F.)
Definition: GeomDet.h:48
T sqrt(T t)
Definition: SSEVec.h:18
T z() const
Definition: PV3DBase.h:64
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
void PatternHitCorrelation(bool &aConfirmation, int &aDisplacement, int &anOffset, const TTStub< T > &aTTStub) const
Matching operations.
def window(xmin, xmax, ymin, ymax, x=0, y=0, width=100, height=100, xlogbase=None, ylogbase=None, minusInfinity=-1000, flipx=False, flipy=True)
Definition: svgfig.py:642
Class to store the L1 Track Trigger stubs.
Definition: TTStub.h:22
JetCorrectorParameters corr
Definition: classes.h:5
Definition: DetId.h:18
virtual const PixelTopology & specificTopology() const
Returns a reference to the pixel proxy topology.
virtual int ncolumns() const =0
T x() const
Definition: PV2DBase.h:45
const edm::Ref< edmNew::DetSetVector< TTCluster< T > >, TTCluster< T > > & getClusterRef(unsigned int hitIdentifier) const
Clusters composing the Stub.
Definition: TTStub.h:103