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 Member Functions | Private Attributes
DTSegmentUpdator Class Reference

#include <DTSegmentUpdator.h>

Public Member Functions

void calculateT0corr (DTRecSegment2D *seg) const
 
void calculateT0corr (DTRecSegment4D *seg) const
 
 DTSegmentUpdator (const edm::ParameterSet &config)
 Constructor. More...
 
bool fit (DTSegmentCand *seg, bool allow3par, const bool fitdebug) const
 
void fit (DTRecSegment2D *seg, bool allow3par, bool block3par) const
 
void fit (DTRecSegment4D *seg, bool allow3par) const
 
void setES (const edm::EventSetup &setup)
 set the setup More...
 
void update (DTRecSegment4D *seg, const bool calcT0, bool allow3par) const
 recompute hits position and refit the segment4D More...
 
void update (DTRecSegment2D *seg, bool allow3par) const
 recompute hits position and refit the segment2D More...
 
 ~DTSegmentUpdator ()
 Destructor. More...
 

Private Member Functions

void fit (const std::vector< float > &x, const std::vector< float > &y, const std::vector< int > &lfit, const std::vector< double > &dist, const std::vector< float > &sigy, LocalPoint &pos, LocalVector &dir, float &cminf, float &vminf, AlgebraicSymMatrix &covMat, double &chi2, const bool allow3par=false, const bool block3par=false) const
 interface to LinearFit More...
 
void rejectBadHits (DTChamberRecSegment2D *) const
 
void updateHits (DTRecSegment2D *seg, GlobalPoint &gpos, GlobalVector &gdir, const int step=2) const
 

Private Attributes

bool debug
 
bool perform_delta_rejecting
 
double T0_hit_resolution
 
DTRecHitBaseAlgotheAlgo
 
DTLinearFittheFitter
 
edm::ESHandle< DTGeometrytheGeom
 
bool vdrift_4parfit
 

Detailed Description

Perform linear fit and hits update for DT segments. Update a segment by improving the hits thanks to the refined knowledge of impact angle and position (also along the wire) and perform linear fit on improved hits.

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
M.Meneghelli - INFN BO marco.nosp@m..men.nosp@m.eghel.nosp@m.li@c.nosp@m.ern.c.nosp@m.h

Definition at line 40 of file DTSegmentUpdator.h.

Constructor & Destructor Documentation

DTSegmentUpdator::DTSegmentUpdator ( const edm::ParameterSet config)

Constructor.

Definition at line 47 of file DTSegmentUpdator.cc.

References gather_cfg::cout, debug, reco::get(), edm::ParameterSet::getParameter(), and theAlgo.

47  :
48  theFitter(new DTLinearFit()) ,
49  vdrift_4parfit(config.getParameter<bool>("performT0_vdriftSegCorrection")),
50  T0_hit_resolution(config.getParameter<double>("hit_afterT0_resolution")),
51  perform_delta_rejecting(config.getParameter<bool>("perform_delta_rejecting")),
52  debug(config.getUntrackedParameter<bool>("debug",false))
53 {
54  string theAlgoName = config.getParameter<string>("recAlgo");
55  theAlgo = DTRecHitAlgoFactory::get()->create(theAlgoName,
56  config.getParameter<ParameterSet>("recAlgoConfig"));
57 
58  if(debug)
59  cout << "[DTSegmentUpdator] Constructor called" << endl;
60 }
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
DTLinearFit * theFitter
tuple cout
Definition: gather_cfg.py:121
DTRecHitBaseAlgo * theAlgo
T get(const Candidate &c)
Definition: component.h:55
DTSegmentUpdator::~DTSegmentUpdator ( )

Destructor.

Definition at line 63 of file DTSegmentUpdator.cc.

References theFitter.

63  {
64  delete theFitter;
65 }
DTLinearFit * theFitter

Member Function Documentation

void DTSegmentUpdator::calculateT0corr ( DTRecSegment2D seg) const

Definition at line 626 of file DTSegmentUpdator.cc.

References a, b, gather_cfg::cout, debug, DTLinearFit::fit4Var(), TrackingRecHit::geographicalId(), DTEnums::Left, DTRecSegment2D::setT0(), DTRecSegment2D::setVdrift(), DTRecSegment2D::specificRecHits(), DTLayer::specificTopology(), theFitter, theGeom, vdrift_4parfit, DTTopology::wirePosition(), x, PV3DBase< T, PVType, FrameType >::x(), hit::x, detailsBasic3DVector::y, and PV3DBase< T, PVType, FrameType >::z().

Referenced by calculateT0corr(), DTMeantimerPatternReco4D::reconstruct(), DTCombinatorialPatternReco4D::reconstruct(), and update().

626  {
627  // WARNING: since this method is called both with a 2D and a 2DPhi as argument
628  // seg->geographicalId() can be a superLayerId or a chamberId
629  if(debug) cout << "[DTSegmentUpdator] CalculateT0corr DTRecSegment4D" << endl;
630 
631  vector<double> d_drift;
632  vector<float> x;
633  vector<float> y;
634  vector<int> lc;
635 
636  vector<DTRecHit1D> hits=seg->specificRecHits();
637 
638  DTWireId wireId;
639  int nptfit = 0;
640 
641  for (vector<DTRecHit1D>::const_iterator hit=hits.begin();
642  hit!=hits.end(); ++hit) {
643 
644  // I have to get the hits position (the hit is in the layer rf) in SL frame...
645  GlobalPoint glbPos = ( theGeom->layer( hit->wireId().layerId() ) )->toGlobal(hit->localPosition());
646  LocalPoint pos = ( theGeom->idToDet(seg->geographicalId()) )->toLocal(glbPos);
647 
648  const DTLayer* layer = theGeom->layer( hit->wireId().layerId() );
649  float xwire = layer->specificTopology().wirePosition(hit->wireId().wire());
650  float distance = fabs(hit->localPosition().x() - xwire);
651 
652  int ilc = ( hit->lrSide() == DTEnums::Left ) ? 1 : -1;
653 
654  nptfit++;
655  x.push_back(pos.z());
656  y.push_back(pos.x());
657  lc.push_back(ilc);
658  d_drift.push_back(distance);
659 
660  // cout << " d_drift "<<distance <<" npt= " <<npt<<endl;
661  }
662 
663  double chi2fit = 0.;
664  float cminf = 0.;
665  float vminf = 0.;
666  float a,b;
667 
668  if ( nptfit > 2 ) {
669  //NB chi2fit is normalized
670  theFitter->fit4Var(x,y,lc,d_drift,nptfit,a,b,cminf,vminf,chi2fit,vdrift_4parfit,debug);
671 
672  double t0cor = -999.;
673  if(cminf > -998.) t0cor = - cminf/0.00543 ; // in ns
674 
675  //cout << "In calculateT0corr: t0 = " << t0cor << endl;
676  //cout << "In calculateT0corr: vminf = " << vminf << endl;
677  //cout << "In calculateT0corr: cminf = " << cminf << endl;
678  //cout << "In calculateT0corr: chi2 = " << chi2fit << endl;
679 
680  seg->setT0(t0cor); // time and
681  seg->setVdrift(vminf); // vdrift correction are recorded in the segment
682  }
683 }
float wirePosition(int wireNumber) const
Returns the x position in the layer of a given wire number.
Definition: DTTopology.cc:86
edm::ESHandle< DTGeometry > theGeom
const DTTopology & specificTopology() const
Definition: DTLayer.cc:42
DTLinearFit * theFitter
void fit4Var(const std::vector< float > &xfit, const std::vector< float > &yfit, const std::vector< int > &lfit, const std::vector< double > &tfit, const int nptfit, float &aminf, float &bminf, float &cminf, float &vminf, double &chi2fit, const bool vdrift_4parfit, const bool debug) const
Definition: DTLinearFit.cc:238
T z() const
Definition: PV3DBase.h:64
std::vector< DTRecHit1D > specificRecHits() const
Access to specific components.
double b
Definition: hdecay.h:120
void setT0(const double &t0)
double a
Definition: hdecay.h:121
tuple cout
Definition: gather_cfg.py:121
void setVdrift(const double &vdrift)
DetId geographicalId() const
Definition: DDAxes.h:10
T x() const
Definition: PV3DBase.h:62
void DTSegmentUpdator::calculateT0corr ( DTRecSegment4D seg) const

