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) const
 
void fit (DTRecSegment2D *seg) const
 
void fit (DTRecSegment4D *seg) const
 
void setES (const edm::EventSetup &setup)
 set the setup More...
 
void update (DTRecSegment4D *seg, const bool calcT0=false) const
 recompute hits position and refit the segment4D More...
 
void update (DTRecSegment2D *seg) 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< float > &sigy, LocalPoint &pos, LocalVector &dir, AlgebraicSymMatrix &covMat, double &chi2) const
 interface to LinearFit More...
 
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 &cminf, double &vminf, double &chi2fit) const
 
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.

Date:
2011/09/21 15:29:59
Revision:
1.19
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 42 of file DTSegmentUpdator.h.

Constructor & Destructor Documentation

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

Constructor.

Definition at line 49 of file DTSegmentUpdator.cc.

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

49  :
50  theFitter(new DTLinearFit()) ,
51  vdrift_4parfit(config.getParameter<bool>("performT0_vdriftSegCorrection")),
52  T0_hit_resolution(config.getParameter<double>("hit_afterT0_resolution")),
53  perform_delta_rejecting(config.getParameter<bool>("perform_delta_rejecting")),
54  debug(config.getUntrackedParameter<bool>("debug",false))
55 {
56  string theAlgoName = config.getParameter<string>("recAlgo");
57  theAlgo = DTRecHitAlgoFactory::get()->create(theAlgoName,
58  config.getParameter<ParameterSet>("recAlgoConfig"));
59 
60  if(debug)
61  cout << "[DTSegmentUpdator] Constructor called" << endl;
62 }
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:56
DTSegmentUpdator::~DTSegmentUpdator ( )

Destructor.

Definition at line 65 of file DTSegmentUpdator.cc.

References theFitter.

65  {
66  delete theFitter;
67 }
DTLinearFit * theFitter

Member Function Documentation

void DTSegmentUpdator::calculateT0corr ( DTRecSegment2D seg) const

Definition at line 536 of file DTSegmentUpdator.cc.

References Fit4Var(), TrackingRecHit::geographicalId(), DTEnums::Left, pos, DTRecSegment2D::setT0(), DTRecSegment2D::setVdrift(), DTRecSegment2D::specificRecHits(), DTLayer::specificTopology(), theGeom, DTTopology::wirePosition(), PV3DBase< T, PVType, FrameType >::x(), hit::x, vdt::x, detailsBasic3DVector::y, and PV3DBase< T, PVType, FrameType >::z().

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

536  {
537  // WARNING: since this method is called both with a 2D and a 2DPhi as argument
538  // seg->geographicalId() can be a superLayerId or a chamberId
539 
540  vector<double> d_drift;
541  vector<float> x;
542  vector<float> y;
543  vector<int> lc;
544 
545  vector<DTRecHit1D> hits=seg->specificRecHits();
546 
547  DTWireId wireId;
548  int nptfit = 0;
549 
550  for (vector<DTRecHit1D>::const_iterator hit=hits.begin();
551  hit!=hits.end(); ++hit) {
552 
553  // I have to get the hits position (the hit is in the layer rf) in SL frame...
554  GlobalPoint glbPos = ( theGeom->layer( hit->wireId().layerId() ) )->toGlobal(hit->localPosition());
555  LocalPoint pos = ( theGeom->idToDet(seg->geographicalId()) )->toLocal(glbPos);
556 
557  const DTLayer* layer = theGeom->layer( hit->wireId().layerId() );
558  float xwire = layer->specificTopology().wirePosition(hit->wireId().wire());
559  float distance = fabs(hit->localPosition().x() - xwire);
560 
561  int ilc = ( hit->lrSide() == DTEnums::Left ) ? 1 : -1;
562 
563  nptfit++;
564  x.push_back(pos.z());
565  y.push_back(pos.x());
566  lc.push_back(ilc);
567  d_drift.push_back(distance);
568 
569  // cout << " d_drift "<<distance <<" npt= " <<npt<<endl;
570  }
571 
572  double chi2fit = 0.;
573  float cminf = 0.;
574  double vminf = 0.;
575 
576  if ( nptfit > 2 ) {
577  //NB chi2fit is normalized
578  Fit4Var(x,y,lc,d_drift,nptfit,cminf,vminf,chi2fit);
579 
580  double t0cor = -999.;
581  if(cminf > -998.) t0cor = - cminf/0.00543 ; // in ns
582 
583  //cout << "In calculateT0corr: t0 = " << t0cor << endl;
584  //cout << "In calculateT0corr: vminf = " << vminf << endl;
585  //cout << "In calculateT0corr: cminf = " << cminf << endl;
586  //cout << "In calculateT0corr: chi2 = " << chi2fit << endl;
587 
588  seg->setT0(t0cor); // time and
589  seg->setVdrift(vminf); // vdrift correction are recorded in the segment
590  }
591 }
float wirePosition(int wireNumber) const
Returns the x position in the layer of a given wire number.
Definition: DTTopology.cc:88
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 &cminf, double &vminf, double &chi2fit) const
edm::ESHandle< DTGeometry > theGeom
const DTTopology & specificTopology() const
Definition: DTLayer.cc:44
T z() const
Definition: PV3DBase.h:63
std::vector< DTRecHit1D > specificRecHits() const
Access to specific components.
void setT0(const double &t0)
void setVdrift(const double &vdrift)
DetId geographicalId() const
x
Definition: VDTMath.h:216
T x() const
Definition: PV3DBase.h:61
void DTSegmentUpdator::calculateT0corr ( DTRecSegment4D seg) const

