CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Classes | Public Member Functions | Protected Member Functions | Protected Attributes
DualTrajectoryFactory Class Reference

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

Inheritance diagram for DualTrajectoryFactory:
TrajectoryFactoryBase

Classes

struct  DualTrajectoryInput
 

Public Member Functions

virtual DualTrajectoryFactoryclone () const
 
 DualTrajectoryFactory (const edm::ParameterSet &config)
 
virtual const
ReferenceTrajectoryCollection 
trajectories (const edm::EventSetup &setup, const ConstTrajTrackPairCollection &tracks, const reco::BeamSpot &beamSpot) const
 Produce the reference trajectories. More...
 
virtual const
ReferenceTrajectoryCollection 
trajectories (const edm::EventSetup &setup, const ConstTrajTrackPairCollection &tracks, const ExternalPredictionCollection &external, const reco::BeamSpot &beamSpot) const
 
virtual ~DualTrajectoryFactory ()
 
- Public Member Functions inherited from TrajectoryFactoryBase
MaterialEffects materialEffects (void) const
 
PropagationDirection propagationDirection (void) const
 
 TrajectoryFactoryBase (const edm::ParameterSet &config)
 
virtual ~TrajectoryFactoryBase (void)
 

Protected Member Functions

const TrajectoryStateOnSurface propagateExternal (const TrajectoryStateOnSurface &external, const Surface &surface, const MagneticField *magField) const
 
const DualTrajectoryInput referenceStateAndRecHits (const ConstTrajTrackPair &track) const
 
- Protected Member Functions inherited from TrajectoryFactoryBase
virtual const TrajectoryInput innermostStateAndRecHits (const ConstTrajTrackPair &track) const
 
virtual const
Trajectory::DataContainer 
orderedTrajectoryMeasurements (const Trajectory &trajectory) const
 
bool sameSurface (const Surface &s1, const Surface &s2) const
 
bool useRecHit (const TransientTrackingRecHit::ConstRecHitPointer &hitPtr) const
 

Protected Attributes

double theMass
 
- Protected Attributes inherited from TrajectoryFactoryBase
bool theUseBeamSpot
 

Additional Inherited Members

- Public Types inherited from TrajectoryFactoryBase
typedef
AlignmentAlgorithmBase::ConstTrajTrackPair 
ConstTrajTrackPair
 
typedef
AlignmentAlgorithmBase::ConstTrajTrackPairCollection 
ConstTrajTrackPairCollection
 
typedef std::vector
< TrajectoryStateOnSurface
ExternalPredictionCollection
 
typedef
ReferenceTrajectoryBase::MaterialEffects 
MaterialEffects
 
typedef std::vector
< ReferenceTrajectoryPtr
ReferenceTrajectoryCollection
 
typedef
ReferenceTrajectoryBase::ReferenceTrajectoryPtr 
ReferenceTrajectoryPtr
 
typedef std::pair
< TrajectoryStateOnSurface,
TransientTrackingRecHit::ConstRecHitContainer
TrajectoryInput
 

Detailed Description

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

Definition at line 17 of file DualTrajectoryFactory.cc.

Constructor & Destructor Documentation

DualTrajectoryFactory::DualTrajectoryFactory ( const edm::ParameterSet config)

Definition at line 56 of file DualTrajectoryFactory.cc.

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

Referenced by clone().

56  :
57  TrajectoryFactoryBase( config )
58 {
59  theMass = config.getParameter< double >( "ParticleMass" );
60 }
T getParameter(std::string const &) const
TrajectoryFactoryBase(const edm::ParameterSet &config)
DualTrajectoryFactory::~DualTrajectoryFactory ( void  )
virtual

Definition at line 63 of file DualTrajectoryFactory.cc.

63 {}

Member Function Documentation

virtual DualTrajectoryFactory* DualTrajectoryFactory::clone ( void  ) const
inlinevirtual

Implements TrajectoryFactoryBase.

Definition at line 33 of file DualTrajectoryFactory.cc.

References DualTrajectoryFactory().

33 { return new DualTrajectoryFactory(*this); }
DualTrajectoryFactory(const edm::ParameterSet &config)
const TrajectoryStateOnSurface DualTrajectoryFactory::propagateExternal ( const TrajectoryStateOnSurface external,
const Surface surface,
const MagneticField magField 
) const
protected

Definition at line 221 of file DualTrajectoryFactory.cc.

References anyDirection, AnalyticalPropagator::propagateWithPath(), and LargeD0_PixelPairStep_cff::propagator.

Referenced by trajectories().

224 {
226  const std::pair< TrajectoryStateOnSurface, double > tsosWithPath =
227  propagator.propagateWithPath( external, surface );
228  return tsosWithPath.first;
229 }
const DualTrajectoryFactory::DualTrajectoryInput DualTrajectoryFactory::referenceStateAndRecHits ( const ConstTrajTrackPair track) const
protected

Definition at line 174 of file DualTrajectoryFactory.cc.

