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::DTCombinatorialExtendedPatternReco ( const edm::ParameterSet pset)

Constructor.

Definition at line 34 of file DTCombinatorialExtendedPatternReco.cc.

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;
42  string theHitAlgoName = pset.getParameter<string>("recAlgo");
43  usePairs = !(theHitAlgoName == "DTNoDriftAlgo");
44 }

References debug, muonDTDigis_cfi::pset, theAlphaMaxPhi, theAlphaMaxTheta, theCleaner, theMaxAllowedHits, theUpdator, and usePairs.

◆ ~DTCombinatorialExtendedPatternReco()

DTCombinatorialExtendedPatternReco::~DTCombinatorialExtendedPatternReco ( )
override

Destructor.

Definition at line 47 of file DTCombinatorialExtendedPatternReco.cc.

47 {}

Member Function Documentation

◆ algoName()

std::string DTCombinatorialExtendedPatternReco::algoName ( ) const
inlineoverridevirtual

return the algo name

Implements DTRecSegment2DBaseAlgo.

Definition at line 57 of file DTCombinatorialExtendedPatternReco.h.

57 { return theAlgoName; }

References theAlgoName.

◆ buildBestSegment()

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

Definition at line 271 of file DTCombinatorialExtendedPatternReco.cc.

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 }

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

Referenced by buildSegments().

◆ buildPointsCollection()

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.

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 }

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

Referenced by buildBestSegment().

◆ buildSegments()

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.

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
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 }

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(), unit(), and trackerHitRTTI::vector.

Referenced by reconstruct().

◆ checkDoubleCandidates()

bool DTCombinatorialExtendedPatternReco::checkDoubleCandidates ( std::vector< DTSegmentCand * > &  segs,
DTSegmentCand seg 
)
private

Definition at line 396 of file DTCombinatorialExtendedPatternReco.cc.

396  {
397  for (vector<DTSegmentCand*>::iterator cand = cands.begin(); cand != cands.end(); ++cand)
398  if (*(*cand) == *seg)
399  return false;
400  return true;
401 }

References HLT_FULL_cff::cands.

Referenced by buildSegments().

◆ closeSL()

bool DTCombinatorialExtendedPatternReco::closeSL ( const DTSuperLayerId id1,
const DTSuperLayerId id2 
)
private

Definition at line 478 of file DTCombinatorialExtendedPatternReco.cc.

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 }

References funct::abs(), globals_cff::id1, and globals_cff::id2.

Referenced by extendCandidates().

◆ extendCandidates()

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.

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 }

References DTSegmentExtendedCand::addClus(), HLT_FULL_cff::candidates, closeSL(), gather_cfg::cout, debug, submitPVResolutionJobs::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().

◆ findCompatibleHits()

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.

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 }

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

Referenced by buildSegments().

◆ initHits()

vector< std::shared_ptr< DTHitPairForFit > > DTCombinatorialExtendedPatternReco::initHits ( const DTSuperLayer sl,
const std::vector< DTRecHit1DPair > &  hits 
)
private

Definition at line 86 of file DTCombinatorialExtendedPatternReco.cc.

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 }

References hfClusterShapes_cfi::hits, mps_fire::result, and theDTGeometry.

Referenced by reconstruct().

◆ reconstruct()

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.

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 }

References buildSegments(), HLT_FULL_cff::candidates, gather_cfg::cout, debug, initHits(), mps_fire::result, theTriedPattern, theUpdator, and DTSegmentUpdator::update().

◆ setClusters()

void DTCombinatorialExtendedPatternReco::setClusters ( const std::vector< DTSLRecCluster > &  clusters)

◆ setES()

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.

78  {
79  // Get the DT Geometry
82 }

References get, DTSegmentUpdator::setES(), singleTopDQM_cfi::setup, theDTGeometry, and theUpdator.

Member Data Documentation

◆ debug

bool DTCombinatorialExtendedPatternReco::debug
private

◆ theAlgoName

