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
DualBzeroTrajectoryFactory Class Reference

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

Inheritance diagram for DualBzeroTrajectoryFactory:
TrajectoryFactoryBase

Classes

struct  DualBzeroTrajectoryInput
 

Public Member Functions

virtual
DualBzeroTrajectoryFactory
clone () const override
 
 DualBzeroTrajectoryFactory (const edm::ParameterSet &config)
 
virtual const
ReferenceTrajectoryCollection 
trajectories (const edm::EventSetup &setup, const ConstTrajTrackPairCollection &tracks, const reco::BeamSpot &beamSpot) const override
 Produce the reference trajectories. More...
 
virtual const
ReferenceTrajectoryCollection 
trajectories (const edm::EventSetup &setup, const ConstTrajTrackPairCollection &tracks, const ExternalPredictionCollection &external, const reco::BeamSpot &beamSpot) const override
 
virtual ~DualBzeroTrajectoryFactory ()
 
- Public Member Functions inherited from TrajectoryFactoryBase
const edm::ParameterSetconfiguration () const
 
MaterialEffects materialEffects (void) const
 
PropagationDirection propagationDirection (void) const
 
unsigned int tracksPerTrajectory () const
 
 TrajectoryFactoryBase (const edm::ParameterSet &config)
 
 TrajectoryFactoryBase (const edm::ParameterSet &config, unsigned int tracksPerTrajectory)
 
virtual ~TrajectoryFactoryBase (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 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
 
double theMomentumEstimate
 
- Protected Attributes inherited from TrajectoryFactoryBase
const bool includeAPEs_
 
const bool useBeamSpot_
 

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 18 of file DualBzeroTrajectoryFactory.cc.

Constructor & Destructor Documentation

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

Definition at line 59 of file DualBzeroTrajectoryFactory.cc.

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

Referenced by clone().

59  :
60  TrajectoryFactoryBase( config )
61 {
62  theMass = config.getParameter< double >( "ParticleMass" );
63  theMomentumEstimate = config.getParameter< double >( "MomentumEstimate" );
64 }
T getParameter(std::string const &) const
TrajectoryFactoryBase(const edm::ParameterSet &config)
DualBzeroTrajectoryFactory::~DualBzeroTrajectoryFactory ( void  )
virtual

Definition at line 67 of file DualBzeroTrajectoryFactory.cc.

67 {}

Member Function Documentation

virtual DualBzeroTrajectoryFactory* DualBzeroTrajectoryFactory::clone ( void  ) const
inlineoverridevirtual

Implements TrajectoryFactoryBase.

Definition at line 34 of file DualBzeroTrajectoryFactory.cc.

References DualBzeroTrajectoryFactory().

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

Definition at line 231 of file DualBzeroTrajectoryFactory.cc.

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

Referenced by trajectories().

234 {
236  const std::pair< TrajectoryStateOnSurface, double > tsosWithPath =
237  propagator.propagateWithPath( external, surface );
238  return tsosWithPath.first;
239 }
const DualBzeroTrajectoryFactory::DualBzeroTrajectoryInput DualBzeroTrajectoryFactory::referenceStateAndRecHits ( const ConstTrajTrackPair track) const
protected

Definition at line 184 of file DualBzeroTrajectoryFactory.cc.

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

Referenced by trajectories().

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

Produce the reference trajectories.

Implements TrajectoryFactoryBase.

Definition at line 71 of file DualBzeroTrajectoryFactory.cc.

References SiPixelRawToDigiRegional_cfi::beamSpot, DualBzeroTrajectoryFactory::DualBzeroTrajectoryInput::bwdRecHits, mps_alisetup::config, DualBzeroTrajectoryFactory::DualBzeroTrajectoryInput::fwdRecHits, edm::EventSetup::get(), ReferenceTrajectoryBase::Config::includeAPEs, TrajectoryFactoryBase::includeAPEs_, input, TrajectoryStateOnSurface::isValid(), HLT_25ns10e33_v2_cff::magneticField, TrajectoryFactoryBase::materialEffects(), edm::ESHandle< class >::product(), TrajectoryFactoryBase::propagationDirection(), referenceStateAndRecHits(), DualBzeroTrajectoryFactory::DualBzeroTrajectoryInput::refTsos, theMass, theMomentumEstimate, ReferenceTrajectoryBase::Config::useBeamSpot, and TrajectoryFactoryBase::useBeamSpot_.

Referenced by trajectories().

74 {
76 
78  setup.get< IdealMagneticFieldRecord >().get( magneticField );
79 
80  ConstTrajTrackPairCollection::const_iterator itTracks = tracks.begin();
81 
82  while ( itTracks != tracks.end() )
83  {
84  const DualBzeroTrajectoryInput input = this->referenceStateAndRecHits( *itTracks );
85  // Check input: If all hits were rejected, the TSOS is initialized as invalid.
86  if ( input.refTsos.isValid() )
87  {
90  config.useBeamSpot = useBeamSpot_;
91  config.includeAPEs = includeAPEs_;
93  input.fwdRecHits,
94  input.bwdRecHits,
95  magneticField.product(),
96  beamSpot,
97  config));
98  trajectories.push_back( ptr );
99  }
100 
101  ++itTracks;
102  }
103 
104  return trajectories;
105 }
MaterialEffects materialEffects(void) const
const DualBzeroTrajectoryInput referenceStateAndRecHits(const ConstTrajTrackPair &track) const
virtual const ReferenceTrajectoryCollection trajectories(const edm::EventSetup &setup, const ConstTrajTrackPairCollection &tracks, const reco::BeamSpot &beamSpot) const override
Produce the reference trajectories.
static std::string const input
Definition: EdmProvDump.cc:44
std::vector< ReferenceTrajectoryPtr > ReferenceTrajectoryCollection
tuple tracks
Definition: testEve_cfg.py:39
const T & get() const
Definition: EventSetup.h:56
T const * product() const
Definition: ESHandle.h:86
PropagationDirection propagationDirection(void) const
ReferenceTrajectoryBase::ReferenceTrajectoryPtr ReferenceTrajectoryPtr
const DualBzeroTrajectoryFactory::ReferenceTrajectoryCollection DualBzeroTrajectoryFactory::trajectories ( const edm::EventSetup setup,
const ConstTrajTrackPairCollection tracks,
const ExternalPredictionCollection external,
const reco::BeamSpot beamSpot 
) const
overridevirtual

