CMS 3D CMS Logo

BasicMultiTrajectoryState Class Reference

#include <TrackingTools/GsfTools/interface/BasicMultiTrajectoryState.h>

Inheritance diagram for BasicMultiTrajectoryState:

BasicTrajectoryState ReferenceCounted

List of all members.

Public Member Functions

 BasicMultiTrajectoryState ()
 BasicMultiTrajectoryState (const std::vector< TSOS > &tsvec)
const CartesianTrajectoryErrorcartesianError () const
TrackCharge charge () const
virtual BasicMultiTrajectoryStateclone () const
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)
 Rescaling the error of the mixture with a given factor.
double signedInverseMomentum () const
const Surfacesurface () const
virtual SurfaceSide surfaceSide () const
 Position relative to material, defined relative to momentum vector.
double transverseCurvature () const
double weight () const

Private Types

typedef TrajectoryStateOnSurface TSOS

Private Member Functions

void checkCombinedState () const

Private Attributes

TSOS theCombinedState
bool theCombinedStateUp2Date
MultiTrajectoryStateCombiner theCombiner
std::vector< TSOStheStates


Detailed Description

Definition at line 10 of file BasicMultiTrajectoryState.h.


Member Typedef Documentation

typedef TrajectoryStateOnSurface BasicMultiTrajectoryState::TSOS [private]

Definition at line 12 of file BasicMultiTrajectoryState.h.


Constructor & Destructor Documentation

BasicMultiTrajectoryState::BasicMultiTrajectoryState ( const std::vector< TSOS > &  tsvec  ) 

Definition at line 8 of file BasicMultiTrajectoryState.cc.

References Exception, i, and theStates.

00008                                                                                   :
00009   theCombinedStateUp2Date( false)
00010 {
00011   theStates.reserve(tsvec.size());
00012   for (std::vector<TSOS>::const_iterator i=tsvec.begin(); i!=tsvec.end(); i++) {
00013     if (!i->isValid()) {
00014       throw cms::Exception("LogicError") << "MultiTrajectoryState constructed with invalid state";
00015     }
00016     if (i->hasError() != tsvec.front().hasError()) {
00017       throw cms::Exception("LogicError") << "MultiTrajectoryState mixes states with and without errors";
00018     }
00019     if ( &i->surface() != &tsvec.front().surface()) {
00020       throw cms::Exception("LogicError") << "MultiTrajectoryState mixes states with different surfaces";
00021     }
00022     if ( i->surfaceSide() != tsvec.front().surfaceSide()) {
00023       throw cms::Exception("LogicError") 
00024         << "MultiTrajectoryState mixes states defined before and after material";
00025     }
00026     if ( i->localParameters().pzSign()*tsvec.front().localParameters().pzSign()<0. ) {
00027       throw cms::Exception("LogicError") 
00028         << "MultiTrajectoryState mixes states with different signs of local p_z";
00029     }
00030     if ( i==tsvec.begin() ) {
00031       // only accept planes!!
00032       const BoundPlane* bp = dynamic_cast<const BoundPlane*>(&i->surface());
00033       if ( bp==0 )
00034         throw cms::Exception("LogicError") << "MultiTrajectoryState constructed on cylinder";
00035     }
00036     theStates.push_back( *i);
00037   }
00038 }

BasicMultiTrajectoryState::BasicMultiTrajectoryState (  )  [inline]

Definition at line 18 of file BasicMultiTrajectoryState.h.

Referenced by clone().

00018 {}


Member Function Documentation

const CartesianTrajectoryError& BasicMultiTrajectoryState::cartesianError (  )  const [inline, virtual]

Implements BasicTrajectoryState.

Definition at line 62 of file BasicMultiTrajectoryState.h.

References TrajectoryStateOnSurface::cartesianError(), checkCombinedState(), and theCombinedState.

00062                                                          {
00063     checkCombinedState();
00064     return theCombinedState.cartesianError();
00065   }

TrackCharge BasicMultiTrajectoryState::charge ( void   )  const [inline, virtual]

Implements BasicTrajectoryState.

Definition at line 47 of file BasicMultiTrajectoryState.h.

References TrajectoryStateOnSurface::charge(), checkCombinedState(), and theCombinedState.

