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.
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_;
60  // set the flag for reversing the RecHits to false, since they are already in the correct order.
61  config.hitsAreReverse = false;
62  trajectories.push_back(ReferenceTrajectoryPtr(new BzeroReferenceTrajectory(input.first, input.second,
63  magneticField.product(),
64  beamSpot, config)));
65  }
66 
67  ++itTracks;
68  }
69 
70  return trajectories;
71 }
72 
73 
78  const ExternalPredictionCollection &external,
79  const reco::BeamSpot &beamSpot) const
80 {
82 
83  if ( tracks.size() != external.size() )
84  {
85  edm::LogInfo("ReferenceTrajectories") << "@SUB=BzeroReferenceTrajectoryFactory::trajectories"
86  << "Inconsistent input:\n"
87  << "\tnumber of tracks = " << tracks.size()
88  << "\tnumber of external predictions = " << external.size();
89  return trajectories;
90  }
91 
93  setup.get< IdealMagneticFieldRecord >().get( magneticField );
94 
95  ConstTrajTrackPairCollection::const_iterator itTracks = tracks.begin();
96  ExternalPredictionCollection::const_iterator itExternal = external.begin();
97 
98  while ( itTracks != tracks.end() )
99  {
101  // Check input: If all hits were rejected, the TSOS is initialized as invalid.
102  if ( input.first.isValid() )
103  {
104  if ( (*itExternal).isValid() && sameSurface( (*itExternal).surface(), input.first.surface() ) )
105  {
108  config.useBeamSpot = useBeamSpot_;
109  config.includeAPEs = includeAPEs_;
110  // set the flag for reversing the RecHits to false, since they are already in the correct order.
111  config.hitsAreReverse = false;
112  ReferenceTrajectoryPtr refTraj (new BzeroReferenceTrajectory(*itExternal, input.second,
113  magneticField.product(),
114  beamSpot, config));
115 
116  AlgebraicSymMatrix externalParamErrors( asHepMatrix<5>( (*itExternal).localError().matrix() ) );
117  refTraj->setParameterErrors( externalParamErrors.sub( 2, 5 ) );
118 
119  trajectories.push_back( refTraj );
120  }
121  else
122  {
125  config.useBeamSpot = useBeamSpot_;
126  config.includeAPEs = includeAPEs_;
127  // set the flag for reversing the RecHits to false, since they are already in the correct order.
128  config.hitsAreReverse = false;
129  trajectories.push_back(ReferenceTrajectoryPtr(new BzeroReferenceTrajectory(input.first, input.second,
130  magneticField.product(),
131  beamSpot, config)));
132  }
133  }
134 
135  ++itTracks;
136  ++itExternal;
137  }
138 
139  return trajectories;
140 }
141 
142 
143 
144 DEFINE_EDM_PLUGIN( TrajectoryFactoryPlugin, BzeroReferenceTrajectoryFactory, "BzeroReferenceTrajectoryFactory" );
MaterialEffects materialEffects(void) const
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.
tuple tracks
Definition: testEve_cfg.py:39
const T & get() const
Definition: EventSetup.h:56
T const * product() const
Definition: ESHandle.h:86
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