11 case 1:
return weights<1>(recHit);
12 case 2:
return weights<2>(recHit);
13 case 3:
return weights<3>(recHit);
14 case 4:
return weights<4>(recHit);
15 case 5:
return weights<5>(recHit);
20 template<
unsigned int D>
29 edm::LogError(
"EmptyPredictedComponents")<<
"a multi state is empty. cannot compute any weight.";
34 std::vector<double> detRs;
36 std::vector<double> chi2s;
48 double chi2Min(DBL_MAX);
61 holder.template setup<D>(&
r, &V, &
H, &
p, &rMeas, &
R,
69 if (! R.Det2(detR) ) {
70 edm::LogError(
"PosteriorWeightsCalculator") <<
"PosteriorWeightsCalculator: determinant failed";
71 return std::vector<double>();
73 detRs.push_back(detR);
75 int ierr = ! R.Invert();
78 <<
"PosteriorWeightsCalculator: inversion failed, ierr = " << ierr;
79 return std::vector<double>();
81 double chi2 = ROOT::Math::Similarity(r,R);
82 chi2s.push_back(chi2);
83 if ( chi2<chi2Min ) chi2Min = chi2;
87 edm::LogError(
"PosteriorWeightsCalculator") <<
"Problem in vector sizes";
88 return std::vector<double>();
95 double sumWeights(0.);
99 double chi2 = chi2s[
i] - chi2Min;
101 double tempWeight(0.);
102 if ( detRs[
i]>FLT_MIN ) {
107 tempWeight = priorWeight *
sqrt(1./detRs[
i]) *
exp(-0.5 * chi2);
112 weights.push_back(tempWeight);
113 sumWeights += tempWeight;
115 if ( sumWeights<DBL_MIN ) {
116 edm::LogInfo(
"PosteriorWeightsCalculator") <<
"PosteriorWeightsCalculator: sumWeight < DBL_MIN";
117 edm::LogError(
"PosteriorWeightsCalculator") <<
"PosteriorWeightsCalculator: sumWeight < DBL_MIN";
118 return std::vector<double>();
122 edm::LogError(
"PosteriorWeightsCalculator") <<
"Problem in vector sizes (2)";
123 return std::vector<double>();
125 for (std::vector<double>::iterator
iter = weights.begin();
127 (*iter) /= sumWeights;
virtual int dimension() const =0
virtual void getKfComponents(KfComponentsHolder &holder) const
ROOT::Math::SMatrix< double, D1, D1, ROOT::Math::MatRepSym< double, D1 > > SymMatrix
std::vector< double > weights(const TrackingRecHit &tsos) const
Create random state.
std::vector< TSOS > predictedComponents
ROOT::Math::SMatrix< double, D1, D2, ROOT::Math::MatRepStd< double, D1, D2 > > Matrix
ROOT::Math::SVector< double, D1 > Vector
ROOT::Math::SVector< double, 5 > AlgebraicVector5