81 std::vector<Float_t>
m_muSignal (fNumParams,0.0);
83 for (
UInt_t param=0; param < fNumParams; ++param) {
95 Log() << kDEBUG <<
"the signal means" <<
Endl;
96 for (
UInt_t param=0; param < fNumParams; ++param)
98 Log() << kDEBUG <<
"the background means" <<
Endl;
109 if (fSigma!=0)
delete fSigma;
110 fSigma =
new TMatrixF(fNumParams, fNumParams);
111 for (
UInt_t row=0; row < fNumParams; ++row) {
112 for (
UInt_t col=0; col < fNumParams; ++col) {
115 (*fSigma)[row][col] = 0;
120 for (
UInt_t row=0; row < fNumParams; ++row) {
121 for (
UInt_t col=0; col < fNumParams; ++col) {
128 for (
UInt_t row=0; row < fNumParams; ++row) {
129 for (
UInt_t col=0; col < fNumParams; ++col) {
140 Log() <<
"after filling sigmaSignal" <<
Endl;
142 Log() <<
"after filling sigmaBack" <<
Endl;
144 Log() <<
"after filling total Sigma" <<
Endl;
154 for (
UInt_t i = 0; i< fNumParams; ++i) {
158 diag(i,i) = fTolerence;
162 Log() <<
"the diagonal" <<
Endl;
171 Log() <<
"the decomposition " <<
Endl;
176 *fSigmaInverse /=
diag;
180 Log() <<
"the SigmaInverse " <<
Endl;
181 fSigmaInverse->
Print();
183 Log() <<
"the real " <<
Endl;
188 for (
UInt_t i =0; i< fNumParams; ++i) {
191 Log() <<
"problem, i= "<< i <<
" j= " <<
j <<
Endl;
192 Log() <<
"Sigma(i,j)= "<< (*fSigma)(i,
j) <<
" SigmaInverse(i,j)= " << (*fSigmaInverse)(i,
j) <<
Endl;
198 if (
problem) Log() << kWARNING <<
"Problem with the inversion!" <<
Endl;
216 for (
UInt_t i=0; i < fNumParams; ++i) {
217 m_temp += (
x[i] - fMu[k][i]) * (*fSigmaInverse)(
j,i);
223 for (
UInt_t i=0; i< fNumParams; ++i) {
std::vector< std::vector< Float_t > > LDAEvents
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
TMatrixT< Float_t > TMatrixF
Single Value Decomposition class.
LDA(Float_t tolerence=1.0e-5, Bool_t debug=false)
constructor
void Initialize(const LDAEvents &inputSignal, const LDAEvents &inputBackground)
Create LDA matrix using local events found by knn method.
Float_t GetLogLikelihood(const std::vector< Float_t > &x, Int_t k)
Log likelihood function with Gaussian approximation.
Float_t GetProb(const std::vector< Float_t > &x, Int_t k)
Signal probability with Gaussian approximation.
Float_t FSub(const std::vector< Float_t > &x, Int_t k)
Probability value using Gaussian approximation.
ostringstream derivative to redirect and format output
virtual void Print(Option_t *option="") const
This method must be overridden when a class wants to print itself.
MsgLogger & Endl(MsgLogger &ml)
Double_t Exp(Double_t x)
Returns the base-e exponential function of x, which is e raised to the power x.
Double_t Log(Double_t x)
Returns the natural logarithm of x.
Double_t Sqrt(Double_t x)
Returns the square root of x.
Short_t Abs(Short_t d)
Returns the absolute value of parameter Short_t d.
constexpr Double_t TwoPi()