CMS 3D CMS Logo

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

Public Member Functions

ReferenceTrajectoryFactoryclone () const override
 
 ReferenceTrajectoryFactory (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
 
 ~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, 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, IdealMagneticFieldRecordm_MagFieldToken
 

Protected Member Functions

const TrajectoryFactoryBasebzeroFactory () const
 
const TrajectoryFactoryBasebzeroFactory (edm::ConsumesCollector &iC) 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() [1/2]

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

Definition at line 53 of file ReferenceTrajectoryFactory.cc.

References TrajectoryFactories_cff::BzeroReferenceTrajectoryFactory, muonDTDigis_cfi::pset, AlCaHLTBitMon_QueryRunRegistry::string, theBzeroFactory, theMass, and theUseBzeroIfFieldOff.

Referenced by clone().

56  theMass(config.getParameter<double>("ParticleMass")),
57  theUseBzeroIfFieldOff(config.getParameter<bool>("UseBzeroIfFieldOff")),
58  theBzeroFactory(nullptr) {
59  edm::LogInfo("Alignment") << "@SUB=ReferenceTrajectoryFactory"
60  << "mass: " << theMass
61  << "\nusing Bzero if |B| = 0: " << (theUseBzeroIfFieldOff ? "yes" : "no");
62  // We take the config of this factory, copy it, replace its name and add
63  // the momentum parameter as expected by BzeroReferenceTrajectoryFactory and create it:
64  //
66  pset.copyForModify(config);
67  // next two lines not needed, but may help to better understand log file:
68  pset.eraseSimpleParameter("TrajectoryFactoryName");
69  pset.addParameter("TrajectoryFactoryName", std::string("BzeroReferenceTrajectoryFactory"));
70  pset.addParameter("MomentumEstimate", config.getParameter<double>("MomentumEstimateFieldOff"));
72 }
Definition: config.py:1
BzeroReferenceTrajectoryFactory
BzeroReferenceTrajectoryFactory.
Log< level::Info, false > LogInfo
TrajectoryFactoryBase(const edm::ParameterSet &config, const edm::ConsumesCollector &iC)
const edm::ESGetToken< MagneticField, IdealMagneticFieldRecord > m_MagFieldToken
const TrajectoryFactoryBase * theBzeroFactory

◆ ~ReferenceTrajectoryFactory()

ReferenceTrajectoryFactory::~ReferenceTrajectoryFactory ( void  )
override

Definition at line 81 of file ReferenceTrajectoryFactory.cc.

References theBzeroFactory.

81 { delete theBzeroFactory; }
const TrajectoryFactoryBase * theBzeroFactory

◆ ReferenceTrajectoryFactory() [2/2]

ReferenceTrajectoryFactory::ReferenceTrajectoryFactory ( const ReferenceTrajectoryFactory other)
protected

Definition at line 74 of file ReferenceTrajectoryFactory.cc.

76  theMass(other.theMass),
77  theUseBzeroIfFieldOff(other.theUseBzeroIfFieldOff),
78  theBzeroFactory(nullptr) // copy data members, but no double pointing to same Bzero factory...
79 {}
TrajectoryFactoryBase(const edm::ParameterSet &config, const edm::ConsumesCollector &iC)
const TrajectoryFactoryBase * theBzeroFactory

Member Function Documentation

◆ bzeroFactory() [1/2]

const TrajectoryFactoryBase * ReferenceTrajectoryFactory::bzeroFactory ( ) const
protected

Definition at line 174 of file ReferenceTrajectoryFactory.cc.

References theBzeroFactory.

Referenced by trajectories().

174  {
175  if (!theBzeroFactory) {
176  edm::LogInfo("Alignment") << "@SUB=ReferenceTrajectoryFactory::bzeroFactory"
177  << "Using BzeroReferenceTrajectoryFactory for some (all?) events.";
178  }
179  return theBzeroFactory;
180 }
Log< level::Info, false > LogInfo
const TrajectoryFactoryBase * theBzeroFactory

◆ bzeroFactory() [2/2]

const TrajectoryFactoryBase* ReferenceTrajectoryFactory::bzeroFactory ( edm::ConsumesCollector iC) const
protected

◆ clone()

ReferenceTrajectoryFactory* ReferenceTrajectoryFactory::clone ( void  ) const
inlineoverridevirtual

Implements TrajectoryFactoryBase.

Definition at line 36 of file ReferenceTrajectoryFactory.cc.

References ReferenceTrajectoryFactory().

36 { return new ReferenceTrajectoryFactory(*this); }
ReferenceTrajectoryFactory(const edm::ParameterSet &config, edm::ConsumesCollector &iC)

◆ trajectories() [1/2]

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 83 of file ReferenceTrajectoryFactory.cc.

References TrajectoryFactoryBase::allowZeroMaterial_, pwdgSkimBPark_cfi::beamSpot, bzeroFactory(), DMR_cfg::config, TrajectoryFactoryBase::includeAPEs_, TrajectoryFactoryBase::innermostStateAndRecHits(), input, m_MagFieldToken, HLT_2022v15_cff::magneticField, TrajectoryFactoryBase::materialEffects(), TrajectoryFactoryBase::propagationDirection(), singleTopDQM_cfi::setup, theMass, theUseBzeroIfFieldOff, tracks, TrajectoryFactoryBase::trajectories(), and TrajectoryFactoryBase::useBeamSpot_.

Referenced by trajectories().

84  {
86 
87  if (theUseBzeroIfFieldOff && magneticField->inTesla(GlobalPoint(0., 0., 0.)).mag2() < 1.e-6) {
88  return this->bzeroFactory()->trajectories(setup, tracks, beamSpot);
89  }
90 
92 
93  ConstTrajTrackPairCollection::const_iterator itTracks = tracks.begin();
94 
95  while (itTracks != tracks.end()) {
97 
98  // Check input: If all hits were rejected, the TSOS is initialized as invalid.
99  if (input.first.isValid()) {
101  config.useBeamSpot = useBeamSpot_;
102  config.includeAPEs = includeAPEs_;
103  config.allowZeroMaterial = allowZeroMaterial_;
104  // set the flag for reversing the RecHits to false, since they are already in the correct order.
105  config.hitsAreReverse = false;
106  trajectories.push_back(
108  }
109 
110  ++itTracks;
111  }
112 
113  return trajectories;
114 }
dictionary config
Read in AllInOne config in JSON format.
Definition: DMR_cfg.py:21
Definition: config.py:1
MaterialEffects materialEffects(void) const
static std::string const input
Definition: EdmProvDump.cc:50
const ReferenceTrajectoryCollection trajectories(const edm::EventSetup &setup, const ConstTrajTrackPairCollection &tracks, const reco::BeamSpot &beamSpot) const override
Produce the reference trajectories.
std::pair< TrajectoryStateOnSurface, TransientTrackingRecHit::ConstRecHitContainer > TrajectoryInput
const TrajectoryFactoryBase * bzeroFactory() const
auto const & tracks
cannot be loose
virtual const TrajectoryInput innermostStateAndRecHits(const ConstTrajTrackPair &track) const
const edm::ESGetToken< MagneticField, IdealMagneticFieldRecord > m_MagFieldToken
virtual const ReferenceTrajectoryCollection trajectories(const edm::EventSetup &setup, const ConstTrajTrackPairCollection &tracks, const reco::BeamSpot &beamSpot) const =0
PropagationDirection propagationDirection(void) const
ReferenceTrajectoryBase::ReferenceTrajectoryPtr ReferenceTrajectoryPtr
std::vector< ReferenceTrajectoryPtr > ReferenceTrajectoryCollection

◆ trajectories() [2/2]

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 116 of file ReferenceTrajectoryFactory.cc.

References TrajectoryFactoryBase::allowZeroMaterial_, pwdgSkimBPark_cfi::beamSpot, bzeroFactory(), DMR_cfg::config, TrajectoryFactoryBase::includeAPEs_, TrajectoryFactoryBase::innermostStateAndRecHits(), input, m_MagFieldToken, HLT_2022v15_cff::magneticField, TrajectoryFactoryBase::materialEffects(), TrajectoryFactoryBase::propagationDirection(), TrajectoryFactoryBase::sameSurface(), singleTopDQM_cfi::setup, theMass, theUseBzeroIfFieldOff, tracks, trajectories(), TrajectoryFactoryBase::trajectories(), and TrajectoryFactoryBase::useBeamSpot_.

120  {
122 
123  if (tracks.size() != external.size()) {
124  edm::LogInfo("ReferenceTrajectories")
125  << "@SUB=ReferenceTrajectoryFactory::trajectories"
126  << "Inconsistent input:\n"
127  << "\tnumber of tracks = " << tracks.size() << "\tnumber of external predictions = " << external.size();
128  return trajectories;
129  }
131 
132  if (theUseBzeroIfFieldOff && magneticField->inTesla(GlobalPoint(0., 0., 0.)).mag2() < 1.e-6) {
133  return this->bzeroFactory()->trajectories(setup, tracks, external, beamSpot);
134  }
135 
136  ConstTrajTrackPairCollection::const_iterator itTracks = tracks.begin();
137  ExternalPredictionCollection::const_iterator itExternal = external.begin();
138 
139  while (itTracks != tracks.end()) {
141  // Check input: If all hits were rejected, the TSOS is initialized as invalid.
142  if (input.first.isValid()) {
143  if ((*itExternal).isValid() && sameSurface((*itExternal).surface(), input.first.surface())) {
145  config.useBeamSpot = useBeamSpot_;
146  config.includeAPEs = includeAPEs_;
147  config.allowZeroMaterial = allowZeroMaterial_;
148  // set the flag for reversing the RecHits to false, since they are already in the correct order.
149  config.hitsAreReverse = false;
150  ReferenceTrajectoryPtr refTraj(
151  new ReferenceTrajectory(*itExternal, input.second, magneticField, beamSpot, config));
152 
153  AlgebraicSymMatrix externalParamErrors(asHepMatrix<5>((*itExternal).localError().matrix()));
154  refTraj->setParameterErrors(externalParamErrors);
155  trajectories.push_back(refTraj);
156  } else {
158  config.useBeamSpot = useBeamSpot_;
159  config.includeAPEs = includeAPEs_;
160  config.allowZeroMaterial = allowZeroMaterial_;
161  config.hitsAreReverse = false;
164  }
165  }
166 
167  ++itTracks;
168  ++itExternal;
169  }
170 
171  return trajectories;
172 }
dictionary config
Read in AllInOne config in JSON format.
Definition: DMR_cfg.py:21
Definition: config.py:1
bool sameSurface(const Surface &s1, const Surface &s2) const
MaterialEffects materialEffects(void) const
static std::string const input
Definition: EdmProvDump.cc:50
const ReferenceTrajectoryCollection trajectories(const edm::EventSetup &setup, const ConstTrajTrackPairCollection &tracks, const reco::BeamSpot &beamSpot) const override
Produce the reference trajectories.
std::pair< TrajectoryStateOnSurface, TransientTrackingRecHit::ConstRecHitContainer > TrajectoryInput
Log< level::Info, false > LogInfo
const TrajectoryFactoryBase * bzeroFactory() const
auto const & tracks
cannot be loose
virtual const TrajectoryInput innermostStateAndRecHits(const ConstTrajTrackPair &track) const
const edm::ESGetToken< MagneticField, IdealMagneticFieldRecord > m_MagFieldToken
virtual const ReferenceTrajectoryCollection trajectories(const edm::EventSetup &setup, const ConstTrajTrackPairCollection &tracks, const reco::BeamSpot &beamSpot) const =0
CLHEP::HepSymMatrix AlgebraicSymMatrix
PropagationDirection propagationDirection(void) const
ReferenceTrajectoryBase::ReferenceTrajectoryPtr ReferenceTrajectoryPtr
std::vector< ReferenceTrajectoryPtr > ReferenceTrajectoryCollection

Member Data Documentation

◆ m_MagFieldToken

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

Definition at line 24 of file ReferenceTrajectoryFactory.cc.

Referenced by trajectories().

◆ theBzeroFactory

const TrajectoryFactoryBase* ReferenceTrajectoryFactory::theBzeroFactory
mutableprotected

◆ theMass

double ReferenceTrajectoryFactory::theMass
protected

Definition at line 43 of file ReferenceTrajectoryFactory.cc.

Referenced by ReferenceTrajectoryFactory(), and trajectories().

◆ theUseBzeroIfFieldOff

bool ReferenceTrajectoryFactory::theUseBzeroIfFieldOff
protected

Definition at line 44 of file ReferenceTrajectoryFactory.cc.

Referenced by ReferenceTrajectoryFactory(), and trajectories().