CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Types | Private Member Functions | Private Attributes | Friends
DTMeantimerPatternReco Class Reference

#include <DTMeantimerPatternReco.h>

Inheritance diagram for DTMeantimerPatternReco:
DTRecSegment2DBaseAlgo

Public Member Functions

virtual std::string algoName () const
 return the algo name More...
 
 DTMeantimerPatternReco (const edm::ParameterSet &pset)
 Constructor. More...
 
virtual edm::OwnVector
< DTSLRecSegment2D
reconstruct (const DTSuperLayer *sl, const std::vector< DTRecHit1DPair > &hits)
 this function is called in the producer More...
 
virtual void setES (const edm::EventSetup &setup)
 
virtual ~DTMeantimerPatternReco ()
 Destructor. More...
 
- Public Member Functions inherited from DTRecSegment2DBaseAlgo
 DTRecSegment2DBaseAlgo (const edm::ParameterSet &)
 Constructor. More...
 
virtual ~DTRecSegment2DBaseAlgo ()
 Destructor. More...
 

Private Types

typedef std::pair
< DTHitPairForFit
*, DTEnums::DTCellSide
AssPoint
 

Private Member Functions

void addHits (const DTSuperLayer *sl, std::vector< AssPoint > &assHits, const std::vector< DTHitPairForFit * > &hits, std::vector< DTSegmentCand * > &result, std::vector< AssPoint > &usedHits)
 
std::vector< DTSegmentCand * > buildSegments (const DTSuperLayer *sl, const std::vector< DTHitPairForFit * > &hits)
 
bool checkDoubleCandidates (std::vector< DTSegmentCand * > &segs, DTSegmentCand *seg)
 
bool fitWithT0 (const std::vector< AssPoint > &assHits, double &chi2, double &t0_corr, const bool fitdebug)
 
bool geometryFilter (const DTWireId first, const DTWireId second) const
 
std::vector< DTHitPairForFit * > initHits (const DTSuperLayer *sl, const std::vector< DTRecHit1DPair > &hits)
 
void rawFit (double &a, double &b, const std::vector< std::pair< double, double > > &hits)
 

Private Attributes

bool debug
 
unsigned int maxfound
 
std::string theAlgoName
 
double theAlphaMaxPhi
 
double theAlphaMaxTheta
 
DTSegmentCleanertheCleaner
 
edm::ESHandle< DTGeometrytheDTGeometry
 
unsigned int theMaxAllowedHits
 
double theMaxChi2
 
double theMaxT0
 
double theMinT0
 
DTSegmentUpdatortheUpdator
 

Friends

class DTMeantimerPatternReco4D
 

Detailed Description

Algo for reconstructing 2d segment in DT using a combinatorial approach with a T0 estimation produced along the way

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
Piotr Traczyk - SINS Warsaw ptrac.nosp@m.zyk@.nosp@m.fuw.e.nosp@m.du.p.nosp@m.l

Definition at line 41 of file DTMeantimerPatternReco.h.

Member Typedef Documentation

Definition at line 70 of file DTMeantimerPatternReco.h.

Constructor & Destructor Documentation

DTMeantimerPatternReco::DTMeantimerPatternReco ( const edm::ParameterSet pset)

Constructor.

Definition at line 35 of file DTMeantimerPatternReco.cc.

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

35  :
36 DTRecSegment2DBaseAlgo(pset), theAlgoName("DTMeantimerPatternReco")
37 {
38 
39  theMaxAllowedHits = pset.getParameter<unsigned int>("MaxAllowedHits"); // 100
40  theAlphaMaxTheta = pset.getParameter<double>("AlphaMaxTheta");// 0.1 ;
41  theAlphaMaxPhi = pset.getParameter<double>("AlphaMaxPhi");// 1.0 ;
42  theMaxT0 = pset.getParameter<double>("MaxT0");
43  theMinT0 = pset.getParameter<double>("MinT0");
44  theMaxChi2 = pset.getParameter<double>("MaxChi2");// 8.0 ;
45  debug = pset.getUntrackedParameter<bool>("debug");
46  theUpdator = new DTSegmentUpdator(pset);
47  theCleaner = new DTSegmentCleaner(pset);
48 }
DTRecSegment2DBaseAlgo(const edm::ParameterSet &)
Constructor.
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
DTMeantimerPatternReco::~DTMeantimerPatternReco ( )
virtual

