CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
BzeroReferenceTrajectoryFactory.cc
Go to the documentation of this file.
3 
8 
10 
12 
15 
16 
18 {
19 public:
20 
23 
27  const reco::BeamSpot &beamSpot) const;
28 
30  const ConstTrajTrackPairCollection &tracks,
31  const ExternalPredictionCollection &external,
32  const reco::BeamSpot &beamSpot) const;
33 
34  virtual BzeroReferenceTrajectoryFactory* clone() const { return new BzeroReferenceTrajectoryFactory( *this ); }
35 
36 private:
37 
38  double theMass;
40 };
41 
42 
46 
48  TrajectoryFactoryBase( config )
49 {
50  theMass = config.getParameter< double >( "ParticleMass" );
51  theMomentumEstimate = config.getParameter< double >( "MomentumEstimate" );
52  theUseBeamSpot = config.getParameter< bool >( "UseBeamSpot" );
53 }
54 
55 
57 
58 
62  const reco::BeamSpot &beamSpot) const
63 {
65 
66  edm::ESHandle< MagneticField > magneticField;
67  setup.get< IdealMagneticFieldRecord >().get( magneticField );
68 
69  ConstTrajTrackPairCollection::const_iterator itTracks = tracks.begin();
70 
71  while ( itTracks != tracks.end() )
72  {
73  TrajectoryInput input = this->innermostStateAndRecHits( *itTracks );
74  // Check input: If all hits were rejected, the TSOS is initialized as invalid.
75  if ( input.first.isValid() )
76  {
77  // set the flag for reversing the RecHits to false, since they are already in the correct order.
78  trajectories.push_back(ReferenceTrajectoryPtr(new BzeroReferenceTrajectory(input.first, input.second, false,
79  magneticField.product(),
84  }
85 
86  ++itTracks;
87  }
88 
89  return trajectories;
90 }
91 
92 
96  const ExternalPredictionCollection &external,
97  const reco::BeamSpot &beamSpot) const
98 {
100 
101  if ( tracks.size() != external.size() )
102  {
103  edm::LogInfo("ReferenceTrajectories") << "@SUB=BzeroReferenceTrajectoryFactory::trajectories"
104  << "Inconsistent input:\n"
105  << "\tnumber of tracks = " << tracks.size()
106  << "\tnumber of external predictions = " << external.size();
107  return trajectories;
108  }
109 
110  edm::ESHandle< MagneticField > magneticField;
111  setup.get< IdealMagneticFieldRecord >().get( magneticField );
112 
113  ConstTrajTrackPairCollection::const_iterator itTracks = tracks.begin();
114  ExternalPredictionCollection::const_iterator itExternal = external.begin();
115 
116  while ( itTracks != tracks.end() )
117  {
119  // Check input: If all hits were rejected, the TSOS is initialized as invalid.
120  if ( input.first.isValid() )
121  {
122  if ( (*itExternal).isValid() && sameSurface( (*itExternal).surface(), input.first.surface() ) )
123  {
124  // set the flag for reversing the RecHits to false, since they are already in the correct order.
125  ReferenceTrajectoryPtr refTraj( new BzeroReferenceTrajectory( *itExternal, input.second, false,
126  magneticField.product(), materialEffects(),
130 
131  AlgebraicSymMatrix externalParamErrors( asHepMatrix<5>( (*itExternal).localError().matrix() ) );
132  refTraj->setParameterErrors( externalParamErrors.sub( 2, 5 ) );
133 
134  trajectories.push_back( refTraj );
135  }
136  else
137  {
138  trajectories.push_back(ReferenceTrajectoryPtr(new BzeroReferenceTrajectory(input.first, input.second, false,
139  magneticField.product(),
140  materialEffects(),
144  }
145  }
146 
147  ++itTracks;
148  ++itExternal;
149  }
150 
151  return trajectories;
152 }
153 
154 
155 
156 DEFINE_EDM_PLUGIN( TrajectoryFactoryPlugin, BzeroReferenceTrajectoryFactory, "BzeroReferenceTrajectoryFactory" );
T getParameter(std::string const &) const
MaterialEffects materialEffects(void) const
virtual BzeroReferenceTrajectoryFactory * clone() const
bool sameSurface(const Surface &s1, const Surface &s2) const
virtual const TrajectoryInput innermostStateAndRecHits(const ConstTrajTrackPair &track) const
BzeroReferenceTrajectoryFactory(const edm::ParameterSet &config)
AlignmentAlgorithmBase::ConstTrajTrackPairCollection ConstTrajTrackPairCollection
std::vector< ReferenceTrajectoryPtr > ReferenceTrajectoryCollection
virtual const ReferenceTrajectoryCollection trajectories(const edm::EventSetup &setup, const ConstTrajTrackPairCollection &tracks, const reco::BeamSpot &beamSpot) const
Produce the reference trajectories.
tuple tracks
Definition: testEve_cfg.py:39
const T & get() const
Definition: EventSetup.h:55
T const * product() const
Definition: ESHandle.h:62
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="")