CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
CSCSegAlgoDF.cc
Go to the documentation of this file.
1 
11 #include "CSCSegAlgoDF.h"
12 #include "CSCSegFit.h"
13 
15 
17 
20 
22 
24 #include "CSCSegAlgoShowering.h"
25 
26 #include <algorithm>
27 #include <cmath>
28 #include <iostream>
29 #include <string>
30 
31 
32 /* Constructor
33  *
34  */
36  : CSCSegmentAlgorithm(ps), myName("CSCSegAlgoDF"), sfit_(0) {
37 
38  debug = ps.getUntrackedParameter<bool>("CSCSegmentDebug");
39  minLayersApart = ps.getParameter<int>("minLayersApart");
40  minHitsPerSegment = ps.getParameter<int>("minHitsPerSegment");
41  dRPhiFineMax = ps.getParameter<double>("dRPhiFineMax");
42  dPhiFineMax = ps.getParameter<double>("dPhiFineMax");
43  tanThetaMax = ps.getParameter<double>("tanThetaMax");
44  tanPhiMax = ps.getParameter<double>("tanPhiMax");
45  chi2Max = ps.getParameter<double>("chi2Max");
46  preClustering = ps.getUntrackedParameter<bool>("preClustering");
47  minHitsForPreClustering= ps.getParameter<int>("minHitsForPreClustering");
48  nHitsPerClusterIsShower= ps.getParameter<int>("nHitsPerClusterIsShower");
49  Pruning = ps.getUntrackedParameter<bool>("Pruning");
50  maxRatioResidual = ps.getParameter<double>("maxRatioResidualPrune");
51 
53  showering_ = new CSCSegAlgoShowering( ps );
54 }
55 
56 
57 /* Destructor
58  *
59  */
61  delete preCluster_;
62  delete showering_;
63 }
64 
65 
66 /* run
67  *
68  */
69 std::vector<CSCSegment> CSCSegAlgoDF::run(const CSCChamber* aChamber, const ChamberHitContainer& rechits) {
70 
71  // Store chamber info in temp memory
72  theChamber = aChamber;
73 
74  int nHits = rechits.size();
75 
76  // Segments prior to pruning
77  std::vector<CSCSegment> segments_temp;
78 
79  if ( preClustering && nHits > minHitsForPreClustering ) {
80  // This is where the segment origin is in the chamber on avg.
81  std::vector<CSCSegment> testSegments;
82  std::vector<ChamberHitContainer> clusteredHits = preCluster_->clusterHits(theChamber, rechits);
83  // loop over the found clusters:
84  for (std::vector<ChamberHitContainer>::iterator subrechits = clusteredHits.begin(); subrechits != clusteredHits.end(); ++subrechits ) {
85  // build the subset of segments:
86  std::vector<CSCSegment> segs = buildSegments( (*subrechits) );
87  // add the found subset of segments to the collection of all segments in this chamber:
88  segments_temp.insert( segments_temp.end(), segs.begin(), segs.end() );
89  }
90  } else {
91  std::vector<CSCSegment> segs = buildSegments( rechits );
92  // add the found subset of segments to the collection of all segments in this chamber:
93  segments_temp.insert( segments_temp.end(), segs.begin(), segs.end() );
94  }
95 
96  return segments_temp;
97 }
98 
99 
100 /* This builds segments by first creating proto-segments from at least 3 hits.
101  * We intend to try all possible pairs of hits to start segment building. 'All possible'
102  * means each hit lies on different layers in the chamber. Once a hit has been assigned
103  * to a segment, we don't consider it again, THAT IS, FOR THE FIRST PASS ONLY !
104  * In fact, this is one of the possible flaw with the SK algorithms as it sometimes manages
105  * to build segments with the wrong starting points. In the DF algorithm, the endpoints
106  * are tested as the best starting points in a 2nd loop.
107  *
108  * Also, a maximum of 5 segments is allowed in the chamber (and then it just gives up.)
109  *
110  * @@ There are 7 return's in this function!
111  *
112  */
113 std::vector<CSCSegment> CSCSegAlgoDF::buildSegments(const ChamberHitContainer& _rechits) {
114 
115  ChamberHitContainer rechits = _rechits;
116  // Clear buffer for segment vector
117  std::vector<CSCSegment> segmentInChamber;
118  segmentInChamber.clear();
119 
120  unsigned nHitInChamber = rechits.size();
121 
122  // std::cout << "[CSCSegAlgoDF::buildSegments] address of chamber = " << theChamber << std::endl;
123  // std::cout << "[CSCSegAlgoDF::buildSegments] starting in " << theChamber->id()
124  // << " with " << nHitInChamber << " rechits" << std::endl;
125 
126  // Return #1 - OK, there aren't enough rechits to build a segment
127  if ( nHitInChamber < 3 ) return segmentInChamber;
128 
129  LayerIndex layerIndex( nHitInChamber );
130 
131  size_t nLayers = 0;
132  size_t old_layer = 0;
133  for ( size_t i = 0; i < nHitInChamber; ++i ) {
134  size_t this_layer = rechits[i]->cscDetId().layer();
135  // std::cout << "[CSCSegAlgoDF::buildSegments] this_layer = " << this_layer << std::endl;
136  layerIndex[i] = this_layer;
137  // std::cout << "[CSCSegAlgoDF::buildSegments] layerIndex[" << i << "] = " << layerIndex[i] << std::endl;
138  if ( this_layer != old_layer ) {
139  old_layer = this_layer;
140  ++nLayers;
141  }
142  }
143 
144  // std::cout << "[CSCSegAlgoDF::buildSegments] layers with rechits = " << nLayers << std::endl;
145 
146  // Return #2 - OK, there aren't enough hit layers to build a segment
147  if ( nLayers < 3 ) return segmentInChamber;
148 
149  double z1 = theChamber->layer(1)->position().z();
150  double z6 = theChamber->layer(6)->position().z();
151 
152  if ( z1 > 0. ) {
153  if ( z1 > z6 ) {
154  reverse( layerIndex.begin(), layerIndex.end() );
155  reverse( rechits.begin(), rechits.end() );
156  }
157  }
158  else if ( z1 < 0. ) {
159  if ( z1 < z6 ) {
160  reverse( layerIndex.begin(), layerIndex.end() );
161  reverse( rechits.begin(), rechits.end() );
162  }
163  }
164 
165  // std::cout << "[CSCSegAlgoDF::buildSegments] rechits have been ordered" << std::endl;
166 
167  // Showering muon
168  if ( preClustering && int(nHitInChamber) > nHitsPerClusterIsShower && nLayers > 2 ) {
169 
170  // std::cout << "[CSCSegAlgoDF::buildSegments] showering block" << std::endl;
171 
172  CSCSegment segShower = showering_->showerSeg(theChamber, rechits);
173 
174  // Return #3 - OK, this is now 'effectve' rechits
175  // Make sure have at least 3 hits...
176  if ( segShower.nRecHits() < 3 ) return segmentInChamber;
177 
178  segmentInChamber.push_back(segShower);
179  if (debug) dumpSegment( segShower );
180 
181  // Return #4 - OK, only get one try at building a segment from shower
182  return segmentInChamber;
183  }
184 
185  // Initialize flags that a given hit has been allocated to a segment
186  BoolContainer used_ini(rechits.size(), false);
187  usedHits = used_ini;
188 
189  ChamberHitContainerCIt ib = rechits.begin();
190  ChamberHitContainerCIt ie = rechits.end();
191 
192  // std::cout << "[CSCSegAlgoDF::buildSegments] entering rechit loop" << std::endl;
193 
194  // Now Loop over hits within the chamber to find 1st seed for segment building
195  for ( ChamberHitContainerCIt i1 = ib; i1 < ie; ++i1 ) {
196  if ( usedHits[i1-ib] ) continue;
197 
198  const CSCRecHit2D* h1 = *i1;
199  int layer1 = layerIndex[i1-ib];
200  const CSCLayer* l1 = theChamber->layer(layer1);
201  GlobalPoint gp1 = l1->toGlobal(h1->localPosition());
202  LocalPoint lp1 = theChamber->toLocal(gp1);
203 
204  // Loop over hits backward to find 2nd seed for segment building
205  for ( ChamberHitContainerCIt i2 = ie-1; i2 > ib; --i2 ) {
206 
207  if ( usedHits[i2-ib] ) continue; // Hit has been used already
208 
209  int layer2 = layerIndex[i2-ib];
210  if ( (layer2 - layer1) < minLayersApart ) continue;
211 
212  const CSCRecHit2D* h2 = *i2;
213  const CSCLayer* l2 = theChamber->layer(layer2);
214  GlobalPoint gp2 = l2->toGlobal(h2->localPosition());
215  LocalPoint lp2 = theChamber->toLocal(gp2);
216 
217  // Clear proto segment so it can be (re)-filled
218  protoSegment.clear();
219 
220  // We want hit wrt chamber (and local z will be != 0)
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 ;
224 
225  // Test if entrance angle is roughly pointing towards IP
226  if (fabs(slope_v) > tanThetaMax) continue;
227  if (fabs(slope_u) > tanPhiMax ) continue;
228 
229  protoSegment.push_back(h1);
230  protoSegment.push_back(h2);
231 
232  // std::cout << "[CSCSegAlgoDF::buildSegments] about to fit 2 hits on layers "
233  // << layer1 << " and " << layer2 << std::endl;
234 
235  // protoSegment has just 2 hits - but need to create a CSCSegFit to hold it in case
236  // we fail to add any more hits
238 
239  // Try adding hits to proto segment
240  tryAddingHitsToSegment(rechits, i1, i2, layerIndex);
241 
242  // Check no. of hits on segment to see if segment is large enough
243  bool segok = true;
244  unsigned iadd = 0;
245 
246  if (protoSegment.size() < minHitsPerSegment+iadd) segok = false;
247 
248  if ( Pruning && segok ) pruneFromResidual();
249 
250  // Check if segment satisfies chi2 requirement
251  if ( sfit_->chi2() > chi2Max) segok = false;
252 
253  if ( segok ) {
254 
255  // Create an actual CSCSegment - retrieve all info from the current fit
258  // std::cout << "[CSCSegAlgoDF::buildSegments] about to delete sfit= = " << sfit_ << std::endl;
259  delete sfit_;
260  sfit_ = 0; // avoid possibility of attempting a second delete later
261 
262  segmentInChamber.push_back(temp);
263  if (debug) dumpSegment( temp );
264 
265  // Return #5 - OK, fewer than 3 rechits not on this segment left in chamber
266  if (nHitInChamber-protoSegment.size() < 3) return segmentInChamber;
267  // Return $6 - already have more than 4 segments in this chamber
268  if (segmentInChamber.size() > 4) return segmentInChamber;
269 
270  // Flag used hits
271  flagHitsAsUsed(rechits);
272  }
273  }
274  }
275  // Return #7
276  return segmentInChamber;
277 }
278 
279 
280 /* Method tryAddingHitsToSegment
281  *
282  * Look at left over hits and try to add them to proto segment by looking how far they
283  * are from the segment in terms of the hit error matrix (so how many sigmas away).
284  *
285  */
287  const ChamberHitContainerCIt i1,
288  const ChamberHitContainerCIt i2,
289  const LayerIndex& layerIndex) {
290 
291 /* Iterate over the layers with hits in the chamber
292  * Skip the layers containing the segment endpoints on first pass, but then
293  * try hits on layer containing the segment starting points on 2nd pass
294  * if segment has >2 hits. Once a hit is added to a layer, don't replace it
295  * until 2nd iteration
296  */
297 
298 
299 // std::cout << "[CSCSegAlgoDF::tryAddingHitsToSegment] entering"
300 // << " with rechits.size() = " << rechits.size() << std::endl;
301 
302  ChamberHitContainerCIt ib = rechits.begin();
303  ChamberHitContainerCIt ie = rechits.end();
304  closeHits.clear();
305 
306 
307  // int counter1 = 0;
308  // int counter2 = 0;
309 
310  for ( ChamberHitContainerCIt i = ib; i != ie; ++i ) {
311  // std::cout << "counter1 = " << ++counter1 << std::endl;
312  if (i == i1 || i == i2 ) continue;
313  if ( usedHits[i-ib] ) continue; // Don't use hits already part of a segment.
314 
315  // std::cout << "counter2 = " << ++counter2 << std::endl;
316  const CSCRecHit2D* h = *i;
317  int layer = layerIndex[i-ib];
318  int layer1 = layerIndex[i1-ib];
319  int layer2 = layerIndex[i2-ib];
320 
321  // std::cout << "[CSCSegAlgoDF::tryAddingHitsToSegment] layer, layer1, layer2 = "
322  // << layer << ", " << layer1 << ", " << layer2 << std::endl;
323 
324  // Low multiplicity case
325  // only adds hit to protoSegment if no hit on layer already; otherwise adds to closeHits
326  if (rechits.size() < 9) {
327  // std::cout << "low mult" << std::endl;
328  if ( isHitNearSegment( h ) ) {
329  if ( !hasHitOnLayer(layer) ) {
330  addHit(h, layer);
331  } else {
332  closeHits.push_back(h);
333  }
334  }
335 
336  // High multiplicity case
337  // only adds hit to protoSegment if no hit on layer already AND then refits; otherwise adds to closeHits
338  } else {
339  // std::cout << "high mult" << std::endl;
340  if ( isHitNearSegment( h ) ) {
341  // std::cout << "near seg" << std::endl;
342  if ( !hasHitOnLayer(layer) ) {
343  // std::cout << "no hit on layer" << std::endl;
344  if ( addHit(h, layer) ) {
345  // std::cout << "update fit" << std::endl;
347  }
348  // Don't change the starting points at this stage !!!
349  } else {
350  // std::cout << "already hit on layer" << std::endl;
351  closeHits.push_back(h);
352  if (layer != layer1 && layer != layer2 ) compareProtoSegment(h, layer);
353  }
354  }
355  }
356  }
357 
358  if ( int(protoSegment.size()) < 3) return;
359  // std::cout << "final fit" << std::endl;
361 
362  // 2nd pass to remove biases
363  // This time, also consider changing the endpoints
364  for ( ChamberHitContainerCIt i = closeHits.begin() ; i != closeHits.end(); ++i ) {
365  // std::cout << "2nd pass" << std::endl;
366  const CSCRecHit2D* h = *i;
367  int layer = (*i)->cscDetId().layer();
368  compareProtoSegment(h, layer);
369  }
370 
371 }
372 
373 
374 /* isHitNearSegment
375  *
376  * Compare rechit with expected position from protosegment
377  */
379 
380  const CSCLayer* layer = theChamber->layer(hit->cscDetId().layer());
381 
382  // hit phi position in global coordinates
383  GlobalPoint Hgp = layer->toGlobal(hit->localPosition());
384  float Hphi = Hgp.phi();
385  if (Hphi < 0.) Hphi += 2.*M_PI;
386  LocalPoint Hlp = theChamber->toLocal(Hgp);
387  float z = Hlp.z();
388 
389  float LocalX = sfit_->xfit(z);
390  float LocalY = sfit_->yfit(z);
391 
392  LocalPoint Slp(LocalX, LocalY, z);
393  GlobalPoint Sgp = theChamber->toGlobal(Slp);
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());
397 
398  float deltaPhi = Sphi - Hphi;
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;
402 
403  float RdeltaPhi = R * deltaPhi;
404 
405  if (RdeltaPhi < dRPhiFineMax && deltaPhi < dPhiFineMax ) return true;
406 
407  return false;
408 }
409 
410 
411 /* Method addHit
412  *
413  * Test if can add hit to proto segment. If so, try to add it.
414  *
415  */
416 bool CSCSegAlgoDF::addHit(const CSCRecHit2D* aHit, int layer) {
417 
418 
419  // std::cout << "[CSCSegAlgoDF::addHit] on layer " << layer << " to protoSegment.size() = "
420  // << protoSegment.size() << std::endl;
421 
422  // Return true if hit was added successfully and then parameters are updated.
423  // Return false if there is already a hit on the same layer, or insert failed.
424 
425  if ( protoSegment.size() > 5 ) return false; //@@ can only have 6 hits at most
426 
427  // Test that we are not trying to add the same hit again
428  for ( ChamberHitContainer::const_iterator it = protoSegment.begin(); it != protoSegment.end(); ++it )
429  if ( aHit == (*it) ) return false;
430 
431  protoSegment.push_back(aHit);
432 
433  return true;
434 }
435 
436 
437 /* Method updateParameters
438  *
439  * Perform a simple Least Square Fit on proto segment to determine slope and intercept
440  *
441  */
443 
444  // Delete existing CSCSegFit, create a new one and make the fit
445  // Uses internal variables - theChamber & protoSegment
446 
447  // std::cout << "[CSCSegAlgoDF::updateParameters] about to delete sfit_ = " << sfit_ << std::endl;
448  delete sfit_;
449  // std::cout << "[CSCSegAlgoDF::updateParameters] protoSegment.size() = "
450  // << protoSegment.size() << std::endl;
451  // std::cout << "[CSCSegAlgoDF::updateParameters] theChamber = " << theChamber << std::endl;
453  // std::cout << "[CSCSegAlgoDF::updateParameters] new sfit_ = " << sfit_ << std::endl;
454  sfit_->fit();
455 }
456 
457 /* hasHitOnLayer
458  *
459  * Just make sure hit to be added to layer comes from different layer than those in proto segment
460  */
461 bool CSCSegAlgoDF::hasHitOnLayer(int layer) const {
462 
463 
464  // std::cout << "[CSCSegAlgoDF::hasHitOnLayer] on layer " << layer << std::endl;
465 
466 
467  // Is there already a hit on this layer?
468  for ( ChamberHitContainerCIt it = protoSegment.begin(); it != protoSegment.end(); it++ )
469  if ( (*it)->cscDetId().layer() == layer ) return true;
470 
471  return false;
472 }
473 
474 
475 /* Method compareProtoSegment
476  *
477  * For hit coming from the same layer of an existing hit within the proto segment
478  * test if achieve better chi^2 by using this hit than the other
479  *
480  */
482 
483 
484  // std::cout << "[CSCSegAlgoDF::compareProtoSegment] for hit on layer " << layer
485  // << " with protoSegment.size() = " << protoSegment.size() << std::endl;
486 
487  // Try adding the hit to existing segment, and remove old one existing in same layer
488  ChamberHitContainer::iterator it;
489  for ( it = protoSegment.begin(); it != protoSegment.end(); ) {
490  if ( (*it)->cscDetId().layer() == layer ) {
491  it = protoSegment.erase(it);
492  } else {
493  ++it;
494  }
495  }
496 
497  // std::cout << "[CSCSegAlgoDF::compareProtoSegment] about to add hit on layer " << layer
498  // << " with protoSegment.size() = " << protoSegment.size() << std::endl;
499 
500  bool ok = addHit(h, layer);
501 
502  CSCSegFit* newfit = 0;
503  if ( ok ) {
504  newfit = new CSCSegFit( theChamber, protoSegment );
505  // std::cout << "[CSCSegAlgoDF::compareProtoSegment] newfit = " << newfit << std::endl;
506  newfit->fit();
507  }
508  if ( !ok || (newfit->chi2() > sfit_->chi2()) ) {
509  // std::cout << "[CSCSegAlgoDF::compareProtoSegment] about to delete newfit = " << newfit << std::endl;
510  delete newfit; // failed to add a hit or new fit is worse
511  }
512  else {
513  // std::cout << "[CSCSegAlgoDF::compareProtoSegment] about to delete sfit_ = " << sfit_ << std::endl;
514  delete sfit_; // new fit is better
515  sfit_ = newfit;
516  // std::cout << "[CSCSegAlgoDF::compareProtoSegment] reset sfit_ = " << sfit_ << std::endl;
517  }
518 }
519 
520 
521 /* Method flagHitsAsUsed
522  *
523  * Flag hits which have entered segment building so we don't reuse them.
524  * Also flag does which were very close to segment to reduce combinatorics
525  */
526 void CSCSegAlgoDF::flagHitsAsUsed(const ChamberHitContainer& rechitsInChamber) {
527 
528  // Flag hits on segment as used
529  ChamberHitContainerCIt ib = rechitsInChamber.begin();
530  ChamberHitContainerCIt hi, iu;
531 
532  for ( hi = protoSegment.begin(); hi != protoSegment.end(); ++hi ) {
533  for ( iu = ib; iu != rechitsInChamber.end(); ++iu ) {
534  if (*hi == *iu) usedHits[iu-ib] = true;
535  }
536  }
537  // Don't reject hits marked as "nearby" for now.
538  // So this is bypassed at all times for now !!!
539  // Perhaps add back to speed up algorithm some more
540  if (closeHits.size() > 0) return;
541  for ( hi = closeHits.begin(); hi != closeHits.end(); ++hi ) {
542  for ( iu = ib; iu != rechitsInChamber.end(); ++iu ) {
543  if (*hi == *iu) usedHits[iu-ib] = true;
544  }
545  }
546 
547 }
548 
549 
550 // Try to clean up segments by quickly looking at residuals
552 
553  // Only prune if have at least 5 hits
554  if ( protoSegment.size() < 5 ) return ;
555 
556  // Now Study residuals
557 
558  float maxResidual = 0.;
559  float sumResidual = 0.;
560  int nHits = 0;
561  int badIndex = -1;
562  int j = 0;
563 
564 
565  ChamberHitContainer::const_iterator ih;
566 
567  for ( ih = protoSegment.begin(); ih != protoSegment.end(); ++ih ) {
568  const CSCRecHit2D& hit = (**ih);
569  const CSCLayer* layer = theChamber->layer(hit.cscDetId().layer());
570  GlobalPoint gp = layer->toGlobal(hit.localPosition());
571  LocalPoint lp = theChamber->toLocal(gp);
572 
573  float residual = sfit_->Rdev(lp.x(), lp.y(), lp.z());
574 
575  sumResidual += residual;
576  nHits++;
577  if ( residual > maxResidual ) {
578  maxResidual = residual;
579  badIndex = j;
580  }
581  j++;
582  }
583 
584  float corrAvgResidual = (sumResidual - maxResidual)/(nHits -1);
585 
586  // Keep all hits
587  if ( maxResidual/corrAvgResidual < maxRatioResidual ) return;
588 
589 
590  // Drop worse hit and recompute segment properties + fill
591 
592  ChamberHitContainer newProtoSegment;
593 
594  j = 0;
595  for ( ih = protoSegment.begin(); ih != protoSegment.end(); ++ih ) {
596  if ( j != badIndex ) newProtoSegment.push_back(*ih);
597  j++;
598  }
599 
600  protoSegment.clear();
601 
602  for ( ih = newProtoSegment.begin(); ih != newProtoSegment.end(); ++ih ) {
603  protoSegment.push_back(*ih);
604  }
605 
606  // Compute segment parameters
608 
609 }
610 
611 void CSCSegAlgoDF::dumpSegment( const CSCSegment& seg ) const {
612 
613  edm::LogVerbatim("CSCSegment") << "CSCSegment in " << theChamber->id()
614  << "\nlocal position = " << seg.localPosition()
615  << "\nerror = " << seg.localPositionError()
616  << "\nlocal direction = " << seg.localDirection()
617  << "\nerror =" << seg.localDirectionError()
618  << "\ncovariance matrix"
619  << seg.parametersError()
620  << "chi2/ndf = " << seg.chi2() << "/" << seg.degreesOfFreedom()
621  << "\n#rechits = " << seg.specificRecHits().size()
622  << "\ntime = " << seg.time();
623 }
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
int i
Definition: DBlmapReader.cc:9
void fit(void)
Definition: CSCSegFit.cc:14
ChamberHitContainer protoSegment
Definition: CSCSegAlgoDF.h:122
std::vector< const CSCRecHit2D * > ChamberHitContainer
Definition: CSCSegAlgoDF.h:56
std::vector< const CSCRecHit2D * >::const_iterator ChamberHitContainerCIt
Definition: CSCSegAlgoDF.h:57
CSCSetOfHits hits(void) const
Definition: CSCSegFit.h:82
CSCDetId cscDetId() const
Definition: CSCRecHit2D.h:52
int ib
Definition: cuy.py:660
LocalVector localdir() const
Definition: CSCSegFit.h:88
FWCore Framework interface EventSetupRecordImplementation h
Helper function to determine trigger accepts.
virtual ~CSCSegAlgoDF()
Destructor.
Definition: CSCSegAlgoDF.cc:60
CSCDetId id() const
Get the (concrete) DetId.
Definition: CSCChamber.h:37
CSCSegAlgoPreClustering * preCluster_
Definition: CSCSegAlgoDF.h:143
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.
Definition: GeomDet.h:52
LocalError localPositionError() const
Definition: CSCSegment.cc:47
Geom::Phi< T > phi() const
Definition: PV3DBase.h:69
T y() const
Definition: PV3DBase.h:63
ChamberHitContainer closeHits
Definition: CSCSegAlgoDF.h:120
float Rdev(float x, float y, float z) const
Definition: CSCSegFit.cc:473
LocalPoint toLocal(const GlobalPoint &gp) const
Conversion to the R.F. of the GeomDet.
Definition: GeomDet.h:67
bool addHit(const CSCRecHit2D *hit, int layer)
bool isHitNearSegment(const CSCRecHit2D *h) const
CSCSegAlgoDF(const edm::ParameterSet &ps)
Constructor.
Definition: CSCSegAlgoDF.cc:35
CSCSegAlgoShowering * showering_
Definition: CSCSegAlgoDF.h:144
int layer() const
Definition: CSCDetId.h:61
bool preClustering
Definition: CSCSegAlgoDF.h:127
virtual int degreesOfFreedom() const
Degrees of freedom of the segment fit.
Definition: CSCSegment.h:61
std::vector< CSCSegment > buildSegments(const ChamberHitContainer &rechits)
std::vector< CSCSegment > run(const CSCChamber *aChamber, const ChamberHitContainer &rechits)
Definition: CSCSegAlgoDF.cc:69
CSCSegFit * sfit_
Definition: CSCSegAlgoDF.h:145
LocalPoint localPosition() const
Definition: CSCSegment.h:38
LocalVector localDirection() const
Local direction.
Definition: CSCSegment.h:41
void updateParameters(void)
std::deque< bool > BoolContainer
Definition: CSCSegAlgoDF.h:58
const Surface::PositionType & position() const
The position (origin of the R.F.)
Definition: GeomDet.h:46
int nRecHits() const
Definition: CSCSegment.h:67
T sqrt(T t)
Definition: SSEVec.h:18
void compareProtoSegment(const CSCRecHit2D *h, int layer)
void dumpSegment(const CSCSegment &seg) const
double chi2(void) const
Definition: CSCSegFit.h:85
T z() const
Definition: PV3DBase.h:64
int j
Definition: DBlmapReader.cc:9
const CSCLayer * layer(CSCDetId id) const
Return the layer corresponding to the given id.
Definition: CSCChamber.cc:39
std::vector< int > LayerIndex
Typedefs.
Definition: CSCSegAlgoDF.h:55
float xfit(float z) const
Definition: CSCSegFit.cc:455
float maxRatioResidual
Definition: CSCSegAlgoDF.h:141
const std::vector< CSCRecHit2D > & specificRecHits() const
Definition: CSCSegment.h:65
int minHitsForPreClustering
Definition: CSCSegAlgoDF.h:128
#define M_PI
AlgebraicSymMatrix parametersError() const
Covariance matrix of parameters()
Definition: CSCSegment.h:48
void flagHitsAsUsed(const ChamberHitContainer &rechitsInChamber)
float tanThetaMax
Definition: CSCSegAlgoDF.h:139
void pruneFromResidual(void)
AlgebraicSymMatrix covarianceMatrix(void)
Definition: CSCSegFit.cc:378
double dPhiFineMax
Definition: CSCSegAlgoDF.h:137
std::vector< std::vector< const CSCRecHit2D * > > clusterHits(const CSCChamber *aChamber, const ChamberHitContainer &rechits)
clusterize
LocalPoint intercept() const
Definition: CSCSegFit.h:87
double dRPhiFineMax
Definition: CSCSegAlgoDF.h:136
double chi2() const
Chi2 of the segment fit.
Definition: CSCSegment.h:57
const CSCChamber * theChamber
Definition: CSCSegAlgoDF.h:117
LocalPoint localPosition() const
Definition: CSCRecHit2D.h:50
int minHitsPerSegment
Definition: CSCSegAlgoDF.h:134
int nHitsPerClusterIsShower
Definition: CSCSegAlgoDF.h:132
T x() const
Definition: PV3DBase.h:62
BoolContainer usedHits
Definition: CSCSegAlgoDF.h:118
float time() const
Definition: CSCSegment.cc:149
LocalError localDirectionError() const
Error on the local direction.
Definition: CSCSegment.cc:51
bool hasHitOnLayer(int layer) const
float yfit(float z) const
Definition: CSCSegFit.cc:461