40 <<
"--------------------------------------------------------------------\n" 42 <<
"dPhiMax = " <<
dPhiMax <<
'\n' 45 <<
"chi2Max = " <<
chi2Max <<
'\n' 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);
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;
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;
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 <<
" ?";
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();
Log< level::Info, true > LogVerbatim
T getParameter(std::string const &) const
const CSCLayer * layer(CSCDetId id) const
Return the layer corresponding to the given id.
LocalPoint localPosition() const override
Geom::Phi< T > phi() const
bool hasHitOnLayer(int layer) const
LocalPoint intercept() const
CSCDetId cscDetId() const
void compareProtoSegment(const CSCRecHit2D *h, int layer)
std::deque< bool > BoolContainer
double chi2() const override
Chi2 of the segment fit.
std::vector< CSCSegment > buildSegments(const ChamberHitContainer &rechits)
T getUntrackedParameter(std::string const &, T const &) const
LocalVector localDirection() const override
Local direction.
std::vector< CSCSegment > run(const CSCChamber *aChamber, const ChamberHitContainer &rechits) override
void updateParameters(void)
bool isHitNearSegment(const CSCRecHit2D *h) const
void dumpSegment(const CSCSegment &seg) const
Abs< T >::type abs(const T &t)
float ChiSquaredProbability(double chiSquared, double nrDOF)
int degreesOfFreedom() const override
Degrees of freedom of the segment fit.
void flagHitsAsUsed(std::vector< CSCSegFit *>::iterator is, const ChamberHitContainer &rechitsInChamber, BoolContainer &used) const
GlobalPoint toGlobal(const Local2DPoint &lp) const
Conversion to the global R.F. from the R.F. of the GeomDet.
bool addHit(const CSCRecHit2D *aHit, int layer)
Utility functions.
const CSCChamber * theChamber
Member variables.
std::vector< CSCSegFit * > candidates
LocalPoint localPosition() const override
LocalError localDirectionError() const override
Error on the local direction.
ChamberHitContainer proto_segment
std::vector< const CSCRecHit2D * > ChamberHitContainer
AlgebraicSymMatrix covarianceMatrix(void)
void tryAddingHitsToSegment(const ChamberHitContainer &rechits, const ChamberHitContainerCIt i1, const ChamberHitContainerCIt i2)
AlgebraicSymMatrix parametersError() const override
Covariance matrix of parameters()
const Surface::PositionType & position() const
The position (origin of the R.F.)
bool areHitsCloseInLocalX(const CSCRecHit2D *h1, const CSCRecHit2D *h2) const
const std::vector< CSCRecHit2D > & specificRecHits() const
LocalVector localdir() const
bool areHitsCloseInGlobalPhi(const CSCRecHit2D *h1, const CSCRecHit2D *h2) const
std::vector< int > LayerIndex
Typedefs.
void dumpHits(const ChamberHitContainer &rechits) const
CSCSetOfHits hits(void) const
float phiAtZ(float z) const
LocalError localPositionError() const override
The Signals That Services Can Subscribe To This is based on ActivityRegistry h
Helper function to determine trigger accepts.
ChamberHitContainer::const_iterator ChamberHitContainerCIt
void increaseProtoSegment(const CSCRecHit2D *h, int layer)
void pruneTheSegments(const ChamberHitContainer &rechitsInChamber)
bool isSegmentGood(std::vector< CSCSegFit *>::iterator is, const ChamberHitContainer &rechitsInChamber, BoolContainer &used) const
bool replaceHit(const CSCRecHit2D *h, int layer)
CSCDetId id() const
Get the (concrete) DetId.
CSCSegAlgoTC(const edm::ParameterSet &ps)
Constructor.