CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
ReferenceTrajectoryFactory.cc
Go to the documentation of this file.
8 
10 
12 
14 {
15 public:
18 
22  const reco::BeamSpot &beamSpot) const;
23 
25  const ConstTrajTrackPairCollection &tracks,
26  const ExternalPredictionCollection &external,
27  const reco::BeamSpot &beamSpot) const;
28 
29  virtual ReferenceTrajectoryFactory* clone() const { return new ReferenceTrajectoryFactory(*this); }
30 
31 protected:
32 
33  double theMass;
34 };
35 
39 
41  TrajectoryFactoryBase( config )
42 {
43  theMass = config.getParameter< double >( "ParticleMass" );
44 }
45 
46 
48 
49 
53  const reco::BeamSpot &beamSpot) const
54 {
56 
57  edm::ESHandle< MagneticField > magneticField;
58  setup.get< IdealMagneticFieldRecord >().get( magneticField );
59 
60  ConstTrajTrackPairCollection::const_iterator itTracks = tracks.begin();
61 
62  while ( itTracks != tracks.end() )
63  {
64  TrajectoryInput input = this->innermostStateAndRecHits( *itTracks );
65 
66  // Check input: If all hits were rejected, the TSOS is initialized as invalid.
67  if ( input.first.isValid() )
68  {
69  // set the flag for reversing the RecHits to false, since they are already in the correct order.
70  trajectories.push_back(ReferenceTrajectoryPtr(new ReferenceTrajectory(input.first, input.second, false,
71  magneticField.product(), materialEffects(),
74  }
75 
76  ++itTracks;
77  }
78 
79  return trajectories;
80 }
81 
82 
86  const ExternalPredictionCollection& external,
87  const reco::BeamSpot &beamSpot) const
88 {
90 
91  if ( tracks.size() != external.size() )
92  {
93  edm::LogInfo("ReferenceTrajectories") << "@SUB=ReferenceTrajectoryFactory::trajectories"
94  << "Inconsistent input:\n"
95  << "\tnumber of tracks = " << tracks.size()
96  << "\tnumber of external predictions = " << external.size();
97  return trajectories;
98  }
99 
100  edm::ESHandle< MagneticField > magneticField;
101  setup.get< IdealMagneticFieldRecord >().get( magneticField );
102 
103  ConstTrajTrackPairCollection::const_iterator itTracks = tracks.begin();
104  ExternalPredictionCollection::const_iterator itExternal = external.begin();
105 
106  while ( itTracks != tracks.end() )
107  {
109  // Check input: If all hits were rejected, the TSOS is initialized as invalid.
110  if ( input.first.isValid() )
111  {
112  if ( (*itExternal).isValid() && sameSurface( (*itExternal).surface(), input.first.surface() ) )
113  {
114  // set the flag for reversing the RecHits to false, since they are already in the correct order.
115  ReferenceTrajectoryPtr refTraj( new ReferenceTrajectory( *itExternal, input.second, false,
116  magneticField.product(), materialEffects(),
119 
120  AlgebraicSymMatrix externalParamErrors( asHepMatrix<5>( (*itExternal).localError().matrix() ) );
121  refTraj->setParameterErrors( externalParamErrors );
122 
123  trajectories.push_back( refTraj );
124  }
125  else
126  {
127  trajectories.push_back(ReferenceTrajectoryPtr(new ReferenceTrajectory(input.first, input.second, false,
128  magneticField.product(), materialEffects(),
131  }
132  }
133 
134  ++itTracks;
135  ++itExternal;
136  }
137 
138  return trajectories;
139 }
140 
T getParameter(std::string const &) const
virtual const ReferenceTrajectoryCollection trajectories(const edm::EventSetup &setup, const ConstTrajTrackPairCollection &tracks, const reco::BeamSpot &beamSpot) const
Produce the reference trajectories.
MaterialEffects materialEffects(void) const
virtual ReferenceTrajectoryFactory * clone() const
A factory that produces instances of class ReferenceTrajectory from a given TrajTrackPairCollection.
bool sameSurface(const Surface &s1, const Surface &s2) const
virtual const TrajectoryInput innermostStateAndRecHits(const ConstTrajTrackPair &track) const
AlignmentAlgorithmBase::ConstTrajTrackPairCollection ConstTrajTrackPairCollection
std::vector< ReferenceTrajectoryPtr > ReferenceTrajectoryCollection
tuple tracks
Definition: testEve_cfg.py:39
const T & get() const
Definition: EventSetup.h:55
T const * product() const
Definition: ESHandle.h:62
ReferenceTrajectoryFactory(const edm::ParameterSet &config)
PropagationDirection propagationDirection(void) const
CLHEP::HepSymMatrix AlgebraicSymMatrix
#define DEFINE_EDM_PLUGIN(factory, type, name)
std::pair< TrajectoryStateOnSurface, TransientTrackingRecHit::ConstRecHitContainer > TrajectoryInput
std::vector< TrajectoryStateOnSurface > ExternalPredictionCollection
ReferenceTrajectoryBase::ReferenceTrajectoryPtr ReferenceTrajectoryPtr
void setup(std::vector< TH2F > &depth, std::string name, std::string units="")