CMS 3D CMS Logo

Public Types | Public Member Functions | Protected Member Functions

DualReferenceTrajectory Class Reference

#include <DualReferenceTrajectory.h>

Inheritance diagram for DualReferenceTrajectory:
ReferenceTrajectoryBase ReferenceCounted DualBzeroReferenceTrajectory

List of all members.

Public Types

typedef
TransientTrackingRecHit::ConstRecHitContainer 
ConstRecHitContainer

Public Member Functions

virtual DualReferenceTrajectoryclone () const
 DualReferenceTrajectory (const TrajectoryStateOnSurface &referenceTsos, const ConstRecHitContainer &forwardRecHits, const ConstRecHitContainer &backwardRecHits, const MagneticField *magField, MaterialEffects materialEffects, PropagationDirection propDir, double mass, bool useBeamSpot, const reco::BeamSpot &beamSpot)
virtual ~DualReferenceTrajectory ()

Protected Member Functions

virtual bool construct (const TrajectoryStateOnSurface &referenceTsos, const ConstRecHitContainer &forwardRecHits, const ConstRecHitContainer &backwardRecHits, double mass, MaterialEffects materialEffects, const PropagationDirection propDir, const MagneticField *magField, bool useBeamSpot, const reco::BeamSpot &beamSpot)
virtual ReferenceTrajectoryconstruct (const TrajectoryStateOnSurface &referenceTsos, const ConstRecHitContainer &recHits, double mass, MaterialEffects materialEffects, const PropagationDirection propDir, const MagneticField *magField, bool useBeamSpot, const reco::BeamSpot &beamSpot) const
 DualReferenceTrajectory (unsigned int nPar, unsigned int nHits)
virtual AlgebraicVector extractParameters (const TrajectoryStateOnSurface &referenceTsos) const
const PropagationDirection oppositeDirection (const PropagationDirection propDir) const

Detailed Description

Definition at line 35 of file DualReferenceTrajectory.h.


Member Typedef Documentation

Reimplemented in DualBzeroReferenceTrajectory.

Definition at line 40 of file DualReferenceTrajectory.h.


Constructor & Destructor Documentation

DualReferenceTrajectory::DualReferenceTrajectory ( const TrajectoryStateOnSurface referenceTsos,
const ConstRecHitContainer forwardRecHits,
const ConstRecHitContainer backwardRecHits,
const MagneticField magField,
MaterialEffects  materialEffects,
PropagationDirection  propDir,
double  mass,
bool  useBeamSpot,
const reco::BeamSpot beamSpot 
)

Definition at line 11 of file DualReferenceTrajectory.cc.

References construct(), and ReferenceTrajectoryBase::theValidityFlag.

Referenced by clone().

  : ReferenceTrajectoryBase(referenceTsos.localParameters().mixedFormatVector().kSize,
                            numberOfUsedRecHits(forwardRecHits) + numberOfUsedRecHits(backwardRecHits) - 1,
                            0, 0)
{
  theValidityFlag = this->construct( referenceTsos, forwardRecHits, backwardRecHits,
                                     mass, materialEffects, propDir, magField, useBeamSpot, beamSpot );
}
virtual DualReferenceTrajectory::~DualReferenceTrajectory ( ) [inline, virtual]

Definition at line 52 of file DualReferenceTrajectory.h.

{}
DualReferenceTrajectory::DualReferenceTrajectory ( unsigned int  nPar,
unsigned int  nHits 
) [protected]

Definition at line 30 of file DualReferenceTrajectory.cc.

  : ReferenceTrajectoryBase(nPar, nHits, 0, 0)
{}

Member Function Documentation

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

Implements ReferenceTrajectoryBase.

Reimplemented in DualBzeroReferenceTrajectory.

Definition at line 54 of file DualReferenceTrajectory.h.

References DualReferenceTrajectory().

{ return new DualReferenceTrajectory(*this); }
bool DualReferenceTrajectory::construct ( const TrajectoryStateOnSurface referenceTsos,
const ConstRecHitContainer forwardRecHits,
const ConstRecHitContainer backwardRecHits,
double  mass,
MaterialEffects  materialEffects,
const PropagationDirection  propDir,
const MagneticField magField,
bool  useBeamSpot,
const reco::BeamSpot beamSpot 
) [protected, virtual]

internal method to calculate members

