CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
List of all members | Classes | Public Member Functions | Public Attributes | 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, edm::ConsumesCollector &iC)
 
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, const edm::ConsumesCollector &iC)
 
 TrajectoryFactoryBase (const edm::ParameterSet &config, unsigned int tracksPerTrajectory, const edm::ConsumesCollector &iC)
 
virtual ~TrajectoryFactoryBase (void)
 

Public Attributes

const edm::ESGetToken
< MagneticField,
IdealMagneticFieldRecord
m_MagFieldToken
 

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
< 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 DualBzeroTrajectoryFactory.cc.

Constructor & Destructor Documentation

DualBzeroTrajectoryFactory::DualBzeroTrajectoryFactory ( const edm::ParameterSet config,
edm::ConsumesCollector iC 
)

Definition at line 56 of file DualBzeroTrajectoryFactory.cc.

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

Referenced by clone().

57  : TrajectoryFactoryBase(config, iC), m_MagFieldToken(iC.esConsumes()) {
58  theMass = config.getParameter<double>("ParticleMass");
59  theMomentumEstimate = config.getParameter<double>("MomentumEstimate");
60 }
const edm::ESGetToken< MagneticField, IdealMagneticFieldRecord > m_MagFieldToken
TrajectoryFactoryBase(const edm::ParameterSet &config, const edm::ConsumesCollector &iC)
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
DualBzeroTrajectoryFactory::~DualBzeroTrajectoryFactory ( void  )
override

Definition at line 62 of file DualBzeroTrajectoryFactory.cc.

62 {}

Member Function Documentation

DualBzeroTrajectoryFactory* DualBzeroTrajectoryFactory::clone ( void  ) const
inlineoverridevirtual

Implements TrajectoryFactoryBase.

Definition at line 33 of file DualBzeroTrajectoryFactory.cc.

References DualBzeroTrajectoryFactory().

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

Definition at line 194 of file DualBzeroTrajectoryFactory.cc.

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

Referenced by trajectories().

196  {
198  const std::pair<TrajectoryStateOnSurface, double> tsosWithPath = propagator.propagateWithPath(external, surface);
199  return tsosWithPath.first;
200 }
tuple propagator
const DualBzeroTrajectoryFactory::DualBzeroTrajectoryInput DualBzeroTrajectoryFactory::referenceStateAndRecHits ( const ConstTrajTrackPair track) const
protected

Definition at line 150 of file DualBzeroTrajectoryFactory.cc.

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

Referenced by trajectories().

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

References ReferenceTrajectoryBase::Config::allowZeroMaterial, TrajectoryFactoryBase::allowZeroMaterial_, DualBzeroTrajectoryFactory::DualBzeroTrajectoryInput::bwdRecHits, submitPVResolutionJobs::config, DualBzeroTrajectoryFactory::DualBzeroTrajectoryInput::fwdRecHits, edm::EventSetup::getData(), ReferenceTrajectoryBase::Config::includeAPEs, TrajectoryFactoryBase::includeAPEs_, input, TrajectoryStateOnSurface::isValid(), m_MagFieldToken, HLT_FULL_cff::magneticField, TrajectoryFactoryBase::materialEffects(), TrajectoryFactoryBase::propagationDirection(), referenceStateAndRecHits(), DualBzeroTrajectoryFactory::DualBzeroTrajectoryInput::refTsos, theMass, theMomentumEstimate, ReferenceTrajectoryBase::Config::useBeamSpot, and TrajectoryFactoryBase::useBeamSpot_.

Referenced by trajectories().

