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

float degradeBend (bool psModule, int window, int bend) const
 
template<>
float degradeBend (bool psModule, int window, int bend) const
 
template<>
float degradeBend (bool psModule, int window, int bend) const
 
template<>
void PatternHitCorrelation (bool &aConfirmation, int &aDisplacement, int &anOffset, float &anHardBend, const TTStub< Ref_Phase2TrackerDigi_ > &aTTStub) const
 Implementation of methods of TTStubAlgorithm_official. More...
 
void PatternHitCorrelation (bool &aConfirmation, int &aDisplacement, int &anOffset, float &anHardBend, const TTStub< T > &aTTStub) const override
 Matching operations. More...
 
template<>
void PatternHitCorrelation (bool &aConfirmation, int &aDisplacement, int &anOffset, float &anHardBend, 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 () override
 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 37 of file TTStubAlgorithm_official.h.

Constructor & Destructor Documentation

◆ TTStubAlgorithm_official()

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 52 of file TTStubAlgorithm_official.h.

References TTStubAlgorithm_official< T >::barrelCut, TTStubAlgorithm_official< T >::barrelNTilt, TTStubAlgorithm_official< T >::mPerformZMatching2S, TTStubAlgorithm_official< T >::mPerformZMatchingPS, TTStubAlgorithm_official< T >::ringCut, and TTStubAlgorithm_official< T >::tiltedCut.

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

◆ ~TTStubAlgorithm_official()

template<typename T >
TTStubAlgorithm_official< T >::~TTStubAlgorithm_official ( )
inlineoverride

Destructor.

Definition at line 70 of file TTStubAlgorithm_official.h.

70 {}

Member Function Documentation

◆ degradeBend() [1/3]

template<typename T >
float TTStubAlgorithm_official< T >::degradeBend ( bool  psModule,
int  window,
int  bend 
) const

◆ degradeBend() [2/3]

template<>
float TTStubAlgorithm_official< Ref_Phase2TrackerDigi_ >::degradeBend ( bool  psModule,
int  window,
int  bend 
) const

◆ degradeBend() [3/3]

template<>
float TTStubAlgorithm_official< Ref_Phase2TrackerDigi_ >::degradeBend ( bool  psModule,
int  window,
int  bend 
) const

Definition at line 131 of file TTStubAlgorithm_official.cc.

References Exception, mps_fire::i, funct::pow(), and svgfig::window().

131  {
132  // Number of bits used to encoded bend output by FE electronics.
133  const unsigned int bitsPS_ = 3;
134  const unsigned int bits2S_ = 4;
135 
136  // Number of degraded bend values should correspond to 3 bits (PS modules) or 4 bits (2S modules),
137  // so measuring everything in half-strip units, max integer "window" size that can be encoded without
138  // compression given by 2*window+1 <= pow(2,B), where B is number of bits.
139  // Hence no compression required if window cut is abs(b) <= 3 (PS) or 7 (2S). Must introduce one merge for
140  // each 1 unit increase in "window" beyond this.
141 
142  // Bend is measured with granularity of 0.5 strips.
143  // Convert it to integer measured in half-strip units for this calculation!
144 
145  float degradedB;
146  unsigned int numBends = 2 * window + 1;
147  unsigned int numAllowed = (psModule) ? pow(2, bitsPS_) : pow(2, bits2S_);
148 
149  // Existance of bend = 0 means can only use an odd number of groups.
150  numAllowed -= 1; // NumAllowed can be only based on 3 or 4 bits encoded bends, so 7 or 15 possible values
151  if (numBends <= numAllowed) {
152  // Can output uncompressed bend info. (So if window is lower or equal than 1.5 in PS, and 3.5 in 2S
153  degradedB = static_cast<double>(bend);
154  } else // all other cases, need to compress
155  {
156  unsigned int inSmallGroup = numBends / numAllowed;
157  unsigned int numLargeGroups = numBends % numAllowed;
158  unsigned int inLargeGroup = inSmallGroup + 1;
159  unsigned int numSmallGroups = numAllowed - numLargeGroups;
160 
161  std::vector<unsigned int> groups;
162 
163  // At the end we have
164  //
165  // numBends=inSmallGroup*numSmallGroups+inLargeGroup*numLargeGroups
166  // and
167  // numAllowed= numSmallGroups+numLargeGroups;
168  //
169  // Then you alternate large-small-large-small....large. In the middle, you
170  // put either large or small, depending if group size is odd or not
171 
172  for (unsigned int i = 0; i < numLargeGroups / 2; i++)
173  groups.push_back(inLargeGroup);
174  for (unsigned int i = 0; i < numSmallGroups / 2; i++)
175  groups.push_back(inSmallGroup);
176 
177  // Only one of numLargeGroups & numSmallGroups can be odd, since numAllowed is odd.
178  // And whichever one is odd is associated to a group with an odd number of elements since numBends is odd,
179  if (numLargeGroups % 2 == 1 && inLargeGroup % 2 == 1) {
180  groups.push_back(inLargeGroup);
181  } else if (numSmallGroups % 2 == 1 && inSmallGroup % 2 == 1) {
182  groups.push_back(inSmallGroup);
183  } else {
184  throw cms::Exception("DegradeBend: logic error with odd numbers");
185  }
186 
187  for (unsigned int i = 0; i < numSmallGroups / 2; i++)
188  groups.push_back(inSmallGroup);
189  for (unsigned int i = 0; i < numLargeGroups / 2; i++)
190  groups.push_back(inLargeGroup);
191 
192  degradedB = 999;
193  int iUp = -static_cast<int>(window) - 1; // Start with the minimal possible bend -1
194  int iDown;
195 
196  for (unsigned int& inGroup : groups) {
197  iUp += inGroup;
198  iDown = iUp - inGroup + 1;
199  if (bend <= iUp && bend >= iDown) {
200  degradedB = 0.5 * (iUp + iDown);
201  }
202  }
203  if (degradedB == 999)
204  throw cms::Exception(
205  "DegradeStubResolution: error in the group creation, method has been called with wrong inputs");
206  }
207 
208  // This is degraded bend in full strip units (neglecting bend sign).
209  return static_cast<float>(degradedB) / 2.;
210 }
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:643
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:29

◆ PatternHitCorrelation() [1/3]

template<>
void TTStubAlgorithm_official< Ref_Phase2TrackerDigi_ >::PatternHitCorrelation ( bool &  aConfirmation,
int &  aDisplacement,
int &  anOffset,
float &  anHardBend,
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(), simBeamSpotPI::alpha, HLT_2024v12_cff::barrelCut, TTStub< T >::clusterRef(), alignCSCRings::corr, funct::cos(), dumpMFGeometry_cfg::delta, ChannelAssignment_cfi::DR, TTStub< T >::getDetId(), PVValHelper::ladder, nano_mu_digi_cff::layer, TTStub< T >::moduleTypePS(), PixelTopology::ncolumns(), PixelTopology::nrows(), PV3DBase< T, PVType, FrameType >::perp(), PixelTopology::pitch(), GeomDet::position(), HLT_2024v12_cff::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.

20  {
22  // These are already corrected for being at the center of each pixel
23  MeasurementPoint mp0 = aTTStub.clusterRef(0)->findAverageLocalCoordinates();
24  MeasurementPoint mp1 = aTTStub.clusterRef(1)->findAverageLocalCoordinates();
25 
26  bool isPS = aTTStub.moduleTypePS(); // get it from the stub now
27 
29  // TODO temporary: should use a method from the topology
30  DetId stDetId(aTTStub.getDetId());
31  const GeomDetUnit* det0 = theTrackerGeom_->idToDetUnit(stDetId + 1);
32  const GeomDetUnit* det1 = theTrackerGeom_->idToDetUnit(stDetId + 2);
33 
35  const PixelGeomDetUnit* pix0 = dynamic_cast<const PixelGeomDetUnit*>(det0);
36  const PixelGeomDetUnit* pix1 = dynamic_cast<const PixelGeomDetUnit*>(det1);
37  const PixelTopology* top0 = dynamic_cast<const PixelTopology*>(&(pix0->specificTopology()));
38  const PixelTopology* top1 = dynamic_cast<const PixelTopology*>(&(pix1->specificTopology()));
39  std::pair<float, float> pitch0 = top0->pitch();
40  std::pair<float, float> pitch1 = top1->pitch();
41 
43  int cols0 = top0->ncolumns();
44  int cols1 = top1->ncolumns();
45  int ratio = cols0 / cols1;
46  int segment0 = floor(mp0.y() / ratio);
47 
48  // if ( ratio == 1 ) /// 2S Modules
49  if (!isPS) {
50  if (mPerformZMatching2S && (segment0 != floor(mp1.y())))
51  return;
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 
87  double dispD = 2 * (mp1.x() - mp0.x()) * (pitch0.first / pitch1.first);
88  int dispI = ((dispD > 0) - (dispD < 0)) * floor(std::abs(dispD));
89 
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  int layer = theTrackerTopo_->layer(stDetId);
100  int ladder = theTrackerTopo_->tobRod(stDetId);
101  int type = 2 * theTrackerTopo_->tobSide(stDetId) - 3; // -1 for tilted-, 1 for tilted+, 3 for flat
102  double corr = 0;
103 
104  if (type < 3) // Only for tilted modules
105  {
106  corr = (barrelNTilt.at(layer) + 1) / 2.;
107  // Corrected ring number, bet 0 and barrelNTilt.at(layer), in ascending |z|
108  ladder = corr - (corr - ladder) * type;
109  window = 2 * (tiltedCut.at(layer)).at(ladder);
110  } else // Classis barrel window otherwise
111  {
112  window = 2 * barrelCut.at(layer);
113  }
114 
115  } else if (stDetId.subdetId() == StripSubdetector::TID) {
116  window = 2 * (ringCut.at(theTrackerTopo_->tidWheel(stDetId))).at(theTrackerTopo_->tidRing(stDetId));
117  }
118 
120  if (std::abs(dispI - offsetI) <= window)
121  {
122  aConfirmation = true;
123  aDisplacement = dispI;
124  anOffset = offsetI;
125  anHardBend = this->degradeBend(isPS, window, (aDisplacement - anOffset)); // In strips units
126  }
127 }
const edm::Ref< edmNew::DetSetVector< TTCluster< T > >, TTCluster< T > > & clusterRef(unsigned int hitStackMember) const
Clusters composing the Stub – see https://twiki.cern.ch/twiki/bin/viewauth/CMS/SLHCTrackerTriggerSWT...
Definition: TTStub.h:150
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 int ncolumns() const =0
T z() const
Definition: PV3DBase.h:61
const TrackerGeometry *const theTrackerGeom_
Data members.
unsigned int tidWheel(const DetId &id) const
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
virtual int nrows() const =0
T x() const
Definition: PV2DBase.h:43
DetId getDetId() const
Detector element.
Definition: TTStub.h:44
unsigned int layer(const DetId &id) const
T y() const
Definition: PV2DBase.h:44
std::vector< double > barrelNTilt
std::vector< std::vector< double > > ringCut
dictionary corr
T sqrt(T t)
Definition: SSEVec.h:19
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
float degradeBend(bool psModule, int window, int bend) const
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:643
bool moduleTypePS() const
check if a PS module
Definition: TTStub.h:194
static constexpr auto TOB
bool mPerformZMatchingPS
Data members.
Definition: DetId.h:17
std::vector< double > barrelCut
const TrackerTopology *const theTrackerTopo_
static const double Z0
unsigned int tobRod(const DetId &id) const
const Surface::PositionType & position() const
The position (origin of the R.F.)
Definition: GeomDet.h:43
std::vector< std::vector< double > > tiltedCut
virtual const PixelTopology & specificTopology() const
Returns a reference to the pixel proxy topology.
unsigned int tidRing(const DetId &id) const
virtual std::pair< float, float > pitch() const =0
static constexpr auto TID

◆ PatternHitCorrelation() [2/3]

template<typename T >
void TTStubAlgorithm_official< T >::PatternHitCorrelation ( bool &  aConfirmation,
int &  aDisplacement,
int &  anOffset,
float &  anHardBend,
const TTStub< T > &  aTTStub 
) const
overridevirtual

Matching operations.

Reimplemented from TTStubAlgorithm< T >.

◆ PatternHitCorrelation() [3/3]

template<>
void TTStubAlgorithm_official< Ref_Phase2TrackerDigi_ >::PatternHitCorrelation ( bool &  aConfirmation,
int &  aDisplacement,
int &  anOffset,
float &  anHardBend,
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

◆ barrelCut

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

◆ barrelNTilt

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

◆ className_

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

Definition at line 43 of file TTStubAlgorithm_official.h.

◆ m_tilted

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

Definition at line 42 of file TTStubAlgorithm_official.h.

◆ mPerformZMatching2S

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

◆ mPerformZMatchingPS

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

Data members.

Definition at line 40 of file TTStubAlgorithm_official.h.

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

◆ ringCut

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

◆ tiltedCut

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