CMS 3D CMS Logo

DualBzeroTrajectoryFactory Class Reference

A factory that produces instances of class ReferenceTrajectory from a given TrajTrackPairCollection. More...

#include <Alignment/ReferenceTrajectories/plugins/DualBzeroTrajectoryFactory.h>

Inheritance diagram for DualBzeroTrajectoryFactory:

TrajectoryFactoryBase

List of all members.

Public Member Functions

virtual
DualBzeroTrajectoryFactory
clone (void) const
 DualBzeroTrajectoryFactory (const edm::ParameterSet &config)
virtual const
ReferenceTrajectoryCollection 
trajectories (const edm::EventSetup &setup, const ConstTrajTrackPairCollection &tracks, const ExternalPredictionCollection &external) const
virtual const
ReferenceTrajectoryCollection 
trajectories (const edm::EventSetup &setup, const ConstTrajTrackPairCollection &tracks) const
 Produce the reference trajectories.
virtual ~DualBzeroTrajectoryFactory (void)

Protected Member Functions

const TrajectoryStateOnSurface propagateExternal (const TrajectoryStateOnSurface &external, const Surface &surface, const MagneticField *magField) const
const DualBzeroTrajectoryInput referenceStateAndRecHits (const ConstTrajTrackPair &track) const

Protected Attributes

double theMass
double theMomentumEstimate

Classes

struct  DualBzeroTrajectoryInput


Detailed Description

A factory that produces instances of class ReferenceTrajectory from a given TrajTrackPairCollection.

Definition at line 9 of file DualBzeroTrajectoryFactory.h.


Constructor & Destructor Documentation

DualBzeroTrajectoryFactory::DualBzeroTrajectoryFactory ( const edm::ParameterSet config  ) 

Definition at line 16 of file DualBzeroTrajectoryFactory.cc.

References edm::ParameterSet::getParameter(), theMass, and theMomentumEstimate.

Referenced by clone().

00016                                                                                        :
00017   TrajectoryFactoryBase( config )
00018 {
00019   theMass = config.getParameter< double >( "ParticleMass" );
00020   theMomentumEstimate = config.getParameter< double >( "MomentumEstimate" );
00021 }

DualBzeroTrajectoryFactory::~DualBzeroTrajectoryFactory ( void   )  [virtual]

Definition at line 24 of file DualBzeroTrajectoryFactory.cc.

00024 {}


Member Function Documentation

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

Implements TrajectoryFactoryBase.

Definition at line 25 of file DualBzeroTrajectoryFactory.h.

References DualBzeroTrajectoryFactory().

00025 { return new DualBzeroTrajectoryFactory( *this ); }

const TrajectoryStateOnSurface DualBzeroTrajectoryFactory::propagateExternal ( const TrajectoryStateOnSurface external,
const Surface surface,
const MagneticField magField 
) const [protected]

Definition at line 190 of file DualBzeroTrajectoryFactory.cc.

References anyDirection, and AnalyticalPropagator::propagateWithPath().

Referenced by trajectories().

00193 {
00194   AnalyticalPropagator propagator( magField, anyDirection );
00195   const std::pair< TrajectoryStateOnSurface, double > tsosWithPath =
00196     propagator.propagateWithPath( external, surface );
00197   return tsosWithPath.first;
00198 }

const DualBzeroTrajectoryFactory::DualBzeroTrajectoryInput DualBzeroTrajectoryFactory::referenceStateAndRecHits ( const ConstTrajTrackPair track  )  const [protected]

Definition at line 143 of file DualBzeroTrajectoryFactory.cc.

References DualBzeroTrajectoryFactory::DualBzeroTrajectoryInput::bwdRecHits, DualBzeroTrajectoryFactory::DualBzeroTrajectoryInput::fwdRecHits, iggi_31X_cfg::input, TrajectoryFactoryBase::orderedTrajectoryMeasurements(), DualBzeroTrajectoryFactory::DualBzeroTrajectoryInput::refTsos, and TrajectoryFactoryBase::useRecHit().

Referenced by trajectories().