Definition at line 531 of file DTSegmentUpdator.cc.

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

531  {
532  if(seg->hasPhi()) calculateT0corr(seg->phiSegment());
533  if(seg->hasZed()) calculateT0corr(seg->zSegment());
534 }
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) 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 193 of file DTSegmentUpdator.cc.

References dir, DTSegmentCand::good(), DTSegmentCand::hits(), pos, DTSegmentCand::setChi2(), DTSegmentCand::setCovMatrix(), DTSegmentCand::setDirection(), DTSegmentCand::setPosition(), mathSSE::sqrt(), PV3DBase< T, PVType, FrameType >::x(), vdt::x, detailsBasic3DVector::y, and PV3DBase< T, PVType, FrameType >::z().

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

193  {
194  if (!seg->good()) return false;
195 
196  vector<float> x;
197  vector<float> y;
198  vector<float> sigy;
199 
200  DTSegmentCand::AssPointCont hits=seg->hits();
201  for (DTSegmentCand::AssPointCont::const_iterator iter=hits.begin();
202  iter!=hits.end(); ++iter) {
203  LocalPoint pos = (*iter).first->localPosition((*iter).second);
204  x.push_back(pos.z());
205  y.push_back(pos.x());
206  sigy.push_back(sqrt((*iter).first->localPositionError().xx()));
207  }
208 
209  LocalPoint pos;
211  AlgebraicSymMatrix covMat(2);
212 
213  double chi2 = 0.;
214  fit(x,y,sigy,pos,dir,covMat,chi2);
215 
216  seg->setPosition(pos);
217  seg->setDirection(dir);
218 
219  //cout << "pos " << segPosition<< endl;
220  //cout << "dir " << segDirection<< endl;
221 
222  seg->setCovMatrix(covMat);
223  // cout << "Mat " << covMat << endl;
224 
225  seg->setChi2(chi2);
226  return true;
227 }
virtual void setChi2(double &chi2)
set chi2
virtual bool good() const
T sqrt(T t)
Definition: SSEVec.h:46
T z() const
Definition: PV3DBase.h:63
virtual void setCovMatrix(AlgebraicSymMatrix &cov)
set the cov matrix
bool fit(DTSegmentCand *seg) const
virtual AssPointCont hits() const
the used hits
std::set< AssPoint, AssPointLessZ > AssPointCont
Definition: DTSegmentCand.h:41
virtual void setDirection(LocalVector &dir)
set direction
Definition: DTSegmentCand.h:94
CLHEP::HepSymMatrix AlgebraicSymMatrix
dbl *** dir
Definition: mlp_gen.cc:35
virtual void setPosition(LocalPoint &pos)
set position
Definition: DTSegmentCand.h:91
x
Definition: VDTMath.h:216
T x() const
Definition: PV3DBase.h:61
void DTSegmentUpdator::fit ( DTRecSegment2D seg) 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 229 of file DTSegmentUpdator.cc.

References dir, fit(), TrackingRecHit::geographicalId(), pos, DTRecSegment2D::setChi2(), DTRecSegment2D::setCovMatrix(), DTRecSegment2D::setDirection(), DTRecSegment2D::setPosition(), DTRecSegment2D::specificRecHits(), mathSSE::sqrt(), theGeom, ErrorFrameTransformer::transform(), PV3DBase< T, PVType, FrameType >::x(), vdt::x, LocalError::xx(), detailsBasic3DVector::y, and PV3DBase< T, PVType, FrameType >::z().

229  {
230  // WARNING: since this method is called both with a 2D and a 2DPhi as argument
231  // seg->geographicalId() can be a superLayerId or a chamberId
232 
233  vector<float> x;
234  vector<float> y;
235  vector<float> sigy;
236 
237  vector<DTRecHit1D> hits=seg->specificRecHits();
238  for (vector<DTRecHit1D>::const_iterator hit=hits.begin();
239  hit!=hits.end(); ++hit) {
240 
241  // I have to get the hits position (the hit is in the layer rf) in SL frame...
242  GlobalPoint glbPos = ( theGeom->layer( hit->wireId().layerId() ) )->toGlobal(hit->localPosition());
243  LocalPoint pos = ( theGeom->idToDet(seg->geographicalId()) )->toLocal(glbPos);
244 
245  x.push_back(pos.z());
246  y.push_back(pos.x());
247 
248  // Get local error in SL frame
249  //RB: is it right in this way?
251  GlobalError glbErr =
252  tran.transform( hit->localPositionError(),(theGeom->layer( hit->wireId().layerId() ))->surface());
253  LocalError slErr =
254  tran.transform( glbErr, (theGeom->idToDet(seg->geographicalId()))->surface());
255 
256  sigy.push_back(sqrt(slErr.xx()));
257  }
258 
259  LocalPoint pos;
261  AlgebraicSymMatrix covMat(2);
262  double chi2 = 0.;
263 
264  fit(x,y,sigy,pos,dir,covMat,chi2);
265 
266  seg->setPosition(pos);
267  seg->setDirection(dir);
268 
269  //cout << "pos " << segPosition << endl;
270  //cout << "dir " << segDirection << endl;
271 
272  seg->setCovMatrix(covMat);
273  // cout << "Mat " << mat << endl;
274 
275  seg->setChi2(chi2);
276 }
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
T sqrt(T t)
Definition: SSEVec.h:46
T z() const
Definition: PV3DBase.h:63
bool fit(DTSegmentCand *seg) const
std::vector< DTRecHit1D > specificRecHits() const
Access to specific components.
void setPosition(const LocalPoint &pos)
CLHEP::HepSymMatrix AlgebraicSymMatrix
void setDirection(const LocalVector &dir)
DetId geographicalId() const
dbl *** dir
Definition: mlp_gen.cc:35
x
Definition: VDTMath.h:216
T x() const
Definition: PV3DBase.h:61
void DTSegmentUpdator::fit ( DTRecSegment4D seg) 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 108 of file DTSegmentUpdator.cc.

