test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
MultiGaussianStateTransform.cc
Go to the documentation of this file.
8 
11 {
12  const reco::GsfTrackExtraRef& extra(tk.gsfExtra());
13  return multiState(extra->outerStateLocalParameters(),
14  extra->outerStateCovariances(),
15  extra->outerStateWeights());
16 }
17 
20 {
21  const reco::GsfTrackExtraRef& extra(tk.gsfExtra());
22  return multiState(extra->innerStateLocalParameters(),
23  extra->innerStateCovariances(),
24  extra->innerStateWeights());
25 }
26 
29  unsigned int index)
30 {
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(extra->outerStateLocalParameters(),
36  extra->outerStateCovariances(),
37  extra->outerStateWeights(),
38  index);
39 }
40 
43  unsigned int index)
44 {
45  if ( index>=N )
46  throw cms::Exception("LogicError") << "MultiGaussianStateTransform: index out of range";
47 
48  const reco::GsfTrackExtraRef& extra(tk.gsfExtra());
49  return multiState1D(extra->innerStateLocalParameters(),
50  extra->innerStateCovariances(),
51  extra->innerStateWeights(),
52  index);
53 }
54 
57  const std::vector<MultiGaussianState<N>::Matrix>& covariances,
58  const std::vector<double>& weights)
59 {
60  unsigned int nc = parameters.size();
62  components.reserve(nc);
63  for ( unsigned int i=0; i<nc; ++i ) {
65  sgs(new MultiGaussianState<N>::SingleState(parameters[i],covariances[i],weights[i]));
66  components.push_back(sgs);
67  }
69 }
70 
73  const std::vector<MultiGaussianState<N>::Matrix>& covariances,
74  const std::vector<double>& weights, unsigned int index)
75 {
76  unsigned int nc = parameters.size();
78  components.reserve(nc);
79  for ( unsigned int i=0; i<nc; ++i ) {
80  components.push_back(SingleGaussianState1D(parameters[i](index),
81  covariances[i](index,index),
82  weights[i]));
83  }
84  return MultiGaussianState1D(components);
85 }
86 
89 {
90  GetComponents comps(tsos);
91  auto const & tsosComponents = comps();
93  components.reserve(tsosComponents.size());
94  for (auto i=tsosComponents.begin();
95  i!=tsosComponents.end(); ++i ) {
97  sgs(new MultiGaussianState<5>::SingleState(i->localParameters().vector(),
98  i->localError().matrix(),
99  i->weight()));
100  components.push_back(sgs);
101  }
103 }
104 
107  unsigned int index)
108 {
109  if ( index>=N )
110  throw cms::Exception("LogicError") << "MultiGaussianStateTransform: index out of range";
111  GetComponents comps(tsos);
112  auto const & tsosComponents = comps();
114  components.reserve(tsosComponents.size());
115  for (auto i=tsosComponents.begin();
116  i!=tsosComponents.end(); ++i ) {
117  components.push_back(SingleGaussianState1D(i->localParameters().vector()(index),
118  i->localError().matrix()(index,index),
119  i->weight()));
120  }
121  return MultiGaussianState1D(components);
122 }
123 
126  const TrajectoryStateOnSurface refTsos)
127 {
128  const LocalTrajectoryParameters& refPars(refTsos.localParameters());
129  double pzSign = refPars.pzSign();
130  bool charged = refPars.charge()!=0;
131  LocalTrajectoryParameters pars(singleState.mean(),pzSign,charged);
132  LocalTrajectoryError errs(singleState.covariance());
133  // return state (doesn't use weight of the single state)
134  return TrajectoryStateOnSurface(pars,errs,refTsos.surface(),refTsos.magneticField());
135 }
int i
Definition: DBlmapReader.cc:9
MultiGaussianState1D outerMultiState1D(const reco::GsfTrack &tk, unsigned int index)
const LocalTrajectoryParameters & localParameters() const
TrajectoryStateOnSurface tsosFromSingleState(const SingleGaussianState< 5 > &, const TrajectoryStateOnSurface)
const Vector & mean() const
parameter vector
std::vector< SingleGaussianState1D > SingleState1dContainer
const MagneticField * magneticField() const
Mixture of multi-variate gaussian states.
MultiGaussianState< N > innerMultiState(const reco::GsfTrack &tk)
std::vector< SingleStatePtr > SingleStateContainer
const Matrix & covariance() const
covariance matrix
const SurfaceType & surface() const
MultiGaussianState1D multiState1D(const std::vector< MultiGaussianState< N >::Vector > &, const std::vector< MultiGaussianState< N >::Matrix > &, const std::vector< double > &, unsigned int)
MultiGaussianState< N > outerMultiState(const reco::GsfTrack &tk)
std::shared_ptr< SingleState > SingleStatePtr
const GsfTrackExtraRef & gsfExtra() const
reference to &quot;extra&quot; object
Definition: GsfTrack.h:32
#define N
Definition: blowfish.cc:9
MultiGaussianState< N > multiState(const std::vector< MultiGaussianState< N >::Vector > &, const std::vector< MultiGaussianState< N >::Matrix > &, const std::vector< double > &)
MultiGaussianState1D innerMultiState1D(const reco::GsfTrack &tk, unsigned int index)
SingleGaussianState< N >::Vector Vector
SingleGaussianState< N >::Matrix Matrix
float pzSign() const
Sign of the z-component of the momentum in the local frame.