Destructor.

Definition at line 51 of file DTMeantimerPatternReco.cc.

References theCleaner, and theUpdator.

51  {
52  delete theUpdator;
53  delete theCleaner;
54 }

Member Function Documentation

void DTMeantimerPatternReco::addHits ( const DTSuperLayer sl,
std::vector< AssPoint > &  assHits,
const std::vector< DTHitPairForFit * > &  hits,
std::vector< DTSegmentCand * > &  result,
std::vector< AssPoint > &  usedHits 
)
private

Definition at line 208 of file DTMeantimerPatternReco.cc.

References checkDoubleCandidates(), gather_cfg::cout, debug, DTSegmentUpdator::fit(), fitWithT0(), geometryFilter(), hit::id, DTEnums::Left, maxfound, DTEnums::Right, DTSegmentCand::setChi2(), and theUpdator.

Referenced by buildSegments().

209  {
210 
211  typedef vector<DTHitPairForFit*> hitCont;
212  double chi2l,chi2r,t0_corrl,t0_corrr;
213  bool foundSomething = false;
214 
215  if (debug)
216  cout << "DTMeantimerPatternReco::addHit " << endl << " Picked " << assHits.size() << " hits, " << hits.size() << " left." << endl;
217 
218  if (assHits.size()+hits.size()<maxfound) return;
219 
220  // loop over the remaining hits
221  for (hitCont::const_iterator hit=hits.begin(); hit!=hits.end(); ++hit) {
222  if (debug)
223  cout << " Trying B: " << **hit<< " wire: " << (*hit)->id() << endl;
224 
225  assHits.push_back(AssPoint(*hit, DTEnums::Left));
226  bool left_ok=fitWithT0(assHits, chi2l, t0_corrl,0);
227  assHits.pop_back();
228 
229  assHits.push_back(AssPoint(*hit, DTEnums::Right));
230  bool right_ok=fitWithT0(assHits, chi2r, t0_corrr,0);
231  assHits.pop_back();
232 
233  if (debug) {
234  int nHits=assHits.size()+1;
235  cout << " Left: t0_corr = " << t0_corrl << "ns chi2/nHits = " << chi2l << "/" << nHits << " ok: " << left_ok << endl;
236  cout << " Right: t0_corr = " << t0_corrr << "ns chi2/nHits = " << chi2r << "/" << nHits << " ok: " << right_ok << endl;
237  }
238 
239  if (!left_ok && !right_ok) continue;
240 
241  foundSomething = true;
242 
243  // prepare the hit set for the next search, start from the other side
244  hitCont hitsForFit;
245  for (hitCont::const_iterator tmpHit=hit+1; tmpHit!=hits.end(); tmpHit++)
246  if (geometryFilter((*tmpHit)->id(),(*hit)->id())) hitsForFit.push_back(*tmpHit);
247 
248  reverse(hitsForFit.begin(),hitsForFit.end());
249 
250  // choose only one - left or right
251  if (assHits.size()>3 && left_ok && right_ok) {
252  if (chi2l<chi2r-0.1) right_ok=false; else
253  if (chi2r<chi2l-0.1) left_ok=false;
254  }
255  if (left_ok) {
256  assHits.push_back(AssPoint(*hit, DTEnums::Left));
257  addHits(sl,assHits,hitsForFit,result,usedHits);
258  assHits.pop_back();
259  }
260  if (right_ok) {
261  assHits.push_back(AssPoint(*hit, DTEnums::Right));
262  addHits(sl,assHits,hitsForFit,result,usedHits);
263  assHits.pop_back();
264  }
265  }
266 
267  if (foundSomething) return;
268 
269  // If we already have a segment with more hits from this hit pair - don't save this one.
270  if (assHits.size()<maxfound) return;
271 
272  // Check if semgent Ok, calculate chi2
273  if (!fitWithT0(assHits, chi2l, t0_corrl,debug)) return;
274 
275  // If no more iterations - store the current segment
276 
277  DTSegmentCand::AssPointCont pointsSet;
278  pointsSet.insert(assHits.begin(),assHits.end());
279  DTSegmentCand* seg = new DTSegmentCand(pointsSet,sl);
280  theUpdator->fit(seg);
281 
282  if (seg) {
283  for (vector<AssPoint>::const_iterator hiti = assHits.begin()+1; hiti != assHits.end()-1; hiti++)
284  usedHits.push_back(*hiti);
285 
286  if (assHits.size()>maxfound) maxfound = assHits.size();
287  seg->setChi2(chi2l); // we need to set the chi^2 so that the cleaner can pick the best segments
288  if (debug) cout << "Segment built: " << *seg<< endl;
289  if (checkDoubleCandidates(result,seg)) {
290  result.push_back(seg);
291  if (debug) cout << " Result is now " << result.size() << endl;
292  } else {
293  if (debug) cout << " Exists - skipping" << endl;
294  delete seg;
295  }
296  }
297 }
std::pair< DTHitPairForFit *, DTEnums::DTCellSide > AssPoint
bool checkDoubleCandidates(std::vector< DTSegmentCand * > &segs, DTSegmentCand *seg)
virtual void setChi2(double &chi2)
set chi2
tuple result
Definition: query.py:137
bool fit(DTSegmentCand *seg) const
bool fitWithT0(const std::vector< AssPoint > &assHits, double &chi2, double &t0_corr, const bool fitdebug)
unsigned int id
std::set< AssPoint, AssPointLessZ > AssPointCont
Definition: DTSegmentCand.h:39
bool geometryFilter(const DTWireId first, const DTWireId second) const
void addHits(const DTSuperLayer *sl, std::vector< AssPoint > &assHits, const std::vector< DTHitPairForFit * > &hits, std::vector< DTSegmentCand * > &result, std::vector< AssPoint > &usedHits)
tuple cout
Definition: gather_cfg.py:121
virtual std::string DTMeantimerPatternReco::algoName ( void  ) const
inlinevirtual