00047                              {
00048     checkCombinedState();
00049     return theCombinedState.charge();
00050   }

void BasicMultiTrajectoryState::checkCombinedState (  )  const [private]

Definition at line 40 of file BasicMultiTrajectoryState.cc.

References MultiTrajectoryStateCombiner::combine(), theCombinedState, theCombinedStateUp2Date, theCombiner, and theStates.

Referenced by cartesianError(), charge(), curvilinearError(), freeTrajectoryState(), globalDirection(), globalMomentum(), globalParameters(), globalPosition(), localDirection(), localError(), localMomentum(), localParameters(), localPosition(), signedInverseMomentum(), and transverseCurvature().

00041 {
00042   if (theCombinedStateUp2Date) return;
00043 
00044   theCombinedState = theCombiner.combine( theStates);
00045   theCombinedStateUp2Date = true;
00046   
00047 }

virtual BasicMultiTrajectoryState* BasicMultiTrajectoryState::clone ( void   )  const [inline, virtual]

Implements BasicTrajectoryState.

Definition at line 121 of file BasicMultiTrajectoryState.h.

References BasicMultiTrajectoryState().

00121                                                    {
00122     return new BasicMultiTrajectoryState(*this);
00123   }

virtual std::vector<TrajectoryStateOnSurface> BasicMultiTrajectoryState::components (  )  const [inline, virtual]

Reimplemented from BasicTrajectoryState.

Definition at line 125 of file BasicMultiTrajectoryState.h.

References theStates.

00125                                                                  {
00126     return theStates;
00127   }

const CurvilinearTrajectoryError& BasicMultiTrajectoryState::curvilinearError (  )  const [inline, virtual]

Implements BasicTrajectoryState.

Definition at line 67 of file BasicMultiTrajectoryState.h.

References checkCombinedState(), TrajectoryStateOnSurface::curvilinearError(), and theCombinedState.

00067                                                              {
00068     checkCombinedState();
00069     return theCombinedState.curvilinearError();
00070   }

FreeTrajectoryState* BasicMultiTrajectoryState::freeTrajectoryState ( bool  withErrors = true  )  const [inline, virtual]

Implements BasicTrajectoryState.

Definition at line 72 of file BasicMultiTrajectoryState.h.

References checkCombinedState(), TrajectoryStateOnSurface::freeTrajectoryState(), and theCombinedState.

00072                                                                          {
00073     checkCombinedState();
00074     return theCombinedState.freeTrajectoryState(withErrors);
00075   }

GlobalVector BasicMultiTrajectoryState::globalDirection (  )  const [inline, virtual]

Implements BasicTrajectoryState.

Definition at line 42 of file BasicMultiTrajectoryState.h.

References checkCombinedState(), TrajectoryStateOnSurface::globalDirection(), and theCombinedState.

00042                                        {
00043     checkCombinedState();
00044     return theCombinedState.globalDirection();
00045   }

GlobalVector BasicMultiTrajectoryState::globalMomentum (  )  const [inline, virtual]

Implements BasicTrajectoryState.

Definition at line 37 of file BasicMultiTrajectoryState.h.

References checkCombinedState(), TrajectoryStateOnSurface::globalMomentum(), and theCombinedState.

00037                                       {
00038     checkCombinedState();
00039     return theCombinedState.globalMomentum();
00040   }

const GlobalTrajectoryParameters& BasicMultiTrajectoryState::globalParameters ( void   )  const [inline, virtual]

Implements BasicTrajectoryState.

Definition at line 27 of file BasicMultiTrajectoryState.h.

References checkCombinedState(), TrajectoryStateOnSurface::globalParameters(), and theCombinedState.

00027                                                              {
00028     checkCombinedState();
00029     return theCombinedState.globalParameters();
00030   }

GlobalPoint BasicMultiTrajectoryState::globalPosition (  )  const [inline, virtual]

Implements BasicTrajectoryState.

Definition at line 32 of file BasicMultiTrajectoryState.h.

References checkCombinedState(), TrajectoryStateOnSurface::globalPosition(), and theCombinedState.

00032                                      {
00033     checkCombinedState();
00034     return theCombinedState.globalPosition();
00035   }