Definition at line 621 of file DTSegmentUpdator.cc.

References calculateT0corr(), DTRecSegment4D::hasPhi(), DTRecSegment4D::hasZed(), DTRecSegment4D::phiSegment(), and DTRecSegment4D::zSegment().

621  {
622  if(seg->hasPhi()) calculateT0corr(seg->phiSegment());
623  if(seg->hasZed()) calculateT0corr(seg->zSegment());
624 }
void calculateT0corr(DTRecSegment2D *seg) const
const DTChamberRecSegment2D * phiSegment() const
The superPhi segment: 0 if no phi projection available.
bool hasPhi() const
Does it have the Phi projection?
bool hasZed() const
Does it have the Z projection?
const DTSLRecSegment2D * zSegment() const
The Z segment: 0 if not zed projection available.
bool DTSegmentUpdator::fit ( DTSegmentCand seg,
bool  allow3par,
const bool  fitdebug 
) const

do the linear fit on the hits of the segment candidate and update it. Returns false if the segment candidate is not good()

Definition at line 215 of file DTSegmentUpdator.cc.

References gather_cfg::cout, debug, dir, DTSegmentCand::good(), DTSegmentCand::hits(), i, getDQMSummary::iter, DTEnums::Left, DTEnums::Right, DTSegmentCand::setChi2(), DTSegmentCand::setCovMatrix(), DTSegmentCand::setDirection(), DTSegmentCand::setPosition(), DTSegmentCand::sett0(), mathSSE::sqrt(), x, PV3DBase< T, PVType, FrameType >::x(), detailsBasic3DVector::y, and PV3DBase< T, PVType, FrameType >::z().

Referenced by DTCombinatorialPatternReco::buildPointsCollection(), DTCombinatorialExtendedPatternReco::buildPointsCollection(), DTCombinatorialExtendedPatternReco::extendCandidates(), fit(), DTMeantimerPatternReco::fitWithT0(), DTRefitAndCombineReco4D::refitSuperSegments(), and update().

215  {
216 
217 // if (debug && fitdebug) cout << "[DTSegmentUpdator] Fit DTRecSegment2D" << endl;
218  if (!seg->good()) return false;
219 
220 // DTSuperLayerId DTid = (DTSuperLayerId)seg->superLayer()->id();
221 // if (DTid.superlayer()==2)
222 // allow3par = 0;
223 
224  vector<float> x;
225  vector<float> y;
226  vector<float> sigy;
227  vector <int> lfit;
228  vector <double> dist;
229  int i=0;
230 
231  x.reserve(8);
232  y.reserve(8);
233  sigy.reserve(8);
234  lfit.reserve(8);
235  dist.reserve(8);
236 
237  DTSegmentCand::AssPointCont hits=seg->hits();
238  for (DTSegmentCand::AssPointCont::const_iterator iter=hits.begin(); iter!=hits.end(); ++iter) {
239  LocalPoint pos = (*iter).first->localPosition((*iter).second);
240  float xwire = (((*iter).first)->localPosition(DTEnums::Left).x() + ((*iter).first)->localPosition(DTEnums::Right).x()) /2.;
241  float distance = pos.x() - xwire;
242 
243  if ((*iter).second==DTEnums::Left) lfit.push_back(1);
244  else lfit.push_back(-1);
245 
246  dist.push_back(distance);
247  sigy.push_back(sqrt((*iter).first->localPositionError().xx()));
248  x.push_back(pos.z());
249  y.push_back(pos.x());
250  i++;
251  }
252 
253  LocalPoint pos;
255  AlgebraicSymMatrix covMat(2);
256  float cminf =0.;
257  float vminf =0.;
258  double chi2 = 0.;
259  double t0_corr = 0.;
260 
261  fit(x,y,lfit,dist,sigy,pos,dir,cminf,vminf,covMat,chi2,allow3par);
262  if (cminf!=0) t0_corr=-cminf/0.00543; // convert drift distance to time
263 
264  if (debug && fitdebug) cout << " DTcand chi2: " << chi2 << endl;
265  if (debug && fitdebug) cout << " DTcand t0: " << t0_corr << endl;
266 
267  seg->setPosition(pos);
268  seg->setDirection(dir);
269  seg->sett0(t0_corr);
270  seg->setCovMatrix(covMat);
271  seg->setChi2(chi2);
272 
273  // cout << "pos " << pos << endl;
274  // cout << "dir " << dir << endl;
275  // cout << "Mat " << covMat << endl;
276 
277  return true;
278 }
int i
Definition: DBlmapReader.cc:9
virtual void setChi2(double &chi2)
set chi2
virtual bool good() const
T sqrt(T t)
Definition: SSEVec.h:48
T z() const
Definition: PV3DBase.h:64
virtual void setCovMatrix(AlgebraicSymMatrix &cov)
set the cov matrix
virtual AssPointCont hits() const
the used hits
std::set< AssPoint, AssPointLessZ > AssPointCont
Definition: DTSegmentCand.h:40
virtual void sett0(double &t0)
set t0
virtual void setDirection(LocalVector &dir)
set direction
Definition: DTSegmentCand.h:96
CLHEP::HepSymMatrix AlgebraicSymMatrix
tuple cout
Definition: gather_cfg.py:121
dbl *** dir
Definition: mlp_gen.cc:35
virtual void setPosition(LocalPoint &pos)
set position
Definition: DTSegmentCand.h:93
Definition: DDAxes.h:10
T x() const
Definition: PV3DBase.h:62
bool fit(DTSegmentCand *seg, bool allow3par, const bool fitdebug) const
void DTSegmentUpdator::fit ( DTRecSegment2D seg,
bool  allow3par,
bool  block3par 
) const