return the algo name

Implements DTRecSegment2DBaseAlgo.

Definition at line 59 of file DTMeantimerPatternReco.h.

References theAlgoName.

59 { return theAlgoName; }
vector< DTSegmentCand * > DTMeantimerPatternReco::buildSegments ( const DTSuperLayer sl,
const std::vector< DTHitPairForFit * > &  hits 
)
private

Definition at line 105 of file DTMeantimerPatternReco.cc.

References addHits(), DTSegmentCleaner::clean(), gather_cfg::cout, debug, geometryFilter(), DTSuperLayer::id(), hit::id, listHistos::IP, DTEnums::Left, maxfound, query::result, DTEnums::Right, theAlphaMaxPhi, theAlphaMaxTheta, theCleaner, theMaxAllowedHits, PV3DBase< T, PVType, FrameType >::theta(), and GeomDet::toGlobal().

Referenced by DTMeantimerPatternReco4D::buildPhiSuperSegmentsCandidates(), and reconstruct().

106  {
107 
108  typedef vector<DTHitPairForFit*> hitCont;
109  typedef hitCont::const_iterator hitIter;
110  vector<DTSegmentCand*> result;
112 
113  if(debug) {
114  cout << "buildSegments: " << sl->id() << " nHits " << hits.size() << endl;
115  for (hitIter hit=hits.begin(); hit!=hits.end(); ++hit) cout << **hit<< " wire: " << (*hit)->id() << " DigiTime: " << (*hit)->digiTime() << endl;
116  }
117 
118  // 10-Mar-2004 SL
119  // put a protection against heavily populated chambers, for which the segment
120  // building could lead to infinite memory usage...
121  if (hits.size() > theMaxAllowedHits ) {
122  if(debug) {
123  cout << "Warning: this SuperLayer " << sl->id() << " has too many hits : "
124  << hits.size() << " max allowed is " << theMaxAllowedHits << endl;
125  cout << "Skipping segment reconstruction... " << endl;
126  }
127  return result;
128  }
129 
130  GlobalPoint IP;
131  float DAlphaMax;
132  if ((sl->id()).superlayer()==2) // Theta SL
133  DAlphaMax=theAlphaMaxTheta;
134  else // Phi SL
135  DAlphaMax=theAlphaMaxPhi;
136 
137  vector<AssPoint> usedHits;
138 
139  // get two hits in different layers and see if there are other hits
140  // compatible with them
141  for (hitCont::const_iterator firstHit=hits.begin(); firstHit!=hits.end();
142  ++firstHit) {
143  for (hitCont::const_reverse_iterator lastHit=hits.rbegin();
144  (*lastHit)!=(*firstHit); ++lastHit) {
145 
146  // a geometrical sensibility cut for the two hits
147  if (!geometryFilter((*firstHit)->id(),(*lastHit)->id())) continue;
148 
149  // create a set of hits for the fit (only the hits between the two selected ones)
150  hitCont hitsForFit;
151  for (hitCont::const_iterator tmpHit=firstHit+1; (*tmpHit)!=(*lastHit); tmpHit++)
152  if ((geometryFilter((*tmpHit)->id(),(*lastHit)->id()))
153  && (geometryFilter((*tmpHit)->id(),(*firstHit)->id()))) hitsForFit.push_back(*tmpHit);
154 
155  for (int firstLR=0; firstLR<2; ++firstLR) {
156  for (int lastLR=0; lastLR<2; ++lastLR) {
157 
158  // TODO move the global transformation in the DTHitPairForFit class
159  // when it will be moved I will able to remove the sl from the input parameter
160  GlobalPoint gposFirst=sl->toGlobal( (*firstHit)->localPosition(codes[firstLR]) );
161  GlobalPoint gposLast= sl->toGlobal( (*lastHit)->localPosition(codes[lastLR]) );
162  GlobalVector gvec=gposLast-gposFirst;
163  GlobalVector gvecIP=gposLast-IP;
164 
165  // difference in angle measured
166  float DAlpha=fabs(gvec.theta()-gvecIP.theta());
167  if (DAlpha>DAlphaMax) continue;
168 
169  if(debug) {
170  cout << "Selected hit pair:" << endl;
171  cout << " First " << *(*firstHit) << " Layer Id: " << (*firstHit)->id().layerId() << " Side: " << firstLR << " DigiTime: " << (*firstHit)->digiTime() << endl;
172  cout << " Last " << *(*lastHit) << " Layer Id: " << (*lastHit)->id().layerId() << " Side: " << lastLR << " DigiTime: " << (*lastHit)->digiTime() << endl;
173  }
174 
175  vector<AssPoint> assHits;
176  // create a candidate hit list
177  assHits.push_back(AssPoint(*firstHit,codes[firstLR]));
178  assHits.push_back(AssPoint(*lastHit,codes[lastLR]));
179 
180  // run hit adding/segment building
181  maxfound = 3;
182  addHits(sl,assHits,hitsForFit,result, usedHits);
183  }
184  }
185  }
186  }
187 
188  // now I have a couple of segment hypotheses, should check for ghost
189  if (debug) {
190  cout << "Result (before cleaning): " << result.size() << endl;
191  for (vector<DTSegmentCand*>::const_iterator seg=result.begin(); seg!=result.end(); ++seg)
192  cout << *(*seg) << endl;
193  }
194  result = theCleaner->clean(result);
195  if (debug) {
196  cout << "Result (after cleaning): " << result.size() << endl;
197  for (vector<DTSegmentCand*>::const_iterator seg=result.begin();
198  seg!=result.end(); ++seg)
199  cout << *(*seg) << endl;
200  }
201 
202  return result;
203 }
std::pair< DTHitPairForFit *, DTEnums::DTCellSide > AssPoint
GlobalPoint toGlobal(const Local2DPoint &lp) const
Conversion to the global R.F. from the R.F. of the GeomDet.
Definition: GeomDet.h:47
DTCellSide
Which side of the DT cell.
Definition: DTEnums.h:15
std::vector< DTSegmentCand * > clean(const std::vector< DTSegmentCand * > &inputCands) const
do the cleaning
Geom::Theta< T > theta() const
Definition: PV3DBase.h:75
DTSuperLayerId id() const
Return the DetId of this SL.
Definition: DTSuperLayer.cc:36
tuple result
Definition: query.py:137
tuple IP
Definition: listHistos.py:76
unsigned int id
bool geometryFilter(const DTWireId first, const DTWireId second) const
void addHits(const DTSuperLayer *sl, std::vector< AssPoint > &assHits, const std::vector< DTHitPairForFit * > &hits, std::vector< DTSegmentCand * > &result, std::vector< AssPoint > &usedHits)
tuple cout
Definition: gather_cfg.py:121
bool DTMeantimerPatternReco::checkDoubleCandidates ( std::vector< DTSegmentCand * > &  segs,
DTSegmentCand seg 
)
private