Implements TrajectoryFactoryBase.

Definition at line 108 of file DualBzeroTrajectoryFactory.cc.

References SiPixelRawToDigiRegional_cfi::beamSpot, DualBzeroTrajectoryFactory::DualBzeroTrajectoryInput::bwdRecHits, mps_alisetup::config, DualBzeroTrajectoryFactory::DualBzeroTrajectoryInput::fwdRecHits, edm::EventSetup::get(), ReferenceTrajectoryBase::Config::includeAPEs, TrajectoryFactoryBase::includeAPEs_, input, TrajectoryStateOnSurface::isValid(), TrajectoryStateOnSurface::localError(), HLT_25ns10e33_v2_cff::magneticField, TrajectoryFactoryBase::materialEffects(), LocalTrajectoryError::matrix(), edm::ESHandle< class >::product(), propagateExternal(), TrajectoryFactoryBase::propagationDirection(), referenceStateAndRecHits(), DualBzeroTrajectoryFactory::DualBzeroTrajectoryInput::refTsos, TrajectoryStateOnSurface::surface(), theMass, theMomentumEstimate, trajectories(), ReferenceTrajectoryBase::Config::useBeamSpot, and TrajectoryFactoryBase::useBeamSpot_.

112 {
114 
115  if ( tracks.size() != external.size() )
116  {
117  edm::LogInfo("ReferenceTrajectories") << "@SUB=DualBzeroTrajectoryFactory::trajectories"
118  << "Inconsistent input:\n"
119  << "\tnumber of tracks = " << tracks.size()
120  << "\tnumber of external predictions = " << external.size();
121  return trajectories;
122  }
123 
125  setup.get< IdealMagneticFieldRecord >().get( magneticField );
126 
127  ConstTrajTrackPairCollection::const_iterator itTracks = tracks.begin();
128  ExternalPredictionCollection::const_iterator itExternal = external.begin();
129 
130  while ( itTracks != tracks.end() )
131  {
132  const DualBzeroTrajectoryInput input = referenceStateAndRecHits( *itTracks );
133  // Check input: If all hits were rejected, the TSOS is initialized as invalid.
134  if ( input.refTsos.isValid() )
135  {
136  if ( (*itExternal).isValid() )
137  {
138  TrajectoryStateOnSurface propExternal =
139  propagateExternal( *itExternal, input.refTsos.surface(), magneticField.product() );
140 
141  if ( !propExternal.isValid() ) continue;
142 
145  config.useBeamSpot = useBeamSpot_;
146  config.includeAPEs = includeAPEs_;
148  input.fwdRecHits,
149  input.bwdRecHits,
150  magneticField.product(),
151  beamSpot,
152  config));
153 
154  AlgebraicSymMatrix externalParamErrors( asHepMatrix<5>( propExternal.localError().matrix() ) );
155  ptr->setParameterErrors( externalParamErrors.sub( 2, 5 ) );
156  trajectories.push_back( ptr );
157  }
158  else
159  {
162  config.useBeamSpot = useBeamSpot_;
163  config.includeAPEs = includeAPEs_;
165  input.fwdRecHits,
166  input.bwdRecHits,
167  magneticField.product(),
168  beamSpot,
169  config));
170 
171  trajectories.push_back( ptr );
172  }
173  }
174 
175  ++itTracks;
176  ++itExternal;
177  }
178 
179  return trajectories;
180 }
const TrajectoryStateOnSurface propagateExternal(const TrajectoryStateOnSurface &external, const Surface &surface, const MagneticField *magField) const
MaterialEffects materialEffects(void) const
const DualBzeroTrajectoryInput referenceStateAndRecHits(const ConstTrajTrackPair &track) const
virtual const ReferenceTrajectoryCollection trajectories(const edm::EventSetup &setup, const ConstTrajTrackPairCollection &tracks, const reco::BeamSpot &beamSpot) const override
Produce the reference trajectories.
static std::string const input
Definition: EdmProvDump.cc:44
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:56
T const * product() const
Definition: ESHandle.h:86
PropagationDirection propagationDirection(void) const
CLHEP::HepSymMatrix AlgebraicSymMatrix
ReferenceTrajectoryBase::ReferenceTrajectoryPtr ReferenceTrajectoryPtr

Member Data Documentation

double DualBzeroTrajectoryFactory::theMass
protected
double DualBzeroTrajectoryFactory::theMomentumEstimate
protected

Definition at line 51 of file DualBzeroTrajectoryFactory.cc.

Referenced by DualBzeroTrajectoryFactory(), and trajectories().