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;
47 double chi2Min(DBL_MAX);
60 holder.template setup<D>(&
r, &V, &H, &rMeas, &
R,
68 if (! R.Det2(detR) ) {
69 edm::LogError(
"PosteriorWeightsCalculator") <<
"PosteriorWeightsCalculator: determinant failed";
70 return std::vector<double>();
72 detRs.push_back(detR);
74 int ierr = ! R.Invert();
77 <<
"PosteriorWeightsCalculator: inversion failed, ierr = " << ierr;
78 return std::vector<double>();
80 double chi2 = ROOT::Math::Similarity(r,R);
81 chi2s.push_back(chi2);
82 if ( chi2<chi2Min ) chi2Min = chi2;
86 edm::LogError(
"PosteriorWeightsCalculator") <<
"Problem in vector sizes";
87 return std::vector<double>();
94 double sumWeights(0.);
98 double chi2 = chi2s[
i] - chi2Min;
100 double tempWeight(0.);
101 if ( detRs[
i]>FLT_MIN ) {
106 tempWeight = priorWeight *
sqrt(1./detRs[
i]) *
exp(-0.5 * chi2);
111 weights.push_back(tempWeight);
112 sumWeights += tempWeight;
114 if ( sumWeights<DBL_MIN ) {
115 edm::LogInfo(
"PosteriorWeightsCalculator") <<
"PosteriorWeightsCalculator: sumWeight < DBL_MIN";
116 edm::LogError(
"PosteriorWeightsCalculator") <<
"PosteriorWeightsCalculator: sumWeight < DBL_MIN";
117 return std::vector<double>();
121 edm::LogError(
"PosteriorWeightsCalculator") <<
"Problem in vector sizes (2)";
122 return std::vector<double>();
124 for (std::vector<double>::iterator iter = weights.begin();
125 iter != weights.end(); iter++) {
126 (*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< TSOS > predictedComponents
ROOT::Math::SMatrix< double, D1, D2, ROOT::Math::MatRepStd< double, D1, D2 > > Matrix
std::vector< double > weights(const TransientTrackingRecHit &tsos) const
Create random state.
ROOT::Math::SVector< double, D1 > Vector
ROOT::Math::SVector< double, 5 > AlgebraicVector5