49 std::vector<float>
x,
y, gz;
52 for (
int i = 0;
i < 6; ++
i) {
60 for (ChamberHitContainer::const_iterator it =
rechits.begin(); it !=
rechits.end(); ++it) {
63 int l_id =
id.layer();
69 x[l_id - 1] += lp.
x();
70 y[l_id - 1] += lp.
y();
71 gz[l_id - 1] +=
gp.z();
75 float avgChamberX = 0.;
76 float avgChamberY = 0.;
79 for (
unsigned i = 0;
i < 6; ++
i) {
91 avgChamberX = avgChamberX / n_lay;
92 avgChamberY = avgChamberY / n_lay;
98 LocalPoint lpCOM(avgChamberX, avgChamberY, 0.);
102 float Gdxdz = gpCOM.
x() / gpCOM.
z();
103 float Gdydz = gpCOM.
y() / gpCOM.
z();
107 std::vector<LocalPoint> layerPoints;
109 for (
size_t i = 0;
i != 6; ++
i) {
114 float layer_Z =
gp.z();
117 float layer_X = Gdxdz * layer_Z;
118 float layer_Y = Gdydz * layer_Z;
122 float layerX = Lintersect.
x();
123 float layerY = Lintersect.
y();
124 float layerZ = Lintersect.
z();
125 LocalPoint layerPoint(layerX, layerY, layerZ);
126 layerPoints.push_back(layerPoint);
129 std::vector<float> r_closest;
131 for (
size_t i = 0;
i != 6; ++
i) {
133 r_closest.push_back(9999.);
139 for (ChamberHitContainer::const_iterator it =
rechits.begin(); it !=
rechits.end(); ++it) {
141 int layId =
hit.cscDetId().layer();
147 float d_x = lp.
x() - layerPoints[layId - 1].x();
148 float d_y = lp.
y() - layerPoints[layId - 1].y();
152 if (fabs(
diff.mag()) < r_closest[layId - 1]) {
153 r_closest[layId - 1] = fabs(
diff.mag());
164 for (ChamberHitContainer::const_iterator it =
rechits.begin(); it !=
rechits.end(); ++it) {
166 int layId =
hit.cscDetId().layer();
168 if (
idx ==
id[layId - 1])
179 }
else if (gz[0] < 0.) {
193 for (ChamberHitContainer::const_iterator it =
rechits.begin(); it !=
rechits.end(); it++) {
195 int layer =
h->cscDetId().layer();
208 double protoTheta = protoGlobalDir.
theta();
209 double protoPhi = protoGlobalDir.
phi();
210 double simTheta = gvCOM.theta();
211 double simPhi = gvCOM.phi();
213 float dTheta = fabs(protoTheta - simTheta);
214 float dPhi = fabs(protoPhi - simPhi);
221 double theFlag = -1.;
244 double Hphi = Hgp.
phi();
254 double Sphi = Sgp.
phi();
257 double R =
sqrt(Sgp.
x() * Sgp.
x() + Sgp.
y() * Sgp.
y());
304 ChamberHitContainer::iterator it;
306 if ((*it)->cscDetId().layer() == layer) {
338 float maxResidual = 0.;
339 float sumResidual = 0.;
342 ChamberHitContainer::iterator ih;
343 ChamberHitContainer::iterator ibad =
protoSegment.end();
360 sumResidual += residual;
362 if (residual > maxResidual) {
363 maxResidual = residual;
368 float corrAvgResidual = (sumResidual - maxResidual) / (nHits - 1);