CMS 3D CMS Logo

MultiGaussianStateTransform.cc
Go to the documentation of this file.
8 
10  const reco::GsfTrack& tk) {
11  const reco::GsfTrackExtraRef& extra(tk.gsfExtra());
12  return multiState(extra->outerStateLocalParameters(), extra->outerStateCovariances(), extra->outerStateWeights());
13 }
14 
16  const reco::GsfTrack& tk) {
17  const reco::GsfTrackExtraRef& extra(tk.gsfExtra());
18  return multiState(extra->innerStateLocalParameters(), extra->innerStateCovariances(), extra->innerStateWeights());
19 }
20 
22  if (index >= N)
23  throw cms::Exception("LogicError") << "MultiGaussianStateTransform: index out of range";
24 
25  const reco::GsfTrackExtraRef& extra(tk.gsfExtra());
26  return multiState1D(
27  extra->outerStateLocalParameters(), extra->outerStateCovariances(), extra->outerStateWeights(), index);
28 }
29 
31  if (index >= N)
32  throw cms::Exception("LogicError") << "MultiGaussianStateTransform: index out of range";
33 
34  const reco::GsfTrackExtraRef& extra(tk.gsfExtra());
35  return multiState1D(
36  extra->innerStateLocalParameters(), extra->innerStateCovariances(), extra->innerStateWeights(), index);
37 }
38 
40  const std::vector<MultiGaussianState<N>::Vector>& parameters,
41  const std::vector<MultiGaussianState<N>::Matrix>& covariances,
42  const std::vector<double>& weights) {
43  unsigned int nc = parameters.size();
45  components.reserve(nc);
46  for (unsigned int i = 0; i < nc; ++i) {
49  components.push_back(sgs);
50  }
52 }
53 
55  const std::vector<MultiGaussianState<N>::Vector>& parameters,
56  const std::vector<MultiGaussianState<N>::Matrix>& covariances,
57  const std::vector<double>& weights,
58  unsigned int index) {
59  unsigned int nc = parameters.size();
61  components.reserve(nc);
62  for (unsigned int i = 0; i < nc; ++i) {
63  components.push_back(SingleGaussianState1D(parameters[i](index), covariances[i](index, index), weights[i]));
64  }
66 }
67 
69  GetComponents comps(tsos);
70  auto const& tsosComponents = comps();
72  components.reserve(tsosComponents.size());
73  for (auto i = tsosComponents.begin(); i != tsosComponents.end(); ++i) {
75  new MultiGaussianState<5>::SingleState(i->localParameters().vector(), i->localError().matrix(), i->weight()));
76  components.push_back(sgs);
77  }
79 }
80 
82  unsigned int index) {
83  if (index >= N)
84  throw cms::Exception("LogicError") << "MultiGaussianStateTransform: index out of range";
85  GetComponents comps(tsos);
86  auto const& tsosComponents = comps();
88  components.reserve(tsosComponents.size());
89  for (auto i = tsosComponents.begin(); i != tsosComponents.end(); ++i) {
91  i->localParameters().vector()(index), i->localError().matrix()(index, index), i->weight()));
92  }
94 }
95 
97  const TrajectoryStateOnSurface refTsos) {
98  const LocalTrajectoryParameters& refPars(refTsos.localParameters());
99  double pzSign = refPars.pzSign();
100  bool charged = refPars.charge() != 0;
101  LocalTrajectoryParameters pars(singleState.mean(), pzSign, charged);
102  LocalTrajectoryError errs(singleState.covariance());
103  // return state (doesn't use weight of the single state)
104  return TrajectoryStateOnSurface(pars, errs, refTsos.surface(), refTsos.magneticField());
105 }
TrajectoryStateOnSurface.h
HLT_2018_cff.weights
weights
Definition: HLT_2018_cff.py:87167
mps_fire.i
i
Definition: mps_fire.py:355
TrackExtraFwd.h
MultiGaussianStateTransform.h
MultiGaussianState
Mixture of multi-variate gaussian states.
Definition: MultiGaussianState.h:18
SingleGaussianState::covariance
const Matrix & covariance() const
covariance matrix
Definition: SingleGaussianState.h:30
edm::Ref< GsfTrackExtraCollection >
parameters
parameters
Definition: BeamSpot_PayloadInspector.cc:14
MultiGaussianState1D.h
GetComponents.h
LocalTrajectoryParameters
Definition: LocalTrajectoryParameters.h:25
reco::GsfTrack
Definition: GsfTrack.h:12
TrajectoryStateOnSurface
Definition: TrajectoryStateOnSurface.h:16
GetComponents
Definition: GetComponents.h:4
N
#define N
Definition: blowfish.cc:9
MultiGaussianState1D
Definition: MultiGaussianState1D.h:12
MultiGaussianStateTransform::innerMultiState1D
MultiGaussianState1D innerMultiState1D(const reco::GsfTrack &tk, unsigned int index)
Definition: MultiGaussianStateTransform.cc:30
reco::GsfTrack::gsfExtra
const GsfTrackExtraRef & gsfExtra() const
reference to "extra" object
Definition: GsfTrack.h:31
TrajectoryStateOnSurface::localParameters
const LocalTrajectoryParameters & localParameters() const
Definition: TrajectoryStateOnSurface.h:73
LocalTrajectoryError
Definition: LocalTrajectoryError.h:20
MultiGaussianStateTransform::multiState
MultiGaussianState< N > multiState(const std::vector< MultiGaussianState< N >::Vector > &, const std::vector< MultiGaussianState< N >::Matrix > &, const std::vector< double > &)
Definition: MultiGaussianStateTransform.cc:39
LocalTrajectoryParameters::pzSign
float pzSign() const
Sign of the z-component of the momentum in the local frame.
Definition: LocalTrajectoryParameters.h:146
SingleGaussianState
Definition: SingleGaussianState.h:14
MultiGaussianState::SingleStatePtr
std::shared_ptr< SingleState > SingleStatePtr
Definition: MultiGaussianState.h:23
SingleGaussianState1D
Definition: SingleGaussianState1D.h:10
MultiGaussianState::Vector
SingleGaussianState< N >::Vector Vector
Definition: MultiGaussianState.h:20
MultiGaussianStateTransform::outerMultiState
MultiGaussianState< N > outerMultiState(const reco::GsfTrack &tk)
Definition: MultiGaussianStateTransform.cc:9
GsfTrackExtraFwd.h
MultiGaussianState::Matrix
SingleGaussianState< N >::Matrix Matrix
Definition: MultiGaussianState.h:21
MultiGaussianState1D::SingleState1dContainer
std::vector< SingleGaussianState1D > SingleState1dContainer
Definition: MultiGaussianState1D.h:14
makeMuonMisalignmentScenario.components
string components
Definition: makeMuonMisalignmentScenario.py:58
Exception
Definition: hltDiff.cc:246
MultiGaussianStateTransform::innerMultiState
MultiGaussianState< N > innerMultiState(const reco::GsfTrack &tk)
Definition: MultiGaussianStateTransform.cc:15
MultiGaussianStateTransform::tsosFromSingleState
TrajectoryStateOnSurface tsosFromSingleState(const SingleGaussianState< 5 > &, const TrajectoryStateOnSurface)
Definition: MultiGaussianStateTransform.cc:96
Exception.h
MultiGaussianStateTransform::outerMultiState1D
MultiGaussianState1D outerMultiState1D(const reco::GsfTrack &tk, unsigned int index)
Definition: MultiGaussianStateTransform.cc:21
TrajectoryStateOnSurface::surface
const SurfaceType & surface() const
Definition: TrajectoryStateOnSurface.h:78
AlignmentPI::index
index
Definition: AlignmentPayloadInspectorHelper.h:46
MultiGaussianState::SingleStateContainer
std::vector< SingleStatePtr > SingleStateContainer
Definition: MultiGaussianState.h:25
MultiGaussianStateTransform::multiState1D
MultiGaussianState1D multiState1D(const std::vector< MultiGaussianState< N >::Vector > &, const std::vector< MultiGaussianState< N >::Matrix > &, const std::vector< double > &, unsigned int)
Definition: MultiGaussianStateTransform.cc:54
TrajectoryStateOnSurface::magneticField
const MagneticField * magneticField() const
Definition: TrajectoryStateOnSurface.h:62
SingleGaussianState::mean
const Vector & mean() const
parameter vector
Definition: SingleGaussianState.h:28