CMS 3D CMS Logo

Public Member Functions | Private Types | Private Member Functions | Private Attributes | Friends

DTRecSegment4D Class Reference

#include <DTRecSegment4D.h>

Inheritance diagram for DTRecSegment4D:
RecSegment TrackingRecHit

List of all members.

Public Member Functions

virtual DTChamberId chamberId () const
 The (specific) DetId of the chamber on which the segment resides.
virtual double chi2 () const
 Chi2 of the segment fit.
virtual DTRecSegment4Dclone () const
virtual int degreesOfFreedom () const
 Degrees of freedom of the segment fit.
virtual int dimension () const
 Dimension (in parameter space)
 DTRecSegment4D (const DTChamberRecSegment2D &phiSeg, const DTSLRecSegment2D &zedSeg, const LocalPoint &posZInCh, const LocalVector &dirZInCh)
 Construct from phi and Z projections.
 DTRecSegment4D (const DTSLRecSegment2D &zedSeg, const LocalPoint &posZInCh, const LocalVector &dirZInCh)
 Construct from Z projection.
 DTRecSegment4D (const DTChamberRecSegment2D &phiSeg)
 Construct from phi projection.
 DTRecSegment4D ()
 Empty constructor.
bool hasPhi () const
 Does it have the Phi projection?
bool hasZed () const
 Does it have the Z projection?
virtual LocalVector localDirection () const
 Local direction in Chamber frame.
virtual LocalError localDirectionError () const
 Local direction error in the Chamber frame.
virtual LocalPoint localPosition () const
 Local position in Chamber frame.
virtual LocalError localPositionError () const
 Local position error in Chamber frame.
AlgebraicVector parameters () const
AlgebraicSymMatrix parametersError () const
 Covariance matrix fo parameters()
const DTChamberRecSegment2DphiSegment () const
 The superPhi segment: 0 if no phi projection available.
virtual AlgebraicMatrix projectionMatrix () const
 The projection matrix relates the trajectory state parameters to the segment parameters().
virtual std::vector< const
TrackingRecHit * > 
recHits () const
 Access to component RecHits (if any)
virtual std::vector
< TrackingRecHit * > 
recHits ()
 Non-const access to component RecHits (if any)
void setCovMatrix (AlgebraicSymMatrix mat)
 Set covariance matrix.
void setDirection (LocalVector dir)
 Set direction.
void setPosition (LocalPoint pos)
 Set position.
const DTSLRecSegment2DzSegment () const
 The Z segment: 0 if not zed projection available.
 ~DTRecSegment4D ()
 Destructor.

Private Types

enum  Projection { full, phi, Z, none }
 

Which projections are actually there.

More...

Private Member Functions

DTChamberRecSegment2DphiSegment ()
 the superPhi segment
void setCovMatrixForZed (const LocalPoint &posZInCh)
DTSLRecSegment2DzSegment ()
 the Z segment

Private Attributes

AlgebraicSymMatrix theCovMatrix
int theDimension
LocalVector theDirection
DTChamberRecSegment2D thePhiSeg
LocalPoint thePosition
Projection theProjection
DTSLRecSegment2D theZedSeg

Friends

class DTSegmentUpdator

Detailed Description

4-parameter RecHits for MuonBarrel DT (x,y, dx/dz, dy/dz)

Date:
2009/10/20 09:06:12
Revision:
1.12
Author:
Stefano Lacaprara - INFN Legnaro <stefano.lacaprara@pd.infn.it>
Riccardo Bellan - INFN TO <riccardo.bellan@cern.ch>

Definition at line 25 of file DTRecSegment4D.h.


Member Enumeration Documentation

Which projections are actually there.

Enumerator:
full 
phi 
Z 
none 

Definition at line 121 of file DTRecSegment4D.h.

{full, phi, Z, none};

Constructor & Destructor Documentation

DTRecSegment4D::DTRecSegment4D ( ) [inline]

Empty constructor.

Definition at line 30 of file DTRecSegment4D.h.

Referenced by clone().

DTRecSegment4D::DTRecSegment4D ( const DTChamberRecSegment2D phiSeg,
const DTSLRecSegment2D zedSeg,
const LocalPoint posZInCh,
const LocalVector dirZInCh 
)

Construct from phi and Z projections.

Definition at line 19 of file DTRecSegment4D.cc.

