CMS 3D CMS Logo

Public Member Functions | Protected Attributes

ReferenceTrajectoryFactory Class Reference

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

Inheritance diagram for ReferenceTrajectoryFactory:
TrajectoryFactoryBase

List of all members.

Public Member Functions

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

Protected Attributes

double theMass

Detailed Description

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

Definition at line 13 of file ReferenceTrajectoryFactory.cc.


Constructor & Destructor Documentation

ReferenceTrajectoryFactory::ReferenceTrajectoryFactory ( const edm::ParameterSet config)

Definition at line 40 of file ReferenceTrajectoryFactory.cc.

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

Referenced by clone().

                                                                                       :
  TrajectoryFactoryBase( config )
{
  theMass = config.getParameter< double >( "ParticleMass" );
}
ReferenceTrajectoryFactory::~ReferenceTrajectoryFactory ( void  ) [virtual]

Definition at line 47 of file ReferenceTrajectoryFactory.cc.

{}

Member Function Documentation

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

Implements TrajectoryFactoryBase.

Definition at line 29 of file ReferenceTrajectoryFactory.cc.

References ReferenceTrajectoryFactory().

{ return new ReferenceTrajectoryFactory(*this); }
const ReferenceTrajectoryFactory::ReferenceTrajectoryCollection ReferenceTrajectoryFactory::trajectories ( const edm::EventSetup setup,
const ConstTrajTrackPairCollection tracks,
const reco::BeamSpot beamSpot 
) const [virtual]

Produce the reference trajectories.

Implements TrajectoryFactoryBase.

Definition at line 51 of file ReferenceTrajectoryFactory.cc.

References SiPixelRawToDigiRegional_cfi::beamSpot, edm::EventSetup::get(), TrajectoryFactoryBase::innermostStateAndRecHits(), LaserDQM_cfg::input, TrajectoryFactoryBase::materialEffects(), edm::ESHandle< T >::product(), TrajectoryFactoryBase::propagationDirection(), theMass, and TrajectoryFactoryBase::theUseBeamSpot.

Referenced by trajectories().

{
  ReferenceTrajectoryCollection trajectories;

  edm::ESHandle< MagneticField > magneticField;
  setup.get< IdealMagneticFieldRecord >().get( magneticField );
  
  ConstTrajTrackPairCollection::const_iterator itTracks = tracks.begin();
  
  while ( itTracks != tracks.end() )
  { 
    TrajectoryInput input = this->innermostStateAndRecHits( *itTracks );
    
    // Check input: If all hits were rejected, the TSOS is initialized as invalid.
    if ( input.first.isValid() )
    {
      // set the flag for reversing the RecHits to false, since they are already in the correct order.
      trajectories.push_back(ReferenceTrajectoryPtr(new ReferenceTrajectory(input.first, input.second, false,
                                                                            magneticField.product(), materialEffects(),
                                                                            propagationDirection(), theMass, 
                                                                            theUseBeamSpot, beamSpot)));
    }

    ++itTracks;
  }

  return trajectories;
}
const ReferenceTrajectoryFactory::ReferenceTrajectoryCollection ReferenceTrajectoryFactory::trajectories ( const edm::EventSetup setup,
const ConstTrajTrackPairCollection tracks,
const ExternalPredictionCollection external,
const reco::BeamSpot beamSpot 
) const [virtual]

Implements TrajectoryFactoryBase.

Definition at line 84 of file ReferenceTrajectoryFactory.cc.

References SiPixelRawToDigiRegional_cfi::beamSpot, edm::EventSetup::get(), TrajectoryFactoryBase::innermostStateAndRecHits(), LaserDQM_cfg::input, TrajectoryFactoryBase::materialEffects(), edm::ESHandle< T >::product(), TrajectoryFactoryBase::propagationDirection(), TrajectoryFactoryBase::sameSurface(), theMass, TrajectoryFactoryBase::theUseBeamSpot, and trajectories().

{
  ReferenceTrajectoryCollection trajectories;

  if ( tracks.size() != external.size() )
  {
    edm::LogInfo("ReferenceTrajectories") << "@SUB=ReferenceTrajectoryFactory::trajectories"
                                          << "Inconsistent input:\n"
                                          << "\tnumber of tracks = " << tracks.size()
                                          << "\tnumber of external predictions = " << external.size();
    return trajectories;
  }

  edm::ESHandle< MagneticField > magneticField;
  setup.get< IdealMagneticFieldRecord >().get( magneticField );

  ConstTrajTrackPairCollection::const_iterator itTracks = tracks.begin();
  ExternalPredictionCollection::const_iterator itExternal = external.begin();

  while ( itTracks != tracks.end() )
  {
    TrajectoryInput input = innermostStateAndRecHits( *itTracks );
    // Check input: If all hits were rejected, the TSOS is initialized as invalid.
    if ( input.first.isValid() )
    {
      if ( (*itExternal).isValid() && sameSurface( (*itExternal).surface(), input.first.surface() ) )
      {
        // set the flag for reversing the RecHits to false, since they are already in the correct order.
        ReferenceTrajectoryPtr refTraj( new ReferenceTrajectory( *itExternal, input.second, false,
                                                                 magneticField.product(), materialEffects(),
                                                                 propagationDirection(), theMass,
                                                                 theUseBeamSpot, beamSpot) );

        AlgebraicSymMatrix externalParamErrors( asHepMatrix<5>( (*itExternal).localError().matrix() ) );
        refTraj->setParameterErrors( externalParamErrors );

        trajectories.push_back( refTraj );
      }
      else
      {
        trajectories.push_back(ReferenceTrajectoryPtr(new ReferenceTrajectory(input.first, input.second, false,
                                                                              magneticField.product(), materialEffects(),
                                                                              propagationDirection(), theMass,
                                                                              theUseBeamSpot, beamSpot)));
      }
    }

    ++itTracks;
    ++itExternal;
  }

  return trajectories;
}

Member Data Documentation

Definition at line 33 of file ReferenceTrajectoryFactory.cc.

Referenced by ReferenceTrajectoryFactory(), and trajectories().