31 const GeomDetUnit* det0 = theTrackerGeom_->idToDetUnit(stDetId + 1);
32 const GeomDetUnit* det1 = theTrackerGeom_->idToDetUnit(stDetId + 2);
39 std::pair<float, float> pitch0 = top0->
pitch();
40 std::pair<float, float> pitch1 = top1->
pitch();
45 int ratio = cols0 / cols1;
46 int segment0 = floor(mp0.
y() / ratio);
50 if (mPerformZMatching2S && (segment0 != floor(mp1.
y())))
54 if (mPerformZMatchingPS && (segment0 != floor(mp1.
y())))
59 double R0 = det0->position().perp();
61 double Z0 = det0->position().z();
67 double alpha = atan2(DR, DZ);
68 double delta =
sqrt(DR * DR + DZ * DZ) / (R0 *
sin(alpha) + Z0 *
cos(alpha));
87 double dispD = 2 * (mp1.
x() - mp0.
x()) * (pitch0.first / pitch1.first);
88 int dispI = ((dispD > 0) - (dispD < 0)) * floor(
std::abs(dispD));
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));
99 int layer = theTrackerTopo_->layer(stDetId);
100 int ladder = theTrackerTopo_->tobRod(stDetId);
101 int type = 2 * theTrackerTopo_->tobSide(stDetId) - 3;
106 corr = (barrelNTilt.at(layer) + 1) / 2.;
108 ladder = corr - (corr -
ladder) * type;
109 window = 2 * (tiltedCut.at(layer)).at(ladder);
112 window = 2 * barrelCut.at(layer);
116 window = 2 * (ringCut.at(theTrackerTopo_->tidWheel(stDetId))).at(theTrackerTopo_->tidRing(stDetId));
122 aConfirmation =
true;
123 aDisplacement = dispI;
125 anHardBend = this->degradeBend(isPS, window, (aDisplacement - anOffset));
133 const unsigned int bitsPS_ = 3;
134 const unsigned int bits2S_ = 4;
146 unsigned int numBends = 2 * window + 1;
147 unsigned int numAllowed = (psModule) ?
pow(2, bitsPS_) :
pow(2, bits2S_);
151 if (numBends <= numAllowed) {
153 degradedB =
static_cast<double>(bend);
156 unsigned int inSmallGroup = numBends / numAllowed;
157 unsigned int numLargeGroups = numBends % numAllowed;
158 unsigned int inLargeGroup = inSmallGroup + 1;
159 unsigned int numSmallGroups = numAllowed - numLargeGroups;
161 std::vector<unsigned int> groups;
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);
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);
184 throw cms::Exception(
"DegradeBend: logic error with odd numbers");
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);
193 int iUp = -
static_cast<int>(
window) - 1;
196 for (
unsigned int& inGroup : groups) {
198 iDown = iUp - inGroup + 1;
199 if (bend <= iUp && bend >= iDown) {
200 degradedB = 0.5 * (iUp + iDown);
203 if (degradedB == 999)
205 "DegradeStubResolution: error in the group creation, method has been called with wrong inputs");
209 return static_cast<float>(degradedB) / 2.;
virtual int ncolumns() const =0
float degradeBend(bool psModule, int window, int bend) const
Sin< T >::type sin(const T &t)
virtual int nrows() const =0
DetId getDetId() const
Detector element.
constexpr std::array< uint8_t, layerIndexSize > layer
void PatternHitCorrelation(bool &aConfirmation, int &aDisplacement, int &anOffset, float &anHardBend, const TTStub< T > &aTTStub) const override
Matching operations.
const Surface::PositionType & position() const
The position (origin of the R.F.)
Cos< T >::type cos(const T &t)
Abs< T >::type abs(const T &t)
static constexpr auto TOB
Class to store the L1 Track Trigger stubs.
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/SLHCTrackerTriggerSWTo...
virtual const PixelTopology & specificTopology() const
Returns a reference to the pixel proxy topology.
virtual std::pair< float, float > pitch() const =0
static constexpr auto TID
Power< A, B >::type pow(const A &a, const B &b)
bool moduleTypePS() const
check if a PS module