some improvements when calculating mean values and reading rge-files
This commit is contained in:
@ -58,7 +58,7 @@ LIBS = $(ROOTLIBS) -lXMLParser
|
|||||||
GLIBS = $(ROOTGLIBS) -lXMLParser
|
GLIBS = $(ROOTGLIBS) -lXMLParser
|
||||||
|
|
||||||
# PSI libs
|
# PSI libs
|
||||||
PSILIBS = -L$(ROOTSYS)/lib -lTLemRunHeader -lPMusr
|
PSILIBS = -L$(ROOTSYS)/lib -lTLemRunHeader -lPMusr -lPUserFcnBase
|
||||||
# Minuit2 lib
|
# Minuit2 lib
|
||||||
MNLIB = -L$(ROOTSYS)/lib -lMinuit2
|
MNLIB = -L$(ROOTSYS)/lib -lMinuit2
|
||||||
# MathMore lib
|
# MathMore lib
|
||||||
|
@ -21,16 +21,16 @@ void syntax()
|
|||||||
cout << endl << "% input file for nonlocal";
|
cout << endl << "% input file for nonlocal";
|
||||||
cout << endl << "% --------------------------------";
|
cout << endl << "% --------------------------------";
|
||||||
cout << endl << "% input parameters:";
|
cout << endl << "% input parameters:";
|
||||||
cout << endl << "% reduced temperature";
|
cout << endl << "% reducedTemp : reduced temperature";
|
||||||
cout << endl << "% lambda London (nm)";
|
cout << endl << "% lambdaL : lambda London (nm)";
|
||||||
cout << endl << "% xi0 (nm)";
|
cout << endl << "% xi0 : coherence length (nm)";
|
||||||
cout << endl << "% mean free path (nm)";
|
cout << endl << "% meanFreePath : mean free path (nm)";
|
||||||
cout << endl << "% film thickness (nm)";
|
cout << endl << "% filmThickness : film thickness (nm)";
|
||||||
cout << endl << "% specular, 1=specular, 0=diffuse";
|
cout << endl << "% specular : 1=specular, 0=diffuse";
|
||||||
cout << endl << "% [Bext in (G)], i.e. this is optional";
|
cout << endl << "% [Bext] : external magnetic field (G), i.e. this is optional";
|
||||||
cout << endl << "% [dead layer in (nm)], i.e. this is optional";
|
cout << endl << "% [deadLayer] : dead layer (nm), i.e. this is optional";
|
||||||
cout << endl << "% [rge input file name], i.e. this is optional";
|
cout << endl << "% [rgeFileName] : rge input file name, i.e. this is optional";
|
||||||
cout << endl << "% [output file name], i.e. this is optional";
|
cout << endl << "% [outputFileName] : output file name, i.e. this is optional";
|
||||||
cout << endl;
|
cout << endl;
|
||||||
cout << endl << "reducedTemp = 0.8287";
|
cout << endl << "reducedTemp = 0.8287";
|
||||||
cout << endl << "lambdaL = 30.0";
|
cout << endl << "lambdaL = 30.0";
|
||||||
@ -223,17 +223,21 @@ int readRgeFile(const char *fln, vector<Double_t> &x, vector<Double_t> &n)
|
|||||||
int lineNo = 1;
|
int lineNo = 1;
|
||||||
int result;
|
int result;
|
||||||
double valX, valN;
|
double valX, valN;
|
||||||
// read first line and ignore it since it is the header line
|
int headerCount = 0;
|
||||||
fgets(line, sizeof(line), fp);
|
|
||||||
while (!feof(fp)) {
|
while (!feof(fp)) {
|
||||||
fgets(line, sizeof(line), fp);
|
fgets(line, sizeof(line), fp);
|
||||||
result = sscanf(line, "%lf %lf", &valX, &valN);
|
result = sscanf(line, "%lf %lf", &valX, &valN);
|
||||||
if (result != 2) {
|
if (result != 2) {
|
||||||
cout << endl << "**ERROR** in line no " << lineNo;
|
if (headerCount >= 2) {
|
||||||
cout << endl << "Couldn't extract x and n(x), will quit.";
|
cout << endl << "**ERROR** in line no " << lineNo;
|
||||||
cout << endl << endl;
|
cout << endl << "Couldn't extract x and n(x), will quit.";
|
||||||
fclose(fp);
|
cout << endl << endl;
|
||||||
return 0;
|
fclose(fp);
|
||||||
|
return 0;
|
||||||
|
} else {
|
||||||
|
headerCount++;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
x.push_back(valX/10.0); // x in nm
|
x.push_back(valX/10.0); // x in nm
|
||||||
n.push_back(valN);
|
n.push_back(valN);
|
||||||
@ -250,10 +254,12 @@ int readRgeFile(const char *fln, vector<Double_t> &x, vector<Double_t> &n)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
Double_t xx=0.0;
|
||||||
for (unsigned int i=0; i<x.size(); i++) {
|
for (unsigned int i=0; i<x.size(); i++) {
|
||||||
cout << endl << i << ": " << x[i] << ", " << n[i];
|
xx += n[i];
|
||||||
}
|
}
|
||||||
cout << endl;
|
xx *= (x[1]-x[0]);
|
||||||
|
cout << "debug> xx=" << xx << endl;
|
||||||
*/
|
*/
|
||||||
|
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
@ -370,6 +376,8 @@ int main(int argc, char *argv[])
|
|||||||
for (unsigned int i=0; i<x.size()-1; i++) {
|
for (unsigned int i=0; i<x.size()-1; i++) {
|
||||||
if (x[i] <= params.deadLayer) {
|
if (x[i] <= params.deadLayer) {
|
||||||
meanB += 1.0 * n[i];
|
meanB += 1.0 * n[i];
|
||||||
|
} else if (x[i] > params.deadLayer+params.filmThickness) {
|
||||||
|
meanB += 1.0 * n[i];
|
||||||
} else {
|
} else {
|
||||||
BB = pippard->GetMagneticField(x[i]-params.deadLayer);
|
BB = pippard->GetMagneticField(x[i]-params.deadLayer);
|
||||||
meanB += BB * n[i];
|
meanB += BB * n[i];
|
||||||
@ -394,8 +402,7 @@ int main(int argc, char *argv[])
|
|||||||
if (params.outputFileName.Length() > 0)
|
if (params.outputFileName.Length() > 0)
|
||||||
pippard->SaveField();
|
pippard->SaveField();
|
||||||
|
|
||||||
cout << endl << ">> magnetic field = " << pippard->GetMagneticField(0.0);
|
cout << endl << endl;
|
||||||
cout << endl;
|
|
||||||
|
|
||||||
if (pippard) {
|
if (pippard) {
|
||||||
delete pippard;
|
delete pippard;
|
||||||
|
Reference in New Issue
Block a user