33 <<
"--------------------------------------------------------------------\n" 34 <<
"dRPhiMax = " << dRPhiMax <<
'\n' 35 <<
"dPhiMax = " << dPhiMax <<
'\n' 36 <<
"dRPhiFineMax = " << dRPhiFineMax <<
'\n' 37 <<
"dPhiFineMax = " << dPhiFineMax <<
'\n' 38 <<
"chi2Max = " << chi2Max <<
'\n' 39 <<
"wideSeg = " << wideSeg <<
'\n' 40 <<
"minLayersApart = " << minLayersApart << std::endl;
50 LogDebug(
"CSC") <<
"*********************************************";
52 LogDebug(
"CSC") <<
"*********************************************";
57 for(
unsigned int i = 0;
i < rechits.size();
i++) {
59 layerIndex[
i] = rechits[
i]->cscDetId().layer();
67 reverse(layerIndex.begin(), layerIndex.end());
68 reverse(rechits.begin(), rechits.end());
73 reverse(layerIndex.begin(), layerIndex.end());
74 reverse(rechits.begin(), rechits.end());
80 if (rechits.size() < 2) {
82 " hit(s) in chamber is not enough to build a segment.\n";
83 return std::vector<CSCSegment>();
103 std::vector<CSCSegment> segments;
114 int npass = (
wideSeg > 1.)? 2 : 1;
116 for (
int ipass = 0; ipass < npass; ++ipass) {
122 int layer1 = layerIndex[i1-
ib];
129 int layer2 = layerIndex[i2-
ib];
143 LogDebug(
"CSC") <<
"start new segment from hits " <<
"h1: " 144 << gp1 <<
" - h2: " << gp2 <<
"\n";
147 if (!
addHit(h1, layer1)) {
148 LogDebug(
"CSC") <<
" failed to add hit h1\n";
152 if (!
addHit(h2, layer2)) {
153 LogDebug(
"CSC") <<
" failed to add hit h2\n";
169 LogDebug(
"CSC") <<
"No segment has been found !!!\n";
177 LogDebug(
"CSC") <<
"Found a segment !!!\n";
179 segments.push_back(
temp);
189 if (segments.size() > 1)
219 if (
i == i1 ||
i == i2 || used[
i-ib])
222 int layer = layerIndex[
i-
ib];
227 LogDebug(
"CSC") <<
" hit at global " << gp1 <<
" is near segment\n.";
233 <<
" hits on segment...skip hit on same layer.\n";
247 << h2->
localPosition().x() <<
" have separation= " << deltaX;
258 float h1p = gp1.
phi();
259 float h2p = gp2.
phi();
260 float dphi12 = h1p - h2p;
267 LogDebug(
"CSC") <<
" Hits at global phi= " << h1p <<
", " 268 << h2p <<
" have separation= " << dphi12;
283 float hphi = hp.
phi();
287 float phidif = sphi-hphi;
293 float dRPhi = fabs(phidif)*hp.
perp();
294 LogDebug(
"CSC") <<
" is hit at phi_h= " << hphi <<
" near segment phi_seg= " << sphi
299 (fabs(phidif) <
dPhiFineMax*windowScale))?
true:
false;
305 edm::LogVerbatim(
"CSCSegment") <<
"[CSCSegAlgoSK::phiAtZ] Segment fit undefined";
314 LogTrace(
"CSCSegment") <<
"[CSCSegAlgoSK::phiAtZ] Global intercept = " << gp <<
", direction = " << gv;
316 float x = gp.
x() + (gv.x()/gv.z())*(z - gp.
z());
317 float y = gp.
y() + (gv.y()/gv.z())*(z - gp.
z());
318 float phi = atan2(y, x);
329 edm::LogInfo(
"CSCSegment") <<
"CSCChamber rechit dump.\n";
330 for(it=rechits.begin(); it!=rechits.end(); it++) {
335 edm::LogInfo(
"CSCSegment") <<
"Global pos.: " << gp1 <<
", phi: " << gp1.
phi() <<
". Local position: " 336 << (*it)->localPosition() <<
", phi: " 337 << (*it)->localPosition().phi() <<
". Layer: " 338 << (*it)->cscDetId().layer() <<
"\n";
349 unsigned int iadd = ( rechitsInChamber.size() > 20 )? 1 : 0;
368 for(iu = ib; iu != rechitsInChamber.end(); ++iu) {
381 ChamberHitContainer::const_iterator it;
384 if (((*it)->cscDetId().layer() == layer) && (aHit != (*it)))
408 if ((*it)->cscDetId().layer() == layer)
417 ChamberHitContainer::iterator it;
419 if ((*it)->cscDetId().layer() == layer)
437 LogDebug(
"CSCSegment") <<
" hit in same layer as a hit on segment; try replacing old one..." 438 <<
" chi2 new: " <<
sfit_->
chi2() <<
" old: " << oldfit->
chi2() <<
"\n";
442 LogDebug(
"CSC") <<
" segment with replaced hit is better.\n";
461 LogDebug(
"CSCSegment") <<
" hit in new layer: added to segment, new chi2: " 469 LogDebug(
"CSCSegment") <<
" segment with added hit is good.\n" ;
486 <<
"\ncovariance matrix" 490 <<
"\ntime = " << seg.
time();
void dumpHits(const ChamberHitContainer &rechits) const
T getParameter(std::string const &) const
std::vector< CSCSegment > run(const CSCChamber *aChamber, const ChamberHitContainer &rechits) override
T getUntrackedParameter(std::string const &, T const &) const
CSCSetOfHits hits(void) const
CSCDetId cscDetId() const
LocalVector localdir() const
LocalVector localDirection() const override
Local direction.
bool areHitsCloseInLocalX(const CSCRecHit2D *h1, const CSCRecHit2D *h2) const
Utility functions.
ChamberHitContainer proto_segment
void flagHitsAsUsed(const ChamberHitContainer &rechitsInChamber, BoolContainer &used) const
CSCDetId id() const
Get the (concrete) DetId.
std::vector< const CSCRecHit2D * >::const_iterator ChamberHitContainerCIt
bool replaceHit(const CSCRecHit2D *h, int layer)
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.
LocalPoint localPosition() const override
bool addHit(const CSCRecHit2D *hit, int layer)
Utility functions.
void dumpSegment(const CSCSegment &seg) const
bool isHitNearSegment(const CSCRecHit2D *h) const
std::string chamberTypeName() const
const Surface::PositionType & position() const
The position (origin of the R.F.)
const CSCChamberSpecs * specs() const
void increaseProtoSegment(const CSCRecHit2D *h, int layer)
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 phiAtZ(float z) const
const std::vector< CSCRecHit2D > & specificRecHits() const
void updateParameters(void)
CSCSegAlgoSK(const edm::ParameterSet &ps)
Constructor.
std::vector< CSCSegment > buildSegments(const ChamberHitContainer &rechits)
bool hasHitOnLayer(int layer) const
AlgebraicSymMatrix covarianceMatrix(void)
LocalPoint intercept() const
std::vector< int > LayerIndex
Typedefs.
bool isSegmentGood(const ChamberHitContainer &rechitsInChamber) const
double chi2() const override
Chi2 of the segment fit.
std::vector< const CSCRecHit2D * > ChamberHitContainer
void tryAddingHitsToSegment(const ChamberHitContainer &rechitsInChamber, const BoolContainer &used, const LayerIndex &layerIndex, const ChamberHitContainerCIt i1, const ChamberHitContainerCIt i2)
int degreesOfFreedom() const override
Degrees of freedom of the segment fit.
LocalError localPositionError() const override
bool areHitsCloseInGlobalPhi(const CSCRecHit2D *h1, const CSCRecHit2D *h2) const
AlgebraicSymMatrix parametersError() const override
Covariance matrix of parameters()
std::deque< bool > BoolContainer
void compareProtoSegment(const CSCRecHit2D *h, int layer)
const CSCChamber * theChamber