CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes
DTCombinatorialExtendedPatternReco Class Reference

#include <DTCombinatorialExtendedPatternReco.h>

Inheritance diagram for DTCombinatorialExtendedPatternReco:
DTRecSegment2DBaseAlgo

Public Member Functions

std::string algoName () const override
 return the algo name More...
 
 DTCombinatorialExtendedPatternReco (const edm::ParameterSet &pset)
 Constructor. More...
 
edm::OwnVector< DTSLRecSegment2Dreconstruct (const DTSuperLayer *sl, const std::vector< DTRecHit1DPair > &hits) override
 this function is called in the producer More...
 
void setClusters (const std::vector< DTSLRecCluster > &clusters)
 
void setES (const edm::EventSetup &setup) override
 
 ~DTCombinatorialExtendedPatternReco () override
 Destructor. More...
 

Private Member Functions

DTSegmentExtendedCandbuildBestSegment (std::vector< DTSegmentCand::AssPoint > &assHits, const DTSuperLayer *sl)
 
void buildPointsCollection (std::vector< DTSegmentCand::AssPoint > &points, std::deque< std::shared_ptr< DTHitPairForFit >> &pointsNoLR, std::vector< DTSegmentCand * > &candidates, const DTSuperLayer *sl)
 
std::vector< DTSegmentCand * > buildSegments (const DTSuperLayer *sl, const std::vector< std::shared_ptr< DTHitPairForFit >> &hits)
 
bool checkDoubleCandidates (std::vector< DTSegmentCand * > &segs, DTSegmentCand *seg)
 
bool closeSL (const DTSuperLayerId &id1, const DTSuperLayerId &id2)
 
std::vector< DTSegmentExtendedCand * > extendCandidates (std::vector< DTSegmentCand * > &candidates, const DTSuperLayer *sl)
 
std::vector< DTSegmentCand::AssPointfindCompatibleHits (const LocalPoint &pos, const LocalVector &dir, const std::vector< std::shared_ptr< DTHitPairForFit >> &hits)
 
std::vector< std::shared_ptr< DTHitPairForFit > > initHits (const DTSuperLayer *sl, const std::vector< DTRecHit1DPair > &hits)
 
- Private Member Functions inherited from DTRecSegment2DBaseAlgo
 DTRecSegment2DBaseAlgo (const edm::ParameterSet &)
 Constructor. More...
 
virtual ~DTRecSegment2DBaseAlgo ()
 Destructor. More...
 

Private Attributes

bool debug
 
std::string theAlgoName
 
double theAlphaMaxPhi
 
double theAlphaMaxTheta
 
DTSegmentCleanertheCleaner
 
std::vector< DTSLRecClustertheClusters
 
edm::ESHandle< DTGeometrytheDTGeometry
 
unsigned int theMaxAllowedHits
 
std::vector< std::vector< int > > theTriedPattern
 
DTSegmentUpdatortheUpdator
 
bool usePairs
 

Detailed Description

Algo for reconstructing 2d segment in DT using a combinatorial approach

Author
Stefano Lacaprara - INFN Legnaro stefa.nosp@m.no.l.nosp@m.acapr.nosp@m.ara@.nosp@m.pd.in.nosp@m.fn.i.nosp@m.t
Riccardo Bellan - INFN TO ricca.nosp@m.rdo..nosp@m.bella.nosp@m.n@ce.nosp@m.rn.ch

Definition at line 42 of file DTCombinatorialExtendedPatternReco.h.

Constructor & Destructor Documentation

DTCombinatorialExtendedPatternReco::DTCombinatorialExtendedPatternReco ( const edm::ParameterSet pset)

Constructor.

Definition at line 34 of file DTCombinatorialExtendedPatternReco.cc.

References debug, edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), theAlphaMaxPhi, theAlphaMaxTheta, theCleaner, theMaxAllowedHits, theUpdator, and usePairs.