65  {
67 
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, 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.
tuple magneticField
auto const & tracks
cannot be loose
static std::string const input
Definition: EdmProvDump.cc:47
const edm::ESGetToken< MagneticField, IdealMagneticFieldRecord > m_MagFieldToken
bool getData(T &iHolder) const
Definition: EventSetup.h:128
tuple config
parse the configuration file
PropagationDirection propagationDirection(void) const
ReferenceTrajectoryBase::ReferenceTrajectoryPtr ReferenceTrajectoryPtr
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_, DualBzeroTrajectoryFactory::DualBzeroTrajectoryInput::bwdRecHits, submitPVResolutionJobs::config, DualBzeroTrajectoryFactory::DualBzeroTrajectoryInput::fwdRecHits, edm::EventSetup::getData(), ReferenceTrajectoryBase::Config::includeAPEs, TrajectoryFactoryBase::includeAPEs_, input, TrajectoryStateOnSurface::isValid(), TrajectoryStateOnSurface::localError(), m_MagFieldToken, HLT_FULL_cff::magneticField, TrajectoryFactoryBase::materialEffects(), LocalTrajectoryError::matrix(), 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 
108  ConstTrajTrackPairCollection::const_iterator itTracks = tracks.begin();
109  ExternalPredictionCollection::const_iterator itExternal = external.begin();
110 
111  while (itTracks != tracks.end()) {
112  const DualBzeroTrajectoryInput input = referenceStateAndRecHits(*itTracks);
113  // Check input: If all hits were rejected, the TSOS is initialized as invalid.
114  if (input.refTsos.isValid()) {
115  if ((*itExternal).isValid()) {
116  TrajectoryStateOnSurface propExternal = propagateExternal(*itExternal, input.refTsos.surface(), magneticField);
117 
118  if (!propExternal.isValid())
119  continue;
120 
122  config.useBeamSpot = useBeamSpot_;
123  config.includeAPEs = includeAPEs_;
124  config.allowZeroMaterial = allowZeroMaterial_;
126  propExternal, input.fwdRecHits, input.bwdRecHits, magneticField, beamSpot, config));
127 
128  AlgebraicSymMatrix externalParamErrors(asHepMatrix<5>(propExternal.localError().matrix()));
129  ptr->setParameterErrors(externalParamErrors.sub(2, 5));
130  trajectories.push_back(ptr);
131  } else {
133  config.useBeamSpot = useBeamSpot_;
134  config.includeAPEs = includeAPEs_;
135  config.allowZeroMaterial = allowZeroMaterial_;
137  input.refTsos, input.fwdRecHits, input.bwdRecHits, magneticField, beamSpot, config));
138 
139  trajectories.push_back(ptr);
140  }
141  }
142 
143  ++itTracks;
144  ++itExternal;
145  }
146 
147  return trajectories;
148 }
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.
tuple magneticField
auto const & tracks
cannot be loose
static std::string const input
Definition: EdmProvDump.cc:47
const edm::ESGetToken< MagneticField, IdealMagneticFieldRecord > m_MagFieldToken
bool getData(T &iHolder) const
Definition: EventSetup.h:128
const AlgebraicSymMatrix55 & matrix() const
const LocalTrajectoryError & localError() const
Log< level::Info, false > LogInfo
tuple config
parse the configuration file
PropagationDirection propagationDirection(void) const
CLHEP::HepSymMatrix AlgebraicSymMatrix
ReferenceTrajectoryBase::ReferenceTrajectoryPtr ReferenceTrajectoryPtr
std::vector< ReferenceTrajectoryPtr > ReferenceTrajectoryCollection

Member Data Documentation

const edm::ESGetToken<MagneticField, IdealMagneticFieldRecord> DualBzeroTrajectoryFactory::m_MagFieldToken

Definition at line 21 of file DualBzeroTrajectoryFactory.cc.

Referenced by trajectories().

double DualBzeroTrajectoryFactory::theMass
protected

Definition at line 48 of file DualBzeroTrajectoryFactory.cc.

Referenced by DualBzeroTrajectoryFactory(), and trajectories().

double DualBzeroTrajectoryFactory::theMomentumEstimate
protected

Definition at line 49 of file DualBzeroTrajectoryFactory.cc.

Referenced by DualBzeroTrajectoryFactory(), and trajectories().