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 
26  m_MagFieldToken(iC.esConsumes()),
27  theMass(config.getParameter<double>("ParticleMass")),
28  theMomentumEstimate(config.getParameter<double>("MomentumEstimate")) {
29  edm::LogInfo("Alignment") << "@SUB=BzeroReferenceTrajectoryFactory"
30  << "mass: " << theMass << "\nmomentum: " << theMomentumEstimate;
31 }
32 
34 
39 
41 
42  ConstTrajTrackPairCollection::const_iterator itTracks = tracks.begin();
43 
44  while (itTracks != tracks.end()) {
46  // Check input: If all hits were rejected, the TSOS is initialized as invalid.
47  if (input.first.isValid()) {
49  config.useBeamSpot = useBeamSpot_;
50  config.includeAPEs = includeAPEs_;
51  config.allowZeroMaterial = allowZeroMaterial_;
52  // set the flag for reversing the RecHits to false, since they are already in the correct order.
53  config.hitsAreReverse = false;
56  }
57 
58  ++itTracks;
59  }
60 
61  return trajectories;
62 }
63 
66  const edm::EventSetup &setup,
69  const reco::BeamSpot &beamSpot) const {
71 
72  if (tracks.size() != external.size()) {
73  edm::LogInfo("ReferenceTrajectories")
74  << "@SUB=BzeroReferenceTrajectoryFactory::trajectories"
75  << "Inconsistent input:\n"
76  << "\tnumber of tracks = " << tracks.size() << "\tnumber of external predictions = " << external.size();
77  return trajectories;
78  }
79 
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_;
93  config.allowZeroMaterial = allowZeroMaterial_;
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, 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_;
107  config.allowZeroMaterial = allowZeroMaterial_;
108  // set the flag for reversing the RecHits to false, since they are already in the correct order.
109  config.hitsAreReverse = false;
112  }
113  }
114 
115  ++itTracks;
116  ++itExternal;
117  }
118 
119  return trajectories;
120 }
121 
ESGetTokenH3DDVariant esConsumes(std::string const &Record, edm::ConsumesCollector &)
Definition: DeDxTools.cc:283
dictionary config
Read in AllInOne config in JSON format.
Definition: DMR_cfg.py:21
Definition: config.py:1
bool sameSurface(const Surface &s1, const Surface &s2) const
MaterialEffects materialEffects(void) const
static std::string const input
Definition: EdmProvDump.cc:50
BzeroReferenceTrajectoryFactory(const edm::ParameterSet &config, edm::ConsumesCollector &iC)
const ReferenceTrajectoryCollection trajectories(const edm::EventSetup &setup, const ConstTrajTrackPairCollection &tracks, const reco::BeamSpot &beamSpot) const override
Produce the reference trajectories.
std::pair< TrajectoryStateOnSurface, TransientTrackingRecHit::ConstRecHitContainer > TrajectoryInput
Log< level::Info, false > LogInfo
AlignmentAlgorithmBase::ConstTrajTrackPairCollection ConstTrajTrackPairCollection
virtual const TrajectoryInput innermostStateAndRecHits(const ConstTrajTrackPair &track) const
const edm::ESGetToken< MagneticField, IdealMagneticFieldRecord > m_MagFieldToken
CLHEP::HepSymMatrix AlgebraicSymMatrix
std::vector< TrajectoryStateOnSurface > ExternalPredictionCollection
PropagationDirection propagationDirection(void) const
#define DEFINE_EDM_PLUGIN(factory, type, name)
ReferenceTrajectoryBase::ReferenceTrajectoryPtr ReferenceTrajectoryPtr
std::vector< ReferenceTrajectoryPtr > ReferenceTrajectoryCollection