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 );
51 if ( mPerformZMatching2S && ( segment0 != floor( mp1.
y() ) ) )
56 if ( mPerformZMatchingPS && ( segment0 != floor( mp1.
y() ) ) )
61 double R0 = det0->position().perp();
63 double Z0 = det0->position().z();
69 double alpha = atan2(DR,DZ);
90 double dispD = 2 * (mp1.
x() - mp0.
x()) * (pitch0.first / pitch1.first);
91 int dispI = ((dispD>0)-(dispD<0))*floor(
std::abs(dispD));
97 double offsetD = 2 * delta * ( mp0.
x() - (top0->
nrows()/2 - 0.5) ) * (pitch0.first / pitch1.first);
98 int offsetI = ((offsetD>0)-(offsetD<0))*floor(
std::abs(offsetD));
102 int layer = theTrackerTopo_->layer(stDetId);
103 int ladder = theTrackerTopo_->tobRod(stDetId);
104 int type = 2*theTrackerTopo_->tobSide(stDetId)-3;
109 corr = (barrelNTilt.at(layer)+1)/2.;
110 ladder = corr-(corr-
ladder)*type;
111 window = 2*(tiltedCut.at(layer)).at(ladder);
121 window = 2*(ringCut.at( theTrackerTopo_->tidWheel(stDetId))).at(theTrackerTopo_->tidRing(stDetId));
127 aConfirmation =
true;
128 aDisplacement = dispI;
130 anROffset =
static_cast<float>(offsetD);
131 anHardBend = this->degradeBend(isPS, window, (aDisplacement - anOffset));
142 const unsigned int bitsPS_ = 3;
143 const unsigned int bits2S_ = 4;
155 unsigned int numBends = 2*window + 1;
156 unsigned int numAllowed = (psModule) ?
pow(2, bitsPS_) :
pow(2, bits2S_);
160 if (numBends <= numAllowed)
163 degradedB =
static_cast<double>(bend);
167 unsigned int inSmallGroup = numBends/numAllowed;
168 unsigned int numLargeGroups = numBends%numAllowed;
169 unsigned int inLargeGroup = inSmallGroup + 1;
170 unsigned int numSmallGroups = numAllowed - numLargeGroups;
172 std::vector<unsigned int> groups;
184 for (
unsigned int i = 0;
i < numLargeGroups/2;
i++) groups.push_back(inLargeGroup);
185 for (
unsigned int i = 0;
i < numSmallGroups/2;
i++) groups.push_back(inSmallGroup);
189 if (numLargeGroups%2 == 1 && inLargeGroup%2 == 1)
191 groups.push_back(inLargeGroup);
192 }
else if (numSmallGroups%2 == 1 && inSmallGroup%2 == 1) {
193 groups.push_back(inSmallGroup);
195 throw cms::Exception(
"DegradeBend: logic error with odd numbers");
198 for (
unsigned int i = 0;
i < numSmallGroups/2;
i++) groups.push_back(inSmallGroup);
199 for (
unsigned int i = 0;
i < numLargeGroups/2;
i++) groups.push_back(inLargeGroup);
202 int iUp = -
static_cast<int>(
window) - 1;
205 for (
unsigned int& inGroup: groups)
208 iDown = iUp - inGroup + 1;
209 if (bend <= iUp && bend >= iDown)
211 degradedB = 0.5*(iUp + iDown);
214 if (degradedB == 999)
throw cms::Exception(
"DegradeStubResolution: error in the group creation, method has been called with wrong inputs");
218 return static_cast<float>(degradedB)/2.;
void PatternHitCorrelation(bool &aConfirmation, int &aDisplacement, int &anOffset, float &anROffset, float &anHardBend, const TTStub< T > &aTTStub) const override
Matching operations.
virtual int nrows() const =0
float degradeBend(bool psModule, int window, int bend) const
Sin< T >::type sin(const T &t)
virtual std::pair< float, float > pitch() const =0
DetId getDetId() const
Detector element.
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)
def window(xmin, xmax, ymin, ymax, x=0, y=0, width=100, height=100, xlogbase=None, ylogbase=None, minusInfinity=-1000, flipx=False, flipy=True)
Class to store the L1 Track Trigger stubs.
virtual const PixelTopology & specificTopology() const
Returns a reference to the pixel proxy topology.
virtual int ncolumns() const =0
const edm::Ref< edmNew::DetSetVector< TTCluster< T > >, TTCluster< T > > & getClusterRef(unsigned int hitIdentifier) const
Clusters composing the Stub.
Power< A, B >::type pow(const A &a, const B &b)