Definition at line 475 of file DTMeantimerPatternReco.cc.

References DTSegmentCand::chi2ndof(), and DTSegmentCand::nHits().

Referenced by addHits().

476  {
477  for (vector<DTSegmentCand*>::iterator cand=cands.begin();
478  cand!=cands.end(); ++cand) {
479  if (*(*cand)==*seg) return false;
480  if (((*cand)->nHits()>=seg->nHits()) && ((*cand)->chi2ndof()<seg->chi2ndof()))
481  if ((*cand)->nSharedHitPairs(*seg)>int(seg->nHits()-2)) return false;
482  }
483  return true;
484 }
virtual double chi2ndof() const
the chi2/NDOF of the fit
Definition: DTSegmentCand.h:66
virtual unsigned int nHits() const
Definition: DTSegmentCand.h:60
bool DTMeantimerPatternReco::fitWithT0 ( const std::vector< AssPoint > &  assHits,
double &  chi2,
double &  t0_corr,
const bool  fitdebug 
)
private

Definition at line 337 of file DTMeantimerPatternReco.cc.

References a, b, gather_cfg::cout, debug, delta, DTEnums::Left, alignCSCRings::s, theMaxChi2, theMinT0, x, and detailsBasic3DVector::y.

Referenced by addHits().

338 {
339  typedef vector < pair<double,double> > hitCoord;
340  double a,b,coordError,x,y;
341  double sx=0,sy=0,sxy=0,sxx=0,ssx=0,ssy=0,s=0,ss=0;
342  int leftHits=0,rightHits=0;
343 
344  if (assHits.size()<3) return false;
345 
346  // I'm assuming the single hit error is the same for all hits...
347  coordError=((*(assHits.begin())).first)->localPositionError().xx();
348 
349  for (vector<AssPoint>::const_iterator assHit=assHits.begin(); assHit!=assHits.end(); ++assHit) {
350  if (coordError!=((*(assHits.begin())).first)->localPositionError().xx())
351  cout << " DTMeantimerPatternReco: Warning! Hit errors different within one segment!" << endl;
352 
353  x=((*assHit).first)->localPosition((*assHit).second).z();
354  y=((*assHit).first)->localPosition((*assHit).second).x();
355 
356  sx+=x;
357  sy+=y;
358  sxy+=x*y;
359  sxx+=x*x;
360  s++;
361 
362  if ((*assHit).second==DTEnums::Left) {
363  leftHits++;
364  ssx+=x;
365  ssy+=y;
366  ss++;
367  } else {
368  rightHits++;
369  ssx-=x;
370  ssy-=y;
371  ss--;
372  }
373  }
374 
375  if (fitdebug && debug)
376  cout << " DTMeantimerPatternReco::fitWithT0 Left hits: " << leftHits << " Right hits: " << rightHits << endl;
377 
378  if (leftHits && rightHits) {
379 
380  double delta = ss*ss*sxx+s*sx*sx+s*ssx*ssx-s*s*sxx-2*ss*sx*ssx;
381  t0_corr=0.;
382 
383  if (delta) {
384  a=(ssy*s*ssx+sxy*ss*ss+sy*sx*s-sy*ss*ssx-ssy*sx*ss-sxy*s*s)/delta;
385  b=(ssx*sy*ssx+sxx*ssy*ss+sx*sxy*s-sxx*sy*s-ssx*sxy*ss-sx*ssy*ssx)/delta;
386  t0_corr=(ssx*s*sxy+sxx*ss*sy+sx*sx*ssy-sxx*s*ssy-sx*ss*sxy-ssx*sx*sy)/delta;
387  } else return false;
388  } else {
389  double d = s*sxx - sx*sx;
390  b = (sxx*sy- sx*sxy)/ d;
391  a = (s*sxy - sx*sy) / d;
392  t0_corr=0;
393  }
394 
395 // Calculate the chi^2 of the hits AFTER t0 correction
396 
397  double chi,chi2_not0;
398  chi2=0;
399  chi2_not0=0;
400 
401  for (vector<AssPoint>::const_iterator assHit=assHits.begin(); assHit!=assHits.end(); ++assHit) {
402  x=((*assHit).first)->localPosition((*assHit).second).z();
403  y=((*assHit).first)->localPosition((*assHit).second).x();
404 
405  chi=y-a*x-b;
406  chi2_not0+=chi*chi/coordError;
407 
408  if ((*assHit).second==DTEnums::Left) chi-=t0_corr;
409  else chi+=t0_corr;
410 
411  chi2+=chi*chi/coordError;
412  }
413 
414  // For 3-hit segments ignore timing information
415  if (assHits.size()<4) {
416  chi2=chi2_not0;
417 // if (chi2<theMaxChi2) return true;
418  if (chi2<200.) return true;
419  else return false;
420  }
421 
422  t0_corr/=-0.00543; // convert drift distance to time
423 
424  if (debug && fitdebug)
425  {
426  cout << " t0_corr = " << t0_corr << "ns chi2/nHits = " << chi2 << "/" << assHits.size() << endl;
427 
428  if (((chi2/(assHits.size()-2)<theMaxChi2) && (t0_corr<theMaxT0) && (t0_corr>theMinT0)) || (assHits.size()==4)) {
429  cout << " a = " << a << " b = " << b << endl;
430  for (vector<AssPoint>::const_iterator assHit=assHits.begin(); assHit!=assHits.end(); ++assHit) {
431  x=((*assHit).first)->localPosition((*assHit).second).z();
432  y=((*assHit).first)->localPosition((*assHit).second).x();
433  cout << " z= " << x << " x= " << y;
434  if ((*assHit).second==DTEnums::Left) cout << " x_corr= " << y+t0_corr*0.00543;
435  else cout << " x_corr= " << y-t0_corr*0.00543;
436  cout << " seg= " << a*x+b << endl;
437  }
438  }
439  }
440 
441  if ((chi2/(assHits.size()-2)<theMaxChi2) && (t0_corr<theMaxT0) && (t0_corr>theMinT0)) return true;
442  else return false;
443 }
dbl * delta
Definition: mlp_gen.cc:36
double b
Definition: hdecay.h:120
double a
Definition: hdecay.h:121
tuple cout
Definition: gather_cfg.py:121
Definition: DDAxes.h:10
bool DTMeantimerPatternReco::geometryFilter ( const DTWireId  first,
const DTWireId  second 
) const
private