35  : DTRecSegment2DBaseAlgo(pset), theAlgoName("DTCombinatorialExtendedPatternReco") {
36  theMaxAllowedHits = pset.getParameter<unsigned int>("MaxAllowedHits"); // 100
37  theAlphaMaxTheta = pset.getParameter<double>("AlphaMaxTheta"); // 0.1 ;
38  theAlphaMaxPhi = pset.getParameter<double>("AlphaMaxPhi"); // 1.0 ;
39  debug = pset.getUntrackedParameter<bool>("debug"); //true;
40  theUpdator = new DTSegmentUpdator(pset);
41  theCleaner = new DTSegmentCleaner(pset);
42  string theHitAlgoName = pset.getParameter<string>("recAlgo");
43  usePairs = !(theHitAlgoName == "DTNoDriftAlgo");
44 }
DTRecSegment2DBaseAlgo(const edm::ParameterSet &)
Constructor.
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
DTCombinatorialExtendedPatternReco::~DTCombinatorialExtendedPatternReco ( )
override

Destructor.

Definition at line 47 of file DTCombinatorialExtendedPatternReco.cc.

47 {}

Member Function Documentation

std::string DTCombinatorialExtendedPatternReco::algoName ( ) const
inlineoverridevirtual
DTSegmentExtendedCand * DTCombinatorialExtendedPatternReco::buildBestSegment ( std::vector< DTSegmentCand::AssPoint > &  assHits,
const DTSuperLayer sl 
)
private

Definition at line 271 of file DTCombinatorialExtendedPatternReco.cc.

References buildPointsCollection(), HLT_2018_cff::candidates, gather_cfg::cout, debug, extendCandidates(), MTVHistoProducerAlgoForTrackerBlock_cfi::minChi2, HLT_2018_cff::points, and DTEnums::undefLR.

Referenced by buildSegments().

272  {
273  if (debug)
274  cout << "DTCombinatorialExtendedPatternReco::buildBestSegment " << hits.size() << endl;
275  if (hits.size() < 3) {
276  //cout << "buildBestSegment: hits " << hits.size()<< endl;
277  return nullptr; // a least 3 point
278  }
279 
280  // hits with defined LR
281  vector<DTSegmentCand::AssPoint> points;
282 
283  // without: I store both L and R, a deque since I need front insertion and
284  // deletion
285  deque<std::shared_ptr<DTHitPairForFit>> pointsNoLR;
286 
287  // first add only the hits with LR assigned
288  for (vector<DTSegmentCand::AssPoint>::const_iterator hit = hits.begin(); hit != hits.end(); ++hit) {
289  if ((*hit).second != DTEnums::undefLR) {
290  points.push_back(*hit);
291  } else { // then also for the undef'd one
292  pointsNoLR.push_back((*hit).first);
293  }
294  }
295 
296  if (debug) {
297  cout << "points " << points.size() << endl;
298  cout << "pointsNoLR " << pointsNoLR.size() << endl;
299  }
300 
301  // build all possible candidates using L/R ambiguity
302  vector<DTSegmentCand*> candidates;
303 
304  buildPointsCollection(points, pointsNoLR, candidates, sl);
305 
306  // here I try to add the external clusters and build a set of "extended
307  // segment candidate
308  vector<DTSegmentExtendedCand*> extendedCands = extendCandidates(candidates, sl);
309  if (debug)
310  cout << "extended candidates " << extendedCands.size() << endl;
311 
312  // so now I have build a given number of segments, I should find the best one,
313  // by #hits and chi2.
314  vector<DTSegmentExtendedCand*>::const_iterator bestCandIter = extendedCands.end();
315  double minChi2 = 999999.;
316  unsigned int maxNumHits = 0;
317  for (vector<DTSegmentExtendedCand*>::const_iterator iter = extendedCands.begin(); iter != extendedCands.end();
318  ++iter) {
319  if ((*iter)->nHits() == maxNumHits && (*iter)->chi2() < minChi2) {
320  minChi2 = (*iter)->chi2();
321  bestCandIter = iter;
322  } else if ((*iter)->nHits() > maxNumHits) {
323  maxNumHits = (*iter)->nHits();
324  minChi2 = (*iter)->chi2();
325  bestCandIter = iter;
326  }
327  }
328 
329  // delete all candidates but the best one!
330  for (vector<DTSegmentExtendedCand*>::iterator iter = extendedCands.begin(); iter != extendedCands.end(); ++iter)
331  if (iter != bestCandIter)
332  delete (*iter);
333 
334  // return the best candate if any
335  if (bestCandIter != extendedCands.end()) {
336  return (*bestCandIter);
337  }
338  return nullptr;
339 }
void buildPointsCollection(std::vector< DTSegmentCand::AssPoint > &points, std::deque< std::shared_ptr< DTHitPairForFit >> &pointsNoLR, std::vector< DTSegmentCand * > &candidates, const DTSuperLayer *sl)
std::vector< DTSegmentExtendedCand * > extendCandidates(std::vector< DTSegmentCand * > &candidates, const DTSuperLayer *sl)
void DTCombinatorialExtendedPatternReco::buildPointsCollection ( std::vector< DTSegmentCand::AssPoint > &  points,
std::deque< std::shared_ptr< DTHitPairForFit >> &  pointsNoLR,
std::vector< DTSegmentCand * > &  candidates,
const DTSuperLayer sl 
)
private