bool BasicMultiTrajectoryState::hasError ( void   )  const [inline, virtual]

Implements BasicTrajectoryState.

Definition at line 22 of file BasicMultiTrajectoryState.h.

References isValid(), and theStates.

00022                         {
00023     if (isValid()) return theStates.front().hasError();
00024     return false;
00025   }

bool BasicMultiTrajectoryState::isValid ( void   )  const [inline, virtual]

Implements BasicTrajectoryState.

Definition at line 20 of file BasicMultiTrajectoryState.h.

References theStates.

Referenced by hasError(), and surface().

00020 { return !theStates.empty() && theStates.front().isValid();}

LocalVector BasicMultiTrajectoryState::localDirection (  )  const [inline, virtual]

Implements BasicTrajectoryState.

Definition at line 94 of file BasicMultiTrajectoryState.h.

References checkCombinedState(), TrajectoryStateOnSurface::localDirection(), and theCombinedState.

00094                                      {
00095     checkCombinedState();
00096     return theCombinedState.localDirection();
00097   }

const LocalTrajectoryError& BasicMultiTrajectoryState::localError (  )  const [inline, virtual]

Implements BasicTrajectoryState.

Definition at line 99 of file BasicMultiTrajectoryState.h.

References checkCombinedState(), TrajectoryStateOnSurface::localError(), and theCombinedState.

00099                                                  {
00100     checkCombinedState();
00101     return theCombinedState.localError();
00102   }

LocalVector BasicMultiTrajectoryState::localMomentum (  )  const [inline, virtual]

Implements BasicTrajectoryState.

Definition at line 89 of file BasicMultiTrajectoryState.h.

References checkCombinedState(), TrajectoryStateOnSurface::localMomentum(), and theCombinedState.

00089                                     {
00090     checkCombinedState();
00091     return theCombinedState.localMomentum();
00092   }

const LocalTrajectoryParameters& BasicMultiTrajectoryState::localParameters (  )  const [inline, virtual]

Implements BasicTrajectoryState.

Definition at line 79 of file BasicMultiTrajectoryState.h.

References checkCombinedState(), TrajectoryStateOnSurface::localParameters(), and theCombinedState.

00079                                                            {
00080     checkCombinedState();
00081     return theCombinedState.localParameters();
00082   }

LocalPoint BasicMultiTrajectoryState::localPosition (  )  const [inline, virtual]

Implements BasicTrajectoryState.

Definition at line 84 of file BasicMultiTrajectoryState.h.

References checkCombinedState(), TrajectoryStateOnSurface::localPosition(), and theCombinedState.

00084                                    {
00085     checkCombinedState();
00086     return theCombinedState.localPosition();
00087   }

const MagneticField * BasicMultiTrajectoryState::magneticField (  )  const [virtual]

Implements BasicTrajectoryState.

Definition at line 79 of file BasicMultiTrajectoryState.cc.

References theStates.

00080 {
00081   //
00082   // Magnetic field should be identical in all components:
00083   // avoid forcing the combination of states and take value from 1st component!
00084   //
00085   if (theStates.empty()) {
00086     edm::LogError("BasicMultiTrajectoryState") 
00087       << "Asking for magneticField of empty MultiTrajectoryState, returning null pointer!";
00088     return 0;
00089   }
00090   return theStates.front().magneticField();
00091 }

void BasicMultiTrajectoryState::rescaleError ( double  factor  )  [virtual]

Rescaling the error of the mixture with a given factor.

Please note that this rescaling is imposed on each of the components of the mixture and does therefore not exactly correspond to rescaling theCombinedState with the same factor.

Implements BasicTrajectoryState.

Definition at line 65 of file BasicMultiTrajectoryState.cc.

References it, theCombinedStateUp2Date, and theStates.

00065                                                           {
00066 
00067   if (theStates.empty()) {
00068     edm::LogError("BasicMultiTrajectoryState") << "Trying to rescale errors of empty MultiTrajectoryState!";
00069     return;
00070   }
00071   
00072   for (std::vector<TSOS>::iterator it = theStates.begin(); it != theStates.end(); it++) {
00073     it->rescaleError(factor);
00074   }
00075   theCombinedStateUp2Date = false;
00076 }

