Helper class which calculates the posterior weights of a Gaussian mixture given a prior (predicted) mixture and a RecHit. The prior is specified during construction time in the form of a vector of trajectory states.
Definition at line 13 of file PosteriorWeightsCalculator.h.
template<unsigned int D>
std::vector< double > PosteriorWeightsCalculator::weights |
( |
const TrackingRecHit & |
tsos | ) |
const |
Definition at line 28 of file PosteriorWeightsCalculator.cc.
References hltPixelTracks_cff::chi2, muonRecoAnalyzer_cfi::chi2Min, JetChargeProducer_cfi::exp, TrackingRecHit::getKfComponents(), mps_fire::i, invertPosDefMatrix(), LogDebug, convertSQLiteXML::ok, AlCaHLTBitMon_ParallelJobs::p, predictedComponents, dttmaxenums::R, alignCSCRings::r, mathSSE::sqrt(), w, weights(), and x.
33 using ROOT::Math::SMatrixNoInit;
37 edm::LogError(
"EmptyPredictedComponents") <<
"a multi state is empty. cannot compute any weight.";
42 std::vector<double> detRs;
44 std::vector<double> chi2s;
48 SMatDD V(SMatrixNoInit{}),
R(SMatrixNoInit{});
59 recHit.getKfComponents(holder);
66 edm::LogError(
"PosteriorWeightsCalculator") <<
"PosteriorWeightsCalculator: determinant failed";
67 return std::vector<double>();
69 detRs.push_back(detR);
73 edm::LogError(
"PosteriorWeightsCalculator") <<
"PosteriorWeightsCalculator: inversion failed";
74 return std::vector<double>();
76 double chi2 = ROOT::Math::Similarity(r, R);
77 chi2s.push_back(chi2);
83 edm::LogError(
"PosteriorWeightsCalculator") <<
"Problem in vector sizes";
84 return std::vector<double>();
92 double sumWeights(0.);
98 double tempWeight(0.);
99 if (detRs[
i] > FLT_MIN) {
106 LogDebug(
"GsfTrackFitters") <<
"PosteriorWeightsCalculator: detR < FLT_MIN !!";
108 weights.push_back(tempWeight);
109 sumWeights += tempWeight;
112 if (sumWeights < DBL_MIN) {
113 LogDebug(
"GsfTrackFitters") <<
"PosteriorWeightsCalculator: sumWeight < DBL_MIN";
114 edm::LogError(
"PosteriorWeightsCalculator") <<
"PosteriorWeightsCalculator: sumWeight < DBL_MIN";
115 return std::vector<double>();
119 edm::LogError(
"PosteriorWeightsCalculator") <<
"Problem in vector sizes (2)";
120 return std::vector<double>();
122 sumWeights = 1. / sumWeights;
123 for (
auto&
w : weights)
ROOT::Math::SMatrix< double, D1, D1, ROOT::Math::MatRepSym< double, D1 > > SymMatrix
std::vector< double > weights(const TrackingRecHit &tsos) const
Create random state.
ROOT::Math::SMatrix< double, D1, D2, ROOT::Math::MatRepStd< double, D1, D2 > > Matrix
std::vector< TSOS > predictedComponents
bool invertPosDefMatrix(ROOT::Math::SMatrix< T, N, N, ROOT::Math::MatRepSym< T, N > > &m)
ROOT::Math::SVector< double, D1 > Vector