74 int nHits = rechits.size();
77 std::vector<CSCSegment> segments_temp;
81 std::vector<CSCSegment> testSegments;
84 for (std::vector<ChamberHitContainer>::iterator subrechits = clusteredHits.begin(); subrechits != clusteredHits.end(); ++subrechits ) {
86 std::vector<CSCSegment> segs =
buildSegments( (*subrechits) );
88 segments_temp.insert( segments_temp.end(), segs.begin(), segs.end() );
93 segments_temp.insert( segments_temp.end(), segs.begin(), segs.end() );
117 std::vector<CSCSegment> segmentInChamber;
118 segmentInChamber.clear();
120 unsigned nHitInChamber = rechits.size();
127 if ( nHitInChamber < 3 )
return segmentInChamber;
132 size_t old_layer = 0;
133 for (
size_t i = 0;
i < nHitInChamber; ++
i ) {
134 size_t this_layer = rechits[
i]->cscDetId().layer();
136 layerIndex[
i] = this_layer;
138 if ( this_layer != old_layer ) {
139 old_layer = this_layer;
147 if ( nLayers < 3 )
return segmentInChamber;
154 reverse( layerIndex.begin(), layerIndex.end() );
155 reverse( rechits.begin(), rechits.end() );
158 else if ( z1 < 0. ) {
160 reverse( layerIndex.begin(), layerIndex.end() );
161 reverse( rechits.begin(), rechits.end() );
176 if ( segShower.
nRecHits() < 3 )
return segmentInChamber;
178 segmentInChamber.push_back(segShower);
182 return segmentInChamber;
196 if ( usedHits[i1-ib] )
continue;
199 int layer1 = layerIndex[i1-
ib];
207 if ( usedHits[i2-ib] )
continue;
209 int layer2 = layerIndex[i2-
ib];
221 float dz = gp2.
z()-gp1.
z();
222 float slope_u = (lp2.
x() - lp1.
x())/dz ;
223 float slope_v = (lp2.
y() - lp1.
y())/dz ;
227 if (fabs(slope_u) >
tanPhiMax )
continue;
262 segmentInChamber.push_back(
temp);
266 if (nHitInChamber-
protoSegment.size() < 3)
return segmentInChamber;
268 if (segmentInChamber.size() > 4)
return segmentInChamber;
276 return segmentInChamber;
312 if (
i == i1 ||
i == i2 )
continue;
317 int layer = layerIndex[
i-
ib];
318 int layer1 = layerIndex[i1-
ib];
319 int layer2 = layerIndex[i2-
ib];
326 if (rechits.size() < 9) {
367 int layer = (*i)->cscDetId().layer();
384 float Hphi = Hgp.
phi();
385 if (Hphi < 0.) Hphi += 2.*
M_PI;
394 float Sphi = Sgp.
phi();
395 if (Sphi < 0.) Sphi += 2.*
M_PI;
396 float R =
sqrt(Sgp.
x()*Sgp.
x() + Sgp.
y()*Sgp.
y());
399 if (deltaPhi > 2.*
M_PI) deltaPhi -= 2.*
M_PI;
400 if (deltaPhi < -2.*
M_PI) deltaPhi += 2.*
M_PI;
401 if (deltaPhi < 0.) deltaPhi = -
deltaPhi;
429 if ( aHit == (*it) )
return false;
469 if ( (*it)->cscDetId().layer() == layer )
return true;
488 ChamberHitContainer::iterator it;
490 if ( (*it)->cscDetId().layer() == layer ) {
533 for ( iu = ib; iu != rechitsInChamber.end(); ++iu ) {
542 for ( iu = ib; iu != rechitsInChamber.end(); ++iu ) {
558 float maxResidual = 0.;
559 float sumResidual = 0.;
565 ChamberHitContainer::const_iterator ih;
575 sumResidual += residual;
577 if ( residual > maxResidual ) {
578 maxResidual = residual;
584 float corrAvgResidual = (sumResidual - maxResidual)/(nHits -1);
596 if ( j != badIndex ) newProtoSegment.push_back(*ih);
602 for ( ih = newProtoSegment.begin(); ih != newProtoSegment.end(); ++ih ) {
618 <<
"\ncovariance matrix" 622 <<
"\ntime = " << seg.
time();
void tryAddingHitsToSegment(const ChamberHitContainer &rechitsInChamber, const ChamberHitContainerCIt i1, const ChamberHitContainerCIt i2, const LayerIndex &layerIndex)
Utility functions.
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
ChamberHitContainer protoSegment
std::vector< const CSCRecHit2D * > ChamberHitContainer
std::vector< const CSCRecHit2D * >::const_iterator ChamberHitContainerCIt
CSCSetOfHits hits(void) const
CSCDetId cscDetId() const
LocalVector localdir() const
LocalVector localDirection() const override
Local direction.
FWCore Framework interface EventSetupRecordImplementation h
Helper function to determine trigger accepts.
CSCDetId id() const
Get the (concrete) DetId.
CSCSegAlgoPreClustering * preCluster_
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
LocalError localDirectionError() const override
Error on the local direction.
ChamberHitContainer closeHits
float Rdev(float x, float y, float z) const
LocalPoint toLocal(const GlobalPoint &gp) const
Conversion to the R.F. of the GeomDet.
bool addHit(const CSCRecHit2D *hit, int layer)
bool isHitNearSegment(const CSCRecHit2D *h) const
LocalPoint localPosition() const override
CSCSegAlgoDF(const edm::ParameterSet &ps)
Constructor.
CSCSegAlgoShowering * showering_
std::vector< CSCSegment > buildSegments(const ChamberHitContainer &rechits)
void updateParameters(void)
std::deque< bool > BoolContainer
const Surface::PositionType & position() const
The position (origin of the R.F.)
void compareProtoSegment(const CSCRecHit2D *h, int layer)
void dumpSegment(const CSCSegment &seg) const
LocalPoint localPosition() const override
const CSCLayer * layer(CSCDetId id) const
Return the layer corresponding to the given id.
std::vector< int > LayerIndex
Typedefs.
float xfit(float z) const
const std::vector< CSCRecHit2D > & specificRecHits() const
int minHitsForPreClustering
void flagHitsAsUsed(const ChamberHitContainer &rechitsInChamber)
void pruneFromResidual(void)
AlgebraicSymMatrix covarianceMatrix(void)
std::vector< std::vector< const CSCRecHit2D * > > clusterHits(const CSCChamber *aChamber, const ChamberHitContainer &rechits)
clusterize
LocalPoint intercept() const
std::vector< CSCSegment > run(const CSCChamber *aChamber, const ChamberHitContainer &rechits) override
~CSCSegAlgoDF() override
Destructor.
double chi2() const override
Chi2 of the segment fit.
const CSCChamber * theChamber
int degreesOfFreedom() const override
Degrees of freedom of the segment fit.
LocalError localPositionError() const override
int nHitsPerClusterIsShower
AlgebraicSymMatrix parametersError() const override
Covariance matrix of parameters()
bool hasHitOnLayer(int layer) const
float yfit(float z) const