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);
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;
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.;