References funct::cos(), DTRecSegment2D::covMatrix(), DTChamberId, Exception, TrackingRecHit::geographicalId(), DTRecSegment2D::localDirection(), DTRecSegment2D::localPosition(), DetId::rawId(), setCovMatrixForZed(), theCovMatrix, theDirection, thePosition, PV3DBase< T, PVType, FrameType >::theta(), Vector3DBase< T, FrameTag >::unit(), PV3DBase< T, PVType, FrameType >::x(), PV3DBase< T, PVType, FrameType >::y(), and PV3DBase< T, PVType, FrameType >::z().

                                                           :
  RecSegment(phiSeg.chamberId()), 
  theProjection(full),
  thePhiSeg(phiSeg),
  theZedSeg(zedSeg),
  theDimension(4)
{
  // Check consistency of 2 sub-segments
  if(DTChamberId(phiSeg.geographicalId().rawId()) != DTChamberId(zedSeg.geographicalId().rawId()))
    throw cms::Exception("DTRecSegment4D")
      <<"the z Segment and the phi segment have different chamber id"<<std::endl;

  // The position of 2D segments are defined in the SL frame: I must first
  // extrapolate that position at the Chamber reference plane
  LocalPoint posZAt0 = posZInCh +
    dirZInCh * (-posZInCh.z())/cos(dirZInCh.theta());


  thePosition=LocalPoint(phiSeg.localPosition().x(),posZAt0.y(),0.);
  LocalVector dirPhiInCh=phiSeg.localDirection();

  // given the actual definition of chamber refFrame, (with z poiniting to IP),
  // the zed component of direction is negative.
  theDirection=LocalVector(dirPhiInCh.x()/fabs(dirPhiInCh.z()),
                           dirZInCh.y()/fabs(dirZInCh.z()),
                           -1.);
  theDirection=theDirection.unit();

  // set cov matrix
  theCovMatrix=AlgebraicSymMatrix(4);
  theCovMatrix[0][0]=phiSeg.covMatrix()[0][0]; //sigma (dx/dz)
  theCovMatrix[0][2]=phiSeg.covMatrix()[0][1]; //cov(dx/dz,x)
  theCovMatrix[2][2]=phiSeg.covMatrix()[1][1]; //sigma (x)
  setCovMatrixForZed(posZInCh);
}
DTRecSegment4D::DTRecSegment4D ( const DTChamberRecSegment2D phiSeg)

Construct from phi projection.

Definition at line 59 of file DTRecSegment4D.cc.

References DTRecSegment2D::covMatrix(), DTRecSegment2D::localDirection(), DTRecSegment2D::localPosition(), theCovMatrix, theDirection, thePhiSeg, and thePosition.

                                                                  :
  RecSegment(phiSeg.chamberId()), 
  theProjection(phi),
  thePhiSeg(phiSeg),
  theZedSeg(DTSLRecSegment2D()),
  theDimension(2)
{
  thePosition=thePhiSeg.localPosition();
  
  theDirection=thePhiSeg.localDirection();

  // set cov matrix
  theCovMatrix=AlgebraicSymMatrix(4);
  theCovMatrix[0][0]=phiSeg.covMatrix()[0][0]; //sigma (dx/dz)
  theCovMatrix[0][2]=phiSeg.covMatrix()[0][1]; //cov(dx/dz,x)
  theCovMatrix[2][2]=phiSeg.covMatrix()[1][1]; //sigma (x)
}
DTRecSegment4D::DTRecSegment4D ( const DTSLRecSegment2D zedSeg,
const LocalPoint posZInCh,
const LocalVector dirZInCh 
)

Construct from Z projection.

Definition at line 78 of file DTRecSegment4D.cc.

References funct::cos(), setCovMatrixForZed(), theCovMatrix, theDirection, thePosition, PV3DBase< T, PVType, FrameType >::theta(), and PV3DBase< T, PVType, FrameType >::z().

                                                            :
  RecSegment(zedSeg.superLayerId().chamberId()),
  theProjection(Z),
  thePhiSeg(DTChamberRecSegment2D()),
  theZedSeg(zedSeg),
  theDimension(2)
{
  
  LocalPoint posZAt0=posZInCh+
    dirZInCh*(-posZInCh.z()/cos(dirZInCh.theta()));
  
  thePosition=posZAt0;
  theDirection = dirZInCh;

  // set cov matrix
  theCovMatrix=AlgebraicSymMatrix(4);
  setCovMatrixForZed(posZInCh);
}
DTRecSegment4D::~DTRecSegment4D ( )

