CMS 3D CMS Logo

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

DualBzeroTrajectoryFactoryclone () const override
 
 DualBzeroTrajectoryFactory (const edm::ParameterSet &config)
 
const ReferenceTrajectoryCollection trajectories (const edm::EventSetup &setup, const ConstTrajTrackPairCollection &tracks, const reco::BeamSpot &beamSpot) const override
 Produce the reference trajectories. More...
 
const ReferenceTrajectoryCollection trajectories (const edm::EventSetup &setup, const ConstTrajTrackPairCollection &tracks, const ExternalPredictionCollection &external, const reco::BeamSpot &beamSpot) const override
 
 ~DualBzeroTrajectoryFactory () override
 
- 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 allowZeroMaterial_
 
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< TrajectoryStateOnSurfaceExternalPredictionCollection
 
typedef ReferenceTrajectoryBase::MaterialEffects MaterialEffects
 
typedef std::vector< ReferenceTrajectoryPtrReferenceTrajectoryCollection
 
typedef ReferenceTrajectoryBase::ReferenceTrajectoryPtr ReferenceTrajectoryPtr
 
typedef std::pair< TrajectoryStateOnSurface, TransientTrackingRecHit::ConstRecHitContainerTrajectoryInput
 

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  )
override

Definition at line 67 of file DualBzeroTrajectoryFactory.cc.

67 {}

Member Function Documentation

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

References anyDirection, DEFINE_EDM_PLUGIN, AnalyticalPropagator::propagateWithPath(), and PhotonConversionTrajectorySeedProducerFromQuadruplets_cfi::propagator.

Referenced by trajectories().

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

Definition at line 187 of file DualBzeroTrajectoryFactory.cc.

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

Referenced by trajectories().

188 {
189  DualBzeroTrajectoryInput input;
190 
191  // get the trajectory measurements in the correct order, i.e. reverse if needed
192  Trajectory::DataContainer allTrajMeas = this->orderedTrajectoryMeasurements( *track.first );
193  Trajectory::DataContainer usedTrajMeas;
194  Trajectory::DataContainer::iterator itM;
195  // get all relevant trajectory measurements
196  for ( itM = allTrajMeas.begin(); itM != allTrajMeas.end(); itM++ )
197  {
198  if ( useRecHit( ( *itM ).recHit() ) ) usedTrajMeas.push_back( *itM );
199  }
200 
201  unsigned int iMeas = 0;
202  unsigned int nMeas = usedTrajMeas.size();
203  unsigned int nRefStateMeas = nMeas/2;
204  // get the valid RecHits
205  for ( itM = usedTrajMeas.begin(); itM != usedTrajMeas.end(); itM++, iMeas++ )
206  {
207  TransientTrackingRecHit::ConstRecHitPointer aRecHit = ( *itM ).recHit();
208 
209  if ( iMeas < nRefStateMeas ) {
210  input.bwdRecHits.push_back( aRecHit );
211  } else if ( iMeas > nRefStateMeas ) {
212  input.fwdRecHits.push_back( aRecHit );
213  } else { // iMeas == nRefStateMeas
214  if ( ( *itM ).updatedState().isValid() )
215  {
216  input.refTsos = ( *itM ).updatedState();
217  input.bwdRecHits.push_back( aRecHit );
218  input.fwdRecHits.push_back( aRecHit );
219  } else {
220  // if the tsos of the middle hit is not valid, try the next one ...
221  nRefStateMeas++;
222  input.bwdRecHits.push_back( aRecHit );
223  }
224  }
225  }
226 
227  // bring input.fwdRecHits into correct order
228  std::reverse( input.bwdRecHits.begin(), input.bwdRecHits.end() );
229 
230  return input;
231 }
virtual const Trajectory::DataContainer orderedTrajectoryMeasurements(const Trajectory &trajectory) const
bool useRecHit(const TransientTrackingRecHit::ConstRecHitPointer &hitPtr) const
static std::string const input
Definition: EdmProvDump.cc:45
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 ReferenceTrajectoryBase::Config::allowZeroMaterial, TrajectoryFactoryBase::allowZeroMaterial_, ecalDrivenElectronSeedsParameters_cff::beamSpot, DualBzeroTrajectoryFactory::DualBzeroTrajectoryInput::bwdRecHits, looper::config, DualBzeroTrajectoryFactory::DualBzeroTrajectoryInput::fwdRecHits, edm::EventSetup::get(), ReferenceTrajectoryBase::Config::includeAPEs, TrajectoryFactoryBase::includeAPEs_, input, TrajectoryStateOnSurface::isValid(), seedCreatorFromRegionConsecutiveHitsEDProducer_cff::magneticField, TrajectoryFactoryBase::materialEffects(), edm::ESHandle< T >::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_;
92  config.allowZeroMaterial = allowZeroMaterial_;
94  input.fwdRecHits,
95  input.bwdRecHits,
96  magneticField.product(),
97  beamSpot,
98  config));
99  trajectories.push_back( ptr );
100  }
101 
102  ++itTracks;
103  }
104 
105  return trajectories;
106 }
MaterialEffects materialEffects(void) const
const DualBzeroTrajectoryInput referenceStateAndRecHits(const ConstTrajTrackPair &track) const
const ReferenceTrajectoryCollection trajectories(const edm::EventSetup &setup, const ConstTrajTrackPairCollection &tracks, const reco::BeamSpot &beamSpot) const override
Produce the reference trajectories.
Definition: config.py:1
static std::string const input
Definition: EdmProvDump.cc:45
config
Definition: looper.py:289
std::vector< ReferenceTrajectoryPtr > ReferenceTrajectoryCollection
T get() const
Definition: EventSetup.h:62
PropagationDirection propagationDirection(void) const
ReferenceTrajectoryBase::ReferenceTrajectoryPtr ReferenceTrajectoryPtr
T const * product() const
Definition: ESHandle.h:86
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 109 of file DualBzeroTrajectoryFactory.cc.

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

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

Member Data Documentation

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

Definition at line 51 of file DualBzeroTrajectoryFactory.cc.

Referenced by DualBzeroTrajectoryFactory(), and trajectories().