00144 {
00145   DualBzeroTrajectoryInput input;
00146  
00147   // get the trajectory measurements in the correct order, i.e. reverse if needed
00148   Trajectory::DataContainer allTrajMeas = this->orderedTrajectoryMeasurements( *track.first );
00149   Trajectory::DataContainer usedTrajMeas;
00150   Trajectory::DataContainer::iterator itM;
00151   // get all relevant trajectory measurements
00152   for ( itM = allTrajMeas.begin(); itM != allTrajMeas.end(); itM++ )
00153   {
00154     if ( useRecHit( ( *itM ).recHit() ) ) usedTrajMeas.push_back( *itM );
00155   }
00156 
00157   unsigned int iMeas = 0;
00158   unsigned int nMeas = usedTrajMeas.size();
00159   unsigned int nRefStateMeas = nMeas/2;
00160   // get the valid RecHits
00161   for ( itM = usedTrajMeas.begin(); itM != usedTrajMeas.end(); itM++, iMeas++ )
00162   {
00163     TransientTrackingRecHit::ConstRecHitPointer aRecHit = ( *itM ).recHit();
00164 
00165     if ( iMeas < nRefStateMeas ) {
00166       input.bwdRecHits.push_back( aRecHit );
00167     } else if ( iMeas > nRefStateMeas ) {
00168       input.fwdRecHits.push_back( aRecHit );
00169     } else { // iMeas == nRefStateMeas
00170       if ( ( *itM ).updatedState().isValid() )
00171       {
00172         input.refTsos = ( *itM ).updatedState();
00173         input.bwdRecHits.push_back( aRecHit );
00174         input.fwdRecHits.push_back( aRecHit );
00175       } else {
00176         // if the tsos of the middle hit is not valid, try the next one ...
00177         nRefStateMeas++;
00178         input.bwdRecHits.push_back( aRecHit );
00179       }
00180     }
00181   }
00182 
00183   // bring input.fwdRecHits into correct order
00184   std::reverse( input.bwdRecHits.begin(), input.bwdRecHits.end() );
00185 
00186   return input;
00187 }

const DualBzeroTrajectoryFactory::ReferenceTrajectoryCollection DualBzeroTrajectoryFactory::trajectories ( const edm::EventSetup setup,
const ConstTrajTrackPairCollection tracks,
const ExternalPredictionCollection external 
) const [virtual]

Definition at line 62 of file DualBzeroTrajectoryFactory.cc.

References DualBzeroTrajectoryFactory::DualBzeroTrajectoryInput::bwdRecHits, DualBzeroTrajectoryFactory::DualBzeroTrajectoryInput::fwdRecHits, edm::EventSetup::get(), iggi_31X_cfg::input, TrajectoryStateOnSurface::isValid(), TrajectoryStateOnSurface::localError(), TrajectoryFactoryBase::materialEffects(), LocalTrajectoryError::matrix(), edm::ESHandle< T >::product(), propagateExternal(), TrajectoryFactoryBase::propagationDirection(), ptr, referenceStateAndRecHits(), DualBzeroTrajectoryFactory::DualBzeroTrajectoryInput::refTsos, TrajectoryStateOnSurface::surface(), parsecf::pyparsing::test(), theMass, theMomentumEstimate, and trajectories().