References DTSuperLayerId::chamberId(), DTRecSegment4D::chamberId(), funct::cos(), dir, fit(), DTRecSegment4D::hasPhi(), DTRecSegment4D::hasZed(), DTRecSegment2D::localDirection(), DTRecSegment2D::localPosition(), DTRecSegment2D::parametersError(), DTRecSegment4D::phiSegment(), DTRecSegment4D::setCovMatrix(), DTRecSegment4D::setCovMatrixForZed(), DTRecSegment4D::setDirection(), DTRecSegment4D::setPosition(), DTChamber::superLayer(), DTSLRecSegment2D::superLayerId(), 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().

108  {
109  // after the update must refit the segments
110  if(seg->hasPhi()) fit(seg->phiSegment());
111  if(seg->hasZed()) fit(seg->zSegment());
112 
113  const DTChamber* theChamber = theGeom->chamber(seg->chamberId());
114 
115  if(seg->hasPhi() && seg->hasZed() ) {
116 
117  DTChamberRecSegment2D *segPhi=seg->phiSegment();
118  DTSLRecSegment2D *segZed=seg->zSegment();
119 
120  // NB Phi seg is already in chamber ref
121  LocalPoint posPhiInCh = segPhi->localPosition();
122  LocalVector dirPhiInCh= segPhi->localDirection();
123 
124  // Zed seg is in SL one
125  const DTSuperLayer* zSL = theChamber->superLayer(segZed->superLayerId());
126  LocalPoint zPos(segZed->localPosition().x(),
127  (zSL->toLocal(theChamber->toGlobal(segPhi->localPosition()))).y(),
128  0.);
129 
130  LocalPoint posZInCh = theChamber->toLocal(zSL->toGlobal(zPos));
131 
132  LocalVector dirZInCh = theChamber->toLocal(zSL->toGlobal(segZed->localDirection()));
133 
134  LocalPoint posZAt0 = posZInCh + dirZInCh*(-posZInCh.z())/cos(dirZInCh.theta());
135 
136  // given the actual definition of chamber refFrame, (with z poiniting to IP),
137  // the zed component of direction is negative.
138  LocalVector dir=LocalVector(dirPhiInCh.x()/fabs(dirPhiInCh.z()),dirZInCh.y()/fabs(dirZInCh.z()),-1.);
139 
140  seg->setPosition(LocalPoint(posPhiInCh.x(),posZAt0.y(),0.));
141  seg->setDirection(dir.unit());
142 
143  AlgebraicSymMatrix mat(4);
144 
145  // set cov matrix
146  mat[0][0] = segPhi->parametersError()[0][0]; //sigma (dx/dz)
147  mat[0][2] = segPhi->parametersError()[0][1]; //cov(dx/dz,x)
148  mat[2][2] = segPhi->parametersError()[1][1]; //sigma (x)
149 
150  seg->setCovMatrix(mat);
151  seg->setCovMatrixForZed(posZInCh);
152 
153  }
154 
155  else if (seg->hasPhi()) {
156  DTChamberRecSegment2D *segPhi=seg->phiSegment();
157 
158  seg->setPosition(segPhi->localPosition());
159  seg->setDirection(segPhi->localDirection());
160 
161  AlgebraicSymMatrix mat(4);
162  // set cov matrix
163  mat[0][0] = segPhi->parametersError()[0][0]; //sigma (dx/dz)
164  mat[0][2] = segPhi->parametersError()[0][1]; //cov(dx/dz,x)
165  mat[2][2] = segPhi->parametersError()[1][1]; //sigma (x)
166 
167  seg->setCovMatrix(mat);
168  }
169 
170  else if (seg->hasZed()) {
171  DTSLRecSegment2D *segZed = seg->zSegment();
172 
173  // Zed seg is in SL one
174  GlobalPoint glbPosZ = ( theGeom->superLayer(segZed->superLayerId()) )->toGlobal(segZed->localPosition());
175  LocalPoint posZInCh = ( theGeom->chamber(segZed->superLayerId().chamberId()) )->toLocal(glbPosZ);
176 
177  GlobalVector glbDirZ = (theGeom->superLayer(segZed->superLayerId()) )->toGlobal(segZed->localDirection());
178  LocalVector dirZInCh = (theGeom->chamber(segZed->superLayerId().chamberId()) )->toLocal(glbDirZ);
179 
180  LocalPoint posZAt0 = posZInCh+
181  dirZInCh*(-posZInCh.z())/cos(dirZInCh.theta());
182 
183  seg->setPosition(posZAt0);
184  seg->setDirection(dirZInCh);
185 
186  AlgebraicSymMatrix mat(4);
187  // set cov matrix
188  seg->setCovMatrix(mat);
189  seg->setCovMatrixForZed(posZInCh);
190  }
191 }
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
T y() const
Definition: PV3DBase.h:62
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
Geom::Theta< T > theta() const
Definition: PV3DBase.h:74
T z() const
Definition: PV3DBase.h:63
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
bool fit(DTSegmentCand *seg) const
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.
dbl *** dir
Definition: mlp_gen.cc:35
T x() const
Definition: PV3DBase.h:61
const DTSuperLayer * superLayer(DTSuperLayerId id) const
Return the superlayer corresponding to the given id.
Definition: DTChamber.cc:67
void setCovMatrix(AlgebraicSymMatrix mat)
Set covariance matrix.
void DTSegmentUpdator::fit ( const std::vector< float > &  x,
const std::vector< float > &  y,
const std::vector< float > &  sigy,
LocalPoint pos,
LocalVector dir,
AlgebraicSymMatrix covMat,
double &  chi2 
) const
private

