CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Protected Member Functions | Protected Attributes
ReferenceTrajectoryFactory Class Reference
Inheritance diagram for ReferenceTrajectoryFactory:
TrajectoryFactoryBase

Public Member Functions

virtual
ReferenceTrajectoryFactory
clone () 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
 
 TrajectoryFactoryBase (const edm::ParameterSet &config)
 
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 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)

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

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

Referenced by trajectories().

183 {
184  if (!theBzeroFactory) {
185  const edm::ParameterSet &myPset = this->configuration();
186  edm::LogInfo("Alignment") << "@SUB=ReferenceTrajectoryFactory::bzeroFactory"
187  << "Using BzeroReferenceTrajectoryFactory for some (all?) events.";
188  // We take the config of this factory, copy it, replace its name and add
189  // the momentum parameter as expected by BzeroReferenceTrajectoryFactory and create it:
191  pset.copyForModify(myPset);
192  // next two lines not needed, but may help to better understand log file:
193  pset.eraseSimpleParameter("TrajectoryFactoryName");
194  pset.addParameter("TrajectoryFactoryName", std::string("BzeroReferenceTrajectoryFactory"));
195  pset.addParameter("MomentumEstimate", myPset.getParameter<double>("MomentumEstimateFieldOff"));
197  }
198  return theBzeroFactory;
199 }
T getParameter(std::string const &) const
tuple BzeroReferenceTrajectoryFactory
BzeroReferenceTrajectoryFactory.
void addParameter(std::string const &name, T const &value)
Definition: ParameterSet.h:144
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 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 SiPixelRawToDigiRegional_cfi::beamSpot, bzeroFactory(), mps_alisetup::config, edm::EventSetup::get(), ReferenceTrajectoryBase::Config::hitsAreReverse, ReferenceTrajectoryBase::Config::includeAPEs, TrajectoryFactoryBase::includeAPEs_, TrajectoryFactoryBase::innermostStateAndRecHits(), input, HLT_25ns10e33_v2_cff::magneticField, TrajectoryFactoryBase::materialEffects(), edm::ESHandle< class >::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  // set the flag for reversing the RecHits to false, since they are already in the correct order.
103  config.hitsAreReverse = false;
104  trajectories.push_back(ReferenceTrajectoryPtr(new ReferenceTrajectory(input.first, input.second,
105  magneticField.product(),
106  beamSpot, config)));
107  }
108 
109  ++itTracks;
110  }
111 
112  return trajectories;
113 }
MaterialEffects materialEffects(void) const
static std::string const input
Definition: EdmProvDump.cc:44
virtual const ReferenceTrajectoryCollection trajectories(const edm::EventSetup &setup, const ConstTrajTrackPairCollection &tracks, const reco::BeamSpot &beamSpot) const override
Produce the reference trajectories.
const TrajectoryFactoryBase * bzeroFactory() const
virtual const TrajectoryInput innermostStateAndRecHits(const ConstTrajTrackPair &track) const
std::vector< ReferenceTrajectoryPtr > ReferenceTrajectoryCollection
tuple tracks
Definition: testEve_cfg.py:39
const T & get() const
Definition: EventSetup.h:56
T const * product() const
Definition: ESHandle.h:86
virtual const ReferenceTrajectoryCollection trajectories(const edm::EventSetup &setup, const ConstTrajTrackPairCollection &tracks, const reco::BeamSpot &beamSpot) const =0
PropagationDirection propagationDirection(void) const
std::pair< TrajectoryStateOnSurface, TransientTrackingRecHit::ConstRecHitContainer > TrajectoryInput
ReferenceTrajectoryBase::ReferenceTrajectoryPtr ReferenceTrajectoryPtr
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 117 of file ReferenceTrajectoryFactory.cc.

References SiPixelRawToDigiRegional_cfi::beamSpot, bzeroFactory(), mps_alisetup::config, edm::EventSetup::get(), ReferenceTrajectoryBase::Config::hitsAreReverse, ReferenceTrajectoryBase::Config::includeAPEs, TrajectoryFactoryBase::includeAPEs_, TrajectoryFactoryBase::innermostStateAndRecHits(), input, HLT_25ns10e33_v2_cff::magneticField, TrajectoryFactoryBase::materialEffects(), edm::ESHandle< class >::product(), TrajectoryFactoryBase::propagationDirection(), TrajectoryFactoryBase::sameSurface(), theMass, theUseBzeroIfFieldOff, trajectories(), TrajectoryFactoryBase::trajectories(), ReferenceTrajectoryBase::Config::useBeamSpot, and TrajectoryFactoryBase::useBeamSpot_.

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

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().