55 std::vector<float>
x,
y, gz;
59 for (
int i = 0;
i < 6; ++
i) {
67 for (ChamberHitContainer::const_iterator it = rechits.begin(); it != rechits.end(); ++it ) {
70 int l_id =
id.
layer();
78 gz[l_id -1] += gp.
z();
83 float avgChamberX = 0.;
84 float avgChamberY = 0.;
87 for (
unsigned i = 0;
i < 6; ++
i) {
88 if (n[
i] < 1 )
continue;
99 avgChamberX = avgChamberX / n_lay;
100 avgChamberY = avgChamberY / n_lay;
106 LocalPoint lpCOM(avgChamberX, avgChamberY, 0.);
110 float Gdxdz = gpCOM.
x()/gpCOM.
z();
111 float Gdydz = gpCOM.
y()/gpCOM.
z();
115 std::vector<LocalPoint> layerPoints;
117 for (
size_t i = 0;
i!=6; ++
i) {
122 float layer_Z = gp.
z();
125 float layer_X = Gdxdz * layer_Z;
126 float layer_Y = Gdydz * layer_Z;
130 float layerX = Lintersect.
x();
131 float layerY = Lintersect.
y();
132 float layerZ = Lintersect.
z();
133 LocalPoint layerPoint(layerX, layerY, layerZ);
134 layerPoints.push_back(layerPoint);
138 std::vector<float> r_closest;
140 for (
size_t i = 0;
i!=6; ++
i ) {
142 r_closest.push_back(9999.);
148 for (ChamberHitContainer::const_iterator it = rechits.begin(); it != rechits.end(); ++it ) {
156 float d_x = lp.
x() - layerPoints[layId-1].x();
157 float d_y = lp.
y() - layerPoints[layId-1].y();
161 if ( fabs(diff.
mag() ) < r_closest[layId-1] ) {
162 r_closest[layId-1] = fabs(diff.
mag());
173 for (ChamberHitContainer::const_iterator it = rechits.begin(); it != rechits.end(); ++it ) {
184 if ( gz[0] > gz[5] ) {
188 else if ( gz[0] < 0. ) {
189 if ( gz[0] < gz[5] ) {
201 for (ChamberHitContainer::const_iterator it = rechits.begin(); it != rechits.end(); it++ ) {
214 double protoTheta = protoGlobalDir.
theta();
215 double protoPhi = protoGlobalDir.
phi();
216 double simTheta = gvCOM.theta();
217 double simPhi = gvCOM.
phi();
219 float dTheta = fabs(protoTheta - simTheta);
220 float dPhi = fabs(protoPhi - simPhi);
227 double theFlag = -1.;
256 double Hphi = Hgp.
phi();
257 if (Hphi < 0.) Hphi += 2.*
M_PI;
265 double Sphi = Sgp.
phi();
266 if (Sphi < 0.) Sphi += 2.*
M_PI;
267 double R =
sqrt(Sgp.
x()*Sgp.
x() + Sgp.
y()*Sgp.
y());
270 if (deltaPhi > 2.*
M_PI) deltaPhi -= 2.*
M_PI;
271 if (deltaPhi < -2.*
M_PI) deltaPhi += 2.*
M_PI;
272 if (deltaPhi < 0.) deltaPhi = -
deltaPhi;
296 if ( aHit == (*it) )
return false;
313 ChamberHitContainer::iterator it;
315 if ( (*it)->cscDetId().layer() == layer ) {
349 float maxResidual = 0.;
350 float sumResidual = 0.;
353 ChamberHitContainer::iterator ih;
354 ChamberHitContainer::iterator ibad =
protoSegment.end();
371 sumResidual += residual;
373 if ( residual > maxResidual ) {
374 maxResidual = residual;
379 float corrAvgResidual = (sumResidual - maxResidual)/(nHits -1);
T getParameter(std::string const &) const
CSCSetOfHits hits(void) const
CSCDetId cscDetId() const
void updateParameters(void)
LocalVector localdir() const
void compareProtoSegment(const CSCRecHit2D *h, int layer)
bool isHitNearSegment(const CSCRecHit2D *h) const
Utility functions.
virtual ~CSCSegAlgoShowering()
Destructor.
CSCSegment showerSeg(const CSCChamber *aChamber, const ChamberHitContainer &rechits)
GlobalPoint toGlobal(const Local2DPoint &lp) const
Conversion to the global R.F. from the R.F. of the GeomDet.
Geom::Phi< T > phi() const
float Rdev(float x, float y, float z) const
LocalPoint toLocal(const GlobalPoint &gp) const
Conversion to the R.F. of the GeomDet.
Geom::Theta< T > theta() const
bool addHit(const CSCRecHit2D *hit, int layer)
CSCSegAlgoShowering(const edm::ParameterSet &ps)
Constructor.
const CSCLayer * layer(CSCDetId id) const
Return the layer corresponding to the given id.
std::vector< const CSCRecHit2D * > ChamberHitContainer
float xfit(float z) const
AlgebraicSymMatrix covarianceMatrix(void)
LocalPoint intercept() const
LocalPoint localPosition() const
const CSCChamber * theChamber
ChamberHitContainer protoSegment
void pruneFromResidual(void)
float yfit(float z) const