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
bool theUseBeamSpot
 

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

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

Referenced by trajectories().

174 {
175  if (!theBzeroFactory) {
176  const edm::ParameterSet &myPset = this->configuration();
177  edm::LogInfo("Alignment") << "@SUB=ReferenceTrajectoryFactory::bzeroFactory"
178  << "Using BzeroReferenceTrajectoryFactory for some (all?) events.";
179  // We take the config of this factory, copy it, replace its name and add
180  // the momentum parameter as expected by BzeroReferenceTrajectoryFactory and create it:
181  edm::ParameterSet pset;
182  pset.copyForModify(myPset);
183  // next two lines not needed, but may help to better understand log file:
184  pset.eraseSimpleParameter("TrajectoryFactoryName");
185  pset.addParameter("TrajectoryFactoryName", std::string("BzeroReferenceTrajectoryFactory"));
186  pset.addParameter("MomentumEstimate", myPset.getParameter<double>("MomentumEstimateFieldOff"));
188  }
189  return theBzeroFactory;
190 }
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(), edm::EventSetup::get(), TrajectoryFactoryBase::innermostStateAndRecHits(), input, HLT_25ns14e33_v1_cff::magneticField, TrajectoryFactoryBase::materialEffects(), edm::ESHandle< class >::product(), TrajectoryFactoryBase::propagationDirection(), theMass, TrajectoryFactoryBase::theUseBeamSpot, theUseBzeroIfFieldOff, and TrajectoryFactoryBase::trajectories().

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  {
99  // set the flag for reversing the RecHits to false, since they are already in the correct order.
100  trajectories.push_back(ReferenceTrajectoryPtr(new ReferenceTrajectory(input.first, input.second, false,
101  magneticField.product(), materialEffects(),
104  }
105 
106  ++itTracks;
107  }
108 
109  return trajectories;
110 }
MaterialEffects materialEffects(void) const
static std::string const input
Definition: EdmProvDump.cc:43
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 114 of file ReferenceTrajectoryFactory.cc.

References SiPixelRawToDigiRegional_cfi::beamSpot, bzeroFactory(), edm::EventSetup::get(), TrajectoryFactoryBase::innermostStateAndRecHits(), input, HLT_25ns14e33_v1_cff::magneticField, TrajectoryFactoryBase::materialEffects(), edm::ESHandle< class >::product(), TrajectoryFactoryBase::propagationDirection(), TrajectoryFactoryBase::sameSurface(), theMass, TrajectoryFactoryBase::theUseBeamSpot, theUseBzeroIfFieldOff, trajectories(), and TrajectoryFactoryBase::trajectories().

118 {
120 
121  if ( tracks.size() != external.size() )
122  {
123  edm::LogInfo("ReferenceTrajectories") << "@SUB=ReferenceTrajectoryFactory::trajectories"
124  << "Inconsistent input:\n"
125  << "\tnumber of tracks = " << tracks.size()
126  << "\tnumber of external predictions = " << external.size();
127  return trajectories;
128  }
129 
131  setup.get< IdealMagneticFieldRecord >().get( magneticField );
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() )
140  {
142  // Check input: If all hits were rejected, the TSOS is initialized as invalid.
143  if ( input.first.isValid() )
144  {
145  if ( (*itExternal).isValid() && sameSurface( (*itExternal).surface(), input.first.surface() ) )
146  {
147  // set the flag for reversing the RecHits to false, since they are already in the correct order.
148  ReferenceTrajectoryPtr refTraj( new ReferenceTrajectory( *itExternal, input.second, false,
149  magneticField.product(), materialEffects(),
152 
153  AlgebraicSymMatrix externalParamErrors( asHepMatrix<5>( (*itExternal).localError().matrix() ) );
154  refTraj->setParameterErrors( externalParamErrors );
155  trajectories.push_back( refTraj );
156  }
157  else
158  {
159  trajectories.push_back(ReferenceTrajectoryPtr(new ReferenceTrajectory(input.first, input.second, false,
160  magneticField.product(), materialEffects(),
163  }
164  }
165 
166  ++itTracks;
167  ++itExternal;
168  }
169 
170  return trajectories;
171 }
MaterialEffects materialEffects(void) const
static std::string const input
Definition: EdmProvDump.cc:43
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().