ditto for true segment: since the fit is applied on a true segment, by definition the segment is "good", while it's not the case for just candidates

Definition at line 280 of file DTSegmentUpdator.cc.

References gather_cfg::cout, debug, dir, fit(), TrackingRecHit::geographicalId(), DTEnums::Left, DTRecSegment2D::setChi2(), DTRecSegment2D::setCovMatrix(), DTRecSegment2D::setDirection(), DTRecSegment2D::setPosition(), DTRecSegment2D::setT0(), DTRecSegment2D::specificRecHits(), DTLayer::specificTopology(), mathSSE::sqrt(), theGeom, ErrorFrameTransformer::transform(), DTTopology::wirePosition(), x, PV3DBase< T, PVType, FrameType >::x(), hit::x, LocalError::xx(), detailsBasic3DVector::y, and PV3DBase< T, PVType, FrameType >::z().

280  {
281 
282  if(debug) cout << "[DTSegmentUpdator] Fit DTRecSegment2D - 3par: " << allow3par << endl;
283 
284  vector<float> x;
285  vector<float> y;
286  vector<float> sigy;
287  vector <int> lfit;
288  vector <double> dist;
289  x.reserve(8);
290  y.reserve(8);
291  sigy.reserve(8);
292  lfit.reserve(8);
293  dist.reserve(8);
294 
295 // DTSuperLayerId DTid = (DTSuperLayerId)seg->geographicalId();
296 // if (DTid.superlayer()==2)
297 // allow3par = 0;
298 
299  vector<DTRecHit1D> hits=seg->specificRecHits();
300  for (vector<DTRecHit1D>::const_iterator hit=hits.begin();
301  hit!=hits.end(); ++hit) {
302 
303  // I have to get the hits position (the hit is in the layer rf) in SL frame...
304  GlobalPoint glbPos = ( theGeom->layer( hit->wireId().layerId() ) )->toGlobal(hit->localPosition());
305  LocalPoint pos = ( theGeom->idToDet(seg->geographicalId()) )->toLocal(glbPos);
306  x.push_back(pos.z());
307  y.push_back(pos.x());
308 
309  const DTLayer* layer = theGeom->layer( hit->wireId().layerId() );
310  float xwire = layer->specificTopology().wirePosition(hit->wireId().wire());
311  float distance = fabs(hit->localPosition().x() - xwire);
312  dist.push_back(distance);
313 
314  int ilc = ( hit->lrSide() == DTEnums::Left ) ? 1 : -1;
315  lfit.push_back(ilc);
316 
317  // Get local error in SL frame
318  //RB: is it right in this way?
320  GlobalError glbErr = tran.transform( hit->localPositionError(),(theGeom->layer( hit->wireId().layerId() ))->surface());
321  LocalError slErr = tran.transform( glbErr, (theGeom->idToDet(seg->geographicalId()))->surface());
322  sigy.push_back(sqrt(slErr.xx()));
323  }
324 
325  LocalPoint pos;
327  AlgebraicSymMatrix covMat(2);
328  double chi2 = 0.;
329  float cminf=0.;
330  float vminf=0.;
331  double t0_corr = 0.;
332 
333  fit(x,y,lfit,dist,sigy,pos,dir,cminf,vminf,covMat,chi2,allow3par,block3par);
334  if (cminf!=0) t0_corr=-cminf/0.00543; // convert drift distance to time
335 
336  if (debug) cout << " DTSeg2d chi2: " << chi2 << endl;
337  if (debug) cout << " DTSeg2d Fit t0: " << t0_corr << endl;
338  // cout << "pos " << segPosition << endl;
339  // cout << "dir " << segDirection << endl;
340  // cout << "Mat " << mat << endl;
341 
342  seg->setPosition(pos);
343  seg->setDirection(dir);
344  seg->setCovMatrix(covMat);
345  seg->setChi2(chi2);
346  seg->setT0(t0_corr);
347 }
float wirePosition(int wireNumber) const
Returns the x position in the layer of a given wire number.
Definition: DTTopology.cc:86
static GlobalError transform(const LocalError &le, const Surface &surf)
float xx() const
Definition: LocalError.h:24
void setChi2(const double &chi2)
void setCovMatrix(const AlgebraicSymMatrix &cov)
edm::ESHandle< DTGeometry > theGeom
const DTTopology & specificTopology() const
Definition: DTLayer.cc:42
T sqrt(T t)
Definition: SSEVec.h:48
T z() const
Definition: PV3DBase.h:64
std::vector< DTRecHit1D > specificRecHits() const
Access to specific components.
void setT0(const double &t0)
void setPosition(const LocalPoint &pos)
CLHEP::HepSymMatrix AlgebraicSymMatrix
void setDirection(const LocalVector &dir)
tuple cout
Definition: gather_cfg.py:121
DetId geographicalId() const
dbl *** dir
Definition: mlp_gen.cc:35
Definition: DDAxes.h:10
T x() const
Definition: PV3DBase.h:62
bool fit(DTSegmentCand *seg, bool allow3par, const bool fitdebug) const
void DTSegmentUpdator::fit ( DTRecSegment4D seg,
bool  allow3par 
) const

ditto for true segment 4D, the fit is done on either projection and then the 4D direction and position is built. Since the fit is applied on a true segment, by definition the segment is "good", while it's not the case for just candidates

Definition at line 109 of file DTSegmentUpdator.cc.

References DTSuperLayerId::chamberId(), DTRecSegment4D::chamberId(), DTRecSegment2D::chi2(), funct::cos(), gather_cfg::cout, debug, dir, fit(), DTRecSegment4D::hasPhi(), DTRecSegment4D::hasZed(), DTRecSegment2D::localDirection(), DTRecSegment2D::localPosition(), DTRecSegment2D::parametersError(), DTRecSegment4D::phiSegment(), DTRecSegment4D::setCovMatrix(), DTRecSegment4D::setCovMatrixForZed(), DTRecSegment4D::setDirection(), DTRecSegment4D::setPosition(), DTSLRecSegment2D::superLayerId(), DTRecSegment2D::t0(), theGeom, PV3DBase< T, PVType, FrameType >::theta(), GeomDet::toGlobal(), GeomDet::toLocal(), PV3DBase< T, PVType, FrameType >::x(), detailsBasic3DVector::y, PV3DBase< T, PVType, FrameType >::y(), PV3DBase< T, PVType, FrameType >::z(), zPos, and DTRecSegment4D::zSegment().

