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 
45  edm::ESHandle< MagneticField > magneticField;
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  {
56  // set the flag for reversing the RecHits to false, since they are already in the correct order.
57  trajectories.push_back(ReferenceTrajectoryPtr(new BzeroReferenceTrajectory(input.first, input.second, false,
58  magneticField.product(),
63  }
64 
65  ++itTracks;
66  }
67 
68  return trajectories;
69 }
70 
71 
76  const ExternalPredictionCollection &external,
77  const reco::BeamSpot &beamSpot) const
78 {
80 
81  if ( tracks.size() != external.size() )
82  {
83  edm::LogInfo("ReferenceTrajectories") << "@SUB=BzeroReferenceTrajectoryFactory::trajectories"
84  << "Inconsistent input:\n"
85  << "\tnumber of tracks = " << tracks.size()
86  << "\tnumber of external predictions = " << external.size();
87  return trajectories;
88  }
89 
90  edm::ESHandle< MagneticField > magneticField;
91  setup.get< IdealMagneticFieldRecord >().get( magneticField );
92 
93  ConstTrajTrackPairCollection::const_iterator itTracks = tracks.begin();
94  ExternalPredictionCollection::const_iterator itExternal = external.begin();
95 
96  while ( itTracks != tracks.end() )
97  {
99  // Check input: If all hits were rejected, the TSOS is initialized as invalid.
100  if ( input.first.isValid() )
101  {
102  if ( (*itExternal).isValid() && sameSurface( (*itExternal).surface(), input.first.surface() ) )
103  {
104  // set the flag for reversing the RecHits to false, since they are already in the correct order.
105  ReferenceTrajectoryPtr refTraj( new BzeroReferenceTrajectory( *itExternal, input.second, false,
106  magneticField.product(), materialEffects(),
110 
111  AlgebraicSymMatrix externalParamErrors( asHepMatrix<5>( (*itExternal).localError().matrix() ) );
112  refTraj->setParameterErrors( externalParamErrors.sub( 2, 5 ) );
113 
114  trajectories.push_back( refTraj );
115  }
116  else
117  {
118  trajectories.push_back(ReferenceTrajectoryPtr(new BzeroReferenceTrajectory(input.first, input.second, false,
119  magneticField.product(),
120  materialEffects(),
124  }
125  }
126 
127  ++itTracks;
128  ++itExternal;
129  }
130 
131  return trajectories;
132 }
133 
134 
135 
136 DEFINE_EDM_PLUGIN( TrajectoryFactoryPlugin, BzeroReferenceTrajectoryFactory, "BzeroReferenceTrajectoryFactory" );
MaterialEffects materialEffects(void) 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="")