CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
TTStubAlgorithm_official< T > Class Template Reference

Class for "official" algorithm to be used in TTStubBuilder. More...

#include <TTStubAlgorithm_official.h>

Inheritance diagram for TTStubAlgorithm_official< T >:
TTStubAlgorithm< T >

Public Member Functions

template<>
void PatternHitCorrelation (bool &aConfirmation, int &aDisplacement, int &anOffset, const TTStub< Ref_Phase2TrackerDigi_ > &aTTStub) const
 Implementation of methods of TTStubAlgorithm_official. More...
 
void PatternHitCorrelation (bool &aConfirmation, int &aDisplacement, int &anOffset, const TTStub< T > &aTTStub) const
 Matching operations. More...
 
template<>
void PatternHitCorrelation (bool &aConfirmation, int &aDisplacement, int &anOffset, const TTStub< Ref_Phase2TrackerDigi_ > &aTTStub) const
 Close class. More...
 
 TTStubAlgorithm_official (const TrackerGeometry *const theTrackerGeom, const TrackerTopology *const theTrackerTopo, std::vector< double > setBarrelCut, std::vector< std::vector< double > > setRingCut, std::vector< std::vector< double > > setTiltedCut, std::vector< double > setBarrelNTilt, bool aPerformZMatchingPS, bool aPerformZMatching2S)
 Constructor. More...
 
 ~TTStubAlgorithm_official ()
 Destructor. More...
 
- Public Member Functions inherited from TTStubAlgorithm< T >
virtual std::string AlgorithmName () const
 Algorithm name. More...
 
 TTStubAlgorithm (const TrackerGeometry *const theTrackerGeom, const TrackerTopology *const theTrackerTopo, std::string fName)
 Constructors. More...
 
virtual ~TTStubAlgorithm ()
 Destructor. More...
 

Private Attributes

std::vector< double > barrelCut
 
std::vector< double > barrelNTilt
 
std::string className_
 
bool m_tilted
 
bool mPerformZMatching2S
 
bool mPerformZMatchingPS
 Data members. More...
 
std::vector< std::vector< double > > ringCut
 
std::vector< std::vector< double > > tiltedCut
 

Additional Inherited Members

- Protected Attributes inherited from TTStubAlgorithm< T >
std::string className_
 
const TrackerGeometry *const theTrackerGeom_
 Data members. More...
 
const TrackerTopology *const theTrackerTopo_
 

Detailed Description

template<typename T>
class TTStubAlgorithm_official< T >

Class for "official" algorithm to be used in TTStubBuilder.

HW-friendly algorithm: layer-wise LUT. After moving from SimDataFormats to DataFormats, the template structure of the class was maintained in order to accomodate any types other than PixelDigis in case there is such a need in the future.

Author
Nicola Pozzobon
Sebastien Viret
Date
2013, Jul 18

Definition at line 38 of file TTStubAlgorithm_official.h.

Constructor & Destructor Documentation

template<typename T>
TTStubAlgorithm_official< T >::TTStubAlgorithm_official ( const TrackerGeometry *const  theTrackerGeom,
const TrackerTopology *const  theTrackerTopo,
std::vector< double >  setBarrelCut,
std::vector< std::vector< double > >  setRingCut,
std::vector< std::vector< double > >  setTiltedCut,
std::vector< double >  setBarrelNTilt,
bool  aPerformZMatchingPS,
bool  aPerformZMatching2S 
)
inline

Constructor.

Definition at line 54 of file TTStubAlgorithm_official.h.

60  : TTStubAlgorithm< T >( theTrackerGeom, theTrackerTopo, __func__ )
61  {
62  barrelCut = setBarrelCut;
63  ringCut = setRingCut;
64  tiltedCut = setTiltedCut;
65  barrelNTilt = setBarrelNTilt;
66  mPerformZMatchingPS = aPerformZMatchingPS;
67  mPerformZMatching2S = aPerformZMatching2S;
68  }
Base class for any algorithm to be used in TTStubBuilder.
std::vector< double > barrelNTilt
bool mPerformZMatchingPS
Data members.
std::vector< std::vector< double > > ringCut
std::vector< std::vector< double > > tiltedCut
std::vector< double > barrelCut
template<typename T>
TTStubAlgorithm_official< T >::~TTStubAlgorithm_official ( )
inline

Destructor.

Definition at line 71 of file TTStubAlgorithm_official.h.

References TTStubAlgorithm_official< T >::PatternHitCorrelation().

71 {}

Member Function Documentation

template<>
void TTStubAlgorithm_official< Ref_Phase2TrackerDigi_ >::PatternHitCorrelation ( bool &  aConfirmation,
int &  aDisplacement,
int &  anOffset,
const TTStub< Ref_Phase2TrackerDigi_ > &  aTTStub 
) const

Implementation of methods of TTStubAlgorithm_official.

Here, in the source file, the methods which do depend on the specific type <T> that can fit the template.

Author
Nicola Pozzobon
Sebastien Viret
Date
2013, Jul 18Matching operations

Calculate average coordinates col/row for inner/outer Cluster

Get the module position in global coordinates

Find pixel pitch and topology related information

Stop if the clusters are not in the same z-segment

This assumes the ratio is integer!

PS Modules

Get the Stack radius and z and displacements

