CMS 3D CMS Logo

Public Member Functions | Private Attributes

BzeroReferenceTrajectoryFactory Class Reference

Inheritance diagram for BzeroReferenceTrajectoryFactory:
TrajectoryFactoryBase

List of all members.

Public Member Functions

 BzeroReferenceTrajectoryFactory (const edm::ParameterSet &config)
virtual
BzeroReferenceTrajectoryFactory
clone () const
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 ~BzeroReferenceTrajectoryFactory ()

Private Attributes

double theMass
double theMomentumEstimate

Detailed Description

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

Definition at line 17 of file BzeroReferenceTrajectoryFactory.cc.


Constructor & Destructor Documentation

BzeroReferenceTrajectoryFactory::BzeroReferenceTrajectoryFactory ( const edm::ParameterSet config)

Definition at line 47 of file BzeroReferenceTrajectoryFactory.cc.

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

Referenced by clone().

                                                                                                 :
  TrajectoryFactoryBase( config )
{
  theMass = config.getParameter< double >( "ParticleMass" );
  theMomentumEstimate = config.getParameter< double >( "MomentumEstimate" );
  theUseBeamSpot = config.getParameter< bool >( "UseBeamSpot" );
}
BzeroReferenceTrajectoryFactory::~BzeroReferenceTrajectoryFactory ( void  ) [virtual]

Definition at line 56 of file BzeroReferenceTrajectoryFactory.cc.

{}

Member Function Documentation

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

Implements TrajectoryFactoryBase.

Definition at line 34 of file BzeroReferenceTrajectoryFactory.cc.

References BzeroReferenceTrajectoryFactory().

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

Produce the reference trajectories.

Implements TrajectoryFactoryBase.

Definition at line 60 of file BzeroReferenceTrajectoryFactory.cc.

References SiPixelRawToDigiRegional_cfi::beamSpot, edm::EventSetup::get(), TrajectoryFactoryBase::innermostStateAndRecHits(), LaserDQM_cfg::input, TrajectoryFactoryBase::materialEffects(), edm::ESHandle< T >::product(), TrajectoryFactoryBase::propagationDirection(), theMass, theMomentumEstimate, 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 BzeroReferenceTrajectory(input.first, input.second, false,
                                                                                 magneticField.product(),
                                                                                 materialEffects(),
                                                                                 propagationDirection(),
                                                                                 theMass, theMomentumEstimate,
                                                                                 theUseBeamSpot, beamSpot)));
    }

    ++itTracks;
  }

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

Implements TrajectoryFactoryBase.

Definition at line 94 of file BzeroReferenceTrajectoryFactory.cc.

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

{
  ReferenceTrajectoryCollection trajectories;

  if ( tracks.size() != external.size() )
  {
    edm::LogInfo("ReferenceTrajectories") << "@SUB=BzeroReferenceTrajectoryFactory::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 BzeroReferenceTrajectory( *itExternal, input.second, false,
                                                                      magneticField.product(), materialEffects(),
                                                                      propagationDirection(), theMass,
                                                                      theMomentumEstimate, 
                                                                      theUseBeamSpot, beamSpot ) );

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

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

    ++itTracks;
    ++itExternal;
  }

  return trajectories;
}

Member Data Documentation