Destructor.

Definition at line 100 of file DTRecSegment4D.cc.

{}

Member Function Documentation

DTChamberId DTRecSegment4D::chamberId ( ) const [virtual]
double DTRecSegment4D::chi2 ( ) const [virtual]

Chi2 of the segment fit.

Implements RecSegment.

Definition at line 191 of file DTRecSegment4D.cc.

References DTRecSegment2D::chi2(), hasPhi(), hasZed(), query::result, thePhiSeg, and theZedSeg.

Referenced by DTChamberEfficiencyTask::getBestSegment(), DTChamberEfficiencyTask::isGoodSegment(), and operator<<().

                                  {
  double result=0;
  if (hasPhi()) result+=thePhiSeg.chi2();
  if (hasZed()) result+=theZedSeg.chi2();
  return result;
}
virtual DTRecSegment4D* DTRecSegment4D::clone ( void  ) const [inline, virtual]

Implements TrackingRecHit.

Definition at line 46 of file DTRecSegment4D.h.

References DTRecSegment4D().

Referenced by DTSegment4DT0Corrector::produce().

{ return new DTRecSegment4D(*this);}
int DTRecSegment4D::degreesOfFreedom ( ) const [virtual]

Degrees of freedom of the segment fit.

Implements RecSegment.

Definition at line 199 of file DTRecSegment4D.cc.

References DTRecSegment2D::degreesOfFreedom(), hasPhi(), hasZed(), query::result, thePhiSeg, and theZedSeg.

Referenced by DTChamberEfficiencyTask::getBestSegment(), DTChamberEfficiencyTask::isGoodSegment(), and operator<<().

                                           {
  int result=0;
  if (hasPhi()) result+=thePhiSeg.degreesOfFreedom();
  if (hasZed()) result+=theZedSeg.degreesOfFreedom();
  return result;
}
virtual int DTRecSegment4D::dimension ( ) const [inline, virtual]

Dimension (in parameter space)

Implements RecSegment.

Definition at line 79 of file DTRecSegment4D.h.

References theDimension.

Referenced by DTCalibValidation::compute(), operator<<(), parameters(), parametersError(), and projectionMatrix().

{ return theDimension; }
bool DTRecSegment4D::hasPhi ( ) const [inline]
bool DTRecSegment4D::hasZed ( ) const [inline]
virtual LocalVector DTRecSegment4D::localDirection ( ) const [inline, virtual]
LocalError DTRecSegment4D::localDirectionError ( ) const [virtual]

Local direction error in the Chamber frame.

Implements RecSegment.

Definition at line 186 of file DTRecSegment4D.cc.

References theCovMatrix.

Referenced by DTSegment4DQuality::analyze().

                                                     {
  return LocalError(theCovMatrix[0][0],theCovMatrix[0][1],theCovMatrix[1][1]);
}
virtual LocalPoint DTRecSegment4D::localPosition ( ) const [inline, virtual]
LocalError DTRecSegment4D::localPositionError ( ) const [virtual]

Local position error in Chamber frame.

Implements TrackingRecHit.

Definition at line 181 of file DTRecSegment4D.cc.

References theCovMatrix.

Referenced by DTSegment4DQuality::analyze().

                                                    {
  return LocalError(theCovMatrix[2][2],theCovMatrix[2][3],theCovMatrix[3][3]);
}
AlgebraicVector DTRecSegment4D::parameters ( void  ) const [virtual]

Parameters of the segment, for the track fit. For a 4D segment: (dx/dy,dy/dz,x,y) For a 2D, phi-only segment: (dx/dz,x) For a 2D, Z-only segment: (dy/dz,y)

Implements TrackingRecHit.

Definition at line 103 of file DTRecSegment4D.cc.

References dimension(), phi, query::result, theDirection, thePosition, theProjection, PV3DBase< T, PVType, FrameType >::x(), PV3DBase< T, PVType, FrameType >::y(), PV3DBase< T, PVType, FrameType >::z(), and Z.