109  {
110  if(debug) cout << "[DTSegmentUpdator] Fit DTRecSegment4D:" << endl;
111  // after the update must refit the segments
112 
113  if (debug) {
114  if(seg->hasPhi()) cout << " 4D Segment contains a Phi segment. t0= " << seg->phiSegment()->t0() << " chi2= " << seg->phiSegment()->chi2() << endl;
115  if(seg->hasZed()) cout << " 4D Segment contains a Zed segment. t0= " << seg->zSegment()->t0() << " chi2= " << seg->zSegment()->chi2() << endl;
116  }
117 
118 
119  // use the 2-par fit UNLESS the 4D segment only has the Phi projection or is out of time by more than 20ns
120  // - in these cases use the 3-par fit
121  if(seg->hasPhi()) {
122  if(seg->hasZed()) {
123 
124  // fit in-time Phi segments with the 2par fit and out-of-time segments with the 3par fit
125  if (fabs(seg->phiSegment()->t0())<40.) {
126  fit(seg->phiSegment(),allow3par,1);
127  fit(seg->zSegment(),allow3par,1);
128  } else {
129  fit(seg->phiSegment(),allow3par,0);
130  fit(seg->zSegment(),allow3par,0);
131  }
132 
133  } else fit(seg->phiSegment(),allow3par,0);
134  } else fit(seg->zSegment(),allow3par,0);
135 
136  const DTChamber* theChamber = theGeom->chamber(seg->chamberId());
137 
138  if(seg->hasPhi() && seg->hasZed() ) {
139 
140  DTChamberRecSegment2D *segPhi=seg->phiSegment();
141  DTSLRecSegment2D *segZed=seg->zSegment();
142 
143  // NB Phi seg is already in chamber ref
144  LocalPoint posPhiInCh = segPhi->localPosition();
145  LocalVector dirPhiInCh= segPhi->localDirection();
146 
147  // Zed seg is in SL one
148  const DTSuperLayer* zSL = theChamber->superLayer(segZed->superLayerId());
149  LocalPoint zPos(segZed->localPosition().x(),
150  (zSL->toLocal(theChamber->toGlobal(segPhi->localPosition()))).y(),
151  0.);
152 
153  LocalPoint posZInCh = theChamber->toLocal(zSL->toGlobal(zPos));
154 
155  LocalVector dirZInCh = theChamber->toLocal(zSL->toGlobal(segZed->localDirection()));
156 
157  LocalPoint posZAt0 = posZInCh + dirZInCh*(-posZInCh.z())/cos(dirZInCh.theta());
158 
159  // given the actual definition of chamber refFrame, (with z poiniting to IP),
160  // the zed component of direction is negative.
161  LocalVector dir=LocalVector(dirPhiInCh.x()/fabs(dirPhiInCh.z()),dirZInCh.y()/fabs(dirZInCh.z()),-1.);
162 
163  seg->setPosition(LocalPoint(posPhiInCh.x(),posZAt0.y(),0.));
164  seg->setDirection(dir.unit());
165 
166  AlgebraicSymMatrix mat(4);
167 
168  // set cov matrix
169  mat[0][0] = segPhi->parametersError()[0][0]; //sigma (dx/dz)
170  mat[0][2] = segPhi->parametersError()[0][1]; //cov(dx/dz,x)
171  mat[2][2] = segPhi->parametersError()[1][1]; //sigma (x)
172 
173  seg->setCovMatrix(mat);
174  seg->setCovMatrixForZed(posZInCh);
175  }
176  else if (seg->hasPhi()) {
177  DTChamberRecSegment2D *segPhi=seg->phiSegment();
178 
179  seg->setPosition(segPhi->localPosition());
180  seg->setDirection(segPhi->localDirection());
181 
182  AlgebraicSymMatrix mat(4);
183  // set cov matrix
184  mat[0][0] = segPhi->parametersError()[0][0]; //sigma (dx/dz)
185  mat[0][2] = segPhi->parametersError()[0][1]; //cov(dx/dz,x)
186  mat[2][2] = segPhi->parametersError()[1][1]; //sigma (x)
187 
188  seg->setCovMatrix(mat);
189  }
190  else if (seg->hasZed()) {
191  DTSLRecSegment2D *segZed = seg->zSegment();
192 
193  // Zed seg is in SL one
194  GlobalPoint glbPosZ = ( theGeom->superLayer(segZed->superLayerId()) )->toGlobal(segZed->localPosition());
195  LocalPoint posZInCh = ( theGeom->chamber(segZed->superLayerId().chamberId()) )->toLocal(glbPosZ);
196 
197  GlobalVector glbDirZ = (theGeom->superLayer(segZed->superLayerId()) )->toGlobal(segZed->localDirection());
198  LocalVector dirZInCh = (theGeom->chamber(segZed->superLayerId().chamberId()) )->toLocal(glbDirZ);
199 
200  LocalPoint posZAt0 = posZInCh+
201  dirZInCh*(-posZInCh.z())/cos(dirZInCh.theta());
202 
203  seg->setPosition(posZAt0);
204  seg->setDirection(dirZInCh);
205 
206  AlgebraicSymMatrix mat(4);
207  // set cov matrix
208  seg->setCovMatrix(mat);
209  seg->setCovMatrixForZed(posZInCh);
210  }
211 }
Local3DVector LocalVector
Definition: LocalVector.h:12
double zPos
DTChamberId chamberId() const
Return the corresponding ChamberId.
const DTChamberRecSegment2D * phiSegment() const
The superPhi segment: 0 if no phi projection available.
GlobalPoint toGlobal(const Local2DPoint &lp) const
Conversion to the global R.F. from the R.F. of the GeomDet.
Definition: GeomDet.h:47
virtual double chi2() const
the chi2 of the fit
T y() const
Definition: PV3DBase.h:63
LocalPoint toLocal(const GlobalPoint &gp) const
Conversion to the R.F. of the GeomDet.
Definition: GeomDet.h:62
virtual DTChamberId chamberId() const
The (specific) DetId of the chamber on which the segment resides.
void setCovMatrixForZed(const LocalPoint &posZInCh)
edm::ESHandle< DTGeometry > theGeom
void setCovMatrix(const AlgebraicSymMatrix &mat)
Set covariance matrix.
Geom::Theta< T > theta() const
Definition: PV3DBase.h:75
T z() const
Definition: PV3DBase.h:64
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
void setDirection(LocalVector dir)
Set direction.
bool hasPhi() const
Does it have the Phi projection?
DTSuperLayerId superLayerId() const
The id of the superlayer on which reside the segment.
virtual LocalPoint localPosition() const
local position in SL frame
bool hasZed() const
Does it have the Z projection?
const DTSLRecSegment2D * zSegment() const
The Z segment: 0 if not zed projection available.
virtual AlgebraicSymMatrix parametersError() const
virtual LocalVector localDirection() const
the local direction in SL frame
CLHEP::HepSymMatrix AlgebraicSymMatrix
Local3DPoint LocalPoint
Definition: LocalPoint.h:11
void setPosition(LocalPoint pos)
Set position.
tuple cout
Definition: gather_cfg.py:121
dbl *** dir
Definition: mlp_gen.cc:35
double t0() const
Get the segment t0 (if recomputed, 0 is returned otherwise)
T x() const
Definition: PV3DBase.h:62
bool fit(DTSegmentCand *seg, bool allow3par, const bool fitdebug) const
void DTSegmentUpdator::fit ( const std::vector< float > &  x,
const std::vector< float > &  y,
const std::vector< int > &  lfit,
const std::vector< double > &  dist,
const std::vector< float > &  sigy,
LocalPoint pos,
LocalVector dir,
float &  cminf,
float &  vminf,
AlgebraicSymMatrix covMat,
double &  chi2,
const bool  allow3par = false,
const bool  block3par = false 
) const
private