00065 {
00066   ReferenceTrajectoryCollection trajectories;
00067 
00068   if ( tracks.size() != external.size() )
00069   {
00070     edm::LogInfo("ReferenceTrajectories") << "@SUB=DualBzeroTrajectoryFactory::trajectories"
00071                                           << "Inconsistent input:\n"
00072                                           << "\tnumber of tracks = " << tracks.size()
00073                                           << "\tnumber of external predictions = " << external.size();
00074     return trajectories;
00075   }
00076 
00077   edm::ESHandle< MagneticField > magneticField;
00078   setup.get< IdealMagneticFieldRecord >().get( magneticField );
00079 
00080   ConstTrajTrackPairCollection::const_iterator itTracks = tracks.begin();
00081   ExternalPredictionCollection::const_iterator itExternal = external.begin();
00082 
00083   while ( itTracks != tracks.end() )
00084   {
00085     const DualBzeroTrajectoryInput input = referenceStateAndRecHits( *itTracks );
00086     // Check input: If all hits were rejected, the TSOS is initialized as invalid.
00087     if ( input.refTsos.isValid() )
00088     {
00089       if ( (*itExternal).isValid() )
00090       {
00091         TrajectoryStateOnSurface propExternal =
00092           propagateExternal( *itExternal, input.refTsos.surface(), magneticField.product() );
00093 
00094         if ( !propExternal.isValid() ) continue;
00095 
00096         // set the flag for reversing the RecHits to false, since they are already in the correct order.
00097         ReferenceTrajectoryPtr ptr( new DualBzeroReferenceTrajectory( propExternal,
00098                                                                       input.fwdRecHits,
00099                                                                       input.bwdRecHits,
00100                                                                       magneticField.product(),
00101                                                                       materialEffects(),
00102                                                                       propagationDirection(),
00103                                                                       theMass,
00104                                                                       theMomentumEstimate ) );
00105 
00106         AlgebraicSymMatrix externalParamErrors( asHepMatrix<5>( propExternal.localError().matrix() ) );
00107         ptr->setParameterErrors( externalParamErrors.sub( 2, 5 ) );
00108         trajectories.push_back( ptr );
00109       }
00110       else
00111       {
00112 //      ReferenceTrajectoryPtr ptr( new DualBzeroReferenceTrajectory( input.refTsos,
00113 //                                                                    input.fwdRecHits,
00114 //                                                                    input.bwdRecHits,
00115 //                                                                    magneticField.product(),
00116 //                                                                    materialEffects(),
00117 //                                                                    propagationDirection(),
00118 //                                                                    theMass,
00119 //                                                                    theMomentumEstimate ) );
00120 
00121         DualBzeroReferenceTrajectory test( input.refTsos,
00122                                            input.fwdRecHits,
00123                                            input.bwdRecHits,
00124                                            magneticField.product(),
00125                                            materialEffects(),
00126                                            propagationDirection(),
00127                                            theMass,
00128                                            theMomentumEstimate );
00129 
00130         //trajectories.push_back( ptr );
00131       }
00132     }
00133 
00134     ++itTracks;
00135     ++itExternal;
00136   }
00137 
00138   return trajectories;
00139 }

const DualBzeroTrajectoryFactory::ReferenceTrajectoryCollection DualBzeroTrajectoryFactory::trajectories ( const edm::EventSetup setup,
const ConstTrajTrackPairCollection tracks 
) const [virtual]

Produce the reference trajectories.

Definition at line 28 of file DualBzeroTrajectoryFactory.cc.

References DualBzeroTrajectoryFactory::DualBzeroTrajectoryInput::bwdRecHits, DualBzeroTrajectoryFactory::DualBzeroTrajectoryInput::fwdRecHits, edm::EventSetup::get(), iggi_31X_cfg::input, TrajectoryStateOnSurface::isValid(), TrajectoryFactoryBase::materialEffects(), edm::ESHandle< T >::product(), TrajectoryFactoryBase::propagationDirection(), ptr, referenceStateAndRecHits(), DualBzeroTrajectoryFactory::DualBzeroTrajectoryInput::refTsos, theMass, and theMomentumEstimate.

Referenced by trajectories().

00030 {
00031   ReferenceTrajectoryCollection trajectories;
00032 
00033   edm::ESHandle< MagneticField > magneticField;
00034   setup.get< IdealMagneticFieldRecord >().get( magneticField );
00035 
00036   ConstTrajTrackPairCollection::const_iterator itTracks = tracks.begin();
00037 
00038   while ( itTracks != tracks.end() )
00039   { 
00040     const DualBzeroTrajectoryInput input = this->referenceStateAndRecHits( *itTracks );
00041     // Check input: If all hits were rejected, the TSOS is initialized as invalid.
00042     if ( input.refTsos.isValid() )
00043     {
00044       ReferenceTrajectoryPtr ptr( new DualBzeroReferenceTrajectory( input.refTsos,
00045                                                                     input.fwdRecHits,
00046                                                                     input.bwdRecHits,
00047                                                                     magneticField.product(),
00048                                                                     materialEffects(),
00049                                                                     propagationDirection(),
00050                                                                     theMass,
00051                                                                     theMomentumEstimate ) );
00052       trajectories.push_back( ptr );
00053     }
00054 
00055     ++itTracks;
00056   }
00057 
00058   return trajectories;
00059 }


Member Data Documentation

double DualBzeroTrajectoryFactory::theMass [protected]

Definition at line 42 of file DualBzeroTrajectoryFactory.h.

Referenced by DualBzeroTrajectoryFactory(), and trajectories().

double DualBzeroTrajectoryFactory::theMomentumEstimate [protected]

Definition at line 43 of file DualBzeroTrajectoryFactory.h.

Referenced by DualBzeroTrajectoryFactory(), and trajectories().


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