Definition at line 301 of file DTMeantimerPatternReco.cc.

References funct::abs(), gather_cfg::cout, DTLayerId::layer(), DTWireId::layerId(), DTSuperLayerId::superLayer(), DTLayerId::superlayerId(), and DTWireId::wire().

Referenced by addHits(), and buildSegments().

302 {
303 // return true;
304 
305  const int layerLowerCut[4]={0,-1,-2,-2};
306  const int layerUpperCut[4]={0, 2, 2, 3};
307 // const int layerLowerCut[4]={0,-2,-4,-5};
308 // const int layerUpperCut[4]={0, 3, 4, 6};
309 
310  // deal only with hits that are in the same SL
311  if (first.layerId().superlayerId().superLayer()!=second.layerId().superlayerId().superLayer())
312  return true;
313 
314  int deltaLayer=abs(first.layerId().layer()-second.layerId().layer());
315 
316  // drop hits in the same layer
317  if (!deltaLayer) return false;
318 
319  // protection against unexpected layer numbering
320  if (deltaLayer>3) {
321  cout << "*** WARNING! DT Layer numbers differ by more than 3! for hits: " << endl;
322  cout << " " << first << endl;
323  cout << " " << second << endl;
324  return false;
325  }
326 
327  // accept only hits in cells "not too far away"
328  int deltaWire=first.wire()-second.wire();
329  if (second.layerId().layer()%2==0) deltaWire=-deltaWire; // yet another trick to get it right...
330  if ((deltaWire<=layerLowerCut[deltaLayer]) || (deltaWire>=layerUpperCut[deltaLayer])) return false;
331 
332  return true;
333 }
int layer() const
Return the layer number.
Definition: DTLayerId.h:53
DTSuperLayerId superlayerId() const
Return the corresponding SuperLayerId.
Definition: DTLayerId.h:59
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
int superLayer() const
Return the superlayer number.
int wire() const
Return the wire number.
Definition: DTWireId.h:56
DTLayerId layerId() const
Return the corresponding LayerId.
Definition: DTWireId.h:62
tuple cout
Definition: gather_cfg.py:121
vector< DTHitPairForFit * > DTMeantimerPatternReco::initHits ( const DTSuperLayer sl,
const std::vector< DTRecHit1DPair > &  hits 
)
private