std::string DTCombinatorialExtendedPatternReco::theAlgoName
private

Definition at line 99 of file DTCombinatorialExtendedPatternReco.h.

Referenced by algoName().

◆ theAlphaMaxPhi

double DTCombinatorialExtendedPatternReco::theAlphaMaxPhi
private

◆ theAlphaMaxTheta

double DTCombinatorialExtendedPatternReco::theAlphaMaxTheta
private

◆ theCleaner

DTSegmentCleaner* DTCombinatorialExtendedPatternReco::theCleaner
private

◆ theClusters

std::vector<DTSLRecCluster> DTCombinatorialExtendedPatternReco::theClusters
private

Definition at line 112 of file DTCombinatorialExtendedPatternReco.h.

Referenced by extendCandidates(), and setClusters().

◆ theDTGeometry

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

Definition at line 108 of file DTCombinatorialExtendedPatternReco.h.

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

◆ theMaxAllowedHits

unsigned int DTCombinatorialExtendedPatternReco::theMaxAllowedHits
private

◆ theTriedPattern

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

Definition at line 111 of file DTCombinatorialExtendedPatternReco.h.

Referenced by findCompatibleHits(), and reconstruct().

◆ theUpdator

DTSegmentUpdator* DTCombinatorialExtendedPatternReco::theUpdator
private

◆ usePairs

