CMS 3D CMS Logo

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

BasicTrajectoryState Class Reference

#include <BasicTrajectoryState.h>

Inheritance diagram for BasicTrajectoryState:
ReferenceCountedPoolAllocated BlockWipedPoolAllocated BasicMultiTrajectoryState BasicSingleTrajectoryState

List of all members.

Public Types

typedef BasicTrajectoryState BTSOS
typedef ProxyBase< BTSOS,
CopyUsingClone< BTSOS > > 
Proxy
typedef
ReferenceCountingPointer
< BasicTrajectoryState
RCPtr
typedef
SurfaceSideDefinition::SurfaceSide 
SurfaceSide

Public Member Functions

 BasicTrajectoryState ()
 BasicTrajectoryState (const Surface &aSurface)
 construct invalid trajectory state (without parameters)
 BasicTrajectoryState (const FreeTrajectoryState &fts, const Surface &aSurface, const SurfaceSide side=SurfaceSideDefinition::atCenterOfSurface)
 BasicTrajectoryState (const GlobalTrajectoryParameters &par, const CurvilinearTrajectoryError &err, const Surface &aSurface, double weight)
 BasicTrajectoryState (const LocalTrajectoryParameters &par, const Surface &aSurface, const MagneticField *field, const SurfaceSide side=SurfaceSideDefinition::atCenterOfSurface)
 BasicTrajectoryState (const GlobalTrajectoryParameters &par, const Surface &aSurface, const SurfaceSide side=SurfaceSideDefinition::atCenterOfSurface)
 BasicTrajectoryState (const LocalTrajectoryParameters &par, const LocalTrajectoryError &err, const Surface &aSurface, const MagneticField *field, const SurfaceSide side=SurfaceSideDefinition::atCenterOfSurface, double weight=1.)
 BasicTrajectoryState (const LocalTrajectoryParameters &par, const LocalTrajectoryError &err, const Surface &aSurface, const MagneticField *field, double weight)
 BasicTrajectoryState (const GlobalTrajectoryParameters &par, const CartesianTrajectoryError &err, const Surface &aSurface, const SurfaceSide side=SurfaceSideDefinition::atCenterOfSurface)
 BasicTrajectoryState (const GlobalTrajectoryParameters &par, const CurvilinearTrajectoryError &err, const Surface &aSurface, const SurfaceSide side=SurfaceSideDefinition::atCenterOfSurface, double weight=1.)
virtual bool canUpdateLocalParameters () const
const CartesianTrajectoryError cartesianError () const
TrackCharge charge () const
virtual BasicTrajectoryStateclone () const =0
virtual std::vector
< TrajectoryStateOnSurface
components () 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 rescaleError (double factor)
double signedInverseMomentum () const
const Surfacesurface () const
SurfaceSide surfaceSide () const
 Position relative to material, defined relative to momentum vector.
double transverseCurvature () const
virtual void update (const LocalTrajectoryParameters &p, const LocalTrajectoryError &err, const Surface &aSurface, const MagneticField *field, const SurfaceSide side, double weight)
virtual void update (const LocalTrajectoryParameters &p, const Surface &aSurface, const MagneticField *field, const SurfaceSide side)
virtual double weight () const
virtual ~BasicTrajectoryState ()

Private Member Functions

void checkCurvilinError () const dso_internal
void checkGlobalParameters () const dso_internal
void createLocalError () const
void createLocalErrorFromCurvilinearError () const dso_internal
void createLocalParameters () const
void missingError (char const *where) const

Static Private Member Functions

static void notValid ()

Private Attributes

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

Friends

class ProxyBase< BTSOS, CopyUsingClone< BTSOS > >
class ReferenceCountingPointer< BasicTrajectoryState >

Detailed Description

No so Abstract (anyore) base class for TrajectoryState. It is ReferenceCounted.

VI 8/12/2011 content of BasicSingleTrajectoryState moved here.... fully devirtualized

Definition at line 48 of file BasicTrajectoryState.h.


Member Typedef Documentation

Definition at line 51 of file BasicTrajectoryState.h.

Definition at line 52 of file BasicTrajectoryState.h.

Definition at line 53 of file BasicTrajectoryState.h.

Definition at line 54 of file BasicTrajectoryState.h.


Constructor & Destructor Documentation

BasicTrajectoryState::BasicTrajectoryState ( ) [inline]

Definition at line 62 of file BasicTrajectoryState.h.

{}
BasicTrajectoryState::BasicTrajectoryState ( const Surface aSurface) [explicit]

construct invalid trajectory state (without parameters)

Definition at line 144 of file BasicTrajectoryState.cc.

BasicTrajectoryState::~BasicTrajectoryState ( ) [virtual]

Definition at line 157 of file BasicTrajectoryState.cc.

{}
BasicTrajectoryState::BasicTrajectoryState ( 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 14 of file BasicTrajectoryState.cc.

BasicTrajectoryState::BasicTrajectoryState ( 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 BasicTrajectoryState.cc.

BasicTrajectoryState::BasicTrajectoryState ( 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 44 of file BasicTrajectoryState.cc.

BasicTrajectoryState::BasicTrajectoryState ( 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 60 of file BasicTrajectoryState.cc.

BasicTrajectoryState::BasicTrajectoryState ( 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 77 of file BasicTrajectoryState.cc.

BasicTrajectoryState::BasicTrajectoryState ( 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 93 of file BasicTrajectoryState.cc.

BasicTrajectoryState::BasicTrajectoryState ( 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 109 of file BasicTrajectoryState.cc.

BasicTrajectoryState::BasicTrajectoryState ( 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 127 of file BasicTrajectoryState.cc.


Member Function Documentation

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

Reimplemented in BasicMultiTrajectoryState.

Definition at line 231 of file BasicTrajectoryState.h.

{ return true; }
const CartesianTrajectoryError BasicTrajectoryState::cartesianError ( ) const [inline]
TrackCharge BasicTrajectoryState::charge ( void  ) const [inline]

Definition at line 152 of file BasicTrajectoryState.h.

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

Referenced by PixelTrackBuilder::build().

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

Definition at line 192 of file BasicTrajectoryState.cc.

References LocalTrajectoryParameters::charge(), likely, LocalTrajectoryParameters::momentum(), AlCaHLTBitMon_ParallelJobs::p, LocalTrajectoryParameters::position(), DeepCopyPointer< T >::replaceWith(), surface(), theField, theFreeState, theGlobalParamsUp2Date, theLocalParameters, Surface::toGlobal(), and x.

Referenced by freeTrajectoryState().

                                                       {
  if likely(theGlobalParamsUp2Date) return;
 
  //    cout<<"!theGlobalParamsUp2Date"<<endl;
  theGlobalParamsUp2Date = true;
  // calculate global parameters from local
  GlobalPoint  x = surface().toGlobal(theLocalParameters.position());
  GlobalVector p = surface().toGlobal(theLocalParameters.momentum());
  // replace in place
  FreeTrajectoryState * fts = &(*theFreeState);
  if (fts) { 
    fts->~FreeTrajectoryState();
    new(fts) FreeTrajectoryState(x, p, theLocalParameters.charge(), theField);
  }else {
    theFreeState.replaceWith(new FreeTrajectoryState(x, p,
                                                     theLocalParameters.charge(),
                                                     theField));
  } 
}
virtual BasicTrajectoryState* BasicTrajectoryState::clone ( ) const [pure virtual]
std::vector< TrajectoryStateOnSurface > BasicTrajectoryState::components ( ) const [virtual]

Reimplemented in BasicMultiTrajectoryState.

Definition at line 343 of file BasicTrajectoryState.cc.

References query::result.

                                       {
  std::vector<TrajectoryStateOnSurface> result; result.reserve(1);
  result.push_back( const_cast<BasicTrajectoryState*>(this));
  return result;
}
void BasicTrajectoryState::createLocalError ( ) const [private]
void BasicTrajectoryState::createLocalErrorFromCurvilinearError ( ) const [private]

Definition at line 252 of file BasicTrajectoryState.cc.

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

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);

  verifyCurvErr(theFreeState->curvilinearError());
  verifyLocalErr(theLocalError);

}
void BasicTrajectoryState::createLocalParameters ( ) const [private]
const CurvilinearTrajectoryError& BasicTrajectoryState::curvilinearError ( ) const [inline]

Definition at line 169 of file BasicTrajectoryState.h.

References FreeTrajectoryState::curvilinearError(), freeTrajectoryState(), hasError(), missingError(), and unlikely.

Referenced by PixelTrackBuilder::build().

                                                             {
    if unlikely(!hasError()) {
        missingError(" accesing curvilinearerror.");
        static CurvilinearTrajectoryError crap;
        return crap;
      }
    return freeTrajectoryState()->curvilinearError();
  }
FreeTrajectoryState * BasicTrajectoryState::freeTrajectoryState ( bool  withErrors = true) const
GlobalVector BasicTrajectoryState::globalDirection ( ) const [inline]
GlobalVector BasicTrajectoryState::globalMomentum ( ) const [inline]

Definition at line 146 of file BasicTrajectoryState.h.

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

Referenced by PixelTrackBuilder::build().

                                      {
    return freeTrajectoryState(false)->momentum();
  }
const GlobalTrajectoryParameters& BasicTrajectoryState::globalParameters ( void  ) const [inline]

Definition at line 140 of file BasicTrajectoryState.h.

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

                                                             {
    return freeTrajectoryState(false)->parameters();
  }
GlobalPoint BasicTrajectoryState::globalPosition ( ) const [inline]

Definition at line 143 of file BasicTrajectoryState.h.

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

Referenced by PixelTrackBuilder::build().

                                     {
    return freeTrajectoryState(false)->position();
  }
bool BasicTrajectoryState::hasError ( void  ) const [inline]
bool BasicTrajectoryState::isValid ( void  ) const [inline]

Definition at line 134 of file BasicTrajectoryState.h.

References theFreeState, and theLocalParametersValid.

Referenced by freeTrajectoryState(), and localParameters().

LocalVector BasicTrajectoryState::localDirection ( ) const [inline]

Definition at line 196 of file BasicTrajectoryState.h.

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

                                     {
    return localMomentum().unit();
  }
const LocalTrajectoryError& BasicTrajectoryState::localError ( ) const [inline]
LocalVector BasicTrajectoryState::localMomentum ( ) const [inline]

Definition at line 193 of file BasicTrajectoryState.h.

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

Referenced by localDirection().

                                    {
    return localParameters().momentum();
  }
const LocalTrajectoryParameters& BasicTrajectoryState::localParameters ( ) const [inline]
LocalPoint BasicTrajectoryState::localPosition ( ) const [inline]

Definition at line 190 of file BasicTrajectoryState.h.

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

                                   {
    return localParameters().position();
  }
const MagneticField* BasicTrajectoryState::magneticField ( ) const [inline]

Definition at line 181 of file BasicTrajectoryState.h.

References theField.

{ return theField; }
void BasicTrajectoryState::missingError ( char const *  where) const [private]

Definition at line 177 of file BasicTrajectoryState.cc.

References LocalTrajectoryError::matrix(), theFreeState, theLocalError, and LocalTrajectoryError::valid().

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

                                                               {
  std::stringstream form;
  form<<"BasicTrajectoryState: attempt to access errors when none available "
      <<where<<".\nfreestate pointer: " <<theFreeState
      <<"\nlocal error valid/values :"<< theLocalError.valid() << "\n" 
      <<  theLocalError.matrix();

  edm::LogWarning("BasicTrajectoryState") << form.str();

  // throw TrajectoryStateException(form.str());
}
void BasicTrajectoryState::notValid ( ) [static, private]

Definition at line 159 of file BasicTrajectoryState.cc.

Referenced by freeTrajectoryState(), and localParameters().

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

Reimplemented in BasicMultiTrajectoryState.

Definition at line 307 of file BasicTrajectoryState.cc.

References benchmark_cfg::errors, hasError(), i, j, LocalTrajectoryError::matrix(), missingError(), MagneticField::nominalValue(), theField, theFreeState, theLocalError, unlikely, and LocalTrajectoryError::valid().

                                                {
  if unlikely(!hasError()) missingError(" trying to rescale");    
  if (theFreeState)
    theFreeState->rescaleError(factor);
  
  if (theLocalError.valid()){
    //do it by hand if the free state is not around.
    bool zeroField = (theField->nominalValue()==0);
    if unlikely(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 BasicTrajectoryState::signedInverseMomentum ( ) const [inline]
const Surface& BasicTrajectoryState::surface ( ) const [inline]
SurfaceSide BasicTrajectoryState::surfaceSide ( ) const [inline]

Position relative to material, defined relative to momentum vector.

Definition at line 220 of file BasicTrajectoryState.h.

References theSurfaceSide.

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

Definition at line 213 of file BasicTrajectoryState.h.

References theWeight.

Referenced by BasicMultiTrajectoryState::combine(), and update().

{return theWeight;} 

Friends And Related Function Documentation

friend class ProxyBase< BTSOS, CopyUsingClone< BTSOS > > [friend]

Definition at line 57 of file BasicTrajectoryState.h.

Definition at line 58 of file BasicTrajectoryState.h.


Member Data Documentation

Definition at line 273 of file BasicTrajectoryState.h.

Referenced by checkGlobalParameters(), and update().

Definition at line 277 of file BasicTrajectoryState.h.

Referenced by surface(), and update().

Definition at line 276 of file BasicTrajectoryState.h.

Referenced by surfaceSide(), and update().

Definition at line 279 of file BasicTrajectoryState.h.

Referenced by update(), and weight().