remove obsolate file.

This commit is contained in:
suter_a 2022-12-21 08:05:49 +01:00
parent fae76acb21
commit 4ba0647765

View File

@ -1,247 +0,0 @@
/***************************************************************************
PDepthProfile.cpp
Author: Andreas Suter
e-mail: andreas.suter@psi.ch
***************************************************************************/
/***************************************************************************
* Copyright (C) 2009-2022 by Andreas Suter *
* andreas.suter@psi.ch *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
#include <cassert>
#include <cmath>
#include <iostream>
#include <vector>
#include <TSAXParser.h>
#include <TMath.h>
#include "PDepthProfile.h"
ClassImp(PDepthProfileGlobal)
//--------------------------------------------------------------------------
// Constructor (PDepthProfileGlobal)
//--------------------------------------------------------------------------
/**
* <p>Constructor. Reads the necessary rge-files based on the depth_profile_startup.xml
*/
PDepthProfileGlobal::PDepthProfileGlobal()
{
// load all the TRIM.SP rge-files
fRgeHandler = new PRgeHandler("./depth_profile_startup.xml");
if (!fRgeHandler->IsValid()) {
std::cout << std::endl << ">> PDepthProfileGlobal::PDepthProfileGlobal **PANIC ERROR**";
std::cout << std::endl << ">> rge data handler too unhappy. Will terminate unfriendly, sorry.";
std::cout << std::endl;
fValid = false;
}
}
//--------------------------------------------------------------------------
// Destructor (PDepthProfileGlobal)
//--------------------------------------------------------------------------
/**
* <p>Clean up the rge-handler.
*/
PDepthProfileGlobal::~PDepthProfileGlobal()
{
if (fRgeHandler) {
delete fRgeHandler;
fRgeHandler = nullptr;
}
}
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
ClassImp(PDepthProfile)
//--------------------------------------------------------------------------
// Destructor (PDepthProfile)
//--------------------------------------------------------------------------
/**
* <p>Clean up the global part.
*/
PDepthProfile::~PDepthProfile()
{
if ((fDepthProfileGlobal != 0) && fInvokedGlobal) {
delete fDepthProfileGlobal;
fDepthProfileGlobal = nullptr;
}
}
//--------------------------------------------------------------------------
// SetGlobalPart (public)
//--------------------------------------------------------------------------
/**
* <p>
*
* <b>return:</b>
*
* \param globalPart
* \param idx
*/
void PDepthProfile::SetGlobalPart(std::vector<void*> &globalPart, UInt_t idx)
{
fIdxGlobal = static_cast<Int_t>(idx);
if ((Int_t)globalPart.size() <= fIdxGlobal) {
fDepthProfileGlobal = new PDepthProfileGlobal();
if (fDepthProfileGlobal == nullptr) {
fValid = false;
std::cerr << std::endl << ">> PDepthProfile::SetGlobalPart(): **ERROR** Couldn't invoke global user function object, sorry ..." << std::endl;
} else if (!fDepthProfileGlobal->IsValid()) {
fValid = false;
std::cerr << std::endl << ">> PDepthProfile::SetGlobalPart(): **ERROR** initialization of global user function object failed, sorry ..." << std::endl;
} else {
fValid = true;
fInvokedGlobal = true;
globalPart.resize(fIdxGlobal+1);
globalPart[fIdxGlobal] = dynamic_cast<PDepthProfileGlobal*>(fDepthProfileGlobal);
}
} else {
fValid = true;
fDepthProfileGlobal = (PDepthProfileGlobal*)globalPart[fIdxGlobal];
}
}
//--------------------------------------------------------------------------
// GlobalPartIsValid (public)
//--------------------------------------------------------------------------
/**
* <p>
*
* <b>return:</b>
*/
Bool_t PDepthProfile::GlobalPartIsValid() const
{
return (fValid && fDepthProfileGlobal->IsValid());
}
//--------------------------------------------------------------------------
// GetStoppingProbability()
//--------------------------------------------------------------------------
/**
* <p>Yet to be implemented.
*/
std::array<double,24> PDepthProfile::GetStoppingProbability(double a, double b, double *energy) const
{
// calculation of stopping probability for a given interval and experimental energy range
// \int n(z, E) dz ~ dz [1/2 n_0 + n_1 + n_2 + ... + n_(N-1) + 1/2 n_N]
double zMax=fRgeHandler->GetZmax(energy[23]);
vector<double> z;
double x=a;
double xMax=b;
if (x==0) {
x=0.5;
}
if (b>zMax){
xMax=zMax;
}
int j=0;
while (x<xMax){
z[j]=a;
x++;
j++;
}
vector<double> n;
double prob[24];
double sum=0;
for (int i=0; i<24;i++){
for (int j=0; j<z.size(); j++){
//n[j]=fRgeHandler.Get_n(energy[i], z[j]);
if ((j==0) || (j==z.size()-1)){
prob=0.5*fRgeHandler->Get_n(energy[i], z[j];
} else {
prob=fRgeHandler->Get_n(energy[i], z[j];
}
sum=sum+prob;
}
prob[i]=sum;
}
return prob;
}
//--------------------------------------------------------------------------
// operator()
//--------------------------------------------------------------------------
/**
* <p>Yet to be implemented.
*/
Double_t PDepthProfile::operator()(Double_t t, const std::vector<Double_t> &param) const
{
//verify number of parameters: 2n+1
// parameters: {f1, f2, ..., f_n, x1, ..., x_(n-1)}
assert(param.size() >2);
assert(((param.size()-1)%2) == 0);
int n=(param.size()-1)/2;
double energy[24];
for (int i=0;i<sizeof(energy); i++){
energy[i]=(i+1)*1000;
}
double probability [sizeof(energy)][n+1];
// get stopping probability
int l=0;
for (int i=n+1; i<2*n+1; i++){
double prob[24];
if (i==n+1){
prob=GetStoppingProbability(0.0,param(i));
} else if (i==2*n) {
prob=GetStoppingProbability(i,fRgeHandler->GetZmax(energy[23]));
} else {
prob=GetStoppingProbability(i,i+1);
}
for (int k=0;k<sizeof(energy); k++){
probability[k][l]=prob[k];
}
l++;
}
double fit[24];
double intermediate;
for (int i=0; i<sizeof(energy); i++){
intermediate=0;
for (int j=0; j<n+1; j++){
intermediate=intermediate+param[j]*probability[i][j];
}
fit[i]=intermediate;
}
return 0.0;
}