interface to LinearFit

Definition at line 278 of file DTSegmentUpdator.cc.

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

284  {
285 
286  float slope = 0.;
287  float intercept = 0.;
288  float covss = 0.;
289  float covii = 0.;
290  float covsi = 0.;
291 
292  // do the fit
293  theFitter->fit(x,y,x.size(),sigy,slope,intercept,covss,covii,covsi);
294  // cout << "slope " << slope << endl;
295  // cout << "intercept " << intercept << endl;
296 
297  // intercept is the x() in chamber frame when the segment cross the chamber
298  // plane (at z()=0), the y() is not measured, so let's put the center of the
299  // chamber.
300  pos = LocalPoint(intercept,0.,0.);
301 
302  // slope is dx()/dz(), while dy()/dz() is by definition 0, finally I want the
303  // segment to point outward, so opposite to local z
304  dir = LocalVector(-slope,0.,-1.).unit();
305 
306  covMatrix = AlgebraicSymMatrix(2);
307  covMatrix[0][0] = covss; // this is var(dy/dz)
308  covMatrix[1][1] = covii; // this is var(y)
309  covMatrix[1][0] = covsi; // this is cov(dy/dz,y)
310 
311  /* Calculate chi2. */
312  chi2 = 0.;
313  for(unsigned int i=0; i<x.size() ; ++i) {
314  double resid= y[i] - (intercept + slope*x[i]);
315  chi2 += (resid/sigy[i])*(resid/sigy[i]);
316  }
317 }
int i
Definition: DBlmapReader.cc:9
Local3DVector LocalVector
Definition: LocalVector.h:12
static const double slope[3]
DTLinearFit * theFitter
Vector3DBase unit() const
Definition: Vector3DBase.h:57
void fit(const std::vector< float > &x, const std::vector< float > &y, int ndat, const std::vector< float > &sigy, float &slope, float &intercept, float &covss, float &covii, float &covsi) const
Definition: DTLinearFit.cc:28
CLHEP::HepSymMatrix AlgebraicSymMatrix
Local3DPoint LocalPoint
Definition: LocalPoint.h:11
x
Definition: VDTMath.h:216
void DTSegmentUpdator::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 &  cminf,
double &  vminf,
double &  chi2fit 
) const
private

Definition at line 594 of file DTSegmentUpdator.cc.

References a, b, alignmentValidation::c1, HiggsCouplings::c5, gather_cfg::cout, debug, delta, j, and vdrift_4parfit.

Referenced by calculateT0corr().

