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