Definition at line 35 of file DualReferenceTrajectory.cc.

References ReferenceTrajectoryBase::breakPoints, ReferenceTrajectoryBase::derivatives(), Exception, extractParameters(), ReferenceTrajectoryBase::isValid(), ReferenceTrajectoryBase::measurementErrors(), ReferenceTrajectoryBase::measurements(), ReferenceTrajectoryBase::nMeasPerHit, ReferenceTrajectoryBase::numberOfHitMeas(), ReferenceTrajectoryBase::numberOfMsMeas(), oppositeDirection(), ReferenceTrajectoryBase::recHits(), ReferenceTrajectoryBase::theDerivatives, ReferenceTrajectoryBase::theMeasurements, ReferenceTrajectoryBase::theMeasurementsCov, ReferenceTrajectoryBase::theNumberOfPars, ReferenceTrajectoryBase::theParameters, ReferenceTrajectoryBase::theRecHits, ReferenceTrajectoryBase::theTrajectoryPositionCov, ReferenceTrajectoryBase::theTrajectoryPositions, ReferenceTrajectoryBase::theTsosVec, ReferenceTrajectoryBase::trajectoryPositionErrors(), ReferenceTrajectoryBase::trajectoryPositions(), and ReferenceTrajectoryBase::trajectoryStates().

Referenced by DualReferenceTrajectory().

{
  if (materialEffects >= breakPoints)  throw cms::Exception("BadConfig")
    << "[DualReferenceTrajectory::construct] Wrong MaterialEffects: " << materialEffects;
    
  ReferenceTrajectoryBase* fwdTraj = construct(refTsos, forwardRecHits,
                                               mass, materialEffects,
                                               propDir, magField, useBeamSpot, beamSpot);

  ReferenceTrajectoryBase* bwdTraj = construct(refTsos, backwardRecHits,
                                               mass, materialEffects,
                                               oppositeDirection(propDir), magField, false, beamSpot);

  if ( !( fwdTraj->isValid() && bwdTraj->isValid() ) )
  {
    delete fwdTraj;
    delete bwdTraj;
    return false;
  }

  //
  // Combine both reference trajactories to a dual reference trajectory
  //

  const std::vector<TrajectoryStateOnSurface>& fwdTsosVec = fwdTraj->trajectoryStates();
  const std::vector<TrajectoryStateOnSurface>& bwdTsosVec = bwdTraj->trajectoryStates();
  theTsosVec.insert( theTsosVec.end(), fwdTsosVec.begin(), fwdTsosVec.end() );
  theTsosVec.insert( theTsosVec.end(), ++bwdTsosVec.begin(), bwdTsosVec.end() );

  const ConstRecHitContainer &fwdRecHits = fwdTraj->recHits();
  const ConstRecHitContainer &bwdRecHits = bwdTraj->recHits();
  theRecHits.insert( theRecHits.end(), fwdRecHits.begin(), fwdRecHits.end() );
  theRecHits.insert( theRecHits.end(), ++bwdRecHits.begin(), bwdRecHits.end() );

  theParameters = extractParameters( refTsos );
  
  unsigned int nParam   = theNumberOfPars;
  unsigned int nFwdMeas = fwdTraj->numberOfHitMeas();
  unsigned int nBwdMeas = bwdTraj->numberOfHitMeas();
  unsigned int nFwdBP   = fwdTraj->numberOfMsMeas();
  unsigned int nBwdBP   = bwdTraj->numberOfMsMeas();
  unsigned int nMeas    = nFwdMeas+nBwdMeas-nMeasPerHit; 
       
  theMeasurements.sub( 1, fwdTraj->measurements().sub( 1, nFwdMeas ) );
  theMeasurements.sub( nFwdMeas+1, bwdTraj->measurements().sub( nMeasPerHit+1, nBwdMeas ) );
    
  theMeasurementsCov.sub( 1, fwdTraj->measurementErrors().sub( 1, nFwdMeas ) );
  theMeasurementsCov.sub( nFwdMeas+1, bwdTraj->measurementErrors().sub( nMeasPerHit+1, nBwdMeas ) );
  
  theTrajectoryPositions.sub( 1, fwdTraj->trajectoryPositions() );
  theTrajectoryPositions.sub( nFwdMeas+1, bwdTraj->trajectoryPositions().sub( nMeasPerHit+1, nBwdMeas ) );

  theTrajectoryPositionCov.sub( 1, fwdTraj->trajectoryPositionErrors() );
  theTrajectoryPositionCov.sub( nFwdMeas+1, bwdTraj->trajectoryPositionErrors().sub( nMeasPerHit+1, nBwdMeas ) );

  theDerivatives.sub( 1, 1, fwdTraj->derivatives().sub( 1, nFwdMeas, 1, nParam ) );
  theDerivatives.sub( nFwdMeas+1, 1, bwdTraj->derivatives().sub( nMeasPerHit+1, nBwdMeas, 1, nParam ) );
  
// for the break points 
// DUAL with break points makes no sense: (MS) correlations between the two parts are lost ! 
  if (nFwdBP>0 )
  {
    theMeasurements.sub( nMeas+1, fwdTraj->measurements().sub( nFwdMeas+1, nFwdMeas+nFwdBP ) );
    theMeasurementsCov.sub( nMeas+1, fwdTraj->measurementErrors().sub( nFwdMeas+1, nFwdMeas+nFwdBP ) );  
    theDerivatives.sub( 1, nParam+1, fwdTraj->derivatives().sub( 1, nFwdMeas, nParam+1, nParam+nFwdBP ) );
    theDerivatives.sub( nMeas+1, nParam+1, fwdTraj->derivatives().sub( nFwdMeas+1, nFwdMeas+nFwdBP, nParam+1, nParam+nFwdBP ) );
  }  
  if (nBwdBP>0 )
  {
    theMeasurements.sub( nMeas+nFwdBP+1, bwdTraj->measurements().sub( nBwdMeas+1, nBwdMeas+nBwdBP ) );  
    theMeasurementsCov.sub( nMeas+nFwdBP+1, bwdTraj->measurementErrors().sub( nBwdMeas+1, nBwdMeas+nBwdBP ) );  
    theDerivatives.sub( nFwdMeas+1, nParam+nFwdBP+1, bwdTraj->derivatives().sub( nMeasPerHit+1, nBwdMeas, nParam+1, nParam+nBwdBP ) );
    theDerivatives.sub( nMeas+nFwdBP+1, nParam+nFwdBP+1, bwdTraj->derivatives().sub( nBwdMeas+1, nBwdMeas+nBwdBP, nParam+1, nParam+nBwdBP ) );
  }
    
  delete fwdTraj;
  delete bwdTraj;

  return true; 
}
ReferenceTrajectory * DualReferenceTrajectory::construct ( const TrajectoryStateOnSurface referenceTsos,
const ConstRecHitContainer recHits,
double  mass,
MaterialEffects  materialEffects,
const PropagationDirection  propDir,
const MagneticField magField,
bool  useBeamSpot,
const reco::BeamSpot beamSpot 
) const [protected, virtual]