601  {
602 
603  const double sigma = 0.0295;// errors can be inserted .just load them/that is the usual TB resolution value for DT chambers
604  double aminf = 0.;
605  double bminf = 0.;
606  int nppar = 0;
607  double sx = 0.;
608  double sx2 = 0.;
609  double sy = 0.;
610  double sxy = 0.;
611  double sl = 0.;
612  double sl2 = 0.;
613  double sly = 0.;
614  double slx = 0.;
615  double st = 0.;
616  double st2 = 0.;
617  double slt = 0.;
618  double sltx = 0.;
619  double slty = 0.;
620  double chi2fitN2 = -1. ;
621  double chi2fit3 = -1.;
622  double chi2fitN3 = -1. ;
623  double chi2fitN4 = -1.;
624  float bminf3 = bminf;
625  float aminf3 = aminf;
626  float cminf3 = cminf;
627  int nppar2 = 0;
628  int nppar3 = 0;
629  int nppar4 = 0;
630 
631  cminf = -999.;
632  vminf = 0.;
633 
634  for (int j=0; j<nptfit; j++){
635  sx = sx + xfit[j];
636  sy = sy + yfit[j];
637  sx2 = sx2 + xfit[j]*xfit[j];
638  sxy = sxy + xfit[j]*yfit[j];
639  sl = sl + lfit[j];
640  sl2 = sl2 + lfit[j]*lfit[j];
641  sly = sly + lfit[j]*yfit[j];
642  slx = slx + lfit[j]*xfit[j];
643  st = st + tfit[j];
644  st2 = st2 + tfit[j] * tfit[j];
645  slt = slt + lfit[j] * tfit[j];
646  sltx = sltx + lfit[j] * tfit[j]*xfit[j];
647  slty = slty + lfit[j] * tfit[j]*yfit[j];
648 
649  } //end loop
650 
651  const double delta = nptfit*sx2 - sx*sx;
652 
653  double a = 0.;
654  double b = 0.;
655 
656  if (delta!=0){ //
657  a = (sx2*sy - sx*sxy)/delta;
658  b = (nptfit*sxy - sx*sy)/delta;
659 
660  // cout << " NPAR=2 : slope = "<<b<< " intercept = "<<a <<endl;
661  for (int j=0; j<nptfit; j++){
662  const double ypred = a + b*xfit[j];
663  const double dy = (yfit[j] - ypred)/sigma;
664  chi2fit = chi2fit + dy*dy;
665  } //end loop chi2
666  }
667 
668  bminf = b;
669  aminf = a;
670 
671  nppar = 2;
672  nppar2 = nppar;
673 
674  chi2fitN2 = chi2fit/(nptfit-2);
675 
676  // cout << "dt0 = 0chi2fit = " << chi2fit << " slope = "<<b<<endl;
677 
678  if (nptfit >= 3) {
679 
680  const double d1 = sy;
681  const double d2 = sxy;
682  const double d3 = sly;
683  const double c1 = sl;
684  const double c2 = slx;
685  const double c3 = sl2;
686  const double b1 = sx;
687  const double b2 = sx2;
688  const double b3 = slx;
689  const double a1 = nptfit;
690  const double a2 = sx;
691  const double a3 = sl;
692 
693  //these parameters are not used in the 4-variables fit
694  const double b4 = b2*a1-b1*a2;
695  const double c4 = c2*a1-c1*a2;
696  const double d4 = d2*a1-d1*a2;
697  const double b5 = a1*b3-a3*b1;
698  const double c5 = a1*c3-a3*c1;
699  const double d5 = a1*d3-d1*a3;
700  const double a6 = slt;
701  const double b6 = sltx;
702  const double c6 = st;
703  const double v6 = st2;
704  const double d6 = slty;
705 
706  if (((c5*b4-c4*b5)*b4*a1)!=0) {
707  nppar = 3;
708  chi2fit = 0.;
709  cminf = (d5*b4-d4*b5)/(c5*b4-c4*b5);
710  bminf = d4/b4 -cminf *c4/b4;
711  aminf = (d1/a1 -cminf*c1/a1 -bminf*b1/a1);
712 
713  for (int j=0; j<nptfit; j++){
714  const double ypred = aminf + bminf*xfit[j];
715  const double dy = (yfit[j]-cminf*lfit[j] - ypred)/sigma;
716  chi2fit = chi2fit + dy*dy;
717 
718  } //end loop chi2
719  chi2fit3 = chi2fit;
720  if (nptfit>3)
721  chi2fitN3 = chi2fit /(nptfit-3);
722 
723  }
724  else {
725  cminf = -999.;
726  bminf = b;
727  aminf = a;
728  chi2fit3 = chi2fit;
729  chi2fitN3 = chi2fit /(nptfit-2);
730  }
731 
732  bminf3 = bminf;
733  aminf3 = aminf;
734  cminf3 = cminf;
735  nppar3 = nppar;
736 
737  if (debug) {
738  cout << "dt0= 0 : slope 2 = " << b << " pos in = " << a << " chi2fitN2 = " << chi2fitN2
739  << " nppar = " << nppar2 << " nptfit = " << nptfit << endl;
740  cout << "dt0 = 0 : slope 3 = " << bminf << " pos out = " << aminf << " chi2fitN3 = "
741  << chi2fitN3 << " nppar = " << nppar3 << " T0_ev ns = " << cminf/0.00543 << endl;
742  }
743 
744  //***********************************
745  // cout << " vdrift_4parfit "<< vdrift_4parfit<<endl;
746  if( nptfit>=5) {
747  const double det = (a1*a1*(b2*v6 - b6*b6) - a1*(a2*a2*v6 - 2*a2*a6*b6 + a6*a6*b2 + b2*c6*c6 + b3*(b3*v6 - 2*b6*c6))
748  + a2*a2*c6*c6 + 2*a2*(a3*(b3*v6 - b6*c6) - a6*b3*c6) + a3*a3*(b6*b6 - b2*v6)
749  + a6*(2*a3*(b2*c6 - b3*b6) + a6*b3*b3));
750 
751  // the dv/vdrift correction may be computed under vdrift_4parfit request;
752  if (det != 0) {
753  nppar = 4;
754  chi2fit = 0.;
755  // computation of a, b, c e v
756  aminf = (a1*(a2*(b6*d6 - v6*d2) + a6*(b6*d2 - b2*d6) + d1*(b2*v6 - b6*b6)) - a2*(b3*(c6*d6 - v6*d3)
757  + c6*(b6*d3 - c6*d2)) + a3*(b2*(c6*d6 - v6*d3) + b3*(v6*d2 - b6*d6) + b6*(b6*d3 - c6*d2))
758  + a6*(b2*c6*d3 + b3*(b3*d6 - b6*d3 - c6*d2)) - d1*(b2*c6*c6 + b3*(b3*v6 - 2*b6*c6)))/det;
759  bminf = - (a1*a1*(b6*d6 - v6*d2) - a1*(a2*(a6*d6 - v6*d1) - a6*a6*d2 + a6*b6*d1 + b3*(c6*d6 - v6*d3)
760  + c6*(b6*d3 - c6*d2)) + a2*(a3*(c6*d6 - v6*d3) + c6*(a6*d3 - c6*d1)) + a3*a3*(v6*d2 - b6*d6)
761  + a3*(a6*(b3*d6 + b6*d3 - 2*c6*d2) - d1*(b3*v6 - b6*c6)) - a6*b3*(a6*d3 - c6*d1))/det;
762  cminf = -(a1*(b2*(c6*d6 - v6*d3) + b3*(v6*d2 - b6*d6) + b6*(b6*d3 - c6*d2)) + a2*a2*(v6*d3 - c6*d6)
763  + a2*(a3*(b6*d6 - v6*d2) + a6*(b3*d6 - 2*b6*d3 + c6*d2) - d1*(b3*v6 - b6*c6))
764  + a3*(d1*(b2*v6 - b6*b6) - a6*(b2*d6 - b6*d2)) + a6*(a6*(b2*d3 - b3*d2) - d1*(b2*c6 - b3*b6)))/det;
765  vminf = - (a1*a1*(b2*d6 - b6*d2) - a1*(a2*a2*d6 - a2*(a6*d2 + b6*d1) + a6*b2*d1 + b2*c6*d3
766  + b3*(b3*d6 - b6*d3 - c6*d2)) + a2*a2*c6*d3 + a2*(a3*(2*b3*d6 - b6*d3 - c6*d2) - b3*(a6*d3 + c6*d1))
767  + a3*a3*(b6*d2 - b2*d6) + a3*(a6*(b2*d3 - b3*d2) + d1*(b2*c6 - b3*b6)) + a6*b3*b3*d1)/det;
768 
769  // chi 2
770  for (int j=0; j<nptfit; j++) {
771  const double ypred = aminf + bminf*xfit[j];
772  const double dy = (yfit[j]+vminf*lfit[j]*tfit[j]-cminf*lfit[j] -ypred)/sigma;
773  chi2fit = chi2fit + dy*dy;
774 
775  } //end loop chi2
776  if (nptfit<=nppar){
777  chi2fitN4=-1;
778  // cout << "nptfit " << nptfit << " nppar " << nppar << endl;
779  }
780  else{
781  chi2fitN4= chi2fit / (nptfit-nppar);
782  }
783  }
784  else {
785  vminf = 0.;
786 
787  if (nptfit <= nppar) chi2fitN4=-1;
788  else chi2fitN4 = chi2fit / (nptfit-nppar);
789  }
790 
791  if (fabs(vminf) >= 0.29) {
792  // for safety and for code construction..dont accept correction on dv/vdrift greater then 0.09
793  vminf = 0.;
794  cminf = cminf3;
795  aminf = aminf3;
796  bminf = bminf3;
797  nppar = 3;
798  chi2fit = chi2fit3;
799  }
800 
801  } //end if vdrift
802 
803  if(!vdrift_4parfit){ //if not required explicitly leave the t0 and track step as at step 3
804  // just update vdrift value vmin for storing in the segments for monitoring
805  cminf = cminf3;
806  aminf = aminf3;
807  bminf = bminf3;
808  nppar = 3;
809  chi2fit = chi2fit3;
810  }
811 
812  nppar4 = nppar;
813 
814  } //end nptfit >=3
815 
816  if (debug) {
817  cout << " dt0= 0 : slope 4 = " << bminf << " pos out = " << aminf <<" chi2fitN4 = " << chi2fitN4
818  << " nppar= " << nppar4 << " T0_ev ns= " << cminf/0.00543 <<" delta v = " << vminf <<endl;
819  cout << nptfit << " nptfit " << " end chi2fit = " << chi2fit/ (nptfit-nppar ) << " T0_ev ns= " << cminf/0.00543 << " delta v = " << vminf <<endl;
820  }
821 
822  if ( fabs(vminf) >= 0.09 && debug ) { //checks only vdrift less then 10 % accepted
823  cout << "vminf gt 0.09 det= " << endl;
824  cout << "dt0= 0 : slope 4 = "<< bminf << " pos out = " << aminf << " chi2fitN4 = " << chi2fitN4
825  << " T0_ev ns = " << cminf/0.00543 << " delta v = "<< vminf << endl;
826  cout << "dt0 = 0 : slope 2 = "<< b << " pos in = " << a <<" chi2fitN2 = " << chi2fitN2
827  << " nppar = " << nppar-1 << " nptfit = " << nptfit <<endl;
828  cout << "dt0 = 0 : slope 3 = " << bminf << " pos out = " << aminf << " chi2fitN3 = "
829  << chi2fitN3 << " T0_ev ns = " << cminf/0.00543 << endl;
830  cout << nptfit <<" nptfit "<< " end chi2fit = " << chi2fit << "T0_ev ns= " << cminf/0.00543 << "delta v = "<< vminf <<endl;
831  }
832 
833  if (nptfit != nppar) chi2fit = chi2fit / (nptfit-nppar);
834 }
dbl * delta
Definition: mlp_gen.cc:36
int j
Definition: DBlmapReader.cc:9
double b
Definition: hdecay.h:120
double a
Definition: hdecay.h:121
tuple cout
Definition: gather_cfg.py:121
void DTSegmentUpdator::rejectBadHits ( DTChamberRecSegment2D phiSeg) const
private

