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 
22 
24  : TrajectoryFactoryBase(config),
25  theMass(config.getParameter<double>("ParticleMass")),
26  theMomentumEstimate(config.getParameter<double>("MomentumEstimate")) {
27  edm::LogInfo("Alignment") << "@SUB=BzeroReferenceTrajectoryFactory"
28  << "mass: " << theMass << "\nmomentum: " << theMomentumEstimate;
29 }
30 
32 
37 
39  setup.get<IdealMagneticFieldRecord>().get(magneticField);
40 
41  ConstTrajTrackPairCollection::const_iterator itTracks = tracks.begin();
42 
43  while (itTracks != tracks.end()) {
45  // Check input: If all hits were rejected, the TSOS is initialized as invalid.
46  if (input.first.isValid()) {
48  config.useBeamSpot = useBeamSpot_;
49  config.includeAPEs = includeAPEs_;
51  // set the flag for reversing the RecHits to false, since they are already in the correct order.
52  config.hitsAreReverse = false;
53  trajectories.push_back(ReferenceTrajectoryPtr(
54  new BzeroReferenceTrajectory(input.first, input.second, magneticField.product(), beamSpot, config)));
55  }
56 
57  ++itTracks;
58  }
59 
60  return trajectories;
61 }
62 
65  const edm::EventSetup &setup,
68  const reco::BeamSpot &beamSpot) const {
70 
71  if (tracks.size() != external.size()) {
72  edm::LogInfo("ReferenceTrajectories")
73  << "@SUB=BzeroReferenceTrajectoryFactory::trajectories"
74  << "Inconsistent input:\n"
75  << "\tnumber of tracks = " << tracks.size() << "\tnumber of external predictions = " << external.size();
76  return trajectories;
77  }
78 
80  setup.get<IdealMagneticFieldRecord>().get(magneticField);
81 
82  ConstTrajTrackPairCollection::const_iterator itTracks = tracks.begin();
83  ExternalPredictionCollection::const_iterator itExternal = external.begin();
84 
85  while (itTracks != tracks.end()) {
87  // Check input: If all hits were rejected, the TSOS is initialized as invalid.
88  if (input.first.isValid()) {
89  if ((*itExternal).isValid() && sameSurface((*itExternal).surface(), input.first.surface())) {
91  config.useBeamSpot = useBeamSpot_;
92  config.includeAPEs = includeAPEs_;
94  // set the flag for reversing the RecHits to false, since they are already in the correct order.
95  config.hitsAreReverse = false;
96  ReferenceTrajectoryPtr refTraj(
97  new BzeroReferenceTrajectory(*itExternal, input.second, magneticField.product(), beamSpot, config));
98 
99  AlgebraicSymMatrix externalParamErrors(asHepMatrix<5>((*itExternal).localError().matrix()));
100  refTraj->setParameterErrors(externalParamErrors.sub(2, 5));
101 
102  trajectories.push_back(refTraj);
103  } else {
105  config.useBeamSpot = useBeamSpot_;
106  config.includeAPEs = includeAPEs_;
108  // set the flag for reversing the RecHits to false, since they are already in the correct order.
109  config.hitsAreReverse = false;
110  trajectories.push_back(ReferenceTrajectoryPtr(
111  new BzeroReferenceTrajectory(input.first, input.second, magneticField.product(), beamSpot, config)));
112  }
113  }
114 
115  ++itTracks;
116  ++itExternal;
117  }
118 
119  return trajectories;
120 }
121 
const ReferenceTrajectoryCollection trajectories(const edm::EventSetup &setup, const ConstTrajTrackPairCollection &tracks, const reco::BeamSpot &beamSpot) const override
Produce the reference trajectories.
MaterialEffects materialEffects(void) const
Definition: config.py:1
static std::string const input
Definition: EdmProvDump.cc:48
config
Definition: looper.py:291
bool sameSurface(const Surface &s1, const Surface &s2) const
std::pair< TrajectoryStateOnSurface, TransientTrackingRecHit::ConstRecHitContainer > TrajectoryInput
virtual const TrajectoryInput innermostStateAndRecHits(const ConstTrajTrackPair &track) const
BzeroReferenceTrajectoryFactory(const edm::ParameterSet &config)
AlignmentAlgorithmBase::ConstTrajTrackPairCollection ConstTrajTrackPairCollection
T get() const
Definition: EventSetup.h:73
PropagationDirection propagationDirection(void) const
CLHEP::HepSymMatrix AlgebraicSymMatrix
std::vector< TrajectoryStateOnSurface > ExternalPredictionCollection
#define DEFINE_EDM_PLUGIN(factory, type, name)
ReferenceTrajectoryBase::ReferenceTrajectoryPtr ReferenceTrajectoryPtr
T const * product() const
Definition: ESHandle.h:86
std::vector< ReferenceTrajectoryPtr > ReferenceTrajectoryCollection