build collection of compatible hits for L/R hits: the candidates is updated with the segment candidates found

Definition at line 341 of file DTCombinatorialExtendedPatternReco.cc.

References filterCSVwithJSON::copy, gather_cfg::cout, debug, DTSegmentUpdator::fit(), DTEnums::Left, DTEnums::Right, and theUpdator.

Referenced by buildBestSegment().

344  {
345  if (debug) {
346  cout << "DTCombinatorialExtendedPatternReco::buildPointsCollection " << endl;
347  cout << "points: " << points.size() << " NOLR: " << pointsNoLR.size() << endl;
348  }
349  if (!pointsNoLR.empty()) { // still unassociated points!
350  std::shared_ptr<DTHitPairForFit> unassHit = pointsNoLR.front();
351  // try with the right
352  if (debug)
353  cout << "Right hit" << endl;
354  points.push_back(DTSegmentCand::AssPoint(unassHit, DTEnums::Right));
355  pointsNoLR.pop_front();
356  buildPointsCollection(points, pointsNoLR, candidates, sl);
357  pointsNoLR.push_front((unassHit));
358  points.pop_back();
359 
360  // try with the left
361  if (debug)
362  cout << "Left hit" << endl;
363  points.push_back(DTSegmentCand::AssPoint(unassHit, DTEnums::Left));
364  pointsNoLR.pop_front();
365  buildPointsCollection(points, pointsNoLR, candidates, sl);
366  pointsNoLR.push_front((unassHit));
367  points.pop_back();
368  } else { // all associated
369 
370  if (debug) {
371  cout << "The Hits were" << endl;
372  copy(points.begin(), points.end(), ostream_iterator<DTSegmentCand::AssPoint>(std::cout));
373  cout << "----" << endl;
374  cout << "All associated " << endl;
375  }
376  DTSegmentCand::AssPointCont pointsSet;
377 
378  // for (vector<DTSegmentCand::AssPoint>::const_iterator point=points.begin();
379  // point!=points.end(); ++point)
380  pointsSet.insert(points.begin(), points.end());
381 
382  if (debug) {
383  cout << "The Hits are" << endl;
384  copy(pointsSet.begin(), pointsSet.end(), ostream_iterator<DTSegmentCand::AssPoint>(std::cout));
385  cout << "----" << endl;
386  }
387 
388  DTSegmentCand* newCand = new DTSegmentCand(pointsSet, sl);
389  if (theUpdator->fit(newCand, false, false))
390  candidates.push_back(newCand);
391  else
392  delete newCand; // bad seg, too few hits
393  }
394 }
std::pair< std::shared_ptr< DTHitPairForFit >, DTEnums::DTCellSide > AssPoint
Definition: DTSegmentCand.h:36
void buildPointsCollection(std::vector< DTSegmentCand::AssPoint > &points, std::deque< std::shared_ptr< DTHitPairForFit >> &pointsNoLR, std::vector< DTSegmentCand * > &candidates, const DTSuperLayer *sl)
std::set< AssPoint, AssPointLessZ > AssPointCont
Definition: DTSegmentCand.h:38
bool fit(DTSegmentCand *seg, bool allow3par, const bool fitdebug) const
vector< DTSegmentCand * > DTCombinatorialExtendedPatternReco::buildSegments ( const DTSuperLayer sl,
const std::vector< std::shared_ptr< DTHitPairForFit >> &  hits 
)
private

get two hits in different layers and see if there are other / hits

Definition at line 95 of file DTCombinatorialExtendedPatternReco.cc.

References buildBestSegment(), checkDoubleCandidates(), DTSegmentCleaner::clean(), gather_cfg::cout, debug, findCompatibleHits(), DTSegmentExtendedCand::good(), hfClusterShapes_cfi::hits, DTSuperLayer::id(), listHistos::IP, DTEnums::Left, mps_fire::result, DTEnums::Right, theAlphaMaxPhi, theAlphaMaxTheta, theCleaner, theMaxAllowedHits, PV3DBase< T, PVType, FrameType >::theta(), GeomDet::toGlobal(), and unit().