Definition at line 93 of file DTMeantimerPatternReco.cc.

References query::result, and theDTGeometry.

Referenced by DTMeantimerPatternReco4D::buildPhiSuperSegmentsCandidates(), and reconstruct().

94  {
95 
96  vector<DTHitPairForFit*> result;
97  for (vector<DTRecHit1DPair>::const_iterator hit=hits.begin();
98  hit!=hits.end(); ++hit) {
99  result.push_back(new DTHitPairForFit(*hit, *sl, theDTGeometry));
100  }
101  return result;
102 }
tuple result
Definition: query.py:137
edm::ESHandle< DTGeometry > theDTGeometry
void DTMeantimerPatternReco::rawFit ( double &  a,
double &  b,
const std::vector< std::pair< double, double > > &  hits 
)
private

Definition at line 446 of file DTMeantimerPatternReco.cc.

References i, alignCSCRings::s, x, and detailsBasic3DVector::y.

446  {
447 
448  double s=0,sx=0,sy=0,x,y;
449  double sxx=0,sxy=0;
450 
451  a=b=0;
452  if (hits.size()==0) return;
453 
454  if (hits.size()==1) {
455  b=(*(hits.begin())).second;
456  } else {
457  for (unsigned int i = 0; i != hits.size(); i++) {
458  x=hits[i].first;
459  y=hits[i].second;
460  sy += y;
461  sxy+= x*y;
462  s += 1.;
463  sx += x;
464  sxx += x*x;
465  }
466  // protect against a vertical line???
467 
468  double d = s*sxx - sx*sx;
469  b = (sxx*sy- sx*sxy)/ d;
470  a = (s*sxy - sx*sy) / d;
471  }
472 }
int i
Definition: DBlmapReader.cc:9
double b
Definition: hdecay.h:120
double a
Definition: hdecay.h:121
Definition: DDAxes.h:10
edm::OwnVector< DTSLRecSegment2D > DTMeantimerPatternReco::reconstruct ( const DTSuperLayer sl,
const std::vector< DTRecHit1DPair > &  hits 
)
virtual

