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

ReferenceTrajectoryFactoryclone () const override
 
 ReferenceTrajectoryFactory (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
 
 ~ReferenceTrajectoryFactory () 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 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 50 of file ReferenceTrajectoryFactory.cc.

References theMass, and theUseBzeroIfFieldOff.

Referenced by clone().

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

Definition at line 67 of file ReferenceTrajectoryFactory.cc.

References theBzeroFactory.

67 { delete theBzeroFactory; }
const TrajectoryFactoryBase * theBzeroFactory
ReferenceTrajectoryFactory::ReferenceTrajectoryFactory ( const ReferenceTrajectoryFactory other)
protected

Definition at line 60 of file ReferenceTrajectoryFactory.cc.

61  : TrajectoryFactoryBase(other),
62  theMass(other.theMass),
64  theBzeroFactory(nullptr) // copy data members, but no double pointing to same Bzero factory...
65 {}
TrajectoryFactoryBase(const edm::ParameterSet &config)
const TrajectoryFactoryBase * theBzeroFactory

Member Function Documentation

const TrajectoryFactoryBase * ReferenceTrajectoryFactory::bzeroFactory ( ) const
protected

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

161  {
162  if (!theBzeroFactory) {
163  const edm::ParameterSet &myPset = this->configuration();
164  edm::LogInfo("Alignment") << "@SUB=ReferenceTrajectoryFactory::bzeroFactory"
165  << "Using BzeroReferenceTrajectoryFactory for some (all?) events.";
166  // We take the config of this factory, copy it, replace its name and add
167  // the momentum parameter as expected by BzeroReferenceTrajectoryFactory and create it:
169  pset.copyForModify(myPset);
170  // next two lines not needed, but may help to better understand log file:
171  pset.eraseSimpleParameter("TrajectoryFactoryName");
172  pset.addParameter("TrajectoryFactoryName", std::string("BzeroReferenceTrajectoryFactory"));
173  pset.addParameter("MomentumEstimate", myPset.getParameter<double>("MomentumEstimateFieldOff"));
175  }
176  return theBzeroFactory;
177 }
T getParameter(std::string const &) const
void addParameter(std::string const &name, T const &value)
Definition: ParameterSet.h:124
BzeroReferenceTrajectoryFactory
BzeroReferenceTrajectoryFactory.
const edm::ParameterSet & configuration() const
void eraseSimpleParameter(std::string const &name)
void copyForModify(ParameterSet const &other)
Definition: ParameterSet.cc:93
const TrajectoryFactoryBase * theBzeroFactory
ReferenceTrajectoryFactory* ReferenceTrajectoryFactory::clone ( void  ) const
inlineoverridevirtual

Implements TrajectoryFactoryBase.

Definition at line 35 of file ReferenceTrajectoryFactory.cc.

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

35 { 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 69 of file ReferenceTrajectoryFactory.cc.

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

Referenced by trajectories().

70  {
72  setup.get<IdealMagneticFieldRecord>().get(magneticField);
73  if (theUseBzeroIfFieldOff && magneticField->inTesla(GlobalPoint(0., 0., 0.)).mag2() < 1.e-6) {
74  return this->bzeroFactory()->trajectories(setup, tracks, beamSpot);
75  }
76 
78 
79  ConstTrajTrackPairCollection::const_iterator itTracks = tracks.begin();
80 
81  while (itTracks != tracks.end()) {
83 
84  // Check input: If all hits were rejected, the TSOS is initialized as invalid.
85  if (input.first.isValid()) {
87  config.useBeamSpot = useBeamSpot_;
88  config.includeAPEs = includeAPEs_;
89  config.allowZeroMaterial = allowZeroMaterial_;
90  // set the flag for reversing the RecHits to false, since they are already in the correct order.
91  config.hitsAreReverse = false;
92  trajectories.push_back(ReferenceTrajectoryPtr(
93  new ReferenceTrajectory(input.first, input.second, magneticField.product(), beamSpot, config)));
94  }
95 
96  ++itTracks;
97  }
98 
99  return trajectories;
100 }
T mag2() const
Definition: PV3DBase.h:63
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:48
config
Definition: looper.py:291
virtual GlobalVector inTesla(const GlobalPoint &gp) const =0
Field value ad specified global point, in Tesla.
std::pair< TrajectoryStateOnSurface, TransientTrackingRecHit::ConstRecHitContainer > TrajectoryInput
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
T get() const
Definition: EventSetup.h:73
PropagationDirection propagationDirection(void) const
ReferenceTrajectoryBase::ReferenceTrajectoryPtr ReferenceTrajectoryPtr
T const * product() const
Definition: ESHandle.h:86
std::vector< ReferenceTrajectoryPtr > ReferenceTrajectoryCollection
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 102 of file ReferenceTrajectoryFactory.cc.

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

106  {
108 
109  if (tracks.size() != external.size()) {
110  edm::LogInfo("ReferenceTrajectories")
111  << "@SUB=ReferenceTrajectoryFactory::trajectories"
112  << "Inconsistent input:\n"
113  << "\tnumber of tracks = " << tracks.size() << "\tnumber of external predictions = " << external.size();
114  return trajectories;
115  }
116 
118  setup.get<IdealMagneticFieldRecord>().get(magneticField);
119  if (theUseBzeroIfFieldOff && magneticField->inTesla(GlobalPoint(0., 0., 0.)).mag2() < 1.e-6) {
120  return this->bzeroFactory()->trajectories(setup, tracks, external, beamSpot);
121  }
122 
123  ConstTrajTrackPairCollection::const_iterator itTracks = tracks.begin();
124  ExternalPredictionCollection::const_iterator itExternal = external.begin();
125 
126  while (itTracks != tracks.end()) {
128  // Check input: If all hits were rejected, the TSOS is initialized as invalid.
129  if (input.first.isValid()) {
130  if ((*itExternal).isValid() && sameSurface((*itExternal).surface(), input.first.surface())) {
132  config.useBeamSpot = useBeamSpot_;
133  config.includeAPEs = includeAPEs_;
134  config.allowZeroMaterial = allowZeroMaterial_;
135  // set the flag for reversing the RecHits to false, since they are already in the correct order.
136  config.hitsAreReverse = false;
137  ReferenceTrajectoryPtr refTraj(
138  new ReferenceTrajectory(*itExternal, input.second, magneticField.product(), beamSpot, config));
139 
140  AlgebraicSymMatrix externalParamErrors(asHepMatrix<5>((*itExternal).localError().matrix()));
141  refTraj->setParameterErrors(externalParamErrors);
142  trajectories.push_back(refTraj);
143  } else {
145  config.useBeamSpot = useBeamSpot_;
146  config.includeAPEs = includeAPEs_;
147  config.allowZeroMaterial = allowZeroMaterial_;
148  config.hitsAreReverse = false;
149  trajectories.push_back(ReferenceTrajectoryPtr(
150  new ReferenceTrajectory(input.first, input.second, magneticField.product(), beamSpot, config)));
151  }
152  }
153 
154  ++itTracks;
155  ++itExternal;
156  }
157 
158  return trajectories;
159 }
T mag2() const
Definition: PV3DBase.h:63
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:48
config
Definition: looper.py:291
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.
std::pair< TrajectoryStateOnSurface, TransientTrackingRecHit::ConstRecHitContainer > TrajectoryInput
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
T get() const
Definition: EventSetup.h:73
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

const TrajectoryFactoryBase* ReferenceTrajectoryFactory::theBzeroFactory
mutableprotected

Definition at line 43 of file ReferenceTrajectoryFactory.cc.

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

double ReferenceTrajectoryFactory::theMass
protected

Definition at line 41 of file ReferenceTrajectoryFactory.cc.

Referenced by ReferenceTrajectoryFactory(), and trajectories().

bool ReferenceTrajectoryFactory::theUseBzeroIfFieldOff
protected

Definition at line 42 of file ReferenceTrajectoryFactory.cc.

Referenced by ReferenceTrajectoryFactory(), and trajectories().