Referenced by reconstruct().

96  {
97  typedef vector<std::shared_ptr<DTHitPairForFit>> hitCont;
98  typedef hitCont::const_iterator hitIter;
99  vector<DTSegmentCand*> result;
100 
101  if (debug) {
102  cout << "DTCombinatorialExtendedPatternReco::buildSegments: " << sl->id() << " nHits " << hits.size() << endl;
103  for (vector<std::shared_ptr<DTHitPairForFit>>::const_iterator hit = hits.begin(); hit != hits.end(); ++hit)
104  cout << **hit << endl;
105  }
106 
107  // 10-Mar-2004 SL
108  // put a protection against heavily populated chambers, for which the segment
109  // building could lead to infinite memory usage...
110  if (hits.size() > theMaxAllowedHits) {
111  if (debug) {
112  cout << "Warning: this SuperLayer " << sl->id() << " has too many hits : " << hits.size() << " max allowed is "
113  << theMaxAllowedHits << endl;
114  cout << "Skipping segment reconstruction... " << endl;
115  }
116  return result;
117  }
118 
120  // compatible with them
121  for (hitCont::const_iterator firstHit = hits.begin(); firstHit != hits.end(); ++firstHit) {
122  for (hitCont::const_reverse_iterator lastHit = hits.rbegin(); (*lastHit) != (*firstHit); ++lastHit) {
123  // hits must nor in the same nor in adiacent layers
124  if (fabs((*lastHit)->id().layerId() - (*firstHit)->id().layerId()) <= 1)
125  continue;
126  if (debug) {
127  cout << "Selected these two hits pair " << endl;
128  cout << "First " << *(*firstHit) << " Layer Id: " << (*firstHit)->id().layerId() << endl;
129  cout << "Last " << *(*lastHit) << " Layer Id: " << (*lastHit)->id().layerId() << endl;
130  }
131 
132  GlobalPoint IP;
133  float DAlphaMax;
134  if ((sl->id()).superlayer() == 2) // Theta SL
135  DAlphaMax = theAlphaMaxTheta;
136  else // Phi SL
137  DAlphaMax = theAlphaMaxPhi;
138 
140  for (int firstLR = 0; firstLR < 2; ++firstLR) {
141  for (int lastLR = 0; lastLR < 2; ++lastLR) {
142  // TODO move the global transformation in the DTHitPairForFit class
143  // when it will be moved I will able to remove the sl from the input parameter
144  GlobalPoint gposFirst = sl->toGlobal((*firstHit)->localPosition(codes[firstLR]));
145  GlobalPoint gposLast = sl->toGlobal((*lastHit)->localPosition(codes[lastLR]));
146 
147  GlobalVector gvec = gposLast - gposFirst;
148  GlobalVector gvecIP = gposLast - IP;
149 
150  // difference in angle measured
151  float DAlpha = fabs(gvec.theta() - gvecIP.theta());
152 
153  // cout << "DAlpha " << DAlpha << endl;
154  if (DAlpha < DAlphaMax) {
155  // create a segment hypotesis
156  // I don't need a true segment, just direction and position
157  LocalPoint posIni = (*firstHit)->localPosition(codes[firstLR]);
158  LocalVector dirIni = ((*lastHit)->localPosition(codes[lastLR]) - posIni).unit();
159 
160  // search for other compatible hits, with or without the L/R solved
161  vector<DTSegmentCand::AssPoint> assHits = findCompatibleHits(posIni, dirIni, hits);
162  if (debug)
163  cout << "compatible hits " << assHits.size() << endl;
164 
165  // here return an extended candidate (which _has_ the original
166  // segment)
167  DTSegmentExtendedCand* seg = buildBestSegment(assHits, sl);
168 
169  if (seg) {
170  if (debug)
171  cout << "segment " << *seg << endl;
172 
173  // check if the chi2 and #hits are ok
174  if (!seg->good()) { // good is reimplmented in extended segment
175  delete seg;
176  } else {
177  // remove duplicated segments
178  if (checkDoubleCandidates(result, seg)) {
179  // add to the vector of hypotesis
180  // still work with extended segments
181  result.push_back(seg);
182  if (debug)
183  cout << "result is now " << result.size() << endl;
184  } else { // delete it!
185  delete seg;
186  if (debug)
187  cout << "already existing" << endl;
188  }
189  }
190  }
191  }
192  }
193  }
194  }
195  }
196  if (debug) {
197  for (vector<DTSegmentCand*>::const_iterator seg = result.begin(); seg != result.end(); ++seg)
198  cout << *(*seg) << endl;
199  }
200 
201  // now I have a couple of segment hypotesis, should check for ghost
202  // still with extended candidates
203  result = theCleaner->clean(result);
204  if (debug) {
205  cout << "result no ghost " << result.size() << endl;
206  for (vector<DTSegmentCand*>::const_iterator seg = result.begin(); seg != result.end(); ++seg)
207  cout << *(*seg) << endl;
208  }
209 
210  // here, finally, I have to return the set of _original_ segments, not the
211  // extended ones.
212  return result;
213 }
GlobalPoint toGlobal(const Local2DPoint &lp) const
Conversion to the global R.F. from the R.F. of the GeomDet.
Definition: GeomDet.h:49
DTCellSide
Which side of the DT cell.
Definition: DTEnums.h:15
std::vector< DTSegmentCand * > clean(const std::vector< DTSegmentCand * > &inputCands) const
do the cleaning
bool checkDoubleCandidates(std::vector< DTSegmentCand * > &segs, DTSegmentCand *seg)
std::vector< std::shared_ptr< DTHitPairForFit > > hitCont
Geom::Theta< T > theta() const
Definition: PV3DBase.h:72
bool good() const override
DTSuperLayerId id() const
Return the DetId of this SL.
Definition: DTSuperLayer.cc:34
hitCont::const_iterator hitIter
DTSegmentExtendedCand * buildBestSegment(std::vector< DTSegmentCand::AssPoint > &assHits, const DTSuperLayer *sl)
std::vector< DTSegmentCand::AssPoint > findCompatibleHits(const LocalPoint &pos, const LocalVector &dir, const std::vector< std::shared_ptr< DTHitPairForFit >> &hits)
Basic3DVector unit() const
bool DTCombinatorialExtendedPatternReco::checkDoubleCandidates ( std::vector< DTSegmentCand * > &  segs,
DTSegmentCand seg 
)
private