interface to LinearFit

Definition at line 349 of file DTSegmentUpdator.cc.

References debug, DTLinearFit::fit(), DTLinearFit::fitNpar(), i, slope, theFitter, and Vector3DBase< T, FrameTag >::unit().

361  {
362 
363  float slope = 0.;
364  float intercept = 0.;
365  float covss = 0.;
366  float covii = 0.;
367  float covsi = 0.;
368 
369  cminf=0;
370  vminf=0;
371 
372  int leftHits=0, rightHits=0;
373  for (unsigned int i=0; i<lfit.size(); i++)
374  if (lfit[i]==1) leftHits++; else rightHits++;
375 
376  theFitter->fit(x,y,x.size(),sigy,slope,intercept,chi2,covss,covii,covsi);
377 
378  // If we have at least one left and one right hit we can try the 3 parameter fit (if it is switched on)
379  // FIXME: currently the covariance matrix from the 2-par fit is kept
380  if (leftHits && rightHits && (leftHits+rightHits>3) && allow3par) {
381  theFitter->fitNpar(3,x,y,lfit,dist,sigy,slope,intercept,cminf,vminf,chi2,debug);
382  double t0_corr=-cminf/0.00543;
383  if (fabs(t0_corr)<20. && block3par) {
384  theFitter->fit(x,y,x.size(),sigy,slope,intercept,chi2,covss,covii,covsi);
385  cminf=0;
386  }
387  }
388 
389  // cout << "slope " << slope << endl;
390  // cout << "intercept " << intercept << endl;
391 
392  // intercept is the x() in chamber frame when the segment cross the chamber
393  // plane (at z()=0), the y() is not measured, so let's put the center of the
394  // chamber.
395  pos = LocalPoint(intercept,0.,0.);
396 
397  // slope is dx()/dz(), while dy()/dz() is by definition 0, finally I want the
398  // segment to point outward, so opposite to local z
399  dir = LocalVector(-slope,0.,-1.).unit();
400 
401  covMatrix = AlgebraicSymMatrix(2);
402  covMatrix[0][0] = covss; // this is var(dy/dz)
403  covMatrix[1][1] = covii; // this is var(y)
404  covMatrix[1][0] = covsi; // this is cov(dy/dz,y)
405 }
int i
Definition: DBlmapReader.cc:9
Local3DVector LocalVector
Definition: LocalVector.h:12
static const double slope[3]
void fit(const std::vector< float > &x, const std::vector< float > &y, int ndat, const std::vector< float > &sigy, float &slope, float &intercept, double &chi2, float &covss, float &covii, float &covsi) const
Definition: DTLinearFit.cc:27
DTLinearFit * theFitter
void fitNpar(const int npar, const std::vector< float > &xfit, const std::vector< float > &yfit, const std::vector< int > &lfit, const std::vector< double > &tfit, const std::vector< float > &sigy, float &aminf, float &bminf, float &cminf, float &vminf, double &chi2fit, const bool debug) const
Definition: DTLinearFit.cc:70
Vector3DBase unit() const
Definition: Vector3DBase.h:57
CLHEP::HepSymMatrix AlgebraicSymMatrix
Local3DPoint LocalPoint
Definition: LocalPoint.h:11
Definition: DDAxes.h:10
void DTSegmentUpdator::rejectBadHits ( DTChamberRecSegment2D phiSeg) const
private

Definition at line 486 of file DTSegmentUpdator.cc.

References gather_cfg::cout, debug, delta, TrackingRecHit::geographicalId(), i, N, DTRecSegment2D::specificRecHits(), theGeom, DTRecSegment2D::update(), x, PV3DBase< T, PVType, FrameType >::x(), detailsBasic3DVector::y, and PV3DBase< T, PVType, FrameType >::z().

Referenced by update().

