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

Constructor & Destructor Documentation

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

Definition at line 55 of file DualBzeroTrajectoryFactory.cc.

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

Referenced by clone().

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

Definition at line 61 of file DualBzeroTrajectoryFactory.cc.

61 {}

Member Function Documentation

DualBzeroTrajectoryFactory* DualBzeroTrajectoryFactory::clone ( void  ) const
inlineoverridevirtual

Implements TrajectoryFactoryBase.

Definition at line 32 of file DualBzeroTrajectoryFactory.cc.

References DualBzeroTrajectoryFactory().

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

Definition at line 152 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().

153  {
154  DualBzeroTrajectoryInput input;
155 
156  // get the trajectory measurements in the correct order, i.e. reverse if needed
158  Trajectory::DataContainer usedTrajMeas;
159  Trajectory::DataContainer::iterator itM;
160  // get all relevant trajectory measurements
161  for (itM = allTrajMeas.begin(); itM != allTrajMeas.end(); itM++) {
162  if (useRecHit((*itM).recHit()))
163  usedTrajMeas.push_back(*itM);
164  }
165 
166  unsigned int iMeas = 0;
167  unsigned int nMeas = usedTrajMeas.size();
168  unsigned int nRefStateMeas = nMeas / 2;
169  // get the valid RecHits
170  for (itM = usedTrajMeas.begin(); itM != usedTrajMeas.end(); itM++, iMeas++) {
171  TransientTrackingRecHit::ConstRecHitPointer aRecHit = (*itM).recHit();
172 
173  if (iMeas < nRefStateMeas) {
174  input.bwdRecHits.push_back(aRecHit);
175  } else if (iMeas > nRefStateMeas) {
176  input.fwdRecHits.push_back(aRecHit);
177  } else { // iMeas == nRefStateMeas
178  if ((*itM).updatedState().isValid()) {
179  input.refTsos = (*itM).updatedState();
180  input.bwdRecHits.push_back(aRecHit);
181  input.fwdRecHits.push_back(aRecHit);
182  } else {
183  // if the tsos of the middle hit is not valid, try the next one ...
184  nRefStateMeas++;
185  input.bwdRecHits.push_back(aRecHit);
186  }
187  }
188  }
189 
190  // bring input.fwdRecHits into correct order
191  std::reverse(input.bwdRecHits.begin(), input.bwdRecHits.end());
192 
193  return input;
194 }
virtual const Trajectory::DataContainer orderedTrajectoryMeasurements(const Trajectory &trajectory) const
bool useRecHit(const TransientTrackingRecHit::ConstRecHitPointer &hitPtr) const
static std::string const input
Definition: EdmProvDump.cc:48
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 63 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().

64  {
66 
68  setup.get<IdealMagneticFieldRecord>().get(magneticField);
69 
70  ConstTrajTrackPairCollection::const_iterator itTracks = tracks.begin();
71 
72  while (itTracks != tracks.end()) {
73  const DualBzeroTrajectoryInput input = this->referenceStateAndRecHits(*itTracks);
74  // Check input: If all hits were rejected, the TSOS is initialized as invalid.
75  if (input.refTsos.isValid()) {
77  config.useBeamSpot = useBeamSpot_;
78  config.includeAPEs = includeAPEs_;
79  config.allowZeroMaterial = allowZeroMaterial_;
81  input.refTsos, input.fwdRecHits, input.bwdRecHits, magneticField.product(), beamSpot, config));
82  trajectories.push_back(ptr);
83  }
84 
85  ++itTracks;
86  }
87 
88  return trajectories;
89 }
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:48
config
Definition: looper.py:291
T get() const
Definition: EventSetup.h:71
PropagationDirection propagationDirection(void) const
ReferenceTrajectoryBase::ReferenceTrajectoryPtr ReferenceTrajectoryPtr
T const * product() const
Definition: ESHandle.h:86
std::vector< ReferenceTrajectoryPtr > ReferenceTrajectoryCollection
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 91 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_.

95  {
97 
98  if (tracks.size() != external.size()) {
99  edm::LogInfo("ReferenceTrajectories")
100  << "@SUB=DualBzeroTrajectoryFactory::trajectories"
101  << "Inconsistent input:\n"
102  << "\tnumber of tracks = " << tracks.size() << "\tnumber of external predictions = " << external.size();
103  return trajectories;
104  }
105 
107  setup.get<IdealMagneticFieldRecord>().get(magneticField);
108 
109  ConstTrajTrackPairCollection::const_iterator itTracks = tracks.begin();
110  ExternalPredictionCollection::const_iterator itExternal = external.begin();
111 
112  while (itTracks != tracks.end()) {
113  const DualBzeroTrajectoryInput input = referenceStateAndRecHits(*itTracks);
114  // Check input: If all hits were rejected, the TSOS is initialized as invalid.
115  if (input.refTsos.isValid()) {
116  if ((*itExternal).isValid()) {
117  TrajectoryStateOnSurface propExternal =
118  propagateExternal(*itExternal, input.refTsos.surface(), magneticField.product());
119 
120  if (!propExternal.isValid())
121  continue;
122 
124  config.useBeamSpot = useBeamSpot_;
125  config.includeAPEs = includeAPEs_;
126  config.allowZeroMaterial = allowZeroMaterial_;
128  propExternal, input.fwdRecHits, input.bwdRecHits, magneticField.product(), beamSpot, config));
129 
130  AlgebraicSymMatrix externalParamErrors(asHepMatrix<5>(propExternal.localError().matrix()));
131  ptr->setParameterErrors(externalParamErrors.sub(2, 5));
132  trajectories.push_back(ptr);
133  } else {
135  config.useBeamSpot = useBeamSpot_;
136  config.includeAPEs = includeAPEs_;
137  config.allowZeroMaterial = allowZeroMaterial_;
139  input.refTsos, input.fwdRecHits, input.bwdRecHits, magneticField.product(), beamSpot, config));
140 
141  trajectories.push_back(ptr);
142  }
143  }
144 
145  ++itTracks;
146  ++itExternal;
147  }
148 
149  return trajectories;
150 }
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:48
config
Definition: looper.py:291
const AlgebraicSymMatrix55 & matrix() const
const LocalTrajectoryError & localError() const
T get() const
Definition: EventSetup.h:71
PropagationDirection propagationDirection(void) const
CLHEP::HepSymMatrix AlgebraicSymMatrix
ReferenceTrajectoryBase::ReferenceTrajectoryPtr ReferenceTrajectoryPtr
T const * product() const
Definition: ESHandle.h:86
std::vector< ReferenceTrajectoryPtr > ReferenceTrajectoryCollection

Member Data Documentation

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

Definition at line 48 of file DualBzeroTrajectoryFactory.cc.

Referenced by DualBzeroTrajectoryFactory(), and trajectories().