Definition at line 396 of file DTCombinatorialExtendedPatternReco.cc.

Referenced by buildSegments().

396  {
397  for (vector<DTSegmentCand*>::iterator cand = cands.begin(); cand != cands.end(); ++cand)
398  if (*(*cand) == *seg)
399  return false;
400  return true;
401 }
bool DTCombinatorialExtendedPatternReco::closeSL ( const DTSuperLayerId id1,
const DTSuperLayerId id2 
)
private

Definition at line 478 of file DTCombinatorialExtendedPatternReco.cc.

References funct::abs(), DTChamberId::sector(), and DTChamberId::wheel().

Referenced by extendCandidates().

478  {
479  if (id1 == id2)
480  return false;
481  if (abs(id1.wheel() - id2.wheel()) > 1)
482  return false;
483  // take into account also sector 13 and 14
484  int sec1 = (id1.sector() == 13) ? 4 : id1.sector();
485  sec1 = (sec1 == 14) ? 10 : sec1;
486  int sec2 = (id2.sector() == 13) ? 4 : id2.sector();
487  sec2 = (sec2 == 14) ? 10 : sec2;
488  // take into account also sector 1/12
489  if (abs(sec1 - sec2) > 1 && abs(sec1 - sec2) != 11)
490  return false;
491  //if (abs(id1.station()-id2.station())>1 ) return false;
492  return true;
493 }
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
int sector() const
Definition: DTChamberId.h:49
int wheel() const
Return the wheel number.
Definition: DTChamberId.h:39
vector< DTSegmentExtendedCand * > DTCombinatorialExtendedPatternReco::extendCandidates ( std::vector< DTSegmentCand * > &  candidates,
const DTSuperLayer sl 
)
private

extend the candidates with clusters from external SL

Definition at line 403 of file DTCombinatorialExtendedPatternReco.cc.

References DTSegmentExtendedCand::addClus(), closeSL(), gather_cfg::cout, debug, runTheMatrix::err, DTSegmentUpdator::fit(), DTSuperLayer::id(), DTSegmentExtendedCand::isCompatible(), DTSegmentExtendedCand::nHits(), mps_fire::result, DTSuperLayerId::superLayer(), DTSegmentCand::superLayer(), DTGeometry::superLayer(), theClusters, theDTGeometry, theUpdator, GeomDet::toGlobal(), and GeomDet::toLocal().