Definition at line 402 of file DTSegmentUpdator.cc.

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

Referenced by update().

402  {
403 
404  vector<float> x;
405  vector<float> y;
406 
407  if(debug) cout << " Inside the segment updator, now loop on hits: ( x == z_loc , y == x_loc) " << endl;
408 
409  vector<DTRecHit1D> hits = phiSeg->specificRecHits();
410  for (vector<DTRecHit1D>::const_iterator hit=hits.begin();
411  hit!=hits.end(); ++hit) {
412 
413  // I have to get the hits position (the hit is in the layer rf) in SL frame...
414  GlobalPoint glbPos = ( theGeom->layer( hit->wireId().layerId() ) )->toGlobal(hit->localPosition());
415  LocalPoint pos = ( theGeom->idToDet(phiSeg->geographicalId()) )->toLocal(glbPos);
416 
417  x.push_back(pos.z());
418  y.push_back(pos.x());
419  }
420 
421  if(debug){
422  cout << " end of segment! " << endl;
423  cout << " size = Number of Hits: " << x.size() << " " << y.size() << endl;
424  }
425 
426  // Perform the 2 par fit:
427  float par[2]={0.,0.}; // q , m
428 
429  //variables to perform the fit:
430  float Sx = 0.;
431  float Sy = 0.;
432  float Sx2 = 0.;
433  float Sy2 = 0.;
434  float Sxy = 0.;
435 
436  const int N = x.size();
437 
438  for(int i = 0; i < N;++i){
439  Sx += x.at(i);
440  Sy += y.at(i);
441  Sx2 += x.at(i)*x.at(i);
442  Sy2 += y.at(i)*y.at(i);
443  Sxy += x.at(i)*y.at(i);
444 
445  }
446 
447  const float delta = N*Sx2 - Sx*Sx;
448  par[0] = ( Sx2*Sy - Sx*Sxy )/delta;
449  par[1] = ( N*Sxy - Sx*Sy )/delta;
450 
451  if(debug) cout << "fit 2 parameters done ----> par0: "<< par[0] << " par1: "<< par[1] << endl;
452 
453  // Calc residuals:
454  float residuals[N];
455 
456  for(int i = 0; i < N;++i)
457  residuals[i] = 0;
458 
459  for(int i = 0; i < N;++i)
460  residuals[i] = y.at(i) - par[1]*x.at(i) - par[0];
461 
462  if(debug) cout << " Residuals computed! "<< endl;
463 
464 
465  // Perform bad hit rejecting -- update hits
466  vector<DTRecHit1D> updatedRecHits;
467 
468  float mean_residual = 0.; //mean of the absolute values of residuals
469 
470  for (int i = 0; i < N; ++i)
471  mean_residual += fabs(residuals[i]);
472 
473  mean_residual = mean_residual/(N - 2);
474 
475  if(debug) cout << " mean_residual: "<< mean_residual << endl;
476 
477  int i = 0;
478 
479  for (vector<DTRecHit1D>::const_iterator hit=hits.begin();
480  hit!=hits.end(); ++hit) {
481 
482  DTRecHit1D newHit1D = (*hit);
483 
484  if(fabs(residuals[i])/mean_residual < 1.5){
485 
486  updatedRecHits.push_back(newHit1D);
487  if(debug) cout << " accepted "<< i+1 << "th hit" <<" Irej: " << fabs(residuals[i])/mean_residual << endl;
488  ++i;
489  }
490  else {
491  if(debug) cout << " rejected "<< i+1 << "th hit" <<" Irej: " << fabs(residuals[i])/mean_residual << endl;
492  ++i;
493  continue;
494  }
495  }
496 
497  phiSeg->update(updatedRecHits);
498 
499  //final check!
500  if(debug){
501 
502  vector<float> x_upd;
503  vector<float> y_upd;
504 
505  cout << " Check the update action: " << endl;
506 
507  vector<DTRecHit1D> hits_upd = phiSeg->specificRecHits();
508  for (vector<DTRecHit1D>::const_iterator hit=hits_upd.begin();
509  hit!=hits_upd.end(); ++hit) {
510 
511  // I have to get the hits position (the hit is in the layer rf) in SL frame...
512  GlobalPoint glbPos = ( theGeom->layer( hit->wireId().layerId() ) )->toGlobal(hit->localPosition());
513  LocalPoint pos = ( theGeom->idToDet(phiSeg->geographicalId()) )->toLocal(glbPos);
514 
515  x_upd.push_back(pos.z());
516  y_upd.push_back(pos.x());
517 
518  cout << " x_upd: "<< pos.z() << " y_upd: "<< pos.x() << endl;
519 
520 
521  }
522 
523  cout << " end of segment! " << endl;
524  cout << " size = Number of Hits: " << x_upd.size() << " " << y_upd.size() << endl;
525 
526  }// end debug
527 
528  return;
529 } //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:63
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
x
Definition: VDTMath.h:216
T x() const
Definition: PV3DBase.h:61
void DTSegmentUpdator::setES ( const edm::EventSetup setup)

