CMS 3D CMS Logo

List of all members | Public Member Functions | Protected Member Functions | Protected Attributes
ReferenceTrajectoryFactory Class Reference
Inheritance diagram for ReferenceTrajectoryFactory:
TrajectoryFactoryBase

Public Member Functions

virtual ReferenceTrajectoryFactoryclone () const override
 
 ReferenceTrajectoryFactory (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 ~ReferenceTrajectoryFactory ()
 
- 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 TrajectoryFactoryBasebzeroFactory () const
 
 ReferenceTrajectoryFactory (const ReferenceTrajectoryFactory &other)
 
- 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

const TrajectoryFactoryBasetheBzeroFactory
 
double theMass
 
bool theUseBzeroIfFieldOff
 
- 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. If |B| = 0 T and configuration parameter UseBzeroIfFieldOff is True, hand-over to the BzeroReferenceTrajectoryFactory.

Definition at line 20 of file ReferenceTrajectoryFactory.cc.

Constructor & Destructor Documentation

ReferenceTrajectoryFactory::ReferenceTrajectoryFactory ( const edm::ParameterSet config)

Definition at line 51 of file ReferenceTrajectoryFactory.cc.

References theMass, and theUseBzeroIfFieldOff.

Referenced by clone().

51  :
52  TrajectoryFactoryBase( config ),
53  theMass(config.getParameter<double>("ParticleMass")),
54  theUseBzeroIfFieldOff(config.getParameter<bool>("UseBzeroIfFieldOff")),
56 {
57  edm::LogInfo("Alignment") << "@SUB=ReferenceTrajectoryFactory"
58  << "mass: " << theMass
59  << "\nusing Bzero if |B| = 0: "
60  << (theUseBzeroIfFieldOff ? "yes" : "no");
61 }
T getParameter(std::string const &) const
TrajectoryFactoryBase(const edm::ParameterSet &config)
const TrajectoryFactoryBase * theBzeroFactory
ReferenceTrajectoryFactory::~ReferenceTrajectoryFactory ( void  )
virtual

Definition at line 71 of file ReferenceTrajectoryFactory.cc.

References theBzeroFactory.

72 {
73  delete theBzeroFactory;
74 }
const TrajectoryFactoryBase * theBzeroFactory
ReferenceTrajectoryFactory::ReferenceTrajectoryFactory ( const ReferenceTrajectoryFactory other)
protected

Definition at line 63 of file ReferenceTrajectoryFactory.cc.

63  :
64  TrajectoryFactoryBase(other),
65  theMass(other.theMass),
67  theBzeroFactory(0) // copy data members, but no double pointing to same Bzero factory...
68 {
69 }
TrajectoryFactoryBase(const edm::ParameterSet &config)
const TrajectoryFactoryBase * theBzeroFactory

Member Function Documentation

const TrajectoryFactoryBase * ReferenceTrajectoryFactory::bzeroFactory ( ) const
protected

Definition at line 185 of file ReferenceTrajectoryFactory.cc.

References edm::ParameterSet::addParameter(), TrajectoryFactories_cff::BzeroReferenceTrajectoryFactory, TrajectoryFactoryBase::configuration(), edm::ParameterSet::copyForModify(), DEFINE_EDM_PLUGIN, edm::ParameterSet::eraseSimpleParameter(), edm::ParameterSet::getParameter(), muonDTDigis_cfi::pset, AlCaHLTBitMon_QueryRunRegistry::string, and theBzeroFactory.

Referenced by clone(), and trajectories().

186 {
187  if (!theBzeroFactory) {
188  const edm::ParameterSet &myPset = this->configuration();
189  edm::LogInfo("Alignment") << "@SUB=ReferenceTrajectoryFactory::bzeroFactory"
190  << "Using BzeroReferenceTrajectoryFactory for some (all?) events.";
191  // We take the config of this factory, copy it, replace its name and add
192  // the momentum parameter as expected by BzeroReferenceTrajectoryFactory and create it:
194  pset.copyForModify(myPset);
195  // next two lines not needed, but may help to better understand log file:
196  pset.eraseSimpleParameter("TrajectoryFactoryName");
197  pset.addParameter("TrajectoryFactoryName", std::string("BzeroReferenceTrajectoryFactory"));
198  pset.addParameter("MomentumEstimate", myPset.getParameter<double>("MomentumEstimateFieldOff"));
200  }
201  return theBzeroFactory;
202 }
T getParameter(std::string const &) const
void addParameter(std::string const &name, T const &value)
Definition: ParameterSet.h:144
BzeroReferenceTrajectoryFactory
BzeroReferenceTrajectoryFactory.
const edm::ParameterSet & configuration() const
void eraseSimpleParameter(std::string const &name)
void copyForModify(ParameterSet const &other)
const TrajectoryFactoryBase * theBzeroFactory
virtual ReferenceTrajectoryFactory* ReferenceTrajectoryFactory::clone ( void  ) const
inlineoverridevirtual

Implements TrajectoryFactoryBase.

Definition at line 36 of file ReferenceTrajectoryFactory.cc.

References bzeroFactory(), trackingPlots::other, and ReferenceTrajectoryFactory().

36 { return new ReferenceTrajectoryFactory(*this); }
ReferenceTrajectoryFactory(const edm::ParameterSet &config)
const ReferenceTrajectoryFactory::ReferenceTrajectoryCollection ReferenceTrajectoryFactory::trajectories ( const edm::EventSetup setup,
const ConstTrajTrackPairCollection tracks,
const reco::BeamSpot beamSpot 
) const
overridevirtual

Produce the reference trajectories.

Implements TrajectoryFactoryBase.

Definition at line 78 of file ReferenceTrajectoryFactory.cc.

References ReferenceTrajectoryBase::Config::allowZeroMaterial, TrajectoryFactoryBase::allowZeroMaterial_, ecalDrivenElectronSeedsParameters_cff::beamSpot, bzeroFactory(), mps_alisetup::config, edm::EventSetup::get(), ReferenceTrajectoryBase::Config::hitsAreReverse, ReferenceTrajectoryBase::Config::includeAPEs, TrajectoryFactoryBase::includeAPEs_, TrajectoryFactoryBase::innermostStateAndRecHits(), input, MagneticField::inTesla(), PV3DBase< T, PVType, FrameType >::mag2(), seedCreatorFromRegionConsecutiveHitsEDProducer_cff::magneticField, TrajectoryFactoryBase::materialEffects(), edm::ESHandle< T >::product(), TrajectoryFactoryBase::propagationDirection(), theMass, theUseBzeroIfFieldOff, TrajectoryFactoryBase::trajectories(), ReferenceTrajectoryBase::Config::useBeamSpot, and TrajectoryFactoryBase::useBeamSpot_.

Referenced by trajectories().

81 {
83  setup.get< IdealMagneticFieldRecord >().get( magneticField );
84  if (theUseBzeroIfFieldOff && magneticField->inTesla(GlobalPoint(0.,0.,0.)).mag2() < 1.e-6) {
85  return this->bzeroFactory()->trajectories(setup, tracks, beamSpot);
86  }
87 
89 
90  ConstTrajTrackPairCollection::const_iterator itTracks = tracks.begin();
91 
92  while ( itTracks != tracks.end() )
93  {
94  TrajectoryInput input = this->innermostStateAndRecHits( *itTracks );
95 
96  // Check input: If all hits were rejected, the TSOS is initialized as invalid.
97  if ( input.first.isValid() )
98  {
100  config.useBeamSpot = useBeamSpot_;
101  config.includeAPEs = includeAPEs_;
102  config.allowZeroMaterial = allowZeroMaterial_;
103  // set the flag for reversing the RecHits to false, since they are already in the correct order.
104  config.hitsAreReverse = false;
105  trajectories.push_back(ReferenceTrajectoryPtr(new ReferenceTrajectory(input.first, input.second,
106  magneticField.product(),
107  beamSpot, config)));
108  }
109 
110  ++itTracks;
111  }
112 
113  return trajectories;
114 }
T mag2() const
Definition: PV3DBase.h:66
virtual const ReferenceTrajectoryCollection trajectories(const edm::EventSetup &setup, const ConstTrajTrackPairCollection &tracks, const reco::BeamSpot &beamSpot) const override
Produce the reference trajectories.
MaterialEffects materialEffects(void) const
Definition: config.py:1
static std::string const input
Definition: EdmProvDump.cc:44
virtual GlobalVector inTesla(const GlobalPoint &gp) const =0
Field value ad specified global point, in Tesla.
virtual const ReferenceTrajectoryCollection trajectories(const edm::EventSetup &setup, const ConstTrajTrackPairCollection &tracks, const reco::BeamSpot &beamSpot) const =0
const TrajectoryFactoryBase * bzeroFactory() const
virtual const TrajectoryInput innermostStateAndRecHits(const ConstTrajTrackPair &track) const
std::vector< ReferenceTrajectoryPtr > ReferenceTrajectoryCollection
const T & get() const
Definition: EventSetup.h:56
PropagationDirection propagationDirection(void) const
std::pair< TrajectoryStateOnSurface, TransientTrackingRecHit::ConstRecHitContainer > TrajectoryInput
ReferenceTrajectoryBase::ReferenceTrajectoryPtr ReferenceTrajectoryPtr
T const * product() const
Definition: ESHandle.h:86
const ReferenceTrajectoryFactory::ReferenceTrajectoryCollection ReferenceTrajectoryFactory::trajectories ( const edm::EventSetup setup,
const ConstTrajTrackPairCollection tracks,
const ExternalPredictionCollection external,
const reco::BeamSpot beamSpot 
) const
overridevirtual

Implements TrajectoryFactoryBase.

Definition at line 118 of file ReferenceTrajectoryFactory.cc.

References ReferenceTrajectoryBase::Config::allowZeroMaterial, TrajectoryFactoryBase::allowZeroMaterial_, ecalDrivenElectronSeedsParameters_cff::beamSpot, bzeroFactory(), mps_alisetup::config, edm::EventSetup::get(), ReferenceTrajectoryBase::Config::hitsAreReverse, ReferenceTrajectoryBase::Config::includeAPEs, TrajectoryFactoryBase::includeAPEs_, TrajectoryFactoryBase::innermostStateAndRecHits(), input, MagneticField::inTesla(), PV3DBase< T, PVType, FrameType >::mag2(), seedCreatorFromRegionConsecutiveHitsEDProducer_cff::magneticField, TrajectoryFactoryBase::materialEffects(), edm::ESHandle< T >::product(), TrajectoryFactoryBase::propagationDirection(), TrajectoryFactoryBase::sameSurface(), theMass, theUseBzeroIfFieldOff, trajectories(), TrajectoryFactoryBase::trajectories(), ReferenceTrajectoryBase::Config::useBeamSpot, and TrajectoryFactoryBase::useBeamSpot_.

122 {
124 
125  if ( tracks.size() != external.size() )
126  {
127  edm::LogInfo("ReferenceTrajectories") << "@SUB=ReferenceTrajectoryFactory::trajectories"
128  << "Inconsistent input:\n"
129  << "\tnumber of tracks = " << tracks.size()
130  << "\tnumber of external predictions = " << external.size();
131  return trajectories;
132  }
133 
135  setup.get< IdealMagneticFieldRecord >().get( magneticField );
136  if (theUseBzeroIfFieldOff && magneticField->inTesla(GlobalPoint(0.,0.,0.)).mag2() < 1.e-6) {
137  return this->bzeroFactory()->trajectories(setup, tracks, external, beamSpot);
138  }
139 
140  ConstTrajTrackPairCollection::const_iterator itTracks = tracks.begin();
141  ExternalPredictionCollection::const_iterator itExternal = external.begin();
142 
143  while ( itTracks != tracks.end() )
144  {
146  // Check input: If all hits were rejected, the TSOS is initialized as invalid.
147  if ( input.first.isValid() )
148  {
149  if ( (*itExternal).isValid() && sameSurface( (*itExternal).surface(), input.first.surface() ) )
150  {
152  config.useBeamSpot = useBeamSpot_;
153  config.includeAPEs = includeAPEs_;
154  config.allowZeroMaterial = allowZeroMaterial_;
155  // set the flag for reversing the RecHits to false, since they are already in the correct order.
156  config.hitsAreReverse = false;
157  ReferenceTrajectoryPtr refTraj(new ReferenceTrajectory(*itExternal, input.second,
158  magneticField.product(),
159  beamSpot, config));
160 
161  AlgebraicSymMatrix externalParamErrors( asHepMatrix<5>( (*itExternal).localError().matrix() ) );
162  refTraj->setParameterErrors( externalParamErrors );
163  trajectories.push_back( refTraj );
164  }
165  else
166  {
168  config.useBeamSpot = useBeamSpot_;
169  config.includeAPEs = includeAPEs_;
170  config.allowZeroMaterial = allowZeroMaterial_;
171  config.hitsAreReverse = false;
172  trajectories.push_back(ReferenceTrajectoryPtr(new ReferenceTrajectory(input.first, input.second,
173  magneticField.product(),
174  beamSpot, config)));
175  }
176  }
177 
178  ++itTracks;
179  ++itExternal;
180  }
181 
182  return trajectories;
183 }
T mag2() const
Definition: PV3DBase.h:66
virtual const ReferenceTrajectoryCollection trajectories(const edm::EventSetup &setup, const ConstTrajTrackPairCollection &tracks, const reco::BeamSpot &beamSpot) const override
Produce the reference trajectories.
MaterialEffects materialEffects(void) const
Definition: config.py:1
static std::string const input
Definition: EdmProvDump.cc:44
bool sameSurface(const Surface &s1, const Surface &s2) const
virtual GlobalVector inTesla(const GlobalPoint &gp) const =0
Field value ad specified global point, in Tesla.
virtual const ReferenceTrajectoryCollection trajectories(const edm::EventSetup &setup, const ConstTrajTrackPairCollection &tracks, const reco::BeamSpot &beamSpot) const =0
const TrajectoryFactoryBase * bzeroFactory() const
virtual const TrajectoryInput innermostStateAndRecHits(const ConstTrajTrackPair &track) const
std::vector< ReferenceTrajectoryPtr > ReferenceTrajectoryCollection
const T & get() const
Definition: EventSetup.h:56
PropagationDirection propagationDirection(void) const
CLHEP::HepSymMatrix AlgebraicSymMatrix
std::pair< TrajectoryStateOnSurface, TransientTrackingRecHit::ConstRecHitContainer > TrajectoryInput
ReferenceTrajectoryBase::ReferenceTrajectoryPtr ReferenceTrajectoryPtr
T const * product() const
Definition: ESHandle.h:86

Member Data Documentation

const TrajectoryFactoryBase* ReferenceTrajectoryFactory::theBzeroFactory
mutableprotected

Definition at line 44 of file ReferenceTrajectoryFactory.cc.

Referenced by bzeroFactory(), and ~ReferenceTrajectoryFactory().

double ReferenceTrajectoryFactory::theMass
protected
bool ReferenceTrajectoryFactory::theUseBzeroIfFieldOff
protected

Definition at line 43 of file ReferenceTrajectoryFactory.cc.

Referenced by ReferenceTrajectoryFactory(), and trajectories().