Referenced by buildBestSegment().

404  {
405  if (debug)
406  cout << "extendCandidates " << candidates.size() << endl;
407  vector<DTSegmentExtendedCand*> result;
408 
409  // in case of phi SL just return
410  if (sl->id().superLayer() != 2) {
411  for (vector<DTSegmentCand*>::const_iterator cand = candidates.begin(); cand != candidates.end(); ++cand) {
412  DTSegmentExtendedCand* extendedCand = new DTSegmentExtendedCand(*cand);
413  // and delete the original candidate
414  delete *cand;
415  result.push_back(extendedCand);
416  }
417  return result;
418  }
419 
420  // first I have to select the cluster which are compatible with the actual
421  // candidate, namely +/-1 sector/station/wheel
422  vector<DTSegmentExtendedCand::DTSLRecClusterForFit> clustersWithPos;
423  if (debug)
424  cout << "AllClustersWithPos " << theClusters.size() << endl;
425  if (debug)
426  cout << "SL: " << sl->id() << endl;
427  for (vector<DTSLRecCluster>::const_iterator clus = theClusters.begin(); clus != theClusters.end(); ++clus) {
428  if (debug)
429  cout << "CLUS: " << (*clus).superLayerId() << endl;
430  if ((*clus).superLayerId().superLayer() == 2 && closeSL(sl->id(), (*clus).superLayerId())) {
431  // and then get their pos in the actual SL frame
432  const DTSuperLayer* clusSl = theDTGeometry->superLayer((*clus).superLayerId());
433  LocalPoint pos = sl->toLocal(clusSl->toGlobal((*clus).localPosition()));
434  //LocalError err=sl->toLocal(clusSl->toGlobal((*clus).localPositionError()));
435  LocalError err = (*clus).localPositionError();
436  clustersWithPos.push_back(DTSegmentExtendedCand::DTSLRecClusterForFit(*clus, pos, err));
437  }
438  }
439  if (debug)
440  cout << "closeClustersWithPos " << clustersWithPos.size() << endl;
441 
442  for (vector<DTSegmentCand*>::const_iterator cand = candidates.begin(); cand != candidates.end(); ++cand) {
443  // create an extended candidate
444  DTSegmentExtendedCand* extendedCand = new DTSegmentExtendedCand(*cand);
445  // and delete the original candidate
446  delete *cand;
447  // do this only for theta SL
448  if (extendedCand->superLayer()->id().superLayer() == 2) {
449  // first check compatibility between cand and clusForFit
450  for (vector<DTSegmentExtendedCand::DTSLRecClusterForFit>::const_iterator exClus = clustersWithPos.begin();
451  exClus != clustersWithPos.end();
452  ++exClus) {
453  if (extendedCand->isCompatible(*exClus)) {
454  if (debug)
455  cout << "is compatible " << endl;
456  // add compatible cluster
457  extendedCand->addClus(*exClus);
458  }
459  }
460  // fit the segment
461  if (debug)
462  cout << "extended cands nHits: " << extendedCand->nHits() << endl;
463  if (theUpdator->fit(extendedCand, false, false)) {
464  // add to result
465  result.push_back(extendedCand);
466  } else {
467  cout << "Bad fit" << endl;
468  delete extendedCand;
469  }
470  } else { // Phi SuperLayer
471  result.push_back(extendedCand);
472  }
473  }
474 
475  return result;
476 }
GlobalPoint toGlobal(const Local2DPoint &lp) const
Conversion to the global R.F. from the R.F. of the GeomDet.
Definition: GeomDet.h:49
LocalPoint toLocal(const GlobalPoint &gp) const
Conversion to the R.F. of the GeomDet.
Definition: GeomDet.h:58
DTSuperLayerId id() const
Return the DetId of this SL.
Definition: DTSuperLayer.cc:34
unsigned int nHits() const override
int superLayer() const
Return the superlayer number.
void addClus(const DTSegmentExtendedCand::DTSLRecClusterForFit &clus)
const DTSuperLayer * superLayer() const
the super layer on which relies
Definition: DTSegmentCand.h:76
bool isCompatible(const DTSegmentExtendedCand::DTSLRecClusterForFit &clus)
bool closeSL(const DTSuperLayerId &id1, const DTSuperLayerId &id2)
bool fit(DTSegmentCand *seg, bool allow3par, const bool fitdebug) const
const DTSuperLayer * superLayer(const DTSuperLayerId &id) const
Return a DTSuperLayer given its id.
Definition: DTGeometry.cc:92
vector< DTSegmentCand::AssPoint > DTCombinatorialExtendedPatternReco::findCompatibleHits ( const LocalPoint pos,
const LocalVector dir,
const std::vector< std::shared_ptr< DTHitPairForFit >> &  hits 
)
private