Referenced by ChamberSegmentUtility::getDTRHmap(), and StateSegmentMatcher::StateSegmentMatcher().

                                                 {
  if (dimension()==4) {
    // (dx/dz,dy/dz,x,y)
    AlgebraicVector result(4);
    result[2] = thePosition.x();
    result[3] = thePosition.y();
    result[0] = theDirection.x()/theDirection.z();
    result[1] = theDirection.y()/theDirection.z();    
    return result;
  } 

  AlgebraicVector result(2);
  if (theProjection==phi) {
    // (dx/dz,x)  
    result[1] = thePosition.x();
    result[0] = theDirection.x()/theDirection.z();
  } else if (theProjection==Z) {
    // (dy/dz,y) (note we are in the chamber r.f.)
    result[1] = thePosition.y();
    result[0] = theDirection.y()/theDirection.z();
  }
  return result;
}
AlgebraicSymMatrix DTRecSegment4D::parametersError ( ) const [virtual]

Covariance matrix fo parameters()

Implements TrackingRecHit.

Definition at line 128 of file DTRecSegment4D.cc.

References dimension(), phi, query::result, theCovMatrix, theProjection, and Z.

Referenced by StateSegmentMatcher::StateSegmentMatcher().

                                                         { 

  if (dimension()==4) {
    return theCovMatrix;
  }

  AlgebraicSymMatrix result(2);
  if (theProjection==phi) {
    result[0][0] = theCovMatrix[0][0]; //S(dx/dz)
    result[0][1] = theCovMatrix[0][2]; //Cov(dx/dz,x)
    result[1][1] = theCovMatrix[2][2]; //S(x)
  } else if (theProjection==Z) {
    result[0][0] = theCovMatrix[1][1]; //S(dy/dz)
    result[0][1] = theCovMatrix[1][3]; //Cov(dy/dz,y)
    result[1][1] = theCovMatrix[3][3]; //S(y)
  }
  return result;
}
const DTChamberRecSegment2D* DTRecSegment4D::phiSegment ( ) const [inline]
DTChamberRecSegment2D* DTRecSegment4D::phiSegment ( ) [inline, private]

the superPhi segment

Definition at line 125 of file DTRecSegment4D.h.

References thePhiSeg.

{return &thePhiSeg;}
AlgebraicMatrix DTRecSegment4D::projectionMatrix ( ) const [virtual]

The projection matrix relates the trajectory state parameters to the segment parameters().

Implements TrackingRecHit.

Definition at line 148 of file DTRecSegment4D.cc.

References dimension(), phi, theProjection, and Z.

                                                       {
  static bool isInitialized=false;
  static AlgebraicMatrix the4DProjectionMatrix(4, 5, 0); 
  static AlgebraicMatrix the2DPhiProjMatrix(2, 5, 0);
  static AlgebraicMatrix the2DZProjMatrix(2, 5, 0);

  if (!isInitialized) {
    the4DProjectionMatrix[0][1] = 1;
    the4DProjectionMatrix[1][2] = 1;
    the4DProjectionMatrix[2][3] = 1;
    the4DProjectionMatrix[3][4] = 1;

    the2DPhiProjMatrix[0][1] = 1;
    the2DPhiProjMatrix[1][3] = 1;

    the2DZProjMatrix[0][2] = 1;
    the2DZProjMatrix[1][4] = 1;

    isInitialized= true;
  }

  if (dimension()==4) { 
    return the4DProjectionMatrix;
  } else if (theProjection==phi) {
    return the2DPhiProjMatrix;
  } else if (theProjection==Z) {
    return the2DZProjMatrix;
  } else {
    return AlgebraicMatrix();
  }
}
std::vector< TrackingRecHit * > DTRecSegment4D::recHits ( ) [virtual]

Non-const access to component RecHits (if any)

Implements TrackingRecHit.

Definition at line 265 of file DTRecSegment4D.cc.

References hasPhi(), hasZed(), phiSegment(), and zSegment().

                                                  {

  std::vector<TrackingRecHit*> pointersOfRecHits; 

  if (hasPhi()) pointersOfRecHits.push_back(phiSegment());
  if (hasZed()) pointersOfRecHits.push_back(zSegment());
  
  return pointersOfRecHits;
}
std::vector< const TrackingRecHit * > DTRecSegment4D::recHits ( ) const [virtual]

Access to component RecHits (if any)

Implements TrackingRecHit.

Definition at line 254 of file DTRecSegment4D.cc.

References hasPhi(), hasZed(), phiSegment(), and zSegment().

                                                              {
  std::vector<const TrackingRecHit*> pointersOfRecHits; 

  if (hasPhi()) pointersOfRecHits.push_back(phiSegment());
  if (hasZed()) pointersOfRecHits.push_back(zSegment());

  return pointersOfRecHits;
}
void DTRecSegment4D::setCovMatrix ( AlgebraicSymMatrix  mat) [inline]

Set covariance matrix.

Definition at line 114 of file DTRecSegment4D.h.

References theCovMatrix.

Referenced by DTSegmentUpdator::fit().

{ theCovMatrix = mat; }
void DTRecSegment4D::setCovMatrixForZed ( const LocalPoint posZInCh) [private]

Definition at line 207 of file DTRecSegment4D.cc.

References DTRecSegment2D::parametersError(), theCovMatrix, theZedSeg, and PV3DBase< T, PVType, FrameType >::z().

Referenced by DTRecSegment4D(), and DTSegmentUpdator::fit().

                                                                 {
  // Warning!!! the covariance matrix for Theta SL segment is defined in the SL
  // reference frame, here that in the Chamber ref frame must be used.
  // For direction, no problem, but the position is extrapolated, so we must
  // propagate the error properly.

  // many thanks to Paolo Ronchese for the help in deriving the formulas!

  // y=m*z+q in SL frame
  // y=m'*z+q' in CH frame

  // var(m') = var(m)
  theCovMatrix[1][1] = theZedSeg.parametersError()[0][0]; //sigma (dy/dz)

  // cov(m',q') = DeltaZ*Var(m) + Cov(m,q)
  theCovMatrix[1][3] =
    posZInCh.z()*theZedSeg.parametersError()[0][0]+
    theZedSeg.parametersError()[0][1]; //cov(dy/dz,y)

  // Var(q') = DeltaZ^2*Var(m) + Var(q) + 2*DeltaZ*Cov(m,q)
  // cout << "Var(q') = DeltaZ^2*Var(m) + Var(q) + 2*DeltaZ*Cov(m,q)" << endl;
  // cout << "Var(q')= " << posZInCh.z()*posZInCh.z() << "*" <<
  //   theZedSeg.parametersError()[0][0] << " + " << 
  //   theZedSeg.parametersError()[1][1] << " + " << 
  //   2*posZInCh.z() << "*" << theZedSeg.parametersError()[0][1] ;
  theCovMatrix[3][3] =
    2.*(posZInCh.z()*posZInCh.z())*theZedSeg.parametersError()[0][0] +
    theZedSeg.parametersError()[1][1] +
    2.*posZInCh.z()*theZedSeg.parametersError()[0][1];
  // cout << " = " << theCovMatrix[3][3] << endl;
}
void DTRecSegment4D::setDirection ( LocalVector  dir) [inline]

Set direction.

Definition at line 111 of file DTRecSegment4D.h.

References dir, and theDirection.

Referenced by DTSegmentUpdator::fit().

void DTRecSegment4D::setPosition ( LocalPoint  pos) [inline]

Set position.

Definition at line 108 of file DTRecSegment4D.h.

References pos, and thePosition.

Referenced by DTSegmentUpdator::fit().

DTSLRecSegment2D* DTRecSegment4D::zSegment ( ) [inline, private]

the Z segment

Definition at line 128 of file DTRecSegment4D.h.

References theZedSeg.

{return &theZedSeg;}
const DTSLRecSegment2D* DTRecSegment4D::zSegment ( ) const [inline]

Friends And Related Function Documentation

friend class DTSegmentUpdator [friend]

Definition at line 28 of file DTRecSegment4D.h.


Member Data Documentation

Definition at line 147 of file DTRecSegment4D.h.

Referenced by dimension().

Definition at line 131 of file DTRecSegment4D.h.

Referenced by DTRecSegment4D(), localDirection(), parameters(), and setDirection().

Definition at line 144 of file DTRecSegment4D.h.

Referenced by chi2(), degreesOfFreedom(), DTRecSegment4D(), and phiSegment().

Definition at line 130 of file DTRecSegment4D.h.

Referenced by DTRecSegment4D(), localPosition(), parameters(), and setPosition().

Definition at line 122 of file DTRecSegment4D.h.

Referenced by hasPhi(), hasZed(), parameters(), parametersError(), and projectionMatrix().

Definition at line 145 of file DTRecSegment4D.h.

Referenced by chi2(), degreesOfFreedom(), setCovMatrixForZed(), and zSegment().