References DualTrajectoryFactory::DualTrajectoryInput::bwdRecHits, DualTrajectoryFactory::DualTrajectoryInput::fwdRecHits, LaserDQM_cfg::input, TrajectoryFactoryBase::orderedTrajectoryMeasurements(), DualTrajectoryFactory::DualTrajectoryInput::refTsos, and TrajectoryFactoryBase::useRecHit().

Referenced by trajectories().

175 {
176  DualTrajectoryInput input;
177 
178  // get the trajectory measurements in the correct order, i.e. reverse if needed
179  Trajectory::DataContainer allTrajMeas = this->orderedTrajectoryMeasurements( *track.first );
180  Trajectory::DataContainer usedTrajMeas;
181  Trajectory::DataContainer::iterator itM;
182  // get all relevant trajectory measurements
183  for ( itM = allTrajMeas.begin(); itM != allTrajMeas.end(); itM++ )
184  {
185  if ( useRecHit( ( *itM ).recHit() ) ) usedTrajMeas.push_back( *itM );
186  }
187 
188  unsigned int iMeas = 0;
189  unsigned int nMeas = usedTrajMeas.size();
190  unsigned int nRefStateMeas = nMeas/2;
191  // get the valid RecHits
192  for ( itM = usedTrajMeas.begin(); itM != usedTrajMeas.end(); itM++, iMeas++ )
193  {
194  TransientTrackingRecHit::ConstRecHitPointer aRecHit = ( *itM ).recHit();
195 
196  if ( iMeas < nRefStateMeas ) {
197  input.bwdRecHits.push_back( aRecHit );
198  } else if ( iMeas > nRefStateMeas ) {
199  input.fwdRecHits.push_back( aRecHit );
200  } else { // iMeas == nRefStateMeas
201  if ( ( *itM ).updatedState().isValid() )
202  {
203  input.refTsos = ( *itM ).updatedState();
204  input.bwdRecHits.push_back( aRecHit );
205  input.fwdRecHits.push_back( aRecHit );
206  } else {
207  // if the tsos of the middle hit is not valid, try the next one ...
208  nRefStateMeas++;
209  input.bwdRecHits.push_back( aRecHit );
210  }
211  }
212  }
213 
214  // bring input.fwdRecHits into correct order
215  std::reverse( input.bwdRecHits.begin(), input.bwdRecHits.end() );
216 
217  return input;
218 }
virtual const Trajectory::DataContainer orderedTrajectoryMeasurements(const Trajectory &trajectory) const
bool useRecHit(const TransientTrackingRecHit::ConstRecHitPointer &hitPtr) const
std::vector< TrajectoryMeasurement > DataContainer
Definition: Trajectory.h:42
const DualTrajectoryFactory::ReferenceTrajectoryCollection DualTrajectoryFactory::trajectories ( const edm::EventSetup setup,
const ConstTrajTrackPairCollection tracks,
const reco::BeamSpot beamSpot 
) const
virtual

Produce the reference trajectories.

Implements TrajectoryFactoryBase.

Definition at line 67 of file DualTrajectoryFactory.cc.

References SiPixelRawToDigiRegional_cfi::beamSpot, DualTrajectoryFactory::DualTrajectoryInput::bwdRecHits, DualTrajectoryFactory::DualTrajectoryInput::fwdRecHits, edm::EventSetup::get(), LaserDQM_cfg::input, TrajectoryStateOnSurface::isValid(), TrajectoryFactoryBase::materialEffects(), edm::ESHandle< class >::product(), TrajectoryFactoryBase::propagationDirection(), referenceStateAndRecHits(), DualTrajectoryFactory::DualTrajectoryInput::refTsos, theMass, and TrajectoryFactoryBase::theUseBeamSpot.

Referenced by trajectories().