set the setup

Definition at line 71 of file DTSegmentUpdator.cc.

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

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

71  {
72  setup.get<MuonGeometryRecord>().get(theGeom);
73  theAlgo->setES(setup);
74 }
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 = false 
) const

recompute hits position and refit the segment4D

Definition at line 76 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(), pos, rejectBadHits(), launcher::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(), DTRefitAndCombineReco4D::reconstruct(), DTCombinatorialPatternReco4D::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().

76  {
77 
78  if(debug) cout << "[DTSegmentUpdator] Starting to update the segment" << endl;
79 
80  const bool hasPhi = seg->hasPhi();
81  const bool hasZed = seg->hasZed();
82 
83  //reject the bad hits (due to delta rays)
84  if(perform_delta_rejecting && hasPhi) rejectBadHits(seg->phiSegment());
85 
86  int step = (hasPhi && hasZed) ? 3 : 2;
87  if(calcT0) step = 4;
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);
98 }
void rejectBadHits(DTChamberRecSegment2D *) const
void updateHits(DTRecSegment2D *seg, GlobalPoint &gpos, GlobalVector &gdir, const int step=2) const
list step
Definition: launcher.py:15
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 fit(DTSegmentCand *seg) const
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
void DTSegmentUpdator::update ( DTRecSegment2D seg) const

recompute hits position and refit the segment2D

Definition at line 100 of file DTSegmentUpdator.cc.

