CMS 3D CMS Logo

BzeroReferenceTrajectoryFactory.cc
Go to the documentation of this file.
1 // Local include from plugins directory...:
3 
6 
11 
13 
15 
18 
19 
23 
25  TrajectoryFactoryBase(config),
26  theMass(config.getParameter<double>("ParticleMass")),
27  theMomentumEstimate(config.getParameter<double>("MomentumEstimate"))
28 {
29  edm::LogInfo("Alignment") << "@SUB=BzeroReferenceTrajectoryFactory"
30  << "mass: " << theMass
31  << "\nmomentum: " << theMomentumEstimate;
32 }
33 
35 
36 
41  const reco::BeamSpot &beamSpot) const
42 {
44 
46  setup.get< IdealMagneticFieldRecord >().get( magneticField );
47 
48  ConstTrajTrackPairCollection::const_iterator itTracks = tracks.begin();
49 
50  while ( itTracks != tracks.end() )
51  {
52  TrajectoryInput input = this->innermostStateAndRecHits( *itTracks );
53  // Check input: If all hits were rejected, the TSOS is initialized as invalid.
54  if ( input.first.isValid() )
55  {
58  config.useBeamSpot = useBeamSpot_;
59  config.includeAPEs = includeAPEs_;
61  // set the flag for reversing the RecHits to false, since they are already in the correct order.
62  config.hitsAreReverse = false;
63  trajectories.push_back(ReferenceTrajectoryPtr(new BzeroReferenceTrajectory(input.first, input.second,
64  magneticField.product(),
65  beamSpot, config)));
66  }
67 
68  ++itTracks;
69  }
70 
71  return trajectories;
72 }
73 
74 
80  const reco::BeamSpot &beamSpot) const
81 {
83 
84  if ( tracks.size() != external.size() )
85  {
86  edm::LogInfo("ReferenceTrajectories") << "@SUB=BzeroReferenceTrajectoryFactory::trajectories"
87  << "Inconsistent input:\n"
88  << "\tnumber of tracks = " << tracks.size()
89  << "\tnumber of external predictions = " << external.size();
90  return trajectories;
91  }
92 
94  setup.get< IdealMagneticFieldRecord >().get( magneticField );
95 
96  ConstTrajTrackPairCollection::const_iterator itTracks = tracks.begin();
97  ExternalPredictionCollection::const_iterator itExternal = external.begin();
98 
99  while ( itTracks != tracks.end() )
100  {
102  // Check input: If all hits were rejected, the TSOS is initialized as invalid.
103  if ( input.first.isValid() )
104  {
105  if ( (*itExternal).isValid() && sameSurface( (*itExternal).surface(), input.first.surface() ) )
106  {
109  config.useBeamSpot = useBeamSpot_;
110  config.includeAPEs = includeAPEs_;
112  // set the flag for reversing the RecHits to false, since they are already in the correct order.
113  config.hitsAreReverse = false;
114  ReferenceTrajectoryPtr refTraj (new BzeroReferenceTrajectory(*itExternal, input.second,
115  magneticField.product(),
116  beamSpot, config));
117 
118  AlgebraicSymMatrix externalParamErrors( asHepMatrix<5>( (*itExternal).localError().matrix() ) );
119  refTraj->setParameterErrors( externalParamErrors.sub( 2, 5 ) );
120 
121  trajectories.push_back( refTraj );
122  }
123  else
124  {
127  config.useBeamSpot = useBeamSpot_;
128  config.includeAPEs = includeAPEs_;
130  // set the flag for reversing the RecHits to false, since they are already in the correct order.
131  config.hitsAreReverse = false;
132  trajectories.push_back(ReferenceTrajectoryPtr(new BzeroReferenceTrajectory(input.first, input.second,
133  magneticField.product(),
134  beamSpot, config)));
135  }
136  }
137 
138  ++itTracks;
139  ++itExternal;
140  }
141 
142  return trajectories;
143 }
144 
145 
146 
147 DEFINE_EDM_PLUGIN( TrajectoryFactoryPlugin, BzeroReferenceTrajectoryFactory, "BzeroReferenceTrajectoryFactory" );
MaterialEffects materialEffects(void) const
def setup(process, global_tag, zero_tesla=False)
Definition: GeneralSetup.py:1
Definition: config.py:1
static std::string const input
Definition: EdmProvDump.cc:44
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.
const T & get() const
Definition: EventSetup.h:56
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
T const * product() const
Definition: ESHandle.h:86