70 {
72 
73  edm::ESHandle< MagneticField > magneticField;
74  setup.get< IdealMagneticFieldRecord >().get( magneticField );
75 
76  ConstTrajTrackPairCollection::const_iterator itTracks = tracks.begin();
77 
78  while ( itTracks != tracks.end() )
79  {
80  const DualTrajectoryInput input = this->referenceStateAndRecHits( *itTracks );
81  // Check input: If all hits were rejected, the TSOS is initialized as invalid.
82  if ( input.refTsos.isValid() )
83  {
84  ReferenceTrajectoryPtr ptr( new DualReferenceTrajectory( input.refTsos,
85  input.fwdRecHits,
86  input.bwdRecHits,
87  magneticField.product(),
90  theMass,
92  trajectories.push_back( ptr );
93  }
94 
95  ++itTracks;
96  }
97 
98  return trajectories;
99 }
const DualTrajectoryInput referenceStateAndRecHits(const ConstTrajTrackPair &track) const
MaterialEffects materialEffects(void) const
virtual const ReferenceTrajectoryCollection trajectories(const edm::EventSetup &setup, const ConstTrajTrackPairCollection &tracks, const reco::BeamSpot &beamSpot) const
Produce the reference trajectories.
std::vector< ReferenceTrajectoryPtr > ReferenceTrajectoryCollection
tuple tracks
Definition: testEve_cfg.py:39
const T & get() const
Definition: EventSetup.h:55
T const * product() const
Definition: ESHandle.h:62
PropagationDirection propagationDirection(void) const
ReferenceTrajectoryBase::ReferenceTrajectoryPtr ReferenceTrajectoryPtr
const DualTrajectoryFactory::ReferenceTrajectoryCollection DualTrajectoryFactory::trajectories ( const edm::EventSetup setup,
const ConstTrajTrackPairCollection tracks,
const ExternalPredictionCollection external,
const reco::BeamSpot beamSpot 
) const
virtual

Implements TrajectoryFactoryBase.

Definition at line 102 of file DualTrajectoryFactory.cc.

References SiPixelRawToDigiRegional_cfi::beamSpot, DualTrajectoryFactory::DualTrajectoryInput::bwdRecHits, DualTrajectoryFactory::DualTrajectoryInput::fwdRecHits, edm::EventSetup::get(), LaserDQM_cfg::input, TrajectoryStateOnSurface::isValid(), TrajectoryStateOnSurface::localError(), TrajectoryFactoryBase::materialEffects(), LocalTrajectoryError::matrix(), edm::ESHandle< class >::product(), propagateExternal(), TrajectoryFactoryBase::propagationDirection(), referenceStateAndRecHits(), DualTrajectoryFactory::DualTrajectoryInput::refTsos, TrajectoryStateOnSurface::surface(), theMass, TrajectoryFactoryBase::theUseBeamSpot, and trajectories().

106 {
108 
109  if ( tracks.size() != external.size() )
110  {
111  edm::LogInfo("ReferenceTrajectories") << "@SUB=DualTrajectoryFactory::trajectories"
112  << "Inconsistent input:\n"
113  << "\tnumber of tracks = " << tracks.size()
114  << "\tnumber of external predictions = " << external.size();
115  return trajectories;
116  }
117 
118  edm::ESHandle< MagneticField > magneticField;
119  setup.get< IdealMagneticFieldRecord >().get( magneticField );
120 
121  ConstTrajTrackPairCollection::const_iterator itTracks = tracks.begin();
122  ExternalPredictionCollection::const_iterator itExternal = external.begin();
123 
124  while ( itTracks != tracks.end() )
125  {
126  const DualTrajectoryInput input = referenceStateAndRecHits( *itTracks );
127  // Check input: If all hits were rejected, the TSOS is initialized as invalid.
128  if ( input.refTsos.isValid() )
129  {
130  if ( (*itExternal).isValid() )
131  {
132  TrajectoryStateOnSurface propExternal =
133  propagateExternal( *itExternal, input.refTsos.surface(), magneticField.product() );
134 
135  if ( !propExternal.isValid() ) continue;
136 
137  // set the flag for reversing the RecHits to false, since they are already in the correct order.
138  ReferenceTrajectoryPtr ptr( new DualReferenceTrajectory( propExternal,
139  input.fwdRecHits,
140  input.bwdRecHits,
141  magneticField.product(),
142  materialEffects(),
144  theMass,
146 
147  AlgebraicSymMatrix externalParamErrors( asHepMatrix<5>( propExternal.localError().matrix() ) );
148  ptr->setParameterErrors( externalParamErrors );
149  trajectories.push_back( ptr );
150  }
151  else
152  {
153  ReferenceTrajectoryPtr ptr( new DualReferenceTrajectory( input.refTsos,
154  input.fwdRecHits,
155  input.bwdRecHits,
156  magneticField.product(),
157  materialEffects(),
159  theMass,
161  trajectories.push_back( ptr );
162  }
163  }
164 
165  ++itTracks;
166  ++itExternal;
167  }
168 
169  return trajectories;
170 }
const TrajectoryStateOnSurface propagateExternal(const TrajectoryStateOnSurface &external, const Surface &surface, const MagneticField *magField) const
const DualTrajectoryInput referenceStateAndRecHits(const ConstTrajTrackPair &track) const
MaterialEffects materialEffects(void) const
virtual const ReferenceTrajectoryCollection trajectories(const edm::EventSetup &setup, const ConstTrajTrackPairCollection &tracks, const reco::BeamSpot &beamSpot) const
Produce the reference trajectories.
const AlgebraicSymMatrix55 & matrix() const
const LocalTrajectoryError & localError() const
std::vector< ReferenceTrajectoryPtr > ReferenceTrajectoryCollection
tuple tracks
Definition: testEve_cfg.py:39
const T & get() const
Definition: EventSetup.h:55
T const * product() const
Definition: ESHandle.h:62
PropagationDirection propagationDirection(void) const
CLHEP::HepSymMatrix AlgebraicSymMatrix
ReferenceTrajectoryBase::ReferenceTrajectoryPtr ReferenceTrajectoryPtr

Member Data Documentation

double DualTrajectoryFactory::theMass
protected