this function is called in the producer

Implements DTRecSegment2DBaseAlgo.

Definition at line 58 of file DTMeantimerPatternReco.cc.

References buildSegments(), gather_cfg::cout, debug, initHits(), edm::OwnVector< T, P >::push_back(), query::result, theUpdator, and DTSegmentUpdator::update().

Referenced by DTMeantimerPatternReco4D::reconstruct().

59  {
60 
62  vector<DTHitPairForFit*> hitsForFit = initHits(sl, pairs);
63 
64  vector<DTSegmentCand*> candidates = buildSegments(sl, hitsForFit);
65 
66  vector<DTSegmentCand*>::const_iterator cand=candidates.begin();
67  while (cand<candidates.end()) {
68 
69  DTSLRecSegment2D *segment = (**cand);
70 
71  theUpdator->update(segment);
72 
73  if (debug)
74  cout<<"Reconstructed 2D segments "<<*segment<<endl;
75  result.push_back(segment);
76 
77  delete *(cand++); // delete the candidate!
78  }
79 
80  for (vector<DTHitPairForFit*>::iterator it = hitsForFit.begin(), ed = hitsForFit.end();
81  it != ed; ++it) delete *it;
82 
83  return result;
84 }
void update(DTRecSegment4D *seg, const bool calcT0=false) const
recompute hits position and refit the segment4D
void push_back(D *&d)
Definition: OwnVector.h:273
std::vector< DTHitPairForFit * > initHits(const DTSuperLayer *sl, const std::vector< DTRecHit1DPair > &hits)
tuple result
Definition: query.py:137
std::vector< DTSegmentCand * > buildSegments(const DTSuperLayer *sl, const std::vector< DTHitPairForFit * > &hits)
tuple cout
Definition: gather_cfg.py:121
void DTMeantimerPatternReco::setES ( const edm::EventSetup setup)
virtual

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

