CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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,
IdealMagneticFieldRecord
m_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
< 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. 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,
edm::ConsumesCollector iC 
)

Definition at line 53 of file ReferenceTrajectoryFactory.cc.

References TrajectoryFactories_cff::BzeroReferenceTrajectoryFactory, edm::ParameterSet::getParameter(), TrackValidation_cff::pset, AlCaHLTBitMon_QueryRunRegistry::string, theBzeroFactory, theMass, and theUseBzeroIfFieldOff.

Referenced by clone().

54  : TrajectoryFactoryBase(config, iC),
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 }
tuple 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
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
ReferenceTrajectoryFactory::~ReferenceTrajectoryFactory ( void  )
override

Definition at line 81 of file ReferenceTrajectoryFactory.cc.

References theBzeroFactory.

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

Definition at line 74 of file ReferenceTrajectoryFactory.cc.

75  : TrajectoryFactoryBase(other),
76  theMass(other.theMass),
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

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
const TrajectoryFactoryBase* ReferenceTrajectoryFactory::bzeroFactory ( edm::ConsumesCollector iC) const
protected
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)
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 ReferenceTrajectoryBase::Config::allowZeroMaterial, TrajectoryFactoryBase::allowZeroMaterial_, bzeroFactory(), submitPVResolutionJobs::config, edm::EventSetup::getData(), ReferenceTrajectoryBase::Config::hitsAreReverse, ReferenceTrajectoryBase::Config::includeAPEs, TrajectoryFactoryBase::includeAPEs_, TrajectoryFactoryBase::innermostStateAndRecHits(), input, MagneticField::inTesla(), m_MagFieldToken, PV3DBase< T, PVType, FrameType >::mag2(), HLT_FULL_cff::magneticField, TrajectoryFactoryBase::materialEffects(), TrajectoryFactoryBase::propagationDirection(), theMass, theUseBzeroIfFieldOff, TrajectoryFactoryBase::trajectories(), ReferenceTrajectoryBase::Config::useBeamSpot, 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(
107  ReferenceTrajectoryPtr(new ReferenceTrajectory(input.first, input.second, magneticField, beamSpot, config)));
108  }
109 
110  ++itTracks;
111  }
112 
113  return trajectories;
114 }
T mag2() const
Definition: PV3DBase.h:63
MaterialEffects materialEffects(void) const
virtual GlobalVector inTesla(const GlobalPoint &gp) const =0
Field value ad specified global point, in Tesla.
tuple magneticField
auto const & tracks
cannot be loose
static std::string const input
Definition: EdmProvDump.cc:47
bool getData(T &iHolder) const
Definition: EventSetup.h:122
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
virtual const TrajectoryInput innermostStateAndRecHits(const ConstTrajTrackPair &track) const
const edm::ESGetToken< MagneticField, IdealMagneticFieldRecord > m_MagFieldToken
tuple config
parse the configuration file
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
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 ReferenceTrajectoryBase::Config::allowZeroMaterial, TrajectoryFactoryBase::allowZeroMaterial_, bzeroFactory(), submitPVResolutionJobs::config, edm::EventSetup::getData(), ReferenceTrajectoryBase::Config::hitsAreReverse, ReferenceTrajectoryBase::Config::includeAPEs, TrajectoryFactoryBase::includeAPEs_, TrajectoryFactoryBase::innermostStateAndRecHits(), input, MagneticField::inTesla(), m_MagFieldToken, PV3DBase< T, PVType, FrameType >::mag2(), HLT_FULL_cff::magneticField, TrajectoryFactoryBase::materialEffects(), TrajectoryFactoryBase::propagationDirection(), TrajectoryFactoryBase::sameSurface(), theMass, theUseBzeroIfFieldOff, trajectories(), TrajectoryFactoryBase::trajectories(), ReferenceTrajectoryBase::Config::useBeamSpot, 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;
162  trajectories.push_back(ReferenceTrajectoryPtr(
163  new ReferenceTrajectory(input.first, input.second, magneticField, beamSpot, config)));
164  }
165  }
166 
167  ++itTracks;
168  ++itExternal;
169  }
170 
171  return trajectories;
172 }
T mag2() const
Definition: PV3DBase.h:63
MaterialEffects materialEffects(void) const
virtual GlobalVector inTesla(const GlobalPoint &gp) const =0
Field value ad specified global point, in Tesla.
tuple magneticField
auto const & tracks
cannot be loose
static std::string const input
Definition: EdmProvDump.cc:47
bool getData(T &iHolder) const
Definition: EventSetup.h:122
bool sameSurface(const Surface &s1, const Surface &s2) const
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
virtual const TrajectoryInput innermostStateAndRecHits(const ConstTrajTrackPair &track) const
const edm::ESGetToken< MagneticField, IdealMagneticFieldRecord > m_MagFieldToken
tuple config
parse the configuration file
virtual const ReferenceTrajectoryCollection trajectories(const edm::EventSetup &setup, const ConstTrajTrackPairCollection &tracks, const reco::BeamSpot &beamSpot) const =0
PropagationDirection propagationDirection(void) const
CLHEP::HepSymMatrix AlgebraicSymMatrix
ReferenceTrajectoryBase::ReferenceTrajectoryPtr ReferenceTrajectoryPtr
std::vector< ReferenceTrajectoryPtr > ReferenceTrajectoryCollection

Member Data Documentation

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

Definition at line 24 of file ReferenceTrajectoryFactory.cc.

Referenced by trajectories().

const TrajectoryFactoryBase* ReferenceTrajectoryFactory::theBzeroFactory
mutableprotected
double ReferenceTrajectoryFactory::theMass
protected

Definition at line 43 of file ReferenceTrajectoryFactory.cc.

Referenced by ReferenceTrajectoryFactory(), and trajectories().

bool ReferenceTrajectoryFactory::theUseBzeroIfFieldOff
protected

Definition at line 44 of file ReferenceTrajectoryFactory.cc.

Referenced by ReferenceTrajectoryFactory(), and trajectories().