CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
GE0SegAlgoRU.cc
Go to the documentation of this file.
1 
9 #include "GE0SegAlgoRU.h"
10 #include "MuonSegFit.h"
16 
17 #include <algorithm>
18 #include <cmath>
19 #include <iostream>
20 #include <string>
21 
22 #include <Math/Functions.h>
23 #include <Math/SVector.h>
24 #include <Math/SMatrix.h>
25 
26 GE0SegAlgoRU::GE0SegAlgoRU(const edm::ParameterSet& ps) : GEMSegmentAlgorithmBase(ps), myName("GE0SegAlgoRU") {
27  allowWideSegments = ps.getParameter<bool>("allowWideSegments");
28  doCollisions = ps.getParameter<bool>("doCollisions");
29 
30  stdParameters.maxChi2Additional = ps.getParameter<double>("maxChi2Additional");
31  stdParameters.maxChi2Prune = ps.getParameter<double>("maxChi2Prune");
32  stdParameters.maxChi2GoodSeg = ps.getParameter<double>("maxChi2GoodSeg");
33  stdParameters.maxPhiSeeds = ps.getParameter<double>("maxPhiSeeds");
34  stdParameters.maxPhiAdditional = ps.getParameter<double>("maxPhiAdditional");
35  stdParameters.maxETASeeds = ps.getParameter<double>("maxETASeeds");
36  stdParameters.requireCentralBX = ps.getParameter<bool>("requireCentralBX");
37  stdParameters.minNumberOfHits = ps.getParameter<unsigned int>("minNumberOfHits");
38  stdParameters.maxNumberOfHits = ps.getParameter<unsigned int>("maxNumberOfHits");
39  stdParameters.maxNumberOfHitsPerLayer = ps.getParameter<unsigned int>("maxNumberOfHitsPerLayer");
41 
48 
57 
58  LogDebug("GE0SegAlgoRU") << myName << " has algorithm cuts set to: \n"
59  << "--------------------------------------------------------------------\n"
60  << "allowWideSegments = " << allowWideSegments << "\n"
61  << "doCollisions = " << doCollisions << "\n"
62  << "maxChi2Additional = " << stdParameters.maxChi2Additional << "\n"
63  << "maxChi2Prune = " << stdParameters.maxChi2Prune << "\n"
64  << "maxChi2GoodSeg = " << stdParameters.maxChi2GoodSeg << "\n"
65  << "maxPhiSeeds = " << stdParameters.maxPhiSeeds << "\n"
66  << "maxPhiAdditional = " << stdParameters.maxPhiAdditional << "\n"
67  << "maxETASeeds = " << stdParameters.maxETASeeds << "\n"
68  << std::endl;
69 
70  theChamber = nullptr;
71 }
72 
73 std::vector<GEMSegment> GE0SegAlgoRU::run(const GEMEnsemble& ensemble, const std::vector<const GEMRecHit*>& rechits) {
74  HitAndPositionContainer hitAndPositions;
75  auto& superchamber = ensemble.first;
76  for (const auto& rechit : rechits) {
77  const GEMEtaPartition* part = ensemble.second.at(rechit->gemId().rawId());
78  GlobalPoint glb = part->toGlobal(rechit->localPosition());
79  LocalPoint nLoc = superchamber->toLocal(glb);
80  hitAndPositions.emplace_back(&(*rechit), nLoc, glb, hitAndPositions.size());
81  }
82 
83  LogDebug("GE0Segment|GE0") << "found " << hitAndPositions.size() << " rechits in superchamber " << superchamber->id();
84  //sort by layer
85  float z1 = superchamber->chamber(1)->position().z();
86  float zlast = superchamber->chamber(superchamber->nChambers())->position().z();
87  if (z1 < zlast)
88  std::sort(hitAndPositions.begin(), hitAndPositions.end(), [](const HitAndPosition& h1, const HitAndPosition& h2) {
89  return h1.layer < h2.layer;
90  });
91  else
92  std::sort(hitAndPositions.begin(), hitAndPositions.end(), [](const HitAndPosition& h1, const HitAndPosition& h2) {
93  return h1.layer > h2.layer;
94  });
95  return run(ensemble.first, hitAndPositions);
96 }
97 
98 std::vector<GEMSegment> GE0SegAlgoRU::run(const GEMSuperChamber* chamber, const HitAndPositionContainer& rechits) {
99 #ifdef EDM_ML_DEBUG // have lines below only compiled when in debug mode
100  GEMDetId chId(chamber->id());
101  edm::LogVerbatim("GE0SegAlgoRU") << "[GEMSegmentAlgorithm::run] build segments in chamber " << chId
102  << " which contains " << rechits.size() << " rechits";
103  for (const auto& h : rechits) {
104  auto ge0id = h.rh->gemId();
105  auto rhLP = h.lp;
106  edm::LogVerbatim("GE0SegAlgoRU") << "[RecHit :: Loc x = " << std::showpos << std::setw(9) << rhLP.x()
107  << " Glb y = " << std::showpos << std::setw(9) << rhLP.y()
108  << " Time = " << std::showpos << h.rh->BunchX() << " -- " << ge0id.rawId() << " = "
109  << ge0id << " ]" << std::endl;
110  }
111 #endif
112 
113  if (rechits.size() < stdParameters.minNumberOfHits || rechits.size() > stdParameters.maxNumberOfHits) {
114  return std::vector<GEMSegment>();
115  }
116 
117  theChamber = chamber;
118 
119  std::vector<unsigned int> recHits_per_layer(theChamber->nChambers(), 0);
120  for (const auto& rechit : rechits) {
121  recHits_per_layer[rechit.layer - 1]++;
122  }
123 
124  BoolContainer used(rechits.size(), false);
125 
126  // We have at least 2 hits. We intend to try all possible pairs of hits to start
127  // segment building. 'All possible' means each hit lies on different layers in the chamber.
128  // after all same size segs are build we get rid of the overcrossed segments using the chi2 criteria
129  // the hits from the segs that are left are marked as used and are not added to segs in future iterations
130  // the hits from 3p segs are marked as used separately in order to try to assamble them in longer segments
131  // in case there is a second pass
132 
133  // Choose first hit (as close to IP as possible) h1 and second hit
134  // (as far from IP as possible) h2 To do this we iterate over hits
135  // in the chamber by layer - pick two layers. Then we
136  // iterate over hits within each of these layers and pick h1 and h2
137  // these. If they are 'close enough' we build an empty
138  // segment. Then try adding hits to this segment.
139 
140  std::vector<GEMSegment> segments;
141 
142  auto doStd = [&]() {
143  for (unsigned int n_seg_min = 6u; n_seg_min >= stdParameters.minNumberOfHits; --n_seg_min)
144  lookForSegments(stdParameters, n_seg_min, rechits, recHits_per_layer, used, segments);
145  };
146  auto doDisplaced = [&]() {
147  for (unsigned int n_seg_min = 6u; n_seg_min >= displacedParameters.minNumberOfHits; --n_seg_min)
148  lookForSegments(displacedParameters, n_seg_min, rechits, recHits_per_layer, used, segments);
149  };
150  // Not currently used
151  // auto doWide = [&] () {
152  // for(unsigned int n_seg_min = 6u; n_seg_min >= wideParameters.minNumberOfHits; --n_seg_min)
153  // lookForSegments(wideParameters,n_seg_min,rechits,recHits_per_layer, used,segments);
154  // };
155  auto printSegments = [&] {
156 #ifdef EDM_ML_DEBUG // have lines below only compiled when in debug mode
157  for (const auto& seg : segments) {
158  GEMDetId chId(seg.gemDetId());
159  const auto& rechits = seg.specificRecHits();
160  edm::LogVerbatim("GE0SegAlgoRU") << "[GE0SegAlgoRU] segment in chamber " << chId << " which contains "
161  << rechits.size() << " rechits and with specs: \n"
162  << seg;
163  for (const auto& rh : rechits) {
164  auto ge0id = rh.gemId();
165  edm::LogVerbatim("GE0SegAlgoRU") << "[RecHit :: Loc x = " << std::showpos << std::setw(9)
166  << rh.localPosition().x() << " Loc y = " << std::showpos << std::setw(9)
167  << rh.localPosition().y() << " Time = " << std::showpos << rh.BunchX()
168  << " -- " << ge0id.rawId() << " = " << ge0id << " ]";
169  }
170  }
171 #endif
172  };
173 
174  //If we arent doing collisions, do a single iteration
175  if (!doCollisions) {
176  doDisplaced();
177  printSegments();
178  return segments;
179  }
180 
181  //Iteration 1: STD processing
182  doStd();
183 
184  if (false) {
185  //How the CSC algorithm ~does iterations. for now not considering
186  //displaced muons will not worry about it later
187  //Iteration 2a: If we don't allow wide segments simply do displaced
188  // Or if we already found a segment simply skip to displaced
189  if (!allowWideSegments || !segments.empty()) {
190  doDisplaced();
191  return segments;
192  }
193  //doWide();
194  doDisplaced();
195  }
196  printSegments();
197  return segments;
198 }
199 
201  const unsigned int n_seg_min,
203  const std::vector<unsigned int>& recHits_per_layer,
204  BoolContainer& used,
205  std::vector<GEMSegment>& segments) const {
206  auto ib = rechits.begin();
207  auto ie = rechits.end();
208  std::vector<std::pair<float, HitAndPositionPtrContainer> > proto_segments;
209  // the first hit is taken from the back
210  for (auto i1 = ib; i1 != ie; ++i1) {
211  const auto& h1 = *i1;
212 
213  //skip if rh is used and the layer tat has big rh multiplicity(>25RHs)
214  if (used[h1.idx])
215  continue;
216  if (recHits_per_layer[h1.layer - 1] > params.maxNumberOfHitsPerLayer)
217  continue;
218 
219  // the second hit from the front
220  for (auto i2 = ie - 1; i2 != i1; --i2) {
221  const auto& h2 = *i2;
222 
223  //skip if rh is used and the layer tat has big rh multiplicity(>25RHs)
224  if (used[h2.idx])
225  continue;
226  if (recHits_per_layer[h2.layer - 1] > params.maxNumberOfHitsPerLayer)
227  continue;
228 
229  //Stop if the distance between layers is not large enough
230  if ((std::abs(int(h2.layer) - int(h1.layer)) + 1) < int(n_seg_min))
231  break;
232 
233  if (!areHitsCloseInEta(params.maxETASeeds, params.requireBeamConstr, h1.gp, h2.gp))
234  continue;
235  if (!areHitsCloseInGlobalPhi(params.maxPhiSeeds, std::abs(int(h2.layer) - int(h1.layer)), h1.gp, h2.gp))
236  continue;
237 
238  HitAndPositionPtrContainer current_proto_segment;
239  std::unique_ptr<MuonSegFit> current_fit;
240  current_fit = addHit(current_proto_segment, h1);
241  current_fit = addHit(current_proto_segment, h2);
242 
244  params.maxPhiAdditional,
245  params.maxChi2Additional,
246  current_fit,
247  current_proto_segment,
248  used,
249  i1,
250  i2);
251 
252  if (current_proto_segment.size() > n_seg_min)
253  pruneBadHits(params.maxChi2Prune, current_proto_segment, current_fit, n_seg_min);
254 
255  edm::LogVerbatim("GE0SegAlgoRU") << "[GE0SegAlgoRU::lookForSegments] # of hits in segment "
256  << current_proto_segment.size() << " min # " << n_seg_min << " => "
257  << (current_proto_segment.size() >= n_seg_min) << " chi2/ndof "
258  << current_fit->chi2() / current_fit->ndof() << " => "
259  << (current_fit->chi2() / current_fit->ndof() < params.maxChi2GoodSeg)
260  << std::endl;
261 
262  if (current_proto_segment.size() < n_seg_min)
263  continue;
264  const float current_metric = current_fit->chi2() / current_fit->ndof();
265  if (current_metric > params.maxChi2GoodSeg)
266  continue;
267 
268  if (params.requireCentralBX) {
269  int nCentral = 0;
270  int nNonCentral = 0;
271  for (const auto* rh : current_proto_segment) {
272  if (std::abs(rh->rh->BunchX()) < 2)
273  nCentral++;
274  else
275  nNonCentral++;
276  }
277  if (nNonCentral >= nCentral)
278  continue;
279  }
280 
281  proto_segments.emplace_back(current_metric, current_proto_segment);
282  }
283  }
284  addUniqueSegments(proto_segments, segments, used);
285 }
286 
288  std::vector<GEMSegment>& segments,
289  BoolContainer& used) const {
290  std::sort(proto_segments.begin(),
291  proto_segments.end(),
292  [](const std::pair<float, HitAndPositionPtrContainer>& a,
293  const std::pair<float, HitAndPositionPtrContainer>& b) { return a.first < b.first; });
294 
295  //Now add to the collect based on minChi2 marking the hits as used after
296  std::vector<unsigned int> usedHits;
297  for (auto& container : proto_segments) {
298  HitAndPositionPtrContainer currentProtoSegment = container.second;
299 
300  //check to see if we already used thes hits this round
301  bool alreadyFilled = false;
302  for (const auto& h : currentProtoSegment) {
303  for (unsigned int iOH = 0; iOH < usedHits.size(); ++iOH) {
304  if (usedHits[iOH] != h->idx)
305  continue;
306  alreadyFilled = true;
307  break;
308  }
309  }
310  if (alreadyFilled)
311  continue;
312  for (const auto* h : currentProtoSegment) {
313  usedHits.push_back(h->idx);
314  used[h->idx] = true;
315  }
316 
317  std::unique_ptr<MuonSegFit> current_fit = makeFit(currentProtoSegment);
318 
319  // Create an actual GEMSegment - retrieve all info from the fit
320  // calculate the timing fron rec hits associated to the TrackingRecHits used
321  // to fit the segment
322  float averageBX = 0.;
323  for (const auto* h : currentProtoSegment) {
324  averageBX += h->rh->BunchX();
325  }
326  averageBX /= int(currentProtoSegment.size());
327 
328  std::sort(currentProtoSegment.begin(),
329  currentProtoSegment.end(),
330  [](const HitAndPosition* a, const HitAndPosition* b) { return a->layer < b->layer; });
331 
332  std::vector<const GEMRecHit*> bareRHs;
333  bareRHs.reserve(currentProtoSegment.size());
334  for (const auto* rh : currentProtoSegment)
335  bareRHs.push_back(rh->rh);
336  const float dPhi = theChamber->computeDeltaPhi(current_fit->intercept(), current_fit->localdir());
337  GEMSegment temp(bareRHs,
338  current_fit->intercept(),
339  current_fit->localdir(),
340  current_fit->covarianceMatrix(),
341  current_fit->chi2(),
342  averageBX,
343  dPhi);
344  segments.push_back(temp);
345  }
346 }
347 
349  const float maxPhi,
350  const float maxChi2,
351  std::unique_ptr<MuonSegFit>& current_fit,
352  HitAndPositionPtrContainer& proto_segment,
353  const BoolContainer& used,
354  HitAndPositionContainer::const_iterator i1,
355  HitAndPositionContainer::const_iterator i2) const {
356  // Iterate over the layers with hits in the chamber
357  // Skip the layers containing the segment endpoints
358  // Test each hit on the other layers to see if it is near the segment
359  // If it is, see whether there is already a hit on the segment from the same layer
360  // - if so, and there are more than 2 hits on the segment, copy the segment,
361  // replace the old hit with the new hit. If the new segment chi2 is better
362  // then replace the original segment with the new one (by swap)
363  // - if not, copy the segment, add the hit. If the new chi2/dof is still satisfactory
364  // then replace the original segment with the new one (by swap)
365 
366  //Hits are ordered by layer, "i1" is the inner hit and i2 is the outer hit
367  //so possible hits to add must be between these two iterators
368  for (auto iH = i1 + 1; iH != i2; ++iH) {
369  if (iH->layer == i1->layer)
370  continue;
371  if (iH->layer == i2->layer)
372  break;
373  if (used[iH->idx])
374  continue;
375  if (!isHitNearSegment(maxETA, maxPhi, current_fit, proto_segment, *iH))
376  continue;
377  if (hasHitOnLayer(proto_segment, iH->layer))
378  compareProtoSegment(current_fit, proto_segment, *iH);
379  else
380  increaseProtoSegment(maxChi2, current_fit, proto_segment, *iH);
381  }
382 }
383 
385  const bool beamConst,
386  const GlobalPoint& h1,
387  const GlobalPoint& h2) const {
388  float diff = std::abs(h1.eta() - h2.eta());
389  edm::LogVerbatim("GE0SegAlgoRU") << "[GE0SegAlgoRU::areHitsCloseInEta] gp1 = " << h1 << " in eta part = " << h1.eta()
390  << " and gp2 = " << h2 << " in eta part = " << h2.eta() << " ==> dEta = " << diff
391  << " ==> return " << (diff < 0.1) << std::endl;
392  //temp for floating point comparision...maxEta is the difference between partitions, so x1.5 to take into account non-circle geom.
393  return (diff < std::max(maxETA, 0.01f));
394 }
395 
397  const unsigned int nLayDisp,
398  const GlobalPoint& h1,
399  const GlobalPoint& h2) const {
400  float dphi12 = deltaPhi(h1.barePhi(), h2.barePhi());
401  edm::LogVerbatim("GE0SegAlgoRU") << "[GE0SegAlgoRU::areHitsCloseInGlobalPhi] gp1 = " << h1 << " and gp2 = " << h2
402  << " ==> dPhi = " << dphi12 << " ==> return "
403  << (std::abs(dphi12) < std::max(maxPHI, 0.02f)) << std::endl;
404  return std::abs(dphi12) < std::max(maxPHI, float(float(nLayDisp) * 0.004));
405 }
406 
408  const float maxPHI,
409  const std::unique_ptr<MuonSegFit>& fit,
410  const HitAndPositionPtrContainer& proto_segment,
411  const HitAndPosition& h) const {
412  //Get average eta, based on the two seeds...asssumes that we have not started pruning yet!
413  const float avgETA = (proto_segment[1]->gp.eta() + proto_segment[0]->gp.eta()) / 2.;
414  if (std::abs(h.gp.eta() - avgETA) > std::max(maxETA, 0.01f))
415  return false;
416 
417  //Now check the dPhi based on the segment fit
418  GlobalPoint globIntercept = globalAtZ(fit, h.lp.z());
419  float dPhi = deltaPhi(h.gp.barePhi(), globIntercept.phi());
420  //check to see if it is inbetween the two rolls of the outer and inner hits
421  return (std::abs(dPhi) < std::max(maxPHI, 0.001f));
422 }
423 
424 GlobalPoint GE0SegAlgoRU::globalAtZ(const std::unique_ptr<MuonSegFit>& fit, float z) const {
425  float x = fit->xfit(z);
426  float y = fit->yfit(z);
427  return theChamber->toGlobal(LocalPoint(x, y, z));
428 }
429 
430 std::unique_ptr<MuonSegFit> GE0SegAlgoRU::addHit(HitAndPositionPtrContainer& proto_segment,
431  const HitAndPosition& aHit) const {
432  proto_segment.push_back(&aHit);
433  // make a fit
434  return makeFit(proto_segment);
435 }
436 
437 std::unique_ptr<MuonSegFit> GE0SegAlgoRU::makeFit(const HitAndPositionPtrContainer& proto_segment) const {
438  // for GE0 we take the gemrechit from the proto_segment we transform into Tracking Rechits
439  // the local rest frame is the GEMSuperChamber
441  for (const auto& rh : proto_segment) {
442  GEMRecHit* newRH = rh->rh->clone();
443  newRH->setPosition(rh->lp);
444  MuonSegFit::MuonRecHitPtr trkRecHit(newRH);
445  muonRecHits.push_back(trkRecHit);
446  }
447  auto currentFit = std::make_unique<MuonSegFit>(muonRecHits);
448  currentFit->fit();
449  return currentFit;
450 }
451 
453  HitAndPositionPtrContainer& proto_segment,
454  std::unique_ptr<MuonSegFit>& fit,
455  const unsigned int n_seg_min) const {
456  while (proto_segment.size() > n_seg_min && fit->chi2() / fit->ndof() > maxChi2) {
457  float maxDev = -1;
458  HitAndPositionPtrContainer::iterator worstHit;
459  for (auto it = proto_segment.begin(); it != proto_segment.end(); ++it) {
460  const float dev = getHitSegChi2(fit, *(*it)->rh);
461  if (dev < maxDev)
462  continue;
463  maxDev = dev;
464  worstHit = it;
465  }
466  edm::LogVerbatim("GE0SegAlgoRU") << "[GE0SegAlgoRU::pruneBadHits] pruning one hit-> layer: " << (*worstHit)->layer
467  << " eta: " << (*worstHit)->gp.eta() << " phi: " << (*worstHit)->gp.phi()
468  << " old chi2/dof: " << fit->chi2() / fit->ndof() << std::endl;
469  proto_segment.erase(worstHit);
470  fit = makeFit(proto_segment);
471  }
472 }
473 
474 float GE0SegAlgoRU::getHitSegChi2(const std::unique_ptr<MuonSegFit>& fit, const GEMRecHit& hit) const {
475  const auto lp = hit.localPosition();
476  const auto le = hit.localPositionError();
477  const float du = fit->xdev(lp.x(), lp.z());
478  const float dv = fit->ydev(lp.y(), lp.z());
479 
480  ROOT::Math::SMatrix<double, 2, 2, ROOT::Math::MatRepSym<double, 2> > IC;
481  IC(0, 0) = le.xx();
482  IC(1, 0) = le.xy();
483  IC(1, 1) = le.yy();
484 
485  // Invert covariance matrix
486  IC.Invert();
487  return du * du * IC(0, 0) + 2. * du * dv * IC(0, 1) + dv * dv * IC(1, 1);
488 }
489 
490 bool GE0SegAlgoRU::hasHitOnLayer(const HitAndPositionPtrContainer& proto_segment, const unsigned int layer) const {
491  for (const auto* h : proto_segment)
492  if (h->layer == layer)
493  return true;
494  return false;
495 }
496 
497 void GE0SegAlgoRU::compareProtoSegment(std::unique_ptr<MuonSegFit>& current_fit,
498  HitAndPositionPtrContainer& current_proto_segment,
499  const HitAndPosition& new_hit) const {
500  const HitAndPosition* old_hit = nullptr;
501  HitAndPositionPtrContainer new_proto_segment = current_proto_segment;
502 
503  for (auto it = new_proto_segment.begin(); it != new_proto_segment.end();) {
504  if ((*it)->layer == new_hit.layer) {
505  old_hit = *it;
506  it = new_proto_segment.erase(it);
507  } else {
508  ++it;
509  }
510  }
511  if (old_hit == nullptr)
512  return;
513  auto new_fit = addHit(new_proto_segment, new_hit);
514 
515  //If on the same strip but different BX choose the closest
516  bool useNew = false;
517  if (old_hit->lp == new_hit.lp) {
518  float avgbx = 0;
519  for (const auto* h : current_proto_segment)
520  if (old_hit != h)
521  avgbx += h->rh->BunchX();
522  avgbx /= float(current_proto_segment.size() - 1);
523  if (std::abs(avgbx - new_hit.rh->BunchX()) < std::abs(avgbx - old_hit->rh->BunchX()))
524  useNew = true;
525  } //otherwise base it on chi2
526  else if (new_fit->chi2() < current_fit->chi2())
527  useNew = true;
528 
529  if (useNew) {
530  current_proto_segment = new_proto_segment;
531  current_fit = std::move(new_fit);
532  }
533 }
534 
536  std::unique_ptr<MuonSegFit>& current_fit,
537  HitAndPositionPtrContainer& current_proto_segment,
538  const HitAndPosition& new_hit) const {
539  HitAndPositionPtrContainer new_proto_segment = current_proto_segment;
540  auto new_fit = addHit(new_proto_segment, new_hit);
541  if (new_fit->chi2() / new_fit->ndof() < maxChi2) {
542  current_proto_segment = new_proto_segment;
543  current_fit = std::move(new_fit);
544  }
545 }
std::unique_ptr< MuonSegFit > addHit(HitAndPositionPtrContainer &proto_segment, const HitAndPosition &aHit) const
std::shared_ptr< TrackingRecHit > MuonRecHitPtr
Definition: MuonSegFit.h:38
Log< level::Info, true > LogVerbatim
float xx() const
Definition: LocalError.h:22
std::vector< bool > BoolContainer
Definition: GE0SegAlgoRU.h:62
Point3DBase< Scalar, LocalTag > LocalPoint
Definition: Definitions.h:30
float computeDeltaPhi(const LocalPoint &position, const LocalVector &direction) const
int ib
Definition: cuy.py:661
GE0SegAlgoRU(const edm::ParameterSet &ps)
Constructor.
Definition: GE0SegAlgoRU.cc:26
SegmentParameters wideParameters
Definition: GE0SegAlgoRU.h:147
LocalPoint localPosition() const override
Return the 3-dimensional local position.
Definition: GEMRecHit.h:37
void increaseProtoSegment(const float maxChi2, std::unique_ptr< MuonSegFit > &current_fit, HitAndPositionPtrContainer &current_proto_segment, const HitAndPosition &new_hit) const
float getHitSegChi2(const std::unique_ptr< MuonSegFit > &fit, const GEMRecHit &hit) const
bool areHitsCloseInEta(const float maxETA, const bool beamConst, const GlobalPoint &h1, const GlobalPoint &h2) const
int BunchX() const
Definition: GEMRecHit.h:67
GlobalPoint toGlobal(const Local2DPoint &lp) const
Conversion to the global R.F. from the R.F. of the GeomDet.
Definition: GeomDet.h:49
double glb
Definition: hdecay.h:103
std::vector< const HitAndPosition * > HitAndPositionPtrContainer
Definition: GE0SegAlgoRU.h:59
Geom::Phi< T > phi() const
Definition: PV3DBase.h:66
bool allowWideSegments
Definition: GE0SegAlgoRU.h:143
const std::string myName
Definition: GE0SegAlgoRU.h:141
std::pair< const GEMSuperChamber *, std::map< uint32_t, const GEMEtaPartition * > > GEMEnsemble
const GEMSuperChamber * theChamber
Definition: GE0SegAlgoRU.h:150
void tryAddingHitsToSegment(const float maxETA, const float maxPhi, const float maxChi2, std::unique_ptr< MuonSegFit > &current_fit, HitAndPositionPtrContainer &proto_segment, const BoolContainer &used, HitAndPositionContainer::const_iterator i1, HitAndPositionContainer::const_iterator i2) const
float float float z
constexpr std::array< uint8_t, layerIndexSize > layer
void compareProtoSegment(std::unique_ptr< MuonSegFit > &current_fit, HitAndPositionPtrContainer &current_proto_segment, const HitAndPosition &new_hit) const
T barePhi() const
Definition: PV3DBase.h:65
void pruneBadHits(const float maxChi2, HitAndPositionPtrContainer &proto_segment, std::unique_ptr< MuonSegFit > &fit, const unsigned int n_seg_min) const
bool hasHitOnLayer(const HitAndPositionPtrContainer &proto_segment, const unsigned int layer) const
auto const & fit
void lookForSegments(const SegmentParameters &params, const unsigned int n_seg_min, const HitAndPositionContainer &rechits, const std::vector< unsigned int > &recHits_per_layer, BoolContainer &used, std::vector< GEMSegment > &segments) const
T z() const
Definition: PV3DBase.h:61
def move
Definition: eostools.py:511
GEMRecHit * clone() const override
Definition: GEMRecHit.cc:58
std::vector< MuonRecHitPtr > MuonRecHitContainer
Definition: MuonSegFit.h:39
LocalError localPositionError() const override
Return the 3-dimensional error on the local position.
Definition: GEMRecHit.h:40
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
std::vector< GEMSegment > run(const GEMSuperChamber *chamber, const HitAndPositionContainer &rechits)
Definition: GE0SegAlgoRU.cc:98
SegmentParameters displacedParameters
Definition: GE0SegAlgoRU.h:146
GlobalPoint globalAtZ(const std::unique_ptr< MuonSegFit > &fit, float z) const
part
Definition: HCALResponse.h:20
int nChambers() const
Return numbers of chambers.
GEMDetId id() const
Return the GEMDetId of this super chamber.
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
double b
Definition: hdecay.h:118
void addUniqueSegments(SegmentByMetricContainer &proto_segments, std::vector< GEMSegment > &segments, BoolContainer &used) const
bool areHitsCloseInGlobalPhi(const float maxPHI, const unsigned int nLayDisp, const GlobalPoint &h1, const GlobalPoint &h2) const
std::vector< std::pair< float, HitAndPositionPtrContainer > > SegmentByMetricContainer
Definition: GE0SegAlgoRU.h:63
bool isHitNearSegment(const float maxETA, const float maxPHI, const std::unique_ptr< MuonSegFit > &fit, const HitAndPositionPtrContainer &proto_segment, const HitAndPosition &h) const
T eta() const
Definition: PV3DBase.h:73
double a
Definition: hdecay.h:119
std::vector< HitAndPosition > HitAndPositionContainer
Definition: GE0SegAlgoRU.h:58
static int position[264][3]
Definition: ReadPGInfo.cc:289
SegmentParameters stdParameters
Definition: GE0SegAlgoRU.h:145
void setPosition(LocalPoint pos)
Set local position.
Definition: GEMRecHit.h:53
The Signals That Services Can Subscribe To This is based on ActivityRegistry h
Helper function to determine trigger accepts.
Definition: Activities.doc:4
std::unique_ptr< MuonSegFit > makeFit(const HitAndPositionPtrContainer &proto_segment) const
#define LogDebug(id)