Implements DTRecSegment2DBaseAlgo.

Definition at line 86 of file DTMeantimerPatternReco.cc.

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

Referenced by DTMeantimerPatternReco4D::setES().

86  {
87  // Get the DT Geometry
88  setup.get<MuonGeometryRecord>().get(theDTGeometry);
89  theUpdator->setES(setup);
90 }
void setES(const edm::EventSetup &setup)
set the setup
const T & get() const
Definition: EventSetup.h:55
edm::ESHandle< DTGeometry > theDTGeometry

Friends And Related Function Documentation

friend class DTMeantimerPatternReco4D
friend

Definition at line 68 of file DTMeantimerPatternReco.h.

Member Data Documentation

bool DTMeantimerPatternReco::debug
private
unsigned int DTMeantimerPatternReco::maxfound
private

Definition at line 112 of file DTMeantimerPatternReco.h.

Referenced by addHits(), and buildSegments().

std::string DTMeantimerPatternReco::theAlgoName
private

Definition at line 101 of file DTMeantimerPatternReco.h.

Referenced by algoName().

double DTMeantimerPatternReco::theAlphaMaxPhi
private

Definition at line 104 of file DTMeantimerPatternReco.h.

Referenced by buildSegments(), and DTMeantimerPatternReco().

double DTMeantimerPatternReco::theAlphaMaxTheta
private

Definition at line 103 of file DTMeantimerPatternReco.h.

Referenced by buildSegments(), and DTMeantimerPatternReco().

DTSegmentCleaner* DTMeantimerPatternReco::theCleaner
private
edm::ESHandle<DTGeometry> DTMeantimerPatternReco::theDTGeometry
private

Definition at line 114 of file DTMeantimerPatternReco.h.

Referenced by initHits(), and setES().

unsigned int DTMeantimerPatternReco::theMaxAllowedHits
private

Definition at line 102 of file DTMeantimerPatternReco.h.

Referenced by buildSegments(), and DTMeantimerPatternReco().

double DTMeantimerPatternReco::theMaxChi2
private

Definition at line 105 of file DTMeantimerPatternReco.h.

Referenced by DTMeantimerPatternReco(), and fitWithT0().

double DTMeantimerPatternReco::theMaxT0
private

Definition at line 106 of file DTMeantimerPatternReco.h.

Referenced by DTMeantimerPatternReco().

double DTMeantimerPatternReco::theMinT0
private

Definition at line 107 of file DTMeantimerPatternReco.h.

Referenced by DTMeantimerPatternReco(), and fitWithT0().

DTSegmentUpdator* DTMeantimerPatternReco::theUpdator
private