Definition at line 215 of file DTCombinatorialExtendedPatternReco.cc.

References filterCSVwithJSON::copy, gather_cfg::cout, debug, spr::find(), hfClusterShapes_cfi::hits, DTEnums::Left, mps_fire::result, DTEnums::Right, OrderedSet::t, theTriedPattern, printsummarytable::tried, DTEnums::undefLR, and usePairs.

Referenced by buildSegments().

216  {
217  if (debug)
218  cout << "Pos: " << posIni << " Dir: " << dirIni << endl;
219  vector<DTSegmentCand::AssPoint> result;
220 
221  // counter to early-avoid double counting in hits pattern
222  vector<int> tried;
223  int nCompatibleHits = 0;
224 
225  typedef vector<std::shared_ptr<DTHitPairForFit>> hitCont;
226  typedef hitCont::const_iterator hitIter;
227  for (hitIter hit = hits.begin(); hit != hits.end(); ++hit) {
228  pair<bool, bool> isCompatible = (*hit)->isCompatible(posIni, dirIni);
229  if (debug)
230  cout << "isCompatible " << isCompatible.first << " " << isCompatible.second << endl;
231 
232  // if only one of the two is compatible, then the LR is assigned,
233  // otherwise is undefined
234 
235  DTEnums::DTCellSide lrcode;
236  if (isCompatible.first && isCompatible.second) {
237  usePairs ? lrcode = DTEnums::undefLR : lrcode = DTEnums::Left; // if not usePairs then only use single side
238  tried.push_back(3);
239  nCompatibleHits++;
240  } else if (isCompatible.first) {
241  lrcode = DTEnums::Left;
242  tried.push_back(2);
243  nCompatibleHits++;
244  } else if (isCompatible.second) {
245  lrcode = DTEnums::Right;
246  tried.push_back(1);
247  nCompatibleHits++;
248  } else {
249  tried.push_back(0);
250  continue; // neither is compatible
251  }
252  result.push_back(DTSegmentCand::AssPoint(*hit, lrcode));
253  }
254 
255  // check if too few associated hits or pattern already tried
256  if (nCompatibleHits < 3 || find(theTriedPattern.begin(), theTriedPattern.end(), tried) == theTriedPattern.end()) {
257  theTriedPattern.push_back(tried);
258  } else {
259  if (debug) {
260  vector<vector<int>>::const_iterator t = find(theTriedPattern.begin(), theTriedPattern.end(), tried);
261  cout << "Already tried";
262  copy((*t).begin(), (*t).end(), ostream_iterator<int>(std::cout));
263  cout << endl;
264  }
265  // empty the result vector
266  result.clear();
267  }
268  return result;
269 }
std::pair< std::shared_ptr< DTHitPairForFit >, DTEnums::DTCellSide > AssPoint
Definition: DTSegmentCand.h:36
DTCellSide
Which side of the DT cell.
Definition: DTEnums.h:15
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:19
std::vector< std::shared_ptr< DTHitPairForFit > > hitCont
std::vector< std::vector< int > > theTriedPattern
hitCont::const_iterator hitIter
vector< std::shared_ptr< DTHitPairForFit > > DTCombinatorialExtendedPatternReco::initHits ( const DTSuperLayer sl,
const std::vector< DTRecHit1DPair > &  hits 
)
private

Definition at line 86 of file DTCombinatorialExtendedPatternReco.cc.

References mps_fire::result, and theDTGeometry.

Referenced by reconstruct().

87  {
88  vector<std::shared_ptr<DTHitPairForFit>> result;
89  for (vector<DTRecHit1DPair>::const_iterator hit = hits.begin(); hit != hits.end(); ++hit) {
90  result.push_back(std::make_shared<DTHitPairForFit>(*hit, *sl, theDTGeometry));
91  }
92  return result;
93 }
edm::OwnVector< DTSLRecSegment2D > DTCombinatorialExtendedPatternReco::reconstruct ( const DTSuperLayer sl,
const std::vector< DTRecHit1DPair > &  hits 
)
overridevirtual