Reimplemented in DualBzeroReferenceTrajectory.

Definition at line 125 of file DualReferenceTrajectory.cc.

References ReferenceTrajectoryBase::breakPoints, and Exception.

{
  if (materialEffects >= breakPoints)  throw cms::Exception("BadConfig")
    << "[DualReferenceTrajectory::construct] Wrong MaterialEffects: " << materialEffects;
  
  return new ReferenceTrajectory(referenceTsos, recHits, false,
                                 magField, materialEffects, propDir, mass,
                                 useBeamSpot, beamSpot);
}
AlgebraicVector DualReferenceTrajectory::extractParameters ( const TrajectoryStateOnSurface referenceTsos) const [protected, virtual]

Reimplemented in DualBzeroReferenceTrajectory.

Definition at line 143 of file DualReferenceTrajectory.cc.

References TrajectoryStateOnSurface::localParameters(), and LocalTrajectoryParameters::mixedFormatVector().

Referenced by construct().

{
  return asHepVector<5>( referenceTsos.localParameters().mixedFormatVector() );
}
const PropagationDirection DualReferenceTrajectory::oppositeDirection ( const PropagationDirection  propDir) const [inline, protected]

Definition at line 81 of file DualReferenceTrajectory.h.

References alongMomentum, anyDirection, and oppositeToMomentum.

Referenced by construct().

  { return ( propDir == anyDirection ) ? anyDirection : ( ( propDir == alongMomentum ) ? oppositeToMomentum : alongMomentum ); }