41 <<
"--------------------------------------------------------------------\n" 42 <<
"dRPhiMax = " << dRPhiMax <<
'\n' 43 <<
"dPhiMax = " << dPhiMax <<
'\n' 44 <<
"dRPhiFineMax = " << dRPhiFineMax <<
'\n' 45 <<
"dPhiFineMax = " << dPhiFineMax <<
'\n' 46 <<
"chi2Max = " << chi2Max <<
'\n' 47 <<
"chi2ndfProbMin = " << chi2ndfProbMin <<
'\n' 48 <<
"minLayersApart = " << minLayersApart <<
'\n' 49 <<
"SegmentSorting = " << SegmentSorting << std::endl;
66 if (rechits.size() < 2) {
68 " hit(s) in chamber is not enough to build a segment.\n";
69 return std::vector<CSCSegment>();
74 for (
size_t i = 0;
i < rechits.size(); ++
i ) {
75 short ilay = rechits[
i]->cscDetId().layer();
86 reverse(layerIndex.begin(), layerIndex.end());
87 reverse(rechits.begin(), rechits.end());
92 reverse(layerIndex.begin(), layerIndex.end());
93 reverse(rechits.begin(), rechits.end());
123 std::vector<CSCSegment> segments;
132 int layer1 = layerIndex[i1-
ib];
138 int layer2 = layerIndex[i2-
ib];
153 LogDebug(
"CSCSegment") <<
"start new segment from hits " <<
"h1: " << gp1 <<
" - h2: " << gp2 <<
"\n";
157 if ( !
addHit(h1, layer1) ) {
158 LogDebug(
"CSCSegment") <<
" failed to add hit h1\n";
162 if ( !
addHit(h2, layer2) ) {
163 LogDebug(
"CSCSegment") <<
" failed to add hit h2\n";
171 LogDebug(
"CSCSegment") <<
"No segment found.\n";
178 LogDebug(
"CSCSegment") <<
"Found a segment.\n";
201 segments.push_back(
temp);
232 if (
i == i1 ||
i == i2 )
235 int layer = (*i)->cscDetId().layer();
242 LogDebug(
"CSC") <<
" hit at global " << gp1 <<
" is near segment\n.";
247 <<
" hits on segment...skip hit on same layer.\n";
266 ChamberHitContainer::const_iterator it;
269 if (((*it)->cscDetId().layer() == layer) && (aHit != *it))
282 ChamberHitContainer::iterator it;
284 if ((*it)->cscDetId().layer() == layer)
310 float x = gp.
x() + (gv.
x()/gv.
z())*(z - gp.
z());
311 float y = gp.
y() + (gv.
y()/gv.
z())*(z - gp.
z());
312 float phi = atan2(y, x);
327 LogDebug(
"CSC") <<
" hit in same layer as a hit on segment; try replacing old one..." 328 <<
" chi2 new: " <<
sfit_->
chi2() <<
" old: " << oldfit->
chi2() <<
"\n";
332 LogDebug(
"CSC") <<
" segment with replaced hit is better.\n";
349 LogDebug(
"CSC") <<
" hit in new layer: added to segment, new chi2: " 356 LogDebug(
"CSC") <<
" segment with added hit is good.\n" ;
368 << h2->
localPosition().x() <<
" have separation= " << deltaX;
369 return (fabs(deltaX) < (
dRPhiMax))?
true:
false;
379 float h1p = gp1.
phi();
380 float h2p = gp2.
phi();
381 float dphi12 = h1p - h2p;
388 LogDebug(
"CSC") <<
" Hits at global phi= " << h1p <<
", " 389 << h2p <<
" have separation= " << dphi12;
390 return (fabs(dphi12) <
dPhiMax)?
true:
false;
404 float hphi = hp.
phi();
408 float phidif = sphi-hphi;
414 float dRPhi = fabs(phidif)*hp.
perp();
415 LogDebug(
"CSC") <<
" is hit at phi_h= " << hphi <<
" near segment phi_seg= " << sphi
417 <<
" and is |" << phidif <<
"|<" <<
dPhiFineMax <<
" ?";
420 (fabs(phidif) < dPhiFineMax))?
true:
false;
429 if ((*it)->cscDetId().layer() == layer)
440 for(it=rechits.begin(); it!=rechits.end(); it++) {
445 LogDebug(
"CSC") <<
"Global pos.: " << gp1 <<
", phi: " << gp1.
phi() <<
". Local position: " 446 << (*it)->localPosition() <<
", phi: " 447 << (*it)->localPosition().phi() <<
". Layer: " 448 << (*it)->cscDetId().layer() <<
"\n";
465 size_t iadd = (rechitsInChamber.size() > 20 )? 1 : 0;
467 size_t nhits = (*seg)->nhits();
469 if (nhits < 3 + iadd)
478 double chi2t = (*seg)->chi2();
479 double ndoft = 2*nhits - 4 ;
480 if( chi2t > 0 && ndoft > 0 ) {
492 for(
size_t ish = 0; ish <
nhits; ++ish) {
498 if((hits_[ish] == (*ic)) && used[ic-
ib])
514 for(
size_t ish = 0; ish < hits.size(); ++ish) {
516 if( hits[ish] == (*iu))
539 std::vector<CSCSegFit*>::iterator is;
543 bool goodSegment =
isSegmentGood(is, rechitsInChamber, used);
546 LogDebug(
"CSC") <<
"Accepting segment: ";
551 LogDebug(
"CSC") <<
"Rejecting segment: ";
596 LogDebug(
"CSC") <<
"No valid segment sorting specified. Algorithm misconfigured! \n";
609 <<
"\ncovariance matrix" 613 <<
"\ntime = " << seg.
time();
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
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.
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.
void dumpSegment(const CSCSegment &seg) const
void compareProtoSegment(const CSCRecHit2D *h, int layer)
std::deque< bool > BoolContainer
LocalPoint localPosition() const override
bool isSegmentGood(std::vector< CSCSegFit * >::iterator is, const ChamberHitContainer &rechitsInChamber, BoolContainer &used) const
float phiAtZ(float z) const
std::vector< CSCSegment > buildSegments(const ChamberHitContainer &rechits)
bool areHitsCloseInLocalX(const CSCRecHit2D *h1, const CSCRecHit2D *h2) const
bool isHitNearSegment(const CSCRecHit2D *h) const
std::vector< CSCSegment > run(const CSCChamber *aChamber, const ChamberHitContainer &rechits) override
void dumpHits(const ChamberHitContainer &rechits) const
void updateParameters(void)
const Surface::PositionType & position() const
The position (origin of the R.F.)
Abs< T >::type abs(const T &t)
LocalPoint localPosition() const override
const CSCLayer * layer(CSCDetId id) const
Return the layer corresponding to the given id.
float ChiSquaredProbability(double chiSquared, double nrDOF)
const std::vector< CSCRecHit2D > & specificRecHits() const
bool areHitsCloseInGlobalPhi(const CSCRecHit2D *h1, const CSCRecHit2D *h2) const
bool addHit(const CSCRecHit2D *aHit, int layer)
Utility functions.
void flagHitsAsUsed(std::vector< CSCSegFit * >::iterator is, const ChamberHitContainer &rechitsInChamber, BoolContainer &used) const
const CSCChamber * theChamber
Member variables.
std::vector< CSCSegFit * > candidates
ChamberHitContainer proto_segment
std::vector< const CSCRecHit2D * > ChamberHitContainer
AlgebraicSymMatrix covarianceMatrix(void)
void tryAddingHitsToSegment(const ChamberHitContainer &rechits, const ChamberHitContainerCIt i1, const ChamberHitContainerCIt i2)
bool hasHitOnLayer(int layer) const
LocalPoint intercept() const
double chi2() const override
Chi2 of the segment fit.
std::vector< int > LayerIndex
Typedefs.
int degreesOfFreedom() const override
Degrees of freedom of the segment fit.
LocalError localPositionError() const override
ChamberHitContainer::const_iterator ChamberHitContainerCIt
AlgebraicSymMatrix parametersError() const override
Covariance matrix of parameters()
void increaseProtoSegment(const CSCRecHit2D *h, int layer)
void pruneTheSegments(const ChamberHitContainer &rechitsInChamber)
bool replaceHit(const CSCRecHit2D *h, int layer)
CSCSegAlgoTC(const edm::ParameterSet &ps)
Constructor.