CMS 3D CMS Logo

Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes

BasicSingleTrajectoryState Class Reference

vvv DEBUG More...

#include <BasicSingleTrajectoryState.h>

Inheritance diagram for BasicSingleTrajectoryState:
BasicTrajectoryState ReferenceCountedPoolAllocated BlockWipedPoolAllocated

List of all members.

Public Member Functions

 BasicSingleTrajectoryState (const FreeTrajectoryState &fts, const Surface &aSurface, const SurfaceSide side=SurfaceSideDefinition::atCenterOfSurface)
 BasicSingleTrajectoryState (const GlobalTrajectoryParameters &par, const Surface &aSurface, const SurfaceSide side=SurfaceSideDefinition::atCenterOfSurface)
 BasicSingleTrajectoryState (const GlobalTrajectoryParameters &par, const CurvilinearTrajectoryError &err, const Surface &aSurface, const SurfaceSide side=SurfaceSideDefinition::atCenterOfSurface, double weight=1.)
 BasicSingleTrajectoryState (const LocalTrajectoryParameters &par, const LocalTrajectoryError &err, const Surface &aSurface, const MagneticField *field, double weight)
 BasicSingleTrajectoryState (const Surface &aSurface)
 construct invalid trajectory state (without parameters)
 BasicSingleTrajectoryState (const GlobalTrajectoryParameters &par, const CurvilinearTrajectoryError &err, const Surface &aSurface, double weight)
 BasicSingleTrajectoryState (const GlobalTrajectoryParameters &par, const CartesianTrajectoryError &err, const Surface &aSurface, const SurfaceSide side=SurfaceSideDefinition::atCenterOfSurface)
 BasicSingleTrajectoryState (const LocalTrajectoryParameters &par, const Surface &aSurface, const MagneticField *field, const SurfaceSide side=SurfaceSideDefinition::atCenterOfSurface)
 BasicSingleTrajectoryState (const LocalTrajectoryParameters &par, const LocalTrajectoryError &err, const Surface &aSurface, const MagneticField *field, const SurfaceSide side=SurfaceSideDefinition::atCenterOfSurface, double weight=1.)
virtual bool canUpdateLocalParameters () const
const CartesianTrajectoryErrorcartesianError () const
TrackCharge charge () const
BasicSingleTrajectoryStateclone () const
const CurvilinearTrajectoryErrorcurvilinearError () const
FreeTrajectoryStatefreeTrajectoryState (bool withErrors=true) const
GlobalVector globalDirection () const
GlobalVector globalMomentum () const
const GlobalTrajectoryParametersglobalParameters () const
GlobalPoint globalPosition () const
bool hasError () const
bool isValid () const
LocalVector localDirection () const
const LocalTrajectoryErrorlocalError () const
LocalVector localMomentum () const
const LocalTrajectoryParameterslocalParameters () const
LocalPoint localPosition () const
const MagneticFieldmagneticField () const
void missingError (char const *where) const
void rescaleError (double factor)
double signedInverseMomentum () const
const Surfacesurface () const
virtual SurfaceSide surfaceSide () const
 Position relative to material, defined relative to momentum vector.
double transverseCurvature () const
virtual void update (const LocalTrajectoryParameters &p, const Surface &aSurface, const MagneticField *field, const SurfaceSide side)
virtual void update (const LocalTrajectoryParameters &p, const LocalTrajectoryError &err, const Surface &aSurface, const MagneticField *field, const SurfaceSide side, double weight)
virtual double weight () const
virtual ~BasicSingleTrajectoryState ()

Static Public Member Functions

static void notValid ()

Private Member Functions

void checkCartesianError () const
void checkCurvilinError () const
void checkGlobalParameters () const
void createLocalError () const
void createLocalErrorFromCartesianError () const
void createLocalErrorFromCurvilinearError () const
void createLocalParameters () const

Private Attributes

bool theCartesianErrorUp2Date
bool theCurvilinErrorUp2Date
const MagneticFieldtheField
DeepCopyPointer
< FreeTrajectoryState
theFreeState
bool theGlobalParamsUp2Date
LocalTrajectoryError theLocalError
bool theLocalErrorValid
LocalTrajectoryParameters theLocalParameters
bool theLocalParametersValid
ConstReferenceCountingPointer
< Surface
theSurfaceP
SurfaceSide theSurfaceSide
double theWeight

Detailed Description

vvv DEBUG

Concrete implementation for the state of one trajectory on a surface.

Definition at line 24 of file BasicSingleTrajectoryState.h.


Constructor & Destructor Documentation

BasicSingleTrajectoryState::BasicSingleTrajectoryState ( const FreeTrajectoryState fts,
const Surface aSurface,
const SurfaceSide  side = SurfaceSideDefinition::atCenterOfSurface 
)

Constructor from FTS and surface. For surfaces with material the side of the surface should be specified explicitely.

Definition at line 11 of file BasicSingleTrajectoryState.cc.

Referenced by clone().

BasicSingleTrajectoryState::BasicSingleTrajectoryState ( const GlobalTrajectoryParameters par,
const Surface aSurface,
const SurfaceSide  side = SurfaceSideDefinition::atCenterOfSurface 
)

Constructor from global parameters and surface. For surfaces with material the side of the surface should be specified explicitely.

Definition at line 29 of file BasicSingleTrajectoryState.cc.

BasicSingleTrajectoryState::BasicSingleTrajectoryState ( const GlobalTrajectoryParameters par,
const CartesianTrajectoryError err,
const Surface aSurface,
const SurfaceSide  side = SurfaceSideDefinition::atCenterOfSurface 
)

Constructor from global parameters, errors and surface. For surfaces with material the side of the surface should be specified explicitely.

Definition at line 47 of file BasicSingleTrajectoryState.cc.

BasicSingleTrajectoryState::BasicSingleTrajectoryState ( const GlobalTrajectoryParameters par,
const CurvilinearTrajectoryError err,
const Surface aSurface,
const SurfaceSide  side = SurfaceSideDefinition::atCenterOfSurface,
double  weight = 1. 
)

Constructor from global parameters, errors and surface. For surfaces with material the side of the surface should be specified explicitely. For multi-states the weight should be specified explicitely.

Definition at line 66 of file BasicSingleTrajectoryState.cc.

BasicSingleTrajectoryState::BasicSingleTrajectoryState ( const GlobalTrajectoryParameters par,
const CurvilinearTrajectoryError err,
const Surface aSurface,
double  weight 
)

Constructor from global parameters, errors and surface. For multi-states the weight should be specified explicitely. For backward compatibility without specification of the side of the surface.

Definition at line 86 of file BasicSingleTrajectoryState.cc.

BasicSingleTrajectoryState::BasicSingleTrajectoryState ( const LocalTrajectoryParameters par,
const Surface aSurface,
const MagneticField field,
const SurfaceSide  side = SurfaceSideDefinition::atCenterOfSurface 
)

Constructor from local parameters, errors and surface. For surfaces with material the side of the surface should be specified explicitely.

Definition at line 105 of file BasicSingleTrajectoryState.cc.

BasicSingleTrajectoryState::BasicSingleTrajectoryState ( const LocalTrajectoryParameters par,
const LocalTrajectoryError err,
const Surface aSurface,
const MagneticField field,
const SurfaceSide  side = SurfaceSideDefinition::atCenterOfSurface,
double  weight = 1. 
)

Constructor from local parameters, errors and surface. For surfaces with material the side of the surface should be specified explicitely. For multi-states the weight should be specified explicitely.

Definition at line 124 of file BasicSingleTrajectoryState.cc.

BasicSingleTrajectoryState::BasicSingleTrajectoryState ( const LocalTrajectoryParameters par,
const LocalTrajectoryError err,
const Surface aSurface,
const MagneticField field,
double  weight 
)

Constructor from local parameters, errors and surface. For multi-states the weight should be specified explicitely. For backward compatibility without specification of the side of the surface.

Definition at line 145 of file BasicSingleTrajectoryState.cc.

BasicSingleTrajectoryState::BasicSingleTrajectoryState ( const Surface aSurface)

construct invalid trajectory state (without parameters)

Definition at line 165 of file BasicSingleTrajectoryState.cc.

BasicSingleTrajectoryState::~BasicSingleTrajectoryState ( ) [virtual]

Definition at line 181 of file BasicSingleTrajectoryState.cc.

{}

Member Function Documentation

virtual bool BasicSingleTrajectoryState::canUpdateLocalParameters ( ) const [inline, virtual]

Implements BasicTrajectoryState.

Definition at line 182 of file BasicSingleTrajectoryState.h.

{ return true; }
const CartesianTrajectoryError& BasicSingleTrajectoryState::cartesianError ( ) const [inline, virtual]

Implements BasicTrajectoryState.

Definition at line 126 of file BasicSingleTrajectoryState.h.

References FreeTrajectoryState::cartesianError(), freeTrajectoryState(), hasError(), and missingError().

                                                         {
    if(!hasError()) missingError(" accesing cartesian error.");
    return freeTrajectoryState()->cartesianError();
  }
TrackCharge BasicSingleTrajectoryState::charge ( void  ) const [inline, virtual]

Implements BasicTrajectoryState.

Definition at line 117 of file BasicSingleTrajectoryState.h.

References FreeTrajectoryState::charge(), and freeTrajectoryState().

Referenced by PixelTrackBuilder::build().

                             {
    return freeTrajectoryState(false)->charge();
  }
void BasicSingleTrajectoryState::checkCartesianError ( ) const [private]
void BasicSingleTrajectoryState::checkCurvilinError ( ) const [private]

Definition at line 221 of file BasicSingleTrajectoryState.cc.

References createLocalError(), createLocalParameters(), JacobianLocalToCurvilinear::jacobian(), localParameters(), LocalTrajectoryError::matrix(), surface(), theCurvilinErrorUp2Date, theField, theFreeState, theLocalError, theLocalErrorValid, and theLocalParametersValid.

Referenced by freeTrajectoryState().

                                                          {
  if(!theCurvilinErrorUp2Date){
    if(!theLocalParametersValid) createLocalParameters();
    // after createLocalParameters we can be sure theFreeState is not null
    if(!theLocalErrorValid) createLocalError();
    //    cout<<"!theCurvilinErrorUp2Date: create curviError from local"<<endl;
    theCurvilinErrorUp2Date = true;
    
    JacobianLocalToCurvilinear loc2Curv(surface(), localParameters(), *theField);
    const AlgebraicMatrix55& jac = loc2Curv.jacobian();
    
    const AlgebraicSymMatrix55 &cov = ROOT::Math::Similarity(jac, theLocalError.matrix());

    //theFreeState->setCurvilinearError( CurvilinearTrajectoryError(cov) );
    theFreeState->setCurvilinearError( cov );
  }
}
void BasicSingleTrajectoryState::checkGlobalParameters ( ) const [private]
BasicSingleTrajectoryState* BasicSingleTrajectoryState::clone ( void  ) const [inline, virtual]

Implements BasicTrajectoryState.

Definition at line 173 of file BasicSingleTrajectoryState.h.

References BasicSingleTrajectoryState().

                                            {
    return new BasicSingleTrajectoryState(*this);
  }
void BasicSingleTrajectoryState::createLocalError ( ) const [private]
void BasicSingleTrajectoryState::createLocalErrorFromCartesianError ( ) const [private]

Definition at line 290 of file BasicSingleTrajectoryState.cc.

References funct::C, JacobianCartesianToLocal::jacobian(), localParameters(), surface(), theFreeState, theLocalError, and theLocalErrorValid.

Referenced by createLocalError().

                                                                     {

  JacobianCartesianToLocal cart2Loc(surface(), localParameters());
  const AlgebraicMatrix56& jac = cart2Loc.jacobian();
    

  const AlgebraicSymMatrix55 &C = 
    ROOT::Math::Similarity(jac, theFreeState->cartesianError().matrix());
  theLocalError = LocalTrajectoryError(C);
  theLocalErrorValid = true;
}
void BasicSingleTrajectoryState::createLocalErrorFromCurvilinearError ( ) const [private]

Definition at line 277 of file BasicSingleTrajectoryState.cc.

References JacobianCurvilinearToLocal::jacobian(), localParameters(), surface(), theField, theFreeState, theLocalError, and theLocalErrorValid.

Referenced by createLocalError().

                                                                       {
  
  JacobianCurvilinearToLocal curv2Loc(surface(), localParameters(), *theField);
  const AlgebraicMatrix55& jac = curv2Loc.jacobian();
  
  const AlgebraicSymMatrix55 &cov = 
    ROOT::Math::Similarity(jac, theFreeState->curvilinearError().matrix());
  //    cout<<"Clocal via curvilinear error"<<endl;
  theLocalError = LocalTrajectoryError(cov);
  theLocalErrorValid = true;
}
void BasicSingleTrajectoryState::createLocalParameters ( ) const [private]
const CurvilinearTrajectoryError& BasicSingleTrajectoryState::curvilinearError ( ) const [inline, virtual]
FreeTrajectoryState * BasicSingleTrajectoryState::freeTrajectoryState ( bool  withErrors = true) const [virtual]

Implements BasicTrajectoryState.

Definition at line 366 of file BasicSingleTrajectoryState.cc.

References checkCartesianError(), checkCurvilinError(), checkGlobalParameters(), hasError(), isValid(), and notValid().

Referenced by cartesianError(), charge(), curvilinearError(), globalDirection(), globalMomentum(), globalParameters(), globalPosition(), signedInverseMomentum(), and transverseCurvature().

                                                                     {
  if(!isValid()) notValid();
  checkGlobalParameters();
  //if(hasError()) { // let's start like this to see if we alloc less
  if(withErrors && hasError()) { // this is the right thing
    checkCartesianError();
    checkCurvilinError();
  }
  return &(*theFreeState);
}
GlobalVector BasicSingleTrajectoryState::globalDirection ( ) const [inline, virtual]
GlobalVector BasicSingleTrajectoryState::globalMomentum ( ) const [inline, virtual]
const GlobalTrajectoryParameters& BasicSingleTrajectoryState::globalParameters ( void  ) const [inline, virtual]
GlobalPoint BasicSingleTrajectoryState::globalPosition ( ) const [inline, virtual]
bool BasicSingleTrajectoryState::hasError ( void  ) const [virtual]
bool BasicSingleTrajectoryState::isValid ( void  ) const [inline, virtual]
LocalVector BasicSingleTrajectoryState::localDirection ( ) const [inline, virtual]

Implements BasicTrajectoryState.

Definition at line 153 of file BasicSingleTrajectoryState.h.

References localMomentum(), and Vector3DBase< T, FrameTag >::unit().

                                     {
    return localMomentum().unit();
  }
const LocalTrajectoryError& BasicSingleTrajectoryState::localError ( ) const [inline, virtual]

Implements BasicTrajectoryState.

Definition at line 157 of file BasicSingleTrajectoryState.h.

References createLocalError(), hasError(), missingError(), theLocalError, and theLocalErrorValid.

                                                 {
    if (!hasError()) missingError(" accessing local error.");
    if (!theLocalErrorValid)
      createLocalError();
    return theLocalError;
  }
LocalVector BasicSingleTrajectoryState::localMomentum ( ) const [inline, virtual]

Implements BasicTrajectoryState.

Definition at line 150 of file BasicSingleTrajectoryState.h.

References localParameters(), and LocalTrajectoryParameters::momentum().

Referenced by localDirection().

                                    {
    return localParameters().momentum();
  }
const LocalTrajectoryParameters& BasicSingleTrajectoryState::localParameters ( ) const [inline, virtual]
LocalPoint BasicSingleTrajectoryState::localPosition ( ) const [inline, virtual]
const MagneticField* BasicSingleTrajectoryState::magneticField ( ) const [inline, virtual]

Implements BasicTrajectoryState.

Definition at line 138 of file BasicSingleTrajectoryState.h.

References theField.

{ return theField; }
void BasicSingleTrajectoryState::missingError ( char const *  where) const

Definition at line 188 of file BasicSingleTrajectoryState.cc.

References theFreeState, and theLocalErrorValid.

Referenced by cartesianError(), curvilinearError(), localError(), and rescaleError().

                                                                     {
  std::stringstream form;
  form<<"TrajectoryStateOnSurface: attempt to access errors when none available "
      <<where<<".\nfreestate pointer: "
      <<theFreeState<<"\nlocal error valid :"<<theLocalErrorValid ;
  throw TrajectoryStateException(form.str());
}
void BasicSingleTrajectoryState::notValid ( ) [static]

Definition at line 183 of file BasicSingleTrajectoryState.cc.

Referenced by freeTrajectoryState(), and localParameters().

                                          {
  throw TrajectoryStateException("TrajectoryStateOnSurface is invalid and cannot return any parameters");
}
void BasicSingleTrajectoryState::rescaleError ( double  factor) [virtual]

Implements BasicTrajectoryState.

Definition at line 343 of file BasicSingleTrajectoryState.cc.

References ExpressReco_HICollisions_FallBack::errors, hasError(), i, MagneticField::inInverseGeV(), j, PV3DBase< T, PVType, FrameType >::mag2(), LocalTrajectoryError::matrix(), missingError(), theField, theFreeState, theLocalError, and theLocalErrorValid.

                                                      {
  if (!hasError()) missingError(" trying to rescale");    
  if (theFreeState)
    theFreeState->rescaleError(factor);
  
  if (theLocalErrorValid){
    //do it by hand if the free state is not around.
    bool zeroField =theField->inInverseGeV(GlobalPoint(0,0,0)).mag2()==0;
    if (zeroField){
      AlgebraicSymMatrix55 errors=theLocalError.matrix();
      //scale the 0 indexed covariance by the square root of the factor
      for (unsigned int i=1;i!=5;++i)      errors(i,0)*=factor;
      double factor_squared=factor*factor;
      //scale all others by the scaled factor
      for (unsigned int i=1;i!=5;++i)  for (unsigned int j=i;j!=5;++j) errors(i,j)*=factor_squared;
      //term 0,0 is not scaled at all
      theLocalError = LocalTrajectoryError(errors);
    }
    else theLocalError *= (factor*factor);
  }
}
double BasicSingleTrajectoryState::signedInverseMomentum ( ) const [inline, virtual]
const Surface& BasicSingleTrajectoryState::surface ( ) const [inline, virtual]
virtual SurfaceSide BasicSingleTrajectoryState::surfaceSide ( ) const [inline, virtual]

Position relative to material, defined relative to momentum vector.

Implements BasicTrajectoryState.

Definition at line 178 of file BasicSingleTrajectoryState.h.

References theSurfaceSide.

                                          {
    return theSurfaceSide;
  }
double BasicSingleTrajectoryState::transverseCurvature ( ) const [inline, virtual]
void BasicSingleTrajectoryState::update ( const LocalTrajectoryParameters p,
const LocalTrajectoryError err,
const Surface aSurface,
const MagneticField field,
const SurfaceSide  side,
double  weight 
) [virtual]
void BasicSingleTrajectoryState::update ( const LocalTrajectoryParameters p,
const Surface aSurface,
const MagneticField field,
const SurfaceSide  side 
) [virtual]
virtual double BasicSingleTrajectoryState::weight ( ) const [inline, virtual]

Reimplemented from BasicTrajectoryState.

Definition at line 168 of file BasicSingleTrajectoryState.h.

References theWeight.

Referenced by update().

{return theWeight;} 

Member Data Documentation

Definition at line 218 of file BasicSingleTrajectoryState.h.

Referenced by checkCurvilinError(), checkGlobalParameters(), and update().

Definition at line 216 of file BasicSingleTrajectoryState.h.

Referenced by checkGlobalParameters(), and update().

Definition at line 222 of file BasicSingleTrajectoryState.h.

Referenced by surface(), and update().

Definition at line 221 of file BasicSingleTrajectoryState.h.

Referenced by surfaceSide(), and update().

Definition at line 224 of file BasicSingleTrajectoryState.h.

Referenced by update(), and weight().