this function is called in the producer

Implements DTRecSegment2DBaseAlgo.

Definition at line 50 of file DTCombinatorialExtendedPatternReco.cc.

References edm::OwnVector< T, P >::back(), buildSegments(), HLT_2018_cff::candidates, gather_cfg::cout, debug, initHits(), edm::OwnVector< T, P >::push_back(), mps_fire::result, theTriedPattern, theUpdator, and DTSegmentUpdator::update().

51  {
52  if (debug)
53  cout << "DTCombinatorialExtendedPatternReco::reconstruct" << endl;
54  theTriedPattern.clear();
56  vector<std::shared_ptr<DTHitPairForFit>> hitsForFit = initHits(sl, pairs);
57 
58  vector<DTSegmentCand*> candidates = buildSegments(sl, hitsForFit);
59 
60  vector<DTSegmentCand*>::const_iterator cand = candidates.begin();
61  while (cand < candidates.end()) {
62  DTSLRecSegment2D* segment = (**cand);
63 
64  theUpdator->update(segment, false);
65 
66  result.push_back(segment);
67 
68  if (debug) {
69  cout << "Reconstructed 2D extended segments " << result.back() << endl;
70  }
71 
72  delete *(cand++); // delete the candidate!
73  }
74 
75  return result;
76 }
reference back()
Definition: OwnVector.h:431
std::vector< DTSegmentCand * > buildSegments(const DTSuperLayer *sl, const std::vector< std::shared_ptr< DTHitPairForFit >> &hits)
void push_back(D *&d)
Definition: OwnVector.h:326
std::vector< std::shared_ptr< DTHitPairForFit > > initHits(const DTSuperLayer *sl, const std::vector< DTRecHit1DPair > &hits)
std::vector< std::vector< int > > theTriedPattern
void update(DTRecSegment4D *seg, const bool calcT0, bool allow3par) const
recompute hits position and refit the segment4D
void DTCombinatorialExtendedPatternReco::setClusters ( const std::vector< DTSLRecCluster > &  clusters)
void DTCombinatorialExtendedPatternReco::setES ( const edm::EventSetup setup)
overridevirtual

Through this function the EventSetup is percolated to the objs which request it

Implements DTRecSegment2DBaseAlgo.

Definition at line 78 of file DTCombinatorialExtendedPatternReco.cc.

References edm::EventSetup::get(), DTSegmentUpdator::setES(), theDTGeometry, and theUpdator.

78  {
79  // Get the DT Geometry
80  setup.get<MuonGeometryRecord>().get(theDTGeometry);
81  theUpdator->setES(setup);
82 }
void setES(const edm::EventSetup &setup)
set the setup
T get() const
Definition: EventSetup.h:73

Member Data Documentation

bool DTCombinatorialExtendedPatternReco::debug
private
std::string DTCombinatorialExtendedPatternReco::theAlgoName
private

Definition at line 99 of file DTCombinatorialExtendedPatternReco.h.

double DTCombinatorialExtendedPatternReco::theAlphaMaxPhi
private
double DTCombinatorialExtendedPatternReco::theAlphaMaxTheta
private
DTSegmentCleaner* DTCombinatorialExtendedPatternReco::theCleaner
private
std::vector<DTSLRecCluster> DTCombinatorialExtendedPatternReco::theClusters
private

Definition at line 112 of file DTCombinatorialExtendedPatternReco.h.

Referenced by extendCandidates(), and setClusters().

edm::ESHandle<DTGeometry> DTCombinatorialExtendedPatternReco::theDTGeometry
private

Definition at line 108 of file DTCombinatorialExtendedPatternReco.h.

Referenced by extendCandidates(), initHits(), and setES().

unsigned int DTCombinatorialExtendedPatternReco::theMaxAllowedHits
private
std::vector<std::vector<int> > DTCombinatorialExtendedPatternReco::theTriedPattern
private

Definition at line 111 of file DTCombinatorialExtendedPatternReco.h.

Referenced by findCompatibleHits(), and reconstruct().

DTSegmentUpdator* DTCombinatorialExtendedPatternReco::theUpdator
private
bool DTCombinatorialExtendedPatternReco::usePairs
private