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

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

Referenced by trajectories().

243 {
245  const std::pair< TrajectoryStateOnSurface, double > tsosWithPath =
246  propagator.propagateWithPath( external, surface );
247  return tsosWithPath.first;
248 }
const DualBzeroTrajectoryFactory::DualBzeroTrajectoryInput DualBzeroTrajectoryFactory::referenceStateAndRecHits ( const ConstTrajTrackPair track) const
protected

Definition at line 193 of file DualBzeroTrajectoryFactory.cc.

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

Referenced by trajectories().

194 {
195  DualBzeroTrajectoryInput input;
196 
197  // get the trajectory measurements in the correct order, i.e. reverse if needed
198  Trajectory::DataContainer allTrajMeas = this->orderedTrajectoryMeasurements( *track.first );
199  Trajectory::DataContainer usedTrajMeas;
200  Trajectory::DataContainer::iterator itM;
201  // get all relevant trajectory measurements
202  for ( itM = allTrajMeas.begin(); itM != allTrajMeas.end(); itM++ )
203  {
204  if ( useRecHit( ( *itM ).recHit() ) ) usedTrajMeas.push_back( *itM );
205  }
206 
207  unsigned int iMeas = 0;
208  unsigned int nMeas = usedTrajMeas.size();
209  unsigned int nRefStateMeas = nMeas/2;
210  // get the valid RecHits
211  for ( itM = usedTrajMeas.begin(); itM != usedTrajMeas.end(); itM++, iMeas++ )
212  {
213  TransientTrackingRecHit::ConstRecHitPointer aRecHit = ( *itM ).recHit();
214 
215  if ( iMeas < nRefStateMeas ) {
216  input.bwdRecHits.push_back( aRecHit );
217  } else if ( iMeas > nRefStateMeas ) {
218  input.fwdRecHits.push_back( aRecHit );
219  } else { // iMeas == nRefStateMeas
220  if ( ( *itM ).updatedState().isValid() )
221  {
222  input.refTsos = ( *itM ).updatedState();
223  input.bwdRecHits.push_back( aRecHit );
224  input.fwdRecHits.push_back( aRecHit );
225  } else {
226  // if the tsos of the middle hit is not valid, try the next one ...
227  nRefStateMeas++;
228  input.bwdRecHits.push_back( aRecHit );
229  }
230  }
231  }
232 
233  // bring input.fwdRecHits into correct order
234  std::reverse( input.bwdRecHits.begin(), input.bwdRecHits.end() );
235 
236  return input;
237 }
virtual const Trajectory::DataContainer orderedTrajectoryMeasurements(const Trajectory &trajectory) const
bool useRecHit(const TransientTrackingRecHit::ConstRecHitPointer &hitPtr) const
static std::string const input
Definition: EdmProvDump.cc:43
std::vector< TrajectoryMeasurement > DataContainer
Definition: Trajectory.h:42
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, DualBzeroTrajectoryFactory::DualBzeroTrajectoryInput::fwdRecHits, edm::EventSetup::get(), input, TrajectoryStateOnSurface::isValid(), HLT_25ns14e33_v1_cff::magneticField, TrajectoryFactoryBase::materialEffects(), edm::ESHandle< class >::product(), TrajectoryFactoryBase::propagationDirection(), referenceStateAndRecHits(), DualBzeroTrajectoryFactory::DualBzeroTrajectoryInput::refTsos, theMass, theMomentumEstimate, and TrajectoryFactoryBase::theUseBeamSpot.

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  {
89  input.fwdRecHits,
90  input.bwdRecHits,
91  magneticField.product(),
94  theMass,
97  trajectories.push_back( ptr );
98  }
99 
100  ++itTracks;
101  }
102 
103  return trajectories;
104 }
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:43
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 107 of file DualBzeroTrajectoryFactory.cc.

References SiPixelRawToDigiRegional_cfi::beamSpot, DualBzeroTrajectoryFactory::DualBzeroTrajectoryInput::bwdRecHits, DualBzeroTrajectoryFactory::DualBzeroTrajectoryInput::fwdRecHits, edm::EventSetup::get(), input, TrajectoryStateOnSurface::isValid(), TrajectoryStateOnSurface::localError(), HLT_25ns14e33_v1_cff::magneticField, TrajectoryFactoryBase::materialEffects(), LocalTrajectoryError::matrix(), edm::ESHandle< class >::product(), propagateExternal(), TrajectoryFactoryBase::propagationDirection(), referenceStateAndRecHits(), DualBzeroTrajectoryFactory::DualBzeroTrajectoryInput::refTsos, TrajectoryStateOnSurface::surface(), run_regression::test, theMass, theMomentumEstimate, TrajectoryFactoryBase::theUseBeamSpot, and trajectories().

111 {
113 
114  if ( tracks.size() != external.size() )
115  {
116  edm::LogInfo("ReferenceTrajectories") << "@SUB=DualBzeroTrajectoryFactory::trajectories"
117  << "Inconsistent input:\n"
118  << "\tnumber of tracks = " << tracks.size()
119  << "\tnumber of external predictions = " << external.size();
120  return trajectories;
121  }
122 
124  setup.get< IdealMagneticFieldRecord >().get( magneticField );
125 
126  ConstTrajTrackPairCollection::const_iterator itTracks = tracks.begin();
127  ExternalPredictionCollection::const_iterator itExternal = external.begin();
128 
129  while ( itTracks != tracks.end() )
130  {
131  const DualBzeroTrajectoryInput input = referenceStateAndRecHits( *itTracks );
132  // Check input: If all hits were rejected, the TSOS is initialized as invalid.
133  if ( input.refTsos.isValid() )
134  {
135  if ( (*itExternal).isValid() )
136  {
137  TrajectoryStateOnSurface propExternal =
138  propagateExternal( *itExternal, input.refTsos.surface(), magneticField.product() );
139 
140  if ( !propExternal.isValid() ) continue;
141 
142  // set the flag for reversing the RecHits to false, since they are already in the correct order.
144  input.fwdRecHits,
145  input.bwdRecHits,
146  magneticField.product(),
147  materialEffects(),
149  theMass,
152 
153  AlgebraicSymMatrix externalParamErrors( asHepMatrix<5>( propExternal.localError().matrix() ) );
154  ptr->setParameterErrors( externalParamErrors.sub( 2, 5 ) );
155  trajectories.push_back( ptr );
156  }
157  else
158  {
159 // GF: Why is the following commented? That is different from the other factories
160 // that usually have the non-external prediction ReferenceTrajectory as fall back...
161 // ReferenceTrajectoryPtr ptr( new DualBzeroReferenceTrajectory( input.refTsos,
162 // input.fwdRecHits,
163 // input.bwdRecHits,
164 // magneticField.product(),
165 // materialEffects(),
166 // propagationDirection(),
167 // theMass,
168 // theMomentumEstimate,
169 // beamSpot ) );
170  DualBzeroReferenceTrajectory test( input.refTsos,
171  input.fwdRecHits,
172  input.bwdRecHits,
173  magneticField.product(),
174  materialEffects(),
176  theMass,
179 
180  //trajectories.push_back( ptr );
181  }
182  }
183 
184  ++itTracks;
185  ++itExternal;
186  }
187 
188  return trajectories;
189 }
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:43
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().