References dir, fit(), TrackingRecHit::geographicalId(), DTRecSegment2D::localDirection(), DTRecSegment2D::localPosition(), pos, 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  GlobalPoint pos = (theGeom->idToDet(seg->geographicalId()))->toGlobal(seg->localPosition());
102  GlobalVector dir = (theGeom->idToDet(seg->geographicalId()))->toGlobal(seg->localDirection());
103 
104  updateHits(seg,pos,dir);
105  fit(seg);
106 }
void updateHits(DTRecSegment2D *seg, GlobalPoint &gpos, GlobalVector &gdir, const int step=2) const
edm::ESHandle< DTGeometry > theGeom
bool fit(DTSegmentCand *seg) const
virtual LocalPoint localPosition() const
local position in SL frame
virtual LocalVector localDirection() const
the local direction in SL frame
DetId geographicalId() const
dbl *** dir
Definition: mlp_gen.cc:35
void DTSegmentUpdator::updateHits ( DTRecSegment2D seg,
GlobalPoint gpos,
GlobalVector gdir,
const int  step = 2 
) const
private

Definition at line 321 of file DTSegmentUpdator.cc.

References angle(), DTRecHitBaseAlgo::compute(), funct::cos(), 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().

322  {
323 
324  // it is not necessary to have DTRecHit1D* to modify the obj in the container
325  // but I have to be carefully, since I cannot make a copy before the iteration!
326 
327  vector<DTRecHit1D> toBeUpdatedRecHits = seg->specificRecHits();
328  vector<DTRecHit1D> updatedRecHits;
329 
330  for (vector<DTRecHit1D>::iterator hit= toBeUpdatedRecHits.begin();
331  hit!=toBeUpdatedRecHits.end(); ++hit) {
332 
333  const DTLayer* layer = theGeom->layer( hit->wireId().layerId() );
334 
335  LocalPoint segPos=layer->toLocal(gpos);
336  LocalVector segDir=layer->toLocal(gdir);
337 
338  // define impact angle needed by the step 2
339  const float angle = atan(segDir.x()/-segDir.z());
340 
341  // define the local position (extr.) of the segment. Needed by the third step
342  LocalPoint segPosAtLayer=segPos+segDir*(-segPos.z())/cos(segDir.theta());
343 
344  DTRecHit1D newHit1D = (*hit);
345 
346  bool ok = true;
347 
348  if (step == 2) {
349  ok = theAlgo->compute(layer,*hit,angle,newHit1D);
350 
351  } else if (step == 3) {
352 
353  LocalPoint hitPos(hit->localPosition().x(),+segPosAtLayer.y(),0.);
354 
355  GlobalPoint glbpos= theGeom->layer( hit->wireId().layerId() )->toGlobal(hitPos);
356 
357  newHit1D.setPosition(hitPos);
358 
359  ok = theAlgo->compute(layer,*hit,angle,glbpos,newHit1D);
360 
361  } else if (step == 4) {
362 
363  //const double vminf = seg->vDrift(); // vdrift correction are recorded in the segment
364  double vminf =0.;
365  if(vdrift_4parfit) vminf = seg->vDrift(); // use vdrift recorded in the segment only if vdrift_4parfit=True
366 
367  double cminf = 0.;
368  if(seg->ist0Valid()) cminf = - seg->t0()*0.00543;
369 
370  //cout << "In updateHits: t0 = " << seg->t0() << endl;
371  //cout << "In updateHits: vminf = " << vminf << endl;
372  //cout << "In updateHits: cminf = " << cminf << endl;
373 
374  const float xwire = layer->specificTopology().wirePosition(hit->wireId().wire());
375  const float distance = fabs(hit->localPosition().x() - xwire);
376 
377  const int ilc = ( hit->lrSide() == DTEnums::Left ) ? 1 : -1;
378 
379  const double dy_corr = (vminf*ilc*distance-cminf*ilc );
380 
381  LocalPoint point(hit->localPosition().x() + dy_corr, +segPosAtLayer.y(), 0.);
382 
384 
385  newHit1D.setPositionAndError(point, error);
386 
387  //FIXME: check that the hit is still inside the cell
388  ok = true;
389 
390  } else throw cms::Exception("DTSegmentUpdator")<<" updateHits called with wrong step " << endl;
391 
392  if (ok) updatedRecHits.push_back(newHit1D);
393  else {
394  LogError("DTSegmentUpdator")<<"DTSegmentUpdator::updateHits failed update" << endl;
395  throw cms::Exception("DTSegmentUpdator")<<"updateHits failed update"<<endl;
396  }
397 
398  }
399  seg->update(updatedRecHits);
400 }
float wirePosition(int wireNumber) const
Returns the x position in the layer of a given wire number.
Definition: DTTopology.cc:88
list step
Definition: launcher.py:15
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:74
const DTTopology & specificTopology() const
Definition: DTLayer.cc:44
double vDrift() const
T z() const
Definition: PV3DBase.h:63
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:61
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 116 of file DTSegmentUpdator.h.

Referenced by DTSegmentUpdator(), Fit4Var(), rejectBadHits(), and update().

bool DTSegmentUpdator::perform_delta_rejecting
private

Definition at line 115 of file DTSegmentUpdator.h.

Referenced by update().

double DTSegmentUpdator::T0_hit_resolution
private

Definition at line 114 of file DTSegmentUpdator.h.

Referenced by updateHits().

DTRecHitBaseAlgo* DTSegmentUpdator::theAlgo
private

Definition at line 85 of file DTSegmentUpdator.h.

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

DTLinearFit* DTSegmentUpdator::theFitter
private

Definition at line 84 of file DTSegmentUpdator.h.

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

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

Definition at line 86 of file DTSegmentUpdator.h.

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

bool DTSegmentUpdator::vdrift_4parfit
private

Definition at line 113 of file DTSegmentUpdator.h.

Referenced by Fit4Var(), and updateHits().