40 <<
"--------------------------------------------------------------------\n" 41 <<
"dRPhiMax = " << dRPhiMax <<
'\n' 42 <<
"dPhiMax = " << dPhiMax <<
'\n' 43 <<
"dRPhiFineMax = " << dRPhiFineMax <<
'\n' 44 <<
"dPhiFineMax = " << dPhiFineMax <<
'\n' 45 <<
"chi2Max = " << chi2Max <<
'\n' 46 <<
"chi2ndfProbMin = " << chi2ndfProbMin <<
'\n' 47 <<
"minLayersApart = " << minLayersApart <<
'\n' 48 <<
"SegmentSorting = " << SegmentSorting << std::endl;
64 if (rechits.size() < 2) {
65 LogDebug(
"CSC") <<
myName <<
": " << rechits.size() <<
" hit(s) in chamber is not enough to build a segment.\n";
66 return std::vector<CSCSegment>();
71 for (
size_t i = 0;
i < rechits.size(); ++
i) {
72 short ilay = rechits[
i]->cscDetId().layer();
83 reverse(layerIndex.begin(), layerIndex.end());
84 reverse(rechits.begin(), rechits.end());
88 reverse(layerIndex.begin(), layerIndex.end());
89 reverse(rechits.begin(), rechits.end());
118 std::vector<CSCSegment> segments;
126 int layer1 = layerIndex[
i1 -
ib];
131 int layer2 = layerIndex[
i2 -
ib];
145 LogDebug(
"CSCSegment") <<
"start new segment from hits " 146 <<
"h1: " << gp1 <<
" - h2: " << gp2 <<
"\n";
150 if (!
addHit(h1, layer1)) {
151 LogDebug(
"CSCSegment") <<
" failed to add hit h1\n";
155 if (!
addHit(h2, layer2)) {
156 LogDebug(
"CSCSegment") <<
" failed to add hit h2\n";
165 LogDebug(
"CSCSegment") <<
"No segment found.\n";
171 LogDebug(
"CSCSegment") <<
"Found a segment.\n";
193 segments.push_back(
temp);
224 if (
i == i1 ||
i == i2)
227 int layer = (*i)->cscDetId().layer();
233 LogDebug(
"CSC") <<
" hit at global " << gp1 <<
" is near segment\n.";
254 ChamberHitContainer::const_iterator it;
257 if (((*it)->cscDetId().layer() == layer) && (aHit != *it))
269 ChamberHitContainer::iterator it;
271 if ((*it)->cscDetId().layer() == layer)
293 float x = gp.
x() + (gv.
x() / gv.
z()) * (z - gp.
z());
294 float y = gp.
y() + (gv.
y() / gv.
z()) * (z - gp.
z());
295 float phi = atan2(y, x);
309 LogDebug(
"CSC") <<
" hit in same layer as a hit on segment; try replacing old one..." 310 <<
" chi2 new: " <<
sfit_->
chi2() <<
" old: " << oldfit->
chi2() <<
"\n";
314 LogDebug(
"CSC") <<
" segment with replaced hit is better.\n";
329 LogDebug(
"CSC") <<
" hit in new layer: added to segment, new chi2: " <<
sfit_->
chi2() <<
"\n";
335 LogDebug(
"CSC") <<
" segment with added hit is good.\n";
346 <<
" have separation= " << deltaX;
347 return (fabs(deltaX) < (
dRPhiMax)) ?
true :
false;
356 float h1p = gp1.
phi();
357 float h2p = gp2.
phi();
358 float dphi12 = h1p - h2p;
365 LogDebug(
"CSC") <<
" Hits at global phi= " << h1p <<
", " << h2p <<
" have separation= " << dphi12;
366 return (fabs(dphi12) <
dPhiMax) ?
true :
false;
379 float hphi = hp.
phi();
383 float phidif = sphi - hphi;
389 float dRPhi = fabs(phidif) * hp.
perp();
390 LogDebug(
"CSC") <<
" is hit at phi_h= " << hphi <<
" near segment phi_seg= " << sphi <<
"? is " << dRPhi <<
"<" 392 <<
" and is |" << phidif <<
"|<" <<
dPhiFineMax <<
" ?";
394 return ((dRPhi <
dRPhiFineMax) && (fabs(phidif) < dPhiFineMax)) ?
true :
false;
402 if ((*it)->cscDetId().layer() == layer)
412 for (it = rechits.begin(); it != rechits.end(); it++) {
416 LogDebug(
"CSC") <<
"Global pos.: " << gp1 <<
", phi: " << gp1.
phi()
417 <<
". Local position: " << (*it)->localPosition() <<
", phi: " << (*it)->localPosition().
phi()
418 <<
". Layer: " << (*it)->cscDetId().layer() <<
"\n";
433 size_t iadd = (rechitsInChamber.size() > 20) ? 1 : 0;
435 size_t nhits = (*seg)->nhits();
437 if (nhits < 3 + iadd)
446 double chi2t = (*seg)->chi2();
447 double ndoft = 2 * nhits - 4;
448 if (chi2t > 0 && ndoft > 0) {
459 for (
size_t ish = 0; ish <
nhits; ++ish) {
463 if ((hits_[ish] == (*ic)) && used[ic -
ib])
479 for (
size_t ish = 0; ish < hits.size(); ++ish) {
481 if (hits[ish] == (*iu))
482 used[iu - ib] =
true;
503 std::vector<CSCSegFit*>::iterator is;
506 bool goodSegment =
isSegmentGood(is, rechitsInChamber, used);
509 LogDebug(
"CSC") <<
"Accepting segment: ";
513 LogDebug(
"CSC") <<
"Rejecting segment: ";
552 LogDebug(
"CSC") <<
"No valid segment sorting specified. Algorithm misconfigured! \n";
565 <<
"\ntime = " << seg.
time();
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
FWCore Framework interface EventSetupRecordImplementation h
Helper function to determine trigger accepts.
CSCSetOfHits hits(void) const
CSCDetId cscDetId() const
LocalVector localdir() const
LocalVector localDirection() const override
Local direction.
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.