CMS 3D CMS Logo

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
 
double intime_cut
 
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, edm::ParameterSet::exists(), reco::get(), edm::ParameterSet::getParameter(), intime_cut, 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  intime_cut=20.;
58  if (config.exists("intime_cut"))
59  intime_cut = config.getParameter<double>("intime_cut");
60 
61  if(debug)
62  cout << "[DTSegmentUpdator] Constructor called" << endl;
63 }
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
bool exists(std::string const &parameterName) const
checks if a parameter exists
DTLinearFit * theFitter
DTRecHitBaseAlgo * theAlgo
T get(const Candidate &c)
Definition: component.h:55
DTSegmentUpdator::~DTSegmentUpdator ( )

Destructor.

Definition at line 66 of file DTSegmentUpdator.cc.

References theFitter.

66  {
67  delete theFitter;
68 }
DTLinearFit * theFitter

Member Function Documentation

void DTSegmentUpdator::calculateT0corr ( DTRecSegment2D seg) const

Definition at line 625 of file DTSegmentUpdator.cc.

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

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

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

Definition at line 620 of file DTSegmentUpdator.cc.

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

620  {
621  if(seg->hasPhi()) calculateT0corr(seg->phiSegment());
622  if(seg->hasZed()) calculateT0corr(seg->zSegment());
623 }
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 vertices_cff::chi2, gather_cfg::cout, debug, dir, SoftLeptonByDistance_cfi::distance, DTSegmentCand::hits(), mps_fire::i, DTEnums::Left, DTEnums::Right, DTSegmentCand::setChi2(), DTSegmentCand::setCovMatrix(), DTSegmentCand::setDirection(), DTSegmentCand::setPosition(), DTSegmentCand::sett0(), mathSSE::sqrt(), x, PV3DBase< T, PVType, FrameType >::x(), y, and PV3DBase< T, PVType, FrameType >::z().

Referenced by DTCombinatorialPatternReco::buildPointsCollection(), DTCombinatorialExtendedPatternReco::buildPointsCollection(), DTCombinatorialExtendedPatternReco::extendCandidates(), fit(), DTMeantimerPatternReco::fitWithT0(), trackingPlots.Iteration::modules(), 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  for (DTSegmentCand::AssPointCont::const_iterator iter=seg->hits().begin(); iter!=seg->hits().end(); ++iter) {
238  LocalPoint pos = (*iter).first->localPosition((*iter).second);
239  float xwire = (((*iter).first)->localPosition(DTEnums::Left).x() + ((*iter).first)->localPosition(DTEnums::Right).x()) /2.;
240  float distance = pos.x() - xwire;
241 
242  if ((*iter).second==DTEnums::Left) lfit.push_back(1);
243  else lfit.push_back(-1);
244 
245  dist.push_back(distance);
246  sigy.push_back(sqrt((*iter).first->localPositionError().xx()));
247  x.push_back(pos.z());
248  y.push_back(pos.x());
249  i++;
250  }
251 
252  LocalPoint pos;
254  AlgebraicSymMatrix covMat(2);
255  float cminf =0.;
256  float vminf =0.;
257  double chi2 = 0.;
258  double t0_corr = 0.;
259 
260  fit(x,y,lfit,dist,sigy,pos,dir,cminf,vminf,covMat,chi2,allow3par);
261  if (cminf!=0) t0_corr=-cminf/0.00543; // convert drift distance to time
262 
263  if (debug && fitdebug)
264  cout << " DTcand chi2: " << chi2 << "/" << x.size() << " t0: " << t0_corr << endl;
265 
266  seg->setPosition(pos);
267  seg->setDirection(dir);
268  seg->sett0(t0_corr);
269  seg->setCovMatrix(covMat);
270  seg->setChi2(chi2);
271 
272  // cout << "pos " << pos << endl;
273  // cout << "dir " << dir << endl;
274  // cout << "Mat " << covMat << endl;
275 
276  return true;
277 }
virtual const AssPointCont & hits() const
the used hits
virtual void setChi2(double &chi2)
set chi2
T sqrt(T t)
Definition: SSEVec.h:18
T z() const
Definition: PV3DBase.h:64
virtual void setCovMatrix(AlgebraicSymMatrix &cov)
set the cov matrix
virtual void sett0(double &t0)
set t0
virtual void setDirection(LocalVector &dir)
set direction
Definition: DTSegmentCand.h:96
CLHEP::HepSymMatrix AlgebraicSymMatrix
dbl *** dir
Definition: mlp_gen.cc:35
virtual void setPosition(LocalPoint &pos)
set position
Definition: DTSegmentCand.h:93
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 279 of file DTSegmentUpdator.cc.

