start to work on a more efficient version of MM PDepthProfile user function.
This commit is contained in:
parent
7bf2cfd8c1
commit
348f02b217
@ -53,6 +53,7 @@ class PDepthProfileGlobal
|
||||
mutable std::vector<Double_t> fPreviousParam;
|
||||
|
||||
PRgeHandler *fRgeHandler{nullptr};
|
||||
PRgeDataList fCfd;
|
||||
|
||||
ClassDef(PDepthProfileGlobal, 1)
|
||||
};
|
||||
|
43
src/external/DepthProfile/src/PDepthProfile.cpp
vendored
43
src/external/DepthProfile/src/PDepthProfile.cpp
vendored
@ -2,8 +2,8 @@
|
||||
|
||||
PDepthProfile.cpp
|
||||
|
||||
Author: Andreas Suter
|
||||
e-mail: andreas.suter@psi.ch
|
||||
Authors: Maria Martins, Andreas Suter
|
||||
e-mail: maria.martins@psi.ch, andreas.suter@psi.ch
|
||||
|
||||
***************************************************************************/
|
||||
|
||||
@ -54,6 +54,20 @@ PDepthProfileGlobal::PDepthProfileGlobal() {
|
||||
std::cout << std::endl;
|
||||
fValid = false;
|
||||
}
|
||||
|
||||
// calculate cumulative frequency distribution of all the rge-files
|
||||
PRgeDataList rgeData = fRgeHandler->GetRgeData();
|
||||
fCfd.resize(fRgeHandler->GetNoOfRgeDataSets());
|
||||
for (unsigned int i=0; i<fCfd.size(); i++) {
|
||||
fCfd[i].energy = rgeData[i].energy;
|
||||
fCfd[i].depth = rgeData[i].depth;
|
||||
fCfd[i].nn.resize(rgeData[i].nn.size());
|
||||
double dval=0.0;
|
||||
for (unsigned int j=0; j<fCfd[i].nn.size(); j++) {
|
||||
dval += rgeData[i].nn[j];
|
||||
fCfd[i].nn[j] = dval;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
@ -80,7 +94,7 @@ ClassImp(PDepthProfile)
|
||||
* <p>Clean up the global part.
|
||||
*/
|
||||
PDepthProfile::~PDepthProfile() {
|
||||
if ((fDepthProfileGlobal != 0) && fInvokedGlobal) {
|
||||
if ((fDepthProfileGlobal != nullptr) && fInvokedGlobal) {
|
||||
delete fDepthProfileGlobal;
|
||||
fDepthProfileGlobal = nullptr;
|
||||
}
|
||||
@ -140,7 +154,13 @@ Bool_t PDepthProfile::GlobalPartIsValid() const {
|
||||
//--------------------------------------------------------------------------
|
||||
// GetStoppingProbability()
|
||||
//--------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* @brief PDepthProfileGlobal::GetStoppingProbability
|
||||
* @param a
|
||||
* @param b
|
||||
* @param energy
|
||||
* @return
|
||||
*/
|
||||
double PDepthProfileGlobal::GetStoppingProbability(double a, double b, Double_t energy) const {
|
||||
|
||||
// calculation of stopping probability for a given z interval and experimental energy
|
||||
@ -175,12 +195,18 @@ double PDepthProfileGlobal::GetStoppingProbability(double a, double b, Double_t
|
||||
//--------------------------------------------------------------------------
|
||||
// operator()
|
||||
//--------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* @brief PDepthProfile::operator ()
|
||||
* @param t
|
||||
* @param param
|
||||
* @return
|
||||
*/
|
||||
Double_t PDepthProfile::operator()(Double_t t, const std::vector <Double_t> ¶m) const {
|
||||
//verify number of parameters: 2n+1
|
||||
// parameters: {E,f1, f2, ..., f_n, x1, ..., x_(n-1)}
|
||||
// verify number of parameters: 2n+1, i.e. it has to be an odd number of parameters
|
||||
// parameters: {f1, f2, ..., f_n, x1, ..., x_(n-1)}
|
||||
assert(param.size() > 2);
|
||||
assert(((param.size() - 1) % 2) == 0);
|
||||
|
||||
//number of steps: n+1
|
||||
int n = (param.size() - 1) / 2;
|
||||
std::vector<double> parameters;
|
||||
@ -259,10 +285,7 @@ Double_t PDepthProfile::operator()(Double_t t, const std::vector <Double_t> &par
|
||||
fit = fit + parameters[j] * probability[j];
|
||||
}
|
||||
|
||||
/* std::cout << "Energy " << energy << std::endl;
|
||||
std::cout << "FRACTION " << fit << std::endl;*/
|
||||
return fit;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user