Scale factor is already present in double mPtScalingFactor = (floor(mMagneticFieldStrength*10.0 + 0.5))/10.0*0.0015/mPtThreshold; hence the formula iis something like displacement < Delta * 1 / sqrt( ( 1/(mPtScalingFactor*R) )** 2 - 1 )

POSITION IN TERMS OF PITCH MULTIPLES: 0 1 2 3 4 5 5 6 8 9 ... COORD: 0 1 2 3 4 5 6 7 8 9 ... OUT | | | | | |x| | | | | | | | | |

IN | | | |x|x| | | | | | | | | | | THIS is 3.5 (COORD) and 4.0 (POS) 1) disp is the difference between average row coordinates in inner and outer stack member, in terms of outer member pitch (in case they are the same, this is just a plain coordinate difference)

In HALF-STRIP units!

In HALF-STRIP units!

2) offset is the projection with a straight line of the innermost hit towards the ourermost stack member, still in terms of outer member pitch NOTE: in terms of coordinates, the center of the module is at NROWS/2-0.5 to be consistent with the definition given above

In HALF-STRIP units!

In HALF-STRIP units!

Accept the stub if the post-offset correction displacement is smaller than the half-window

In HALF-STRIP units!

In HALF-STRIP units!

In HALF-STRIP units!

End of stub is accepted

Definition at line 15 of file TTStubAlgorithm_official.cc.

References funct::abs(), alpha, corr, funct::cos(), delta, TTStub< T >::getClusterRef(), TTStub< T >::getDetId(), PVValHelper::ladder, PixelTopology::ncolumns(), PixelTopology::nrows(), PV3DBase< T, PVType, FrameType >::perp(), TrackerGeometry::Ph2PSP, PixelTopology::pitch(), GeomDet::position(), pfBoostedDoubleSVAK8TagInfos_cfi::R0, particleFlowDisplacedVertex_cfi::ratio, funct::sin(), PixelGeomDetUnit::specificTopology(), mathSSE::sqrt(), StripSubdetector::TID, StripSubdetector::TOB, svgfig::window(), PV2DBase< T, PVType, FrameType >::x(), PV2DBase< T, PVType, FrameType >::y(), PV3DBase< T, PVType, FrameType >::z(), and Z0.

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 
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
unsigned int tidRing(const DetId &id) const
const TrackerGeometry *const theTrackerGeom_
Data members.
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
virtual std::pair< float, float > pitch() const =0
unsigned int tidWheel(const DetId &id) const
DetId getDetId() const
Detector element.
Definition: TTStub.h:40
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
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
unsigned int tobSide(const DetId &id) const
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
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
std::vector< double > barrelNTilt
ModuleType getDetectorType(DetId) const
JetCorrectorParameters corr
Definition: classes.h:5
bool mPerformZMatchingPS
Data members.
Definition: DetId.h:18
const TrackerTopology *const theTrackerTopo_
std::vector< std::vector< double > > ringCut
virtual const PixelTopology & specificTopology() const
Returns a reference to the pixel proxy topology.
std::vector< std::vector< double > > tiltedCut
unsigned int layer(const DetId &id) const
virtual int ncolumns() const =0
std::vector< double > barrelCut
unsigned int tobRod(const DetId &id) const
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
template<typename T>
void TTStubAlgorithm_official< T >::PatternHitCorrelation ( bool &  aConfirmation,
int &  aDisplacement,
int &  anOffset,
const TTStub< T > &  aTTStub 
) const
virtual

Matching operations.

Reimplemented from TTStubAlgorithm< T >.

Referenced by TTStubAlgorithm_official< T >::~TTStubAlgorithm_official().

template<>
void TTStubAlgorithm_official< Ref_Phase2TrackerDigi_ >::PatternHitCorrelation ( bool &  aConfirmation,
int &  aDisplacement,
int &  anOffset,
const TTStub< Ref_Phase2TrackerDigi_ > &  aTTStub 
) const

Close class.

Implementation of methods

Here, in the header file, the methods which do not depend on the specific type <T> that can fit the template. Other methods, with type-specific features, are implemented in the source file.Matching operations

Member Data Documentation

template<typename T>
std::vector< double > TTStubAlgorithm_official< T >::barrelCut
private

Definition at line 47 of file TTStubAlgorithm_official.h.

template<typename T>
std::vector< double > TTStubAlgorithm_official< T >::barrelNTilt
private

Definition at line 50 of file TTStubAlgorithm_official.h.

template<typename T>
std::string TTStubAlgorithm_official< T >::className_
private

Definition at line 45 of file TTStubAlgorithm_official.h.

template<typename T>
bool TTStubAlgorithm_official< T >::m_tilted
private

Definition at line 44 of file TTStubAlgorithm_official.h.

template<typename T>
bool TTStubAlgorithm_official< T >::mPerformZMatching2S
private
template<typename T>
bool TTStubAlgorithm_official< T >::mPerformZMatchingPS
private

Data members.

Definition at line 42 of file TTStubAlgorithm_official.h.

Referenced by ES_TTStubAlgorithm_official< T >::produce().

template<typename T>
std::vector< std::vector< double > > TTStubAlgorithm_official< T >::ringCut
private

Definition at line 48 of file TTStubAlgorithm_official.h.

template<typename T>
std::vector< std::vector< double > > TTStubAlgorithm_official< T >::tiltedCut
private

Definition at line 49 of file TTStubAlgorithm_official.h.