References vertices_cff::chi2, gather_cfg::cout, debug, dir, SoftLeptonByDistance_cfi::distance, fit(), TrackingRecHit::geographicalId(), hfClusterShapes_cfi::hits, DTGeometry::idToDet(), DTGeometry::layer(), 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(), y, and PV3DBase< T, PVType, FrameType >::z().

Referenced by trackingPlots.Iteration::modules().

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

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

Referenced by trackingPlots.Iteration::modules().

112  {
113  if(debug) cout << "[DTSegmentUpdator] Fit DTRecSegment4D:" << endl;
114  // after the update must refit the segments
115 
116  if (debug) {
117  if(seg->hasPhi()) cout << " 4D Segment contains a Phi segment. t0= " << seg->phiSegment()->t0() << " chi2= " << seg->phiSegment()->chi2() << endl;
118  if(seg->hasZed()) cout << " 4D Segment contains a Zed segment. t0= " << seg->zSegment()->t0() << " chi2= " << seg->zSegment()->chi2() << endl;
119  }
120 
121 
122  // If both phi and zed projections are present and the phi segment is in time (segment t0<intime_cut) the 3-par fit is blocked and
123  // segments are fit with the 2-par fit. Setting intime_cut to -1 results in the 3-par fit being used always.
124  if(seg->hasPhi()) {
125  if(seg->hasZed()) {
126  if (fabs(seg->phiSegment()->t0())<intime_cut) {
127  fit(seg->phiSegment(),allow3par,true);
128  fit(seg->zSegment(),allow3par,true);
129  } else {
130  fit(seg->phiSegment(),allow3par,false);
131  fit(seg->zSegment(),allow3par,false);
132  }
133  } else fit(seg->phiSegment(),allow3par,false);
134  } else fit(seg->zSegment(),allow3par,false);
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
Point3DBase< Scalar, LocalTag > LocalPoint
Definition: Definitions.h:32
const DTChamber * chamber(const DTChamberId &id) const
Return a DTChamber given its id.
Definition: DTGeometry.cc:99
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:54
T y() const
Definition: PV3DBase.h:63
LocalPoint toLocal(const GlobalPoint &gp) const
Conversion to the R.F. of the GeomDet.
Definition: GeomDet.h:69
AlgebraicSymMatrix parametersError() const override
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.
double chi2() const override
the chi2 of the fit
bool hasPhi() const
Does it have the Phi projection?
DTSuperLayerId superLayerId() const
The id of the superlayer on which reside the segment.
bool hasZed() const
Does it have the Z projection?
const DTSLRecSegment2D * zSegment() const
The Z segment: 0 if not zed projection available.
LocalPoint localPosition() const override
local position in SL frame
LocalVector localDirection() const override
the local direction in SL frame
CLHEP::HepSymMatrix AlgebraicSymMatrix
void setPosition(LocalPoint pos)
Set position.
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
const DTSuperLayer * superLayer(const DTSuperLayerId &id) const
Return a DTSuperLayer given its id.
Definition: DTGeometry.cc:104
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 348 of file DTSegmentUpdator.cc.

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

Referenced by trackingPlots.Iteration::modules().

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

Definition at line 485 of file DTSegmentUpdator.cc.

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

Referenced by update().

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

set the setup

Definition at line 72 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().

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

recompute hits position and refit the segment4D

Definition at line 77 of file DTSegmentUpdator.cc.

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

Referenced by progressbar.ProgressBar::__next__(), MatrixUtil.Matrix::__setitem__(), MatrixUtil.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(), MatrixUtil.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().

77  {
78 
79  if(debug) cout << "[DTSegmentUpdator] Starting to update the DTRecSegment4D" << endl;
80 
81  const bool hasPhi = seg->hasPhi();
82  const bool hasZed = seg->hasZed();
83 
84  //reject the bad hits (due to delta rays)
85  if(perform_delta_rejecting && hasPhi) rejectBadHits(seg->phiSegment());
86 
87  int step = (hasPhi && hasZed) ? 3 : 2;
88  if(calcT0) step = 4;
89 
90  if(debug) cout << "Step of update is " << step << endl;
91 
92  GlobalPoint pos = theGeom->idToDet(seg->geographicalId())->toGlobal(seg->localPosition());
93  GlobalVector dir = theGeom->idToDet(seg->geographicalId())->toGlobal(seg->localDirection());
94 
95  if(calcT0) calculateT0corr(seg);
96 
97  if(hasPhi) updateHits(seg->phiSegment(),pos,dir,step);
98  if(hasZed) updateHits(seg->zSegment() ,pos,dir,step);
99 
100  fit(seg,allow3par);
101 }
void rejectBadHits(DTChamberRecSegment2D *) const
LocalPoint localPosition() const override
Local position in Chamber frame.
void updateHits(DTRecSegment2D *seg, GlobalPoint &gpos, GlobalVector &gdir, const int step=2) const
void calculateT0corr(DTRecSegment2D *seg) const
LocalVector localDirection() const override
Local direction in Chamber frame.
const DTChamberRecSegment2D * phiSegment() const
The superPhi segment: 0 if no phi projection available.
edm::ESHandle< DTGeometry > theGeom
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.
const GeomDet * idToDet(DetId) const override
Definition: DTGeometry.cc:75
step
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 103 of file DTSegmentUpdator.cc.

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

Referenced by progressbar.ProgressBar::__next__(), MatrixUtil.Matrix::__setitem__(), MatrixUtil.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(), MatrixUtil.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().

103  {
104  if(debug) cout << "[DTSegmentUpdator] Starting to update the DTRecSegment2D" << endl;
105  GlobalPoint pos = (theGeom->idToDet(seg->geographicalId()))->toGlobal(seg->localPosition());
106  GlobalVector dir = (theGeom->idToDet(seg->geographicalId()))->toGlobal(seg->localDirection());
107 
108  updateHits(seg,pos,dir);
109  fit(seg,allow3par,false);
110 }
void updateHits(DTRecSegment2D *seg, GlobalPoint &gpos, GlobalVector &gdir, const int step=2) const
edm::ESHandle< DTGeometry > theGeom
LocalPoint localPosition() const override
local position in SL frame
LocalVector localDirection() const override
the local direction in SL frame
const GeomDet * idToDet(DetId) const override
Definition: DTGeometry.cc:75
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 408 of file DTSegmentUpdator.cc.

References angle(), DTRecHitBaseAlgo::compute(), funct::cos(), SoftLeptonByDistance_cfi::distance, relativeConstraints::error, Exception, DTRecSegment2D::ist0Valid(), DTGeometry::layer(), 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().

409  {
410 
411  // it is not necessary to have DTRecHit1D* to modify the obj in the container
412  // but I have to be carefully, since I cannot make a copy before the iteration!
413 
414  vector<DTRecHit1D> toBeUpdatedRecHits = seg->specificRecHits();
415  vector<DTRecHit1D> updatedRecHits;
416 
417  for (vector<DTRecHit1D>::iterator hit= toBeUpdatedRecHits.begin();
418  hit!=toBeUpdatedRecHits.end(); ++hit) {
419 
420  const DTLayer* layer = theGeom->layer( hit->wireId().layerId() );
421 
422  LocalPoint segPos=layer->toLocal(gpos);
423  LocalVector segDir=layer->toLocal(gdir);
424 
425  // define impact angle needed by the step 2
426  const float angle = atan(segDir.x()/-segDir.z());
427 
428  // define the local position (extr.) of the segment. Needed by the third step
429  LocalPoint segPosAtLayer=segPos+segDir*(-segPos.z())/cos(segDir.theta());
430 
431  DTRecHit1D newHit1D = (*hit);
432  bool ok = true;
433 
434  if (step == 2) {
435  ok = theAlgo->compute(layer,*hit,angle,newHit1D);
436 
437  } else if (step == 3) {
438 
439  LocalPoint hitPos(hit->localPosition().x(),+segPosAtLayer.y(),0.);
440  GlobalPoint glbpos= theGeom->layer( hit->wireId().layerId() )->toGlobal(hitPos);
441  newHit1D.setPosition(hitPos);
442  ok = theAlgo->compute(layer,*hit,angle,glbpos,newHit1D);
443 
444  } else if (step == 4) {
445 
446  //const double vminf = seg->vDrift(); // vdrift correction are recorded in the segment
447  double vminf =0.;
448  if(vdrift_4parfit) vminf = seg->vDrift(); // use vdrift recorded in the segment only if vdrift_4parfit=True
449 
450  double cminf = 0.;
451  if(seg->ist0Valid()) cminf = - seg->t0()*0.00543;
452 
453  //cout << "In updateHits: t0 = " << seg->t0() << endl;
454  //cout << "In updateHits: vminf = " << vminf << endl;
455  //cout << "In updateHits: cminf = " << cminf << endl;
456 
457  const float xwire = layer->specificTopology().wirePosition(hit->wireId().wire());
458  const float distance = fabs(hit->localPosition().x() - xwire);
459  const int ilc = ( hit->lrSide() == DTEnums::Left ) ? 1 : -1;
460  const double dy_corr = (vminf*ilc*distance-cminf*ilc );
461 
462  LocalPoint point(hit->localPosition().x() + dy_corr, +segPosAtLayer.y(), 0.);
463 
464  //double final_hit_resol = T0_hit_resolution;
465  //if(newHit1D.wireId().layerId().superlayerId().superLayer() != 2) final_hit_resol = final_hit_resol * 0.8;
466  //LocalError error(final_hit_resol * final_hit_resol,0.,0.);
468  newHit1D.setPositionAndError(point, error);
469 
470  //FIXME: check that the hit is still inside the cell
471  ok = true;
472 
473  } else throw cms::Exception("DTSegmentUpdator")<<" updateHits called with wrong step " << endl;
474 
475  if (ok) updatedRecHits.push_back(newHit1D);
476  else {
477  LogError("DTSegmentUpdator")<<"DTSegmentUpdator::updateHits failed update" << endl;
478  throw cms::Exception("DTSegmentUpdator")<<"updateHits failed update"<<endl;
479  }
480 
481  }
482  seg->update(updatedRecHits);
483 }
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:69
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
std::vector< DTRecHit1D > specificRecHits() const
Access to specific components.
bool ist0Valid() const
virtual bool compute(const DTLayer *layer, const DTDigi &digi, LocalPoint &leftPoint, LocalPoint &rightPoint, LocalError &error) const =0
step
const DTLayer * layer(const DTLayerId &id) const
Return a layer given its id.
Definition: DTGeometry.cc:109
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 113 of file DTSegmentUpdator.h.

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

double DTSegmentUpdator::intime_cut
private

Definition at line 109 of file DTSegmentUpdator.h.

Referenced by DTSegmentUpdator(), and fit().

bool DTSegmentUpdator::perform_delta_rejecting
private

Definition at line 112 of file DTSegmentUpdator.h.

Referenced by update().

double DTSegmentUpdator::T0_hit_resolution
private

Definition at line 111 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 110 of file DTSegmentUpdator.h.

Referenced by calculateT0corr(), and updateHits().