/*************************************************************************** TTrimSPDataHandler.cpp Author: Bastian M. Wojek e-mail: bastian.wojek@psi.ch 2008/05/26 ***************************************************************************/ #include "TTrimSPDataHandler.h" #include #include #include #include using namespace std; //-------------------- // Constructor of the TrimSPData class -- reading all available trim.SP-rge-files with a given name into std::vectors // The rge-file names have to contain the Implantation energy just before the rge-extension in the format %02u_%1u // Example: string path("/home/user/TrimSP/SomeSample-"); // string energyArr[] = {"02_1", "02_5", "03_5", "05_0", "07_5", "10_0", "12_5"}; // vector energyVec(energyArr, energyArr+(sizeof(energyArr)/sizeof(energyArr[0]))); // // This will read the files "/home/user/TrimSP/SomeSample-02_1.rge", "/home/user/TrimSP/SomeSample-02_5.rge" and so on. //-------------------- TTrimSPData::TTrimSPData(const string &path, vector &energyVec) { double zz(0.0), nzz(0.0); vector vzz, vnzz; string word, energyStr; for(unsigned int i(0); i> word) if(word == "PARTICLES") break; while(!rgeFile->eof()) { *rgeFile >> zz >> nzz; vzz.push_back(zz); vnzz.push_back(nzz); } fDataZ.push_back(vzz); fDataNZ.push_back(vnzz); rgeFile->close(); delete rgeFile; rgeFile = 0; vzz.clear(); vnzz.clear(); } } fOrigDataNZ = fDataNZ; for(unsigned int i(0); i TTrimSPData::DataZ(double e) const { for(unsigned int i(0); i TTrimSPData::DataNZ(double e) const { for(unsigned int i(0); i TTrimSPData::OrigDataNZ(double e) const { for(unsigned int i(0); i& interface, const vector& weight) const { if(weight.size()-interface.size()-1) { cout << "For the weighting the number of interfaces has to be one less than the number of weights!" << endl; cout << "No weighting of the implantation profile will be done unless you take care of that!" << endl; return; } for(unsigned int i(0); i1) { if (interface[i]1.0 || weight[i]<0.0) { cout << "At least one of the specified weights is out of range - no weighting will be done!" << endl; return; } } for(unsigned int i(0); i z, nz; for(unsigned int i(0); i= zz) { found = true; break; } } if (!found) return -1.0; if (i == 0) return nz[0]*10.0*zz/z[0]; return fabs(nz[i-1]+(nz[i]-nz[i-1])*(10.0*zz-z[i-1])/(z[i]-z[i-1])); } //--------------------- // Method normalizing the n(z)-vector calculated by trim.SP for a given energy[keV] //--------------------- void TTrimSPData::Normalize(double e) { for(unsigned int i(0); i