bool DTCombinatorialExtendedPatternReco::usePairs
private
Vector3DBase
Definition: Vector3DBase.h:8
DTSLRecSegment2D
Definition: DTSLRecSegment2D.h:15
DTCombinatorialExtendedPatternReco::theTriedPattern
std::vector< std::vector< int > > theTriedPattern
Definition: DTCombinatorialExtendedPatternReco.h:111
hitIter
hitCont::const_iterator hitIter
Definition: DTMeantimerPatternReco.cc:35
hfClusterShapes_cfi.hits
hits
Definition: hfClusterShapes_cfi.py:5
filterCSVwithJSON.copy
copy
Definition: filterCSVwithJSON.py:36
HLT_FULL_cff.points
points
Definition: HLT_FULL_cff.py:21455
DTCombinatorialExtendedPatternReco::initHits
std::vector< std::shared_ptr< DTHitPairForFit > > initHits(const DTSuperLayer *sl, const std::vector< DTRecHit1DPair > &hits)
Definition: DTCombinatorialExtendedPatternReco.cc:86
DTCombinatorialExtendedPatternReco::theClusters
std::vector< DTSLRecCluster > theClusters
Definition: DTCombinatorialExtendedPatternReco.h:112
DTSegmentExtendedCand::nHits
unsigned int nHits() const override
Definition: DTSegmentExtendedCand.cc:38
PV3DBase::theta
Geom::Theta< T > theta() const
Definition: PV3DBase.h:72
globals_cff.id1
id1
Definition: globals_cff.py:33
gather_cfg.cout
cout
Definition: gather_cfg.py:144
pos
Definition: PixelAliasList.h:18
MTVHistoProducerAlgoForTrackerBlock_cfi.minChi2
minChi2
Definition: MTVHistoProducerAlgoForTrackerBlock_cfi.py:89
DTCombinatorialExtendedPatternReco::extendCandidates
std::vector< DTSegmentExtendedCand * > extendCandidates(std::vector< DTSegmentCand * > &candidates, const DTSuperLayer *sl)
Definition: DTCombinatorialExtendedPatternReco.cc:403
printsummarytable.tried
tried
Definition: printsummarytable.py:21
DTEnums::undefLR
Definition: DTEnums.h:15
DTSuperLayer::id
DTSuperLayerId id() const
Return the DetId of this SL.
Definition: DTSuperLayer.cc:34
DTSuperLayer
Definition: DTSuperLayer.h:24
DTSuperLayerId::superLayer
int superLayer() const
Return the superlayer number.
Definition: DTSuperLayerId.h:39
spr::find
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:19
DTCombinatorialExtendedPatternReco::findCompatibleHits
std::vector< DTSegmentCand::AssPoint > findCompatibleHits(const LocalPoint &pos, const LocalVector &dir, const std::vector< std::shared_ptr< DTHitPairForFit >> &hits)
Definition: DTCombinatorialExtendedPatternReco.cc:215
singleTopDQM_cfi.setup
setup
Definition: singleTopDQM_cfi.py:37
DTCombinatorialExtendedPatternReco::closeSL
bool closeSL(const DTSuperLayerId &id1, const DTSuperLayerId &id2)
Definition: DTCombinatorialExtendedPatternReco.cc:478
DTSegmentUpdator
Definition: DTSegmentUpdator.h:43
DTSegmentCleaner
Definition: DTSegmentCleaner.h:31
DTCombinatorialExtendedPatternReco::theDTGeometry
edm::ESHandle< DTGeometry > theDTGeometry
Definition: DTCombinatorialExtendedPatternReco.h:108
DTEnums::Left
Definition: DTEnums.h:15
DTSegmentCand::superLayer
const DTSuperLayer * superLayer() const
the super layer on which relies
Definition: DTSegmentCand.h:76
DTCombinatorialExtendedPatternReco::theAlgoName
std::string theAlgoName
Definition: DTCombinatorialExtendedPatternReco.h:99
DTCombinatorialExtendedPatternReco::theMaxAllowedHits
unsigned int theMaxAllowedHits
Definition: DTCombinatorialExtendedPatternReco.h:100
DTSegmentUpdator::fit
bool fit(DTSegmentCand *seg, bool allow3par, const bool fitdebug) const
Definition: DTSegmentUpdator.cc:216
DTCombinatorialExtendedPatternReco::buildBestSegment
DTSegmentExtendedCand * buildBestSegment(std::vector< DTSegmentCand::AssPoint > &assHits, const DTSuperLayer *sl)
Definition: DTCombinatorialExtendedPatternReco.cc:271
DTSegmentCand::AssPoint
std::pair< std::shared_ptr< DTHitPairForFit >, DTEnums::DTCellSide > AssPoint
Definition: DTSegmentCand.h:36
DTSegmentExtendedCand::good
bool good() const override
Definition: DTSegmentExtendedCand.cc:40
DTSegmentCand
Definition: DTSegmentCand.h:34
DTCombinatorialExtendedPatternReco::usePairs
bool usePairs
Definition: DTCombinatorialExtendedPatternReco.h:104
Point3DBase< float, GlobalTag >
GeomDet::toLocal
LocalPoint toLocal(const GlobalPoint &gp) const
Conversion to the R.F. of the GeomDet.
Definition: GeomDet.h:58
bsc_activity_cfg.clusters
clusters
Definition: bsc_activity_cfg.py:36
listHistos.IP
IP
Definition: listHistos.py:76
HLT_FULL_cff.cands
cands
Definition: HLT_FULL_cff.py:15142
GeomDet::toGlobal
GlobalPoint toGlobal(const Local2DPoint &lp) const
Conversion to the global R.F. from the R.F. of the GeomDet.
Definition: GeomDet.h:49
DTCombinatorialExtendedPatternReco::theCleaner
DTSegmentCleaner * theCleaner
Definition: DTCombinatorialExtendedPatternReco.h:106
hitCont
std::vector< std::shared_ptr< DTHitPairForFit > > hitCont
Definition: DTMeantimerPatternReco.cc:34
LocalError
Definition: LocalError.h:12
cand
Definition: decayParser.h:32
DTSegmentCand::AssPointCont
std::set< AssPoint, AssPointLessZ > AssPointCont
Definition: DTSegmentCand.h:38
trackerHitRTTI::vector
Definition: trackerHitRTTI.h:21
DTSegmentUpdator::setES
void setES(const edm::EventSetup &setup)
set the setup
Definition: DTSegmentUpdator.cc:68
submitPVResolutionJobs.err
err
Definition: submitPVResolutionJobs.py:85
get
#define get
unit
Basic3DVector unit() const
Definition: Basic3DVectorLD.h:162
DTCombinatorialExtendedPatternReco::debug
bool debug
Definition: DTCombinatorialExtendedPatternReco.h:103
DTCombinatorialExtendedPatternReco::buildSegments
std::vector< DTSegmentCand * > buildSegments(const DTSuperLayer *sl, const std::vector< std::shared_ptr< DTHitPairForFit >> &hits)
Definition: DTCombinatorialExtendedPatternReco.cc:95
DTEnums::Right
Definition: DTEnums.h:15
DTCombinatorialExtendedPatternReco::theAlphaMaxTheta
double theAlphaMaxTheta
Definition: DTCombinatorialExtendedPatternReco.h:101
DTCombinatorialExtendedPatternReco::theAlphaMaxPhi
double theAlphaMaxPhi
Definition: DTCombinatorialExtendedPatternReco.h:102
HLT_FULL_cff.candidates
candidates
Definition: HLT_FULL_cff.py:54985
DTEnums::DTCellSide
DTCellSide
Which side of the DT cell.
Definition: DTEnums.h:15
DTCombinatorialExtendedPatternReco::buildPointsCollection
void buildPointsCollection(std::vector< DTSegmentCand::AssPoint > &points, std::deque< std::shared_ptr< DTHitPairForFit >> &pointsNoLR, std::vector< DTSegmentCand * > &candidates, const DTSuperLayer *sl)
Definition: DTCombinatorialExtendedPatternReco.cc:341
DTSegmentCleaner::clean
std::vector< DTSegmentCand * > clean(const std::vector< DTSegmentCand * > &inputCands) const
do the cleaning
Definition: DTSegmentCleaner.cc:36
DTSegmentExtendedCand::DTSLRecClusterForFit
Definition: DTSegmentExtendedCand.h:52
minChi2
Definition: JetCombinatorics.h:265
DTCombinatorialExtendedPatternReco::theUpdator
DTSegmentUpdator * theUpdator
Definition: DTCombinatorialExtendedPatternReco.h:105
DTSegmentExtendedCand::addClus
void addClus(const DTSegmentExtendedCand::DTSLRecClusterForFit &clus)
Definition: DTSegmentExtendedCand.h:40
mps_fire.result
result
Definition: mps_fire.py:311
DTGeometry::superLayer
const DTSuperLayer * superLayer(const DTSuperLayerId &id) const
Return a DTSuperLayer given its id.
Definition: DTGeometry.cc:92
funct::abs
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
globals_cff.id2
id2
Definition: globals_cff.py:34
DTSegmentExtendedCand::isCompatible
bool isCompatible(const DTSegmentExtendedCand::DTSLRecClusterForFit &clus)
Definition: DTSegmentExtendedCand.cc:29
DTCombinatorialExtendedPatternReco::checkDoubleCandidates
bool checkDoubleCandidates(std::vector< DTSegmentCand * > &segs, DTSegmentCand *seg)
Definition: DTCombinatorialExtendedPatternReco.cc:396
submitPVValidationJobs.t
string t
Definition: submitPVValidationJobs.py:644
MuonGeometryRecord
Definition: MuonGeometryRecord.h:34
DTSegmentExtendedCand
Definition: DTSegmentExtendedCand.h:29
hit
Definition: SiStripHitEffFromCalibTree.cc:88
muonDTDigis_cfi.pset
pset
Definition: muonDTDigis_cfi.py:27
edm::OwnVector
Definition: OwnVector.h:24
DTRecSegment2DBaseAlgo::DTRecSegment2DBaseAlgo
DTRecSegment2DBaseAlgo(const edm::ParameterSet &)
Constructor.
Definition: DTRecSegment2DBaseAlgo.h:35
DTSegmentUpdator::update
void update(DTRecSegment4D *seg, const bool calcT0, bool allow3par) const
recompute hits position and refit the segment4D
Definition: DTSegmentUpdator.cc:73