486  {
487 
488  vector<float> x;
489  vector<float> y;
490 
491  if(debug) cout << " Inside the segment updator, now loop on hits: ( x == z_loc , y == x_loc) " << endl;
492 
493  vector<DTRecHit1D> hits = phiSeg->specificRecHits();
494  for (vector<DTRecHit1D>::const_iterator hit=hits.begin();
495  hit!=hits.end(); ++hit) {
496 
497  // I have to get the hits position (the hit is in the layer rf) in SL frame...
498  GlobalPoint glbPos = ( theGeom->layer( hit->wireId().layerId() ) )->toGlobal(hit->localPosition());
499  LocalPoint pos = ( theGeom->idToDet(phiSeg->geographicalId()) )->toLocal(glbPos);
500 
501  x.push_back(pos.z());
502  y.push_back(pos.x());
503  }
504 
505  if(debug){
506  cout << " end of segment! " << endl;
507  cout << " size = Number of Hits: " << x.size() << " " << y.size() << endl;
508  }
509 
510  // Perform the 2 par fit:
511  float par[2]={0.,0.}; // q , m
512 
513  //variables to perform the fit:
514  float Sx = 0.;
515  float Sy = 0.;
516  float Sx2 = 0.;
517  float Sy2 = 0.;
518  float Sxy = 0.;
519 
520  size_t N = x.size();
521 
522  if (N == 0)
523  return;
524 
525  for(size_t i = 0; i < N;++i){
526  Sx += x.at(i);
527  Sy += y.at(i);
528  Sx2 += x.at(i)*x.at(i);
529  Sy2 += y.at(i)*y.at(i);
530  Sxy += x.at(i)*y.at(i);
531 
532  }
533 
534  const float delta = N*Sx2 - Sx*Sx;
535  par[0] = ( Sx2*Sy - Sx*Sxy )/delta;
536  par[1] = ( N*Sxy - Sx*Sy )/delta;
537 
538  if(debug) cout << "fit 2 parameters done ----> par0: "<< par[0] << " par1: "<< par[1] << endl;
539 
540  // Calc residuals:
541  float residuals[N];
542 
543  for(size_t i = 0; i < N;++i)
544  residuals[i] = 0;
545 
546  for(size_t i = 0; i < N;++i){
547  residuals[i] = y.at(i) - par[1]*x.at(i) - par[0];
548  if(debug){
549  cout<<" i: "<<i<<" y_i "<<y.at(i)<<" x_i "<<x.at(i)<<" res_i "<<residuals[i];
550  if (i==N-1) cout<<endl;
551  }
552  }
553 
554  if(debug) cout << " Residuals computed! "<< endl;
555 
556  // Perform bad hit rejecting -- update hits
557  vector<DTRecHit1D> updatedRecHits;
558 
559  float mean_residual = 0.; //mean of the absolute values of residuals
560 
561  for (size_t i = 0; i < N; ++i)
562  mean_residual += fabs(residuals[i]);
563 
564  mean_residual = mean_residual/(N - 2);
565 
566  if(debug) cout << " mean_residual: "<< mean_residual << endl;
567 
568  int i = 0;
569 
570  for (vector<DTRecHit1D>::const_iterator hit=hits.begin();
571  hit!=hits.end(); ++hit) {
572 
573  DTRecHit1D newHit1D = (*hit);
574 
575  float normResidual = mean_residual > 0 ? fabs(residuals[i])/mean_residual : 0;
576  if(normResidual < 1.5){
577 
578  updatedRecHits.push_back(newHit1D);
579  if(debug) cout << " accepted "<< i+1 << "th hit" <<" Irej: " << normResidual << endl;
580  ++i;
581  }
582  else {
583  if(debug) cout << " rejected "<< i+1 << "th hit" <<" Irej: " << normResidual << endl;
584  ++i;
585  continue;
586  }
587  }
588 
589  phiSeg->update(updatedRecHits);
590 
591  //final check!
592  if(debug){
593 
594  vector<float> x_upd;
595  vector<float> y_upd;
596 
597  cout << " Check the update action: " << endl;
598 
599  vector<DTRecHit1D> hits_upd = phiSeg->specificRecHits();
600  for (vector<DTRecHit1D>::const_iterator hit=hits_upd.begin();
601  hit!=hits_upd.end(); ++hit) {
602 
603  // I have to get the hits position (the hit is in the layer rf) in SL frame...
604  GlobalPoint glbPos = ( theGeom->layer( hit->wireId().layerId() ) )->toGlobal(hit->localPosition());
605  LocalPoint pos = ( theGeom->idToDet(phiSeg->geographicalId()) )->toLocal(glbPos);
606 
607  x_upd.push_back(pos.z());
608  y_upd.push_back(pos.x());
609 
610  cout << " x_upd: "<< pos.z() << " y_upd: "<< pos.x() << endl;
611  }
612 
613  cout << " end of segment! " << endl;
614  cout << " size = Number of Hits: " << x_upd.size() << " " << y_upd.size() << endl;
615 
616  }// end debug
617 
618  return;
619 } //end DTSegmentUpdator::rejectBadHits
dbl * delta
Definition: mlp_gen.cc:36
int i
Definition: DBlmapReader.cc:9
void update(std::vector< DTRecHit1D > &updatedRecHits)
edm::ESHandle< DTGeometry > theGeom
T z() const
Definition: PV3DBase.h:64
std::vector< DTRecHit1D > specificRecHits() const
Access to specific components.
#define N
Definition: blowfish.cc:9
tuple cout
Definition: gather_cfg.py:121
DetId geographicalId() const
Definition: DDAxes.h:10
T x() const
Definition: PV3DBase.h:62
void DTSegmentUpdator::setES ( const edm::EventSetup setup)

set the setup

Definition at line 69 of file DTSegmentUpdator.cc.

References edm::EventSetup::get(), DTRecHitBaseAlgo::setES(), theAlgo, and theGeom.

Referenced by DTCombinatorialPatternReco4D::setES(), DTMeantimerPatternReco4D::setES(), DTRefitAndCombineReco4D::setES(), DTCombinatorialPatternReco::setES(), DTCombinatorialExtendedPatternReco::setES(), and DTMeantimerPatternReco::setES().

69  {
70  setup.get<MuonGeometryRecord>().get(theGeom);
71  theAlgo->setES(setup);
72 }
edm::ESHandle< DTGeometry > theGeom
virtual void setES(const edm::EventSetup &setup)=0
Pass the Event Setup to the algo at each event.
const T & get() const
Definition: EventSetup.h:55
DTRecHitBaseAlgo * theAlgo
void DTSegmentUpdator::update ( DTRecSegment4D seg,
const bool  calcT0,
bool  allow3par 
) const

recompute hits position and refit the segment4D

Definition at line 74 of file DTSegmentUpdator.cc.

References calculateT0corr(), gather_cfg::cout, debug, dir, fit(), TrackingRecHit::geographicalId(), DTRecSegment4D::hasPhi(), DTRecSegment4D::hasZed(), DTRecSegment4D::localDirection(), DTRecSegment4D::localPosition(), perform_delta_rejecting, DTRecSegment4D::phiSegment(), rejectBadHits(), relval_parameters_module::step, theGeom, updateHits(), and DTRecSegment4D::zSegment().

Referenced by progressbar.ProgressBar::__next__(), relval_steps.Matrix::__setitem__(), relval_steps.Steps::__setitem__(), Vispa.Gui.VispaWidget.VispaWidget::autosize(), Vispa.Views.LineDecayView.LineDecayContainer::createObject(), Vispa.Views.LineDecayView.LineDecayContainer::deselectAllObjects(), Vispa.Gui.VispaWidgetOwner.VispaWidgetOwner::deselectAllWidgets(), Vispa.Gui.VispaWidget.VispaWidget::enableAutosizing(), progressbar.ProgressBar::finish(), Vispa.Gui.MenuWidget.MenuWidget::leaveEvent(), Vispa.Gui.VispaWidgetOwner.VispaWidgetOwner::mouseMoveEvent(), Vispa.Gui.MenuWidget.MenuWidget::mouseMoveEvent(), Vispa.Views.LineDecayView.LineDecayContainer::mouseMoveEvent(), Vispa.Gui.VispaWidgetOwner.VispaWidgetOwner::mouseReleaseEvent(), Vispa.Views.LineDecayView.LineDecayContainer::objectMoved(), relval_steps.Steps::overwrite(), DTMeantimerPatternReco4D::reconstruct(), DTCombinatorialPatternReco4D::reconstruct(), DTRefitAndCombineReco4D::reconstruct(), DTCombinatorialPatternReco::reconstruct(), DTCombinatorialExtendedPatternReco::reconstruct(), DTMeantimerPatternReco::reconstruct(), Vispa.Views.LineDecayView.LineDecayContainer::removeObject(), Vispa.Gui.ConnectableWidget.ConnectableWidget::removePorts(), Vispa.Gui.FindDialog.FindDialog::reset(), Vispa.Gui.PortConnection.PointToPointConnection::select(), Vispa.Gui.VispaWidget.VispaWidget::select(), Vispa.Views.LineDecayView.LineDecayContainer::select(), Vispa.Gui.VispaWidget.VispaWidget::setText(), Vispa.Gui.VispaWidget.VispaWidget::setTitle(), Vispa.Gui.ZoomableWidget.ZoomableWidget::setZoom(), Vispa.Views.LineDecayView.LineDecayContainer::setZoom(), and Vispa.Gui.PortConnection.PointToPointConnection::updateConnection().

74  {
75 
76  if(debug) cout << "[DTSegmentUpdator] Starting to update the DTRecSegment4D" << endl;
77 
78  const bool hasPhi = seg->hasPhi();
79  const bool hasZed = seg->hasZed();
80 
81  //reject the bad hits (due to delta rays)
82  if(perform_delta_rejecting && hasPhi) rejectBadHits(seg->phiSegment());
83 
84  int step = (hasPhi && hasZed) ? 3 : 2;
85  if(calcT0) step = 4;
86 
87  if(debug) cout << "Step of update is " << step << endl;
88 
89  GlobalPoint pos = theGeom->idToDet(seg->geographicalId())->toGlobal(seg->localPosition());
90  GlobalVector dir = theGeom->idToDet(seg->geographicalId())->toGlobal(seg->localDirection());
91 
92  if(calcT0) calculateT0corr(seg);
93 
94  if(hasPhi) updateHits(seg->phiSegment(),pos,dir,step);
95  if(hasZed) updateHits(seg->zSegment() ,pos,dir,step);
96 
97  fit(seg,allow3par);
98 }
void rejectBadHits(DTChamberRecSegment2D *) const
void updateHits(DTRecSegment2D *seg, GlobalPoint &gpos, GlobalVector &gdir, const int step=2) const
void calculateT0corr(DTRecSegment2D *seg) const
const DTChamberRecSegment2D * phiSegment() const
The superPhi segment: 0 if no phi projection available.
edm::ESHandle< DTGeometry > theGeom
virtual LocalVector localDirection() const
Local direction in Chamber frame.
bool hasPhi() const
Does it have the Phi projection?
virtual LocalPoint localPosition() const
Local position in Chamber frame.
bool hasZed() const
Does it have the Z projection?
const DTSLRecSegment2D * zSegment() const
The Z segment: 0 if not zed projection available.
tuple cout
Definition: gather_cfg.py:121
DetId geographicalId() const
dbl *** dir
Definition: mlp_gen.cc:35
bool fit(DTSegmentCand *seg, bool allow3par, const bool fitdebug) const
void DTSegmentUpdator::update ( DTRecSegment2D seg,
bool  allow3par 
) const

recompute hits position and refit the segment2D

Definition at line 100 of file DTSegmentUpdator.cc.

References gather_cfg::cout, debug, dir, fit(), TrackingRecHit::geographicalId(), DTRecSegment2D::localDirection(), DTRecSegment2D::localPosition(), theGeom, and updateHits().

Referenced by progressbar.ProgressBar::__next__(), relval_steps.Matrix::__setitem__(), relval_steps.Steps::__setitem__(), Vispa.Gui.VispaWidget.VispaWidget::autosize(), Vispa.Views.LineDecayView.LineDecayContainer::createObject(), Vispa.Views.LineDecayView.LineDecayContainer::deselectAllObjects(), Vispa.Gui.VispaWidgetOwner.VispaWidgetOwner::deselectAllWidgets(), Vispa.Gui.VispaWidget.VispaWidget::enableAutosizing(), progressbar.ProgressBar::finish(), Vispa.Gui.MenuWidget.MenuWidget::leaveEvent(), Vispa.Gui.VispaWidgetOwner.VispaWidgetOwner::mouseMoveEvent(), Vispa.Gui.MenuWidget.MenuWidget::mouseMoveEvent(), Vispa.Views.LineDecayView.LineDecayContainer::mouseMoveEvent(), Vispa.Gui.VispaWidgetOwner.VispaWidgetOwner::mouseReleaseEvent(), Vispa.Views.LineDecayView.LineDecayContainer::objectMoved(), relval_steps.Steps::overwrite(), Vispa.Views.LineDecayView.LineDecayContainer::removeObject(), Vispa.Gui.ConnectableWidget.ConnectableWidget::removePorts(), Vispa.Gui.FindDialog.FindDialog::reset(), Vispa.Gui.PortConnection.PointToPointConnection::select(), Vispa.Gui.VispaWidget.VispaWidget::select(), Vispa.Views.LineDecayView.LineDecayContainer::select(), Vispa.Gui.VispaWidget.VispaWidget::setText(), Vispa.Gui.VispaWidget.VispaWidget::setTitle(), Vispa.Gui.ZoomableWidget.ZoomableWidget::setZoom(), Vispa.Views.LineDecayView.LineDecayContainer::setZoom(), and Vispa.Gui.PortConnection.PointToPointConnection::updateConnection().

100  {
101  if(debug) cout << "[DTSegmentUpdator] Starting to update the DTRecSegment2D" << endl;
102  GlobalPoint pos = (theGeom->idToDet(seg->geographicalId()))->toGlobal(seg->localPosition());
103  GlobalVector dir = (theGeom->idToDet(seg->geographicalId()))->toGlobal(seg->localDirection());
104 
105  updateHits(seg,pos,dir);
106  fit(seg,allow3par,0);
107 }
void updateHits(DTRecSegment2D *seg, GlobalPoint &gpos, GlobalVector &gdir, const int step=2) const
edm::ESHandle< DTGeometry > theGeom
virtual LocalPoint localPosition() const
local position in SL frame
virtual LocalVector localDirection() const
the local direction in SL frame
tuple cout
Definition: gather_cfg.py:121
DetId geographicalId() const
dbl *** dir
Definition: mlp_gen.cc:35
bool fit(DTSegmentCand *seg, bool allow3par, const bool fitdebug) const
void DTSegmentUpdator::updateHits ( DTRecSegment2D seg,
GlobalPoint gpos,
GlobalVector gdir,
const int  step = 2 
) const
private

Definition at line 409 of file DTSegmentUpdator.cc.

References angle(), DTRecHitBaseAlgo::compute(), funct::cos(), relativeConstraints::error, edm::hlt::Exception, DTRecSegment2D::ist0Valid(), DTEnums::Left, convertSQLiteXML::ok, point, DTRecSegment2D::specificRecHits(), DTLayer::specificTopology(), DTRecSegment2D::t0(), T0_hit_resolution, theAlgo, theGeom, PV3DBase< T, PVType, FrameType >::theta(), GeomDet::toLocal(), DTRecSegment2D::update(), DTRecSegment2D::vDrift(), vdrift_4parfit, DTTopology::wirePosition(), PV3DBase< T, PVType, FrameType >::x(), hit::x, and PV3DBase< T, PVType, FrameType >::z().

Referenced by update().

410  {
411 
412  // it is not necessary to have DTRecHit1D* to modify the obj in the container
413  // but I have to be carefully, since I cannot make a copy before the iteration!
414 
415  vector<DTRecHit1D> toBeUpdatedRecHits = seg->specificRecHits();
416  vector<DTRecHit1D> updatedRecHits;
417 
418  for (vector<DTRecHit1D>::iterator hit= toBeUpdatedRecHits.begin();
419  hit!=toBeUpdatedRecHits.end(); ++hit) {
420 
421  const DTLayer* layer = theGeom->layer( hit->wireId().layerId() );
422 
423  LocalPoint segPos=layer->toLocal(gpos);
424  LocalVector segDir=layer->toLocal(gdir);
425 
426  // define impact angle needed by the step 2
427  const float angle = atan(segDir.x()/-segDir.z());
428 
429  // define the local position (extr.) of the segment. Needed by the third step
430  LocalPoint segPosAtLayer=segPos+segDir*(-segPos.z())/cos(segDir.theta());
431 
432  DTRecHit1D newHit1D = (*hit);
433  bool ok = true;
434 
435  if (step == 2) {
436  ok = theAlgo->compute(layer,*hit,angle,newHit1D);
437 
438  } else if (step == 3) {
439 
440  LocalPoint hitPos(hit->localPosition().x(),+segPosAtLayer.y(),0.);
441  GlobalPoint glbpos= theGeom->layer( hit->wireId().layerId() )->toGlobal(hitPos);
442  newHit1D.setPosition(hitPos);
443  ok = theAlgo->compute(layer,*hit,angle,glbpos,newHit1D);
444 
445  } else if (step == 4) {
446 
447  //const double vminf = seg->vDrift(); // vdrift correction are recorded in the segment
448  double vminf =0.;
449  if(vdrift_4parfit) vminf = seg->vDrift(); // use vdrift recorded in the segment only if vdrift_4parfit=True
450 
451  double cminf = 0.;
452  if(seg->ist0Valid()) cminf = - seg->t0()*0.00543;
453 
454  //cout << "In updateHits: t0 = " << seg->t0() << endl;
455  //cout << "In updateHits: vminf = " << vminf << endl;
456  //cout << "In updateHits: cminf = " << cminf << endl;
457 
458  const float xwire = layer->specificTopology().wirePosition(hit->wireId().wire());
459  const float distance = fabs(hit->localPosition().x() - xwire);
460  const int ilc = ( hit->lrSide() == DTEnums::Left ) ? 1 : -1;
461  const double dy_corr = (vminf*ilc*distance-cminf*ilc );
462 
463  LocalPoint point(hit->localPosition().x() + dy_corr, +segPosAtLayer.y(), 0.);
464 
465  //double final_hit_resol = T0_hit_resolution;
466  //if(newHit1D.wireId().layerId().superlayerId().superLayer() != 2) final_hit_resol = final_hit_resol * 0.8;
467  //LocalError error(final_hit_resol * final_hit_resol,0.,0.);
469  newHit1D.setPositionAndError(point, error);
470 
471  //FIXME: check that the hit is still inside the cell
472  ok = true;
473 
474  } else throw cms::Exception("DTSegmentUpdator")<<" updateHits called with wrong step " << endl;
475 
476  if (ok) updatedRecHits.push_back(newHit1D);
477  else {
478  LogError("DTSegmentUpdator")<<"DTSegmentUpdator::updateHits failed update" << endl;
479  throw cms::Exception("DTSegmentUpdator")<<"updateHits failed update"<<endl;
480  }
481 
482  }
483  seg->update(updatedRecHits);
484 }
float wirePosition(int wireNumber) const
Returns the x position in the layer of a given wire number.
Definition: DTTopology.cc:86
LocalPoint toLocal(const GlobalPoint &gp) const
Conversion to the R.F. of the GeomDet.
Definition: GeomDet.h:62
void update(std::vector< DTRecHit1D > &updatedRecHits)
edm::ESHandle< DTGeometry > theGeom
Geom::Theta< T > theta() const
Definition: PV3DBase.h:75
const DTTopology & specificTopology() const
Definition: DTLayer.cc:42
double vDrift() const
T z() const
Definition: PV3DBase.h:64
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
virtual bool compute(const DTLayer *layer, const DTDigi &digi, LocalPoint &leftPoint, LocalPoint &rightPoint, LocalError &error) const =0
std::vector< DTRecHit1D > specificRecHits() const
Access to specific components.
bool ist0Valid() const
double t0() const
Get the segment t0 (if recomputed, 0 is returned otherwise)
T x() const
Definition: PV3DBase.h:62
DTRecHitBaseAlgo * theAlgo
*vegas h *****************************************************used in the default bin number in original ***version of VEGAS is ***a higher bin number might help to derive a more precise ***grade subtle point
Definition: invegas.h:5
T angle(T x1, T y1, T z1, T x2, T y2, T z2)
Definition: angle.h:11

Member Data Documentation

bool DTSegmentUpdator::debug
private

Definition at line 112 of file DTSegmentUpdator.h.

Referenced by calculateT0corr(), DTSegmentUpdator(), fit(), rejectBadHits(), and update().

bool DTSegmentUpdator::perform_delta_rejecting
private

Definition at line 111 of file DTSegmentUpdator.h.

Referenced by update().

double DTSegmentUpdator::T0_hit_resolution
private

Definition at line 110 of file DTSegmentUpdator.h.

Referenced by updateHits().

DTRecHitBaseAlgo* DTSegmentUpdator::theAlgo
private

Definition at line 83 of file DTSegmentUpdator.h.

Referenced by DTSegmentUpdator(), setES(), and updateHits().

DTLinearFit* DTSegmentUpdator::theFitter
private

Definition at line 82 of file DTSegmentUpdator.h.

Referenced by calculateT0corr(), fit(), and ~DTSegmentUpdator().

edm::ESHandle<DTGeometry> DTSegmentUpdator::theGeom
private

Definition at line 84 of file DTSegmentUpdator.h.

Referenced by calculateT0corr(), fit(), rejectBadHits(), setES(), update(), and updateHits().

bool DTSegmentUpdator::vdrift_4parfit
private

Definition at line 109 of file DTSegmentUpdator.h.

Referenced by calculateT0corr(), and updateHits().