CMS 3D CMS Logo

CSCSegAlgoTC.cc
Go to the documentation of this file.
1 
8 #include "CSCSegAlgoTC.h"
9 #include "CSCSegFit.h"
10 
13 
15 
18 
20 
21 #include <algorithm>
22 #include <cmath>
23 #include <iostream>
24 #include <string>
25 
27  : CSCSegmentAlgorithm(ps), sfit_(0), myName("CSCSegAlgoTC") {
28 
29  debugInfo = ps.getUntrackedParameter<bool>("verboseInfo");
30 
31  dRPhiMax = ps.getParameter<double>("dRPhiMax");
32  dPhiMax = ps.getParameter<double>("dPhiMax");
33  dRPhiFineMax = ps.getParameter<double>("dRPhiFineMax");
34  dPhiFineMax = ps.getParameter<double>("dPhiFineMax");
35  chi2Max = ps.getParameter<double>("chi2Max");
36  chi2ndfProbMin = ps.getParameter<double>("chi2ndfProbMin");
37  minLayersApart = ps.getParameter<int>("minLayersApart");
38  SegmentSorting = ps.getParameter<int>("SegmentSorting");
39 
40  LogDebug("CSC") << myName << " has algorithm cuts set to: \n"
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;
50 }
51 
52 std::vector<CSCSegment> CSCSegAlgoTC::run(const CSCChamber* aChamber, const ChamberHitContainer& rechits) {
53  theChamber = aChamber;
54 
55  return buildSegments(rechits);
56 }
57 
58 std::vector<CSCSegment> CSCSegAlgoTC::buildSegments(const ChamberHitContainer& urechits) {
59 
60  // ChamberHitContainer rechits = urechits;
61  ChamberHitContainer rechits(urechits);
62 
63  // edm::LogVerbatim("CSCSegment") << "[CSCSegAlgoTC::buildSegments] start building segments in " << theChamber->id();
64  // edm::LogVerbatim("CSCSegment") << "[CSCSegAlgoTC::buildSegments] size of rechit container = " << rechits.size();
65 
66  if (rechits.size() < 2) {
67  LogDebug("CSC") << myName << ": " << rechits.size() <<
68  " hit(s) in chamber is not enough to build a segment.\n";
69  return std::vector<CSCSegment>();
70  }
71 
72  LayerIndex layerIndex(rechits.size());
73 
74  for ( size_t i = 0; i < rechits.size(); ++i ) {
75  short ilay = rechits[i]->cscDetId().layer();
76  layerIndex[i] = ilay;
77  // edm::LogVerbatim("CSCSegment") << "layerIndex[" << i << "] should be " << rechits[i]->cscDetId().layer();
78  // edm::LogVerbatim("CSCSegment") << "layerIndex[" << i << "] actually is " << layerIndex[i];
79  }
80 
81  double z1 = theChamber->layer(1)->position().z();
82  double z6 = theChamber->layer(6)->position().z();
83 
84  if ( z1 > 0. ) {
85  if ( z1 > z6 ) {
86  reverse(layerIndex.begin(), layerIndex.end());
87  reverse(rechits.begin(), rechits.end());
88  }
89  }
90  else if ( z1 < 0. ) {
91  if ( z1 < z6 ) {
92  reverse(layerIndex.begin(), layerIndex.end());
93  reverse(rechits.begin(), rechits.end());
94  }
95  }
96 
97  // Dump rechits after sorting?
98  // if (debugInfo) dumpHits(rechits);
99 
100  // if (rechits.size() < 2) {
101  // LogDebug("CSC") << myName << ": " << rechits.size() <<
102  // " hit(s) in chamber is not enough to build a segment.\n";
103  // return std::vector<CSCSegment>();
104  // }
105 
106  // We have at least 2 hits. We intend to try all possible pairs of hits to start
107  // segment building. 'All possible' means each hit lies on different layers in the chamber.
108  // For now we don't care whether a hit has already been allocated to another segment;
109  // we'll sort that out after building all possible segments.
110 
111  // Choose first hit (as close to IP as possible) h1 and
112  // second hit (as far from IP as possible) h2
113  // To do this we iterate over hits in the chamber by layer - pick two layers.
114  // @@ Require the two layers are at least 3 layers apart. May need tuning?
115  // Then we iterate over hits within each of these layers and pick h1 and h2 from these.
116  // If they are 'close enough' we build an empty segment.
117  // Then try adding hits to this segment.
118 
119  // Define buffer for segments we build (at the end we'll sort them somehow, and remove
120  // those which share hits with better-quality segments.
121 
122 
123  std::vector<CSCSegment> segments;
124 
125  sfit_ = 0;
126 
127  ChamberHitContainerCIt ib = rechits.begin();
128  ChamberHitContainerCIt ie = rechits.end();
129 
130  for (ChamberHitContainerCIt i1 = ib; i1 != ie; ++i1) {
131 
132  int layer1 = layerIndex[i1-ib];
133 
134  const CSCRecHit2D* h1 = *i1;
135 
136  for (ChamberHitContainerCIt i2 = ie-1; i2 != i1; --i2) {
137 
138  int layer2 = layerIndex[i2-ib];
139 
140  if (abs(layer2 - layer1) < minLayersApart)
141  break;
142 
143  const CSCRecHit2D* h2 = *i2;
144 
145  if (areHitsCloseInLocalX(h1, h2) && areHitsCloseInGlobalPhi(h1, h2)) {
146 
147  proto_segment.clear();
148 
149  const CSCLayer* l1 = theChamber->layer(h1->cscDetId().layer());
150  GlobalPoint gp1 = l1->toGlobal(h1->localPosition());
151  const CSCLayer* l2 = theChamber->layer(h2->cscDetId().layer());
152  GlobalPoint gp2 = l2->toGlobal(h2->localPosition());
153  LogDebug("CSCSegment") << "start new segment from hits " << "h1: " << gp1 << " - h2: " << gp2 << "\n";
154  // edm::LogVerbatim("CSCSegment") << "start new segment from hits " << "h1: " << gp1 << " - h2: " << gp2;
155  // edm::LogVerbatim("CSCSegment") << "on layers " << layer1 << " and " << layer2;
156 
157  if ( !addHit(h1, layer1) ) {
158  LogDebug("CSCSegment") << " failed to add hit h1\n";
159  continue;
160  }
161 
162  if ( !addHit(h2, layer2) ) {
163  LogDebug("CSCSegment") << " failed to add hit h2\n";
164  continue;
165  }
166 
167  if ( sfit_ ) tryAddingHitsToSegment(rechits, i1, i2); // can only add hits if there's a segment
168 
169  // if a segment has been found push back it into the segment collection
170  if (proto_segment.empty()) {
171  LogDebug("CSCSegment") << "No segment found.\n";
172  // edm::LogVerbatim("CSCSegment") << "No segment found.";
173  }
174  else {
175  //@@ THIS IS GOING TO BE TRICKY - CREATING MANY FITS ON HEAP
176  //@@ BUT MEMBER VARIABLE JUST POINTS TO MOST RECENT ONE
177  candidates.push_back( sfit_ ); // store the current fit
178  LogDebug("CSCSegment") << "Found a segment.\n";
179  // edm::LogVerbatim("CSCSegment") << "Found a segment.";
180  }
181  }
182  }
183  }
184 
185  // edm::LogVerbatim("CSCSegment") << "[CSCSegAlgoTC::buildSegments] no. of candidates before pruning = " << candidates.size();
186 
187  // We've built all possible segments. Now pick the best, non-overlapping subset.
188  pruneTheSegments(rechits);
189 
190  // Create CSCSegments for the surviving candidates
191  for(unsigned int i = 0; i < candidates.size(); ++i ) {
192  CSCSegFit*sfit = candidates[i];
193  // edm::LogVerbatim("CSCSegment") << "candidate fit " << i+1 << " of " << candidates.size() << " is at " << sfit;
194  // if ( !sfit ) {
195  // edm::LogVerbatim("CSCSegment") << "stored a null pointer for element " << i+1 << " of " << candidates.size();
196  // continue;
197  // }
198  CSCSegment temp(sfit->hits(), sfit->intercept(), sfit->localdir(),
199  sfit->covarianceMatrix(), sfit->chi2() );
200  delete sfit;
201  segments.push_back(temp);
202  if (debugInfo) dumpSegment( temp );
203  }
204 
205  // reset member variables
206  candidates.clear();
207  sfit_ = 0;
208 
209  // edm::LogVerbatim("CSCSegment") << "[CSCSegAlgoTC::buildSegments] no. of segments returned = " << segments.size();
210 
211  return segments;
212 }
213 
215  const ChamberHitContainerCIt i1, const ChamberHitContainerCIt i2) {
216 
217  // Iterate over the layers with hits in the chamber
218  // Skip the layers containing the segment endpoints
219  // Test each hit on the other layers to see if it is near the segment
220  // If it is, see whether there is already a hit on the segment from the same layer
221  // - if so, and there are more than 2 hits on the segment, copy the segment,
222  // replace the old hit with the new hit. If the new segment chi2 is better
223  // then replace the original segment with the new one (by swap)
224  // - if not, copy the segment, add the hit. If the new chi2/dof is still satisfactory
225  // then replace the original segment with the new one (by swap)
226 
227  ChamberHitContainerCIt ib = rechits.begin();
228  ChamberHitContainerCIt ie = rechits.end();
229 
230  for (ChamberHitContainerCIt i = ib; i != ie; ++i) {
231 
232  if ( i == i1 || i == i2 )
233  continue;
234 
235  int layer = (*i)->cscDetId().layer();
236  const CSCRecHit2D* h = *i;
237 
238  if (isHitNearSegment(h)) {
239 
240  const CSCLayer* l1 = theChamber->layer(h->cscDetId().layer());
241  GlobalPoint gp1 = l1->toGlobal(h->localPosition());
242  LogDebug("CSC") << " hit at global " << gp1 << " is near segment\n.";
243 
244  if (hasHitOnLayer(layer)) {
245  if (proto_segment.size() <= 2) {
246  LogDebug("CSC") << " " << proto_segment.size()
247  << " hits on segment...skip hit on same layer.\n";
248  continue;
249  }
250 
251  compareProtoSegment(h, layer);
252  }
253  else
254  increaseProtoSegment(h, layer);
255  } // h & seg close
256  } // i
257 }
258 
259 bool CSCSegAlgoTC::addHit(const CSCRecHit2D* aHit, int layer) {
260 
261  // Return true if hit was added successfully
262  // (and then parameters are updated).
263  // Return false if there is already a hit on the same layer, or insert failed.
264 
265  bool ok = true;
266  ChamberHitContainer::const_iterator it;
267 
268  for(it = proto_segment.begin(); it != proto_segment.end(); it++)
269  if (((*it)->cscDetId().layer() == layer) && (aHit != *it))
270  return false;
271 
272  if (ok) {
273  proto_segment.push_back(aHit);
275  }
276  return ok;
277 }
278 
279 bool CSCSegAlgoTC::replaceHit(const CSCRecHit2D* h, int layer) {
280 
281  // replace a hit from a layer
282  ChamberHitContainer::iterator it;
283  for (it = proto_segment.begin(); it != proto_segment.end();) {
284  if ((*it)->cscDetId().layer() == layer)
285  it = proto_segment.erase(it);
286  else
287  ++it;
288  }
289 
290  return addHit(h, layer);
291 
292 }
293 
295 
296  //@@ DO NOT DELETE EXISTING FIT SINCE WE SAVE IT!!
297  // delete sfit_;
299  sfit_->fit();
300 
301 }
302 
303 float CSCSegAlgoTC::phiAtZ(float z) const {
304 
305  // Returns a phi in [ 0, 2*pi )
306  const CSCLayer* l1 = theChamber->layer(1);
308  GlobalVector gv = l1->toGlobal(sfit_->localdir());
309 
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);
313  if (phi < 0.f)
314  phi += 2. * M_PI;
315 
316  return phi ;
317 }
318 
320 
321  // Save copy of current fit
322  CSCSegFit* oldfit = new CSCSegFit( *sfit_ );
323 
324  bool ok = replaceHit(h, layer); // possible new fit
325 
326  if (ok) {
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";
329  }
330 
331  if ( ok && (sfit_->chi2() < oldfit->chi2()) ) {
332  LogDebug("CSC") << " segment with replaced hit is better.\n";
333  delete oldfit; // new fit is better
334  }
335  else {
336  delete sfit_; // new fit is worse
337  sfit_ = oldfit; // restore original fit
338  }
339 }
340 
342 
343  // save copy of input fit
344  CSCSegFit* oldfit = new CSCSegFit( *sfit_ );
345 
346  bool ok = addHit(h, layer); // possible new fit
347 
348  if (ok) {
349  LogDebug("CSC") << " hit in new layer: added to segment, new chi2: "
350  << sfit_->chi2() << "\n";
351  }
352 
353  // int ndf = 2*proto_segment.size() - 4;
354 
355  if (ok && ((sfit_->chi2() <= 0) || (sfit_->chi2()/sfit_->ndof() < chi2Max))) {
356  LogDebug("CSC") << " segment with added hit is good.\n" ;
357  delete oldfit; // new fit is better
358  }
359  else {
360  delete sfit_; // new fit is worse
361  sfit_ = oldfit; // restore original fit
362  }
363 }
364 
366  float deltaX = (h1->localPosition()-h2->localPosition()).x();
367  LogDebug("CSC") << " Hits at local x= " << h1->localPosition().x() << ", "
368  << h2->localPosition().x() << " have separation= " << deltaX;
369  return (fabs(deltaX) < (dRPhiMax))? true:false; // +v
370 }
371 
373 
374  const CSCLayer* l1 = theChamber->layer(h1->cscDetId().layer());
375  GlobalPoint gp1 = l1->toGlobal(h1->localPosition());
376  const CSCLayer* l2 = theChamber->layer(h2->cscDetId().layer());
377  GlobalPoint gp2 = l2->toGlobal(h2->localPosition());
378 
379  float h1p = gp1.phi();
380  float h2p = gp2.phi();
381  float dphi12 = h1p - h2p;
382 
383  // Into range [-pi, pi) (phi() returns values in this range)
384  if (dphi12 < -M_PI)
385  dphi12 += 2.*M_PI;
386  if (dphi12 > M_PI)
387  dphi12 -= 2.*M_PI;
388  LogDebug("CSC") << " Hits at global phi= " << h1p << ", "
389  << h2p << " have separation= " << dphi12;
390  return (fabs(dphi12) < dPhiMax)? true:false; // +v
391 }
392 
394 
395  // Is hit near segment?
396  // Requires deltaphi and rxy*deltaphi within ranges specified
397  // in orcarc, or by default, where rxy=sqrt(x**2+y**2) of hit itself.
398  // Note that to make intuitive cuts on delta(phi) one must work in
399  // phi range (-pi, +pi] not [0, 2pi
400 
401  const CSCLayer* l1 = theChamber->layer(h->cscDetId().layer());
402  GlobalPoint hp = l1->toGlobal(h->localPosition());
403 
404  float hphi = hp.phi(); // in (-pi, +pi]
405  if (hphi < 0.)
406  hphi += 2.*M_PI; // into range [0, 2pi)
407  float sphi = phiAtZ(hp.z()); // in [0, 2*pi)
408  float phidif = sphi-hphi;
409  if (phidif < 0.)
410  phidif += 2.*M_PI; // into range [0, 2pi)
411  if (phidif > M_PI)
412  phidif -= 2.*M_PI; // into range (-pi, pi]
413 
414  float dRPhi = fabs(phidif)*hp.perp();
415  LogDebug("CSC") << " is hit at phi_h= " << hphi << " near segment phi_seg= " << sphi
416  << "? is " << dRPhi << "<" << dRPhiFineMax << " ? "
417  << " and is |" << phidif << "|<" << dPhiFineMax << " ?";
418 
419  return ((dRPhi < dRPhiFineMax) &&
420  (fabs(phidif) < dPhiFineMax))? true:false; // +v
421 }
422 
423 bool CSCSegAlgoTC::hasHitOnLayer(int layer) const {
424 
425  // Is there is already a hit on this layer?
427 
428  for(it = proto_segment.begin(); it != proto_segment.end(); it++)
429  if ((*it)->cscDetId().layer() == layer)
430  return true;
431 
432  return false;
433 }
434 
436 
437  // Dump positions of RecHit's in each CSCChamber
439 
440  for(it=rechits.begin(); it!=rechits.end(); it++) {
441 
442  const CSCLayer* l1 = theChamber->layer((*it)->cscDetId().layer());
443  GlobalPoint gp1 = l1->toGlobal((*it)->localPosition());
444 
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";
449  }
450 }
451 
452 
453 
454 bool CSCSegAlgoTC::isSegmentGood(std::vector<CSCSegFit*>::iterator seg,
455  const ChamberHitContainer& rechitsInChamber, BoolContainer& used) const {
456 
457  // Apply any selection cuts to segment
458 
459  // 1) Require a minimum no. of hits
460  // (@@ THESE VALUES SHOULD BECOME PARAMETERS?)
461 
462  // 2) Ensure no hits on segment are already assigned to another segment
463  // (typically of higher quality)
464 
465  size_t iadd = (rechitsInChamber.size() > 20 )? 1 : 0;
466 
467  size_t nhits = (*seg)->nhits();
468 
469  if (nhits < 3 + iadd)
470  return false;
471 
472  // Additional part of alternative segment selection scheme: reject
473  // segments with a chi2 probability of less than chi2ndfProbMin. Relies on list
474  // being sorted with "SegmentSorting == 2", that is first by nrechits and then
475  // by chi2prob in subgroups of same no. of rechits.
476 
477  if( SegmentSorting == 2 ){
478  double chi2t = (*seg)->chi2();
479  double ndoft = 2*nhits - 4 ;
480  if( chi2t > 0 && ndoft > 0 ) {
481  if ( ChiSquaredProbability(chi2t,ndoft) < chi2ndfProbMin ) {
482  return false;
483  }
484  }
485  else {
486  return false;
487  }
488  }
489 
490  ChamberHitContainer hits_ = (*seg)->hits();
491 
492  for(size_t ish = 0; ish < nhits; ++ish) {
493 
494  ChamberHitContainerCIt ib = rechitsInChamber.begin();
495 
496  for(ChamberHitContainerCIt ic = ib; ic != rechitsInChamber.end(); ++ic) {
497 
498  if((hits_[ish] == (*ic)) && used[ic-ib])
499  return false;
500  }
501  }
502 
503  return true;
504 }
505 
506 void CSCSegAlgoTC::flagHitsAsUsed(std::vector<CSCSegFit*>::iterator seg,
507  const ChamberHitContainer& rechitsInChamber, BoolContainer& used) const {
508 
509  // Flag hits on segment as used
510 
511  ChamberHitContainerCIt ib = rechitsInChamber.begin();
512  ChamberHitContainer hits = (*seg)->hits();
513 
514  for(size_t ish = 0; ish < hits.size(); ++ish) {
515  for(ChamberHitContainerCIt iu = ib; iu != rechitsInChamber.end(); ++iu)
516  if( hits[ish] == (*iu))
517  used[iu-ib] = true;
518  }
519 }
520 
522 
523  // Sort the segment store according to segment 'quality' (chi2/#hits ?) and
524  // remove any segments which contain hits assigned to higher-quality segments.
525 
526  if (candidates.empty())
527  return;
528 
529  // Initialize flags that a given hit has been allocated to a segment
530  BoolContainer used(rechitsInChamber.size(), false);
531 
532  // Sort by chi2/#hits
533  segmentSort();
534 
535  // Select best quality segments, requiring hits are assigned to just one segment
536  // Want to erase the bad segments, so the iterator must be incremented
537  // inside the loop, and only when the erase is not called
538 
539  std::vector<CSCSegFit*>::iterator is;
540 
541  for (is = candidates.begin(); is != candidates.end(); ) {
542 
543  bool goodSegment = isSegmentGood(is, rechitsInChamber, used);
544 
545  if (goodSegment) {
546  LogDebug("CSC") << "Accepting segment: ";
547  flagHitsAsUsed(is, rechitsInChamber, used);
548  ++is;
549  }
550  else {
551  LogDebug("CSC") << "Rejecting segment: ";
552  delete *is; // delete the CSCSegFit*
553  is = candidates.erase(is); // erase the element in container
554  }
555  }
556 }
557 
559 
560  // The segment collection is sorted according to e.g. chi2/#hits
561 
562  for(size_t i=0; i<candidates.size()-1; ++i) {
563  for(size_t j=i+1; j<candidates.size(); ++j) {
564 
565  size_t ni = (candidates[i]->hits()).size();
566  size_t nj = (candidates[j]->hits()).size();
567 
568  // Sort criterion: first sort by no. of rechits, then in groups of rechits by chi2prob
569  if( SegmentSorting == 2 ){
570  if ( nj > ni ) { // sort by no. of rechits
571  CSCSegFit* temp = candidates[j];
572  candidates[j] = candidates[i];
573  candidates[i] = temp;
574  }
575  // sort by chi2 probability in subgroups with equal nr of rechits
576  // if(chi2s[i] != 0. && 2*n2-4 > 0 ) {
577  if( candidates[i]->chi2() > 0 && candidates[i]->ndof() > 0 ) {
578  if( nj == ni &&
579  ( ChiSquaredProbability( candidates[i]->chi2(),(double)(candidates[i]->ndof()) ) <
580  ChiSquaredProbability( candidates[j]->chi2(),(double)(candidates[j]->ndof()) ) )
581  ){
582  CSCSegFit* temp = candidates[j];
583  candidates[j] = candidates[i];
584  candidates[i] = temp;
585  }
586  }
587  }
588  else if( SegmentSorting == 1 ){
589  if ((candidates[i]->chi2()/ni) > (candidates[j]->chi2()/nj)) {
590  CSCSegFit* temp = candidates[j];
591  candidates[j] = candidates[i];
592  candidates[i] = temp;
593  }
594  }
595  else{
596  LogDebug("CSC") << "No valid segment sorting specified. Algorithm misconfigured! \n";
597  }
598  }
599  }
600 }
601 
602 void CSCSegAlgoTC::dumpSegment( const CSCSegment& seg ) const {
603 
604  edm::LogVerbatim("CSCSegment") << "CSCSegment in " << theChamber->id()
605  << "\nlocal position = " << seg.localPosition()
606  << "\nerror = " << seg.localPositionError()
607  << "\nlocal direction = " << seg.localDirection()
608  << "\nerror =" << seg.localDirectionError()
609  << "\ncovariance matrix"
610  << seg.parametersError()
611  << "chi2/ndf = " << seg.chi2() << "/" << seg.degreesOfFreedom()
612  << "\n#rechits = " << seg.specificRecHits().size()
613  << "\ntime = " << seg.time();
614 }
#define LogDebug(id)
size
Write out results.
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
void fit(void)
Definition: CSCSegFit.cc:14
CSCSetOfHits hits(void) const
Definition: CSCSegFit.h:82
CSCDetId cscDetId() const
Definition: CSCRecHit2D.h:52
T perp() const
Definition: PV3DBase.h:72
LocalVector localdir() const
Definition: CSCSegFit.h:88
CSCDetId id() const
Get the (concrete) DetId.
Definition: CSCChamber.h:37
const std::string myName
Definition: CSCSegAlgoTC.h:192
GlobalPoint toGlobal(const Local2DPoint &lp) const
Conversion to the global R.F. from the R.F. of the GeomDet.
Definition: GeomDet.h:54
LocalError localPositionError() const
Definition: CSCSegment.cc:47
Geom::Phi< T > phi() const
Definition: PV3DBase.h:69
void dumpSegment(const CSCSegment &seg) const
T y() const
Definition: PV3DBase.h:63
void compareProtoSegment(const CSCRecHit2D *h, int layer)
std::deque< bool > BoolContainer
Definition: CSCSegAlgoTC.h:47
int layer() const
Definition: CSCDetId.h:61
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)
Definition: CSCSegAlgoTC.cc:58
virtual int degreesOfFreedom() const
Degrees of freedom of the segment fit.
Definition: CSCSegment.h:61
bool areHitsCloseInLocalX(const CSCRecHit2D *h1, const CSCRecHit2D *h2) const
bool isHitNearSegment(const CSCRecHit2D *h) const
LocalPoint localPosition() const
Definition: CSCSegment.h:38
LocalVector localDirection() const
Local direction.
Definition: CSCSegment.h:41
void dumpHits(const ChamberHitContainer &rechits) const
void updateParameters(void)
const Surface::PositionType & position() const
The position (origin of the R.F.)
Definition: GeomDet.h:48
susybsm::HSCParticleRefProd hp
Definition: classes.h:27
double chi2(void) const
Definition: CSCSegFit.h:85
T z() const
Definition: PV3DBase.h:64
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
const CSCLayer * layer(CSCDetId id) const
Return the layer corresponding to the given id.
Definition: CSCChamber.cc:39
float dRPhiFineMax
Definition: CSCSegAlgoTC.h:162
int ndof(void) const
Definition: CSCSegFit.h:86
double f[11][100]
float ChiSquaredProbability(double chiSquared, double nrDOF)
const std::vector< CSCRecHit2D > & specificRecHits() const
Definition: CSCSegment.h:65
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
float chi2ndfProbMin
Definition: CSCSegAlgoTC.h:157
#define M_PI
const CSCChamber * theChamber
Member variables.
Definition: CSCSegAlgoTC.h:140
std::vector< CSCSegFit * > candidates
Definition: CSCSegAlgoTC.h:148
std::vector< CSCSegment > run(const CSCChamber *aChamber, const ChamberHitContainer &rechits)
Definition: CSCSegAlgoTC.cc:52
AlgebraicSymMatrix parametersError() const
Covariance matrix of parameters()
Definition: CSCSegment.h:48
ChamberHitContainer proto_segment
Definition: CSCSegAlgoTC.h:142
std::vector< const CSCRecHit2D * > ChamberHitContainer
Definition: CSCSegAlgoTC.h:39
AlgebraicSymMatrix covarianceMatrix(void)
Definition: CSCSegFit.cc:378
void tryAddingHitsToSegment(const ChamberHitContainer &rechits, const ChamberHitContainerCIt i1, const ChamberHitContainerCIt i2)
bool hasHitOnLayer(int layer) const
LocalPoint intercept() const
Definition: CSCSegFit.h:87
double chi2() const
Chi2 of the segment fit.
Definition: CSCSegment.h:57
std::vector< int > LayerIndex
Typedefs.
Definition: CSCSegAlgoTC.h:38
LocalPoint localPosition() const
Definition: CSCRecHit2D.h:50
T x() const
Definition: PV3DBase.h:62
CSCSegFit * sfit_
Definition: CSCSegAlgoTC.h:145
ChamberHitContainer::const_iterator ChamberHitContainerCIt
Definition: CSCSegAlgoTC.h:40
void increaseProtoSegment(const CSCRecHit2D *h, int layer)
void pruneTheSegments(const ChamberHitContainer &rechitsInChamber)
float time() const
Definition: CSCSegment.cc:149
LocalError localDirectionError() const
Error on the local direction.
Definition: CSCSegment.cc:51
bool replaceHit(const CSCRecHit2D *h, int layer)
ib
Definition: cuy.py:660
CSCSegAlgoTC(const edm::ParameterSet &ps)
Constructor.
Definition: CSCSegAlgoTC.cc:26
void segmentSort(void)
float dPhiFineMax
Definition: CSCSegAlgoTC.h:167