double BasicMultiTrajectoryState::signedInverseMomentum (  )  const [inline, virtual]

Implements BasicTrajectoryState.

Definition at line 52 of file BasicMultiTrajectoryState.h.

References checkCombinedState(), TrajectoryStateOnSurface::signedInverseMomentum(), and theCombinedState.

00052                                        {
00053     checkCombinedState();
00054     return theCombinedState.signedInverseMomentum();
00055   }

const Surface& BasicMultiTrajectoryState::surface (  )  const [inline, virtual]

Implements BasicTrajectoryState.

Definition at line 104 of file BasicMultiTrajectoryState.h.

References Exception, isValid(), and theStates.

00104                                  {
00105     if (!isValid()) 
00106       throw cms::Exception("LogicError") 
00107         << "surface() called for invalid MultiTrajectoryState";
00108     return theStates.front().surface();
00109   }

SurfaceSide BasicMultiTrajectoryState::surfaceSide (  )  const [virtual]

Position relative to material, defined relative to momentum vector.

Implements BasicTrajectoryState.

Definition at line 94 of file BasicMultiTrajectoryState.cc.

References SurfaceSideDefinition::atCenterOfSurface, and theStates.

00095 {
00096   //
00097   // SurfaceSide should be identical in all components:
00098   // avoid forcing the combination of states and take value from 1st component!
00099   //
00100   if (theStates.empty()) {
00101     edm::LogError("BasicMultiTrajectoryState") 
00102       << "Asking for magneticField of empty MultiTrajectoryState, returning atCenterOfSurface!";
00103     return atCenterOfSurface;
00104   }
00105   return theStates.front().surfaceSide();
00106 }

double BasicMultiTrajectoryState::transverseCurvature (  )  const [inline, virtual]

Implements BasicTrajectoryState.

Definition at line 57 of file BasicMultiTrajectoryState.h.

References checkCombinedState(), theCombinedState, and TrajectoryStateOnSurface::transverseCurvature().

00057                                      {
00058     checkCombinedState();
00059     return theCombinedState.transverseCurvature();
00060   }

double BasicMultiTrajectoryState::weight (  )  const [virtual]

Reimplemented from BasicTrajectoryState.

Definition at line 49 of file BasicMultiTrajectoryState.cc.

References it, and theStates.

00049                                                {
00050 
00051   if (theStates.empty()) {
00052     edm::LogError("BasicMultiTrajectoryState") 
00053       << "Asking for weight of empty MultiTrajectoryState, returning zero!";
00054     return 0.;
00055   }
00056 
00057   double sumw = 0.;
00058   for (std::vector<TSOS>::const_iterator it = theStates.begin(); it != theStates.end(); it++) {
00059     sumw += it->weight();
00060   }
00061   return sumw;
00062 }


Member Data Documentation

TSOS BasicMultiTrajectoryState::theCombinedState [mutable, private]

Definition at line 136 of file BasicMultiTrajectoryState.h.

Referenced by cartesianError(), charge(), checkCombinedState(), curvilinearError(), freeTrajectoryState(), globalDirection(), globalMomentum(), globalParameters(), globalPosition(), localDirection(), localError(), localMomentum(), localParameters(), localPosition(), signedInverseMomentum(), and transverseCurvature().

bool BasicMultiTrajectoryState::theCombinedStateUp2Date [mutable, private]

Definition at line 137 of file BasicMultiTrajectoryState.h.

Referenced by checkCombinedState(), and rescaleError().

MultiTrajectoryStateCombiner BasicMultiTrajectoryState::theCombiner [private]

Definition at line 138 of file BasicMultiTrajectoryState.h.

Referenced by checkCombinedState().

std::vector<TSOS> BasicMultiTrajectoryState::theStates [private]

Definition at line 134 of file BasicMultiTrajectoryState.h.

Referenced by BasicMultiTrajectoryState(), checkCombinedState(), components(), hasError(), isValid(), magneticField(), rescaleError(), surface(), surfaceSide(), and weight().


The documentation for this class was generated from the following files:
Generated on Tue Jun 9 18:14:58 2009 for CMSSW by  doxygen 1.5.4