424 std::cout <<
"Level scheme details: " << std::endl;
430 std::cout <<
"\tInvalid entry. Must be >1." << std::endl;
436 for(
int i=0; i<nstates; i++) {
448 if (parity) {
sp = std::to_string(spin) +
"+"; }
449 else {
sp = std::to_string(spin) +
"-"; }
454 std::cout <<
"\tState " << i <<
" spin and parity [" <<
sp <<
"]: ";
455 std::getline(std::cin,inp);
456 if(inp.empty()) {
break; }
457 if(inp[inp.size()-1]==
'+') parity =
true;
458 else if(inp[inp.size()-1]==
'-') parity =
false;
460 std::cout <<
"\tParity not specified. Please specify spin and parity e.g. 0.5+" << std::endl;
463 try { spin = std::stof(inp.substr(0,inp.size()-1)); }
464 catch(
const std::invalid_argument& ia) {
465 std::cout <<
"\tInvalid entry. Must be numerical." << std::endl;
469 std::cout <<
"\tInvalid entry. Must be >=0." << std::endl;
484 std::cout << std::endl;
485 std::cout <<
"Levels: " << std::endl;
487 std::cout << std::endl;
489 std::cout <<
"Transition details: " << std::endl;
494 for(
int i=0; i<ntrans; i++) {
504 bup = transition->
GetBUp();
505 mult = transition->
fMult;
523 transition->
fFinal =
final;
525 transition->
fMult = mult;
571 std::ifstream ansfile;
572 ansfile.open(file_name.c_str());
574 std::cout <<
"Could not open answer file " << file_name << std::endl;
586 std::cout <<
"\tInvalid beam nucleus. Ensure nucleus is in the format AEl, ElA or El-A e.g. 3He, Li-5." << std::endl;
601 std::cout <<
"\tInvalid beam energy" << std::endl;
610 std::cout <<
"\tInvalid taget nucleus. Ensure nucleus is in the format AEl, ElA or El-A e.g. 3He, Li-5." << std::endl;
625 std::cout <<
"\tInvalid target thickness" << std::endl;
634 std::cout <<
"\tInvalid target density" << std::endl;
649 std::cout <<
"\tInvalid projectile(1) or target(2) excitation" << std::endl;
662 std::cout <<
"\tInvalid projectile(1) or target(2) detection" << std::endl;
668 if(!ans.empty()) pread = std::stoi(ans);
672 std::cout <<
"\nInvalid number of states" << std::endl;
677 std::cout <<
"\nInvalid number of states" << std::endl;
681 for (
int i=0; i<nstates; ++i) {
685 try { energy = stof(ans); }
686 catch(
const std::invalid_argument& ia) {
687 std::cout <<
"Invalid state energy. Must be numerical." << std::endl;
691 std::cout <<
"Invalid state energy. Must be >=0." << std::endl;
702 if(ans[ans.size()-1]==
'+') parity =
true;
703 else if(ans[ans.size()-1]==
'-') parity =
false;
705 std::cout <<
"\tState parity not specified. " << std::endl;
708 try { spin = std::stof(ans.substr(0,ans.size()-1)); }
709 catch(
const std::invalid_argument& ia) {
710 std::cout <<
"\tState spin invalid. Must be numerical." << std::endl;
714 std::cout <<
"\tState spin invalid. Invalid entry. Must be >=0." << std::endl;
722 for(
int i=0; i<pread; i++) {
732 std::cout <<
"\tInvalid level of interest" << std::endl;
740 if(!ans.empty()) pread = std::stoi(ans);
744 std::cout <<
"\tInvalid number of transitions" << std::endl;
748 for (
int i=0; i<ntrans; ++i) {
753 std::cout <<
"\tInvalid lower state index" << std::endl;
759 std::cout <<
"\tInvalid upper state index" << std::endl;
765 std::cout <<
"\tInvalid transition strength" << std::endl;
774 std::cout <<
"\tInvalid transition multiplicity" << std::endl;
779 "l"+std::to_string(i1-1),
786 for(
int i=0; i<pread; i++) {
798 std::cout <<
"\tInvalid transition of interest" << std::endl;
804 float pdetx, pdety, pdetz, pdetr;
807 std::cout <<
"\tInvalid particle detector X" << std::endl;
813 std::cout <<
"\tInvalid particle detector Y" << std::endl;
818 try { pdetz = stof(ans); }
819 catch(
const std::invalid_argument& ia) {
820 std::cout <<
"\tInvalid particle detector Z distance. Must be numerical." << std::endl;
824 std::cout <<
"\tInvalid particle detector Z distance. Must be non-zero." << std::endl;
829 try { pdetr = stof(ans); }
830 catch(
const std::invalid_argument& ia) {
831 std::cout <<
"\tInvalid particle detector R distance. Must be numerical." << std::endl;
940 bool ProjDet =
false;
942 std::vector<WDB_nuclvl> levels =
fLevelScheme.GetLevels();
943 std::vector<WDB_nuctrans> Etrans =
fLevelScheme.GetETransitions();
944 std::vector<WDB_nuctrans> Mtrans =
fLevelScheme.GetMTransitions();
950 bool failbit =
false;
960 int grouptype = int(TgtEx) + 1;
966 std::cerr <<
"CRITICAL Could not create data file for coulex routine. Ensure you have write access to the working directory." << std::endl;
969 std::cerr <<
"CRITICAL There was a problem reading the coulex data file. Please check you have read access to the working directory, and your inputs for the data file." << std::endl;
972 std::cout <<
"NON-CRITICAL Could not remove the coulex routine data file. You may need to manually remove the file or it may already have been deleted." << std::endl;
977 auto key = mlevel.first;
978 auto level = mlevel.second;
979 level->fCrossSection=0;
984 auto key = mlevel.first;
985 auto level = mlevel.second;
990 double *sfctrx =
new double[11];
991 double *sfctry =
new double[11];
992 double *sfctrz =
new double[11];
994 std::complex<double> ***rhox =
new std::complex<double>**[11];
995 std::complex<double> ***rhoy =
new std::complex<double>**[11];
996 std::complex<double> ***rhoz =
new std::complex<double>**[11];
997 std::complex<double> **rhoi;
998 for(
int i=0; i<=10; i++) {
999 rhox[i] =
new std::complex<double>*[3];
1000 for(
int k=0; k<3; k++) rhox[i][k] = new std::complex<double>[5];
1007 float Tstep =
fTarget.thickness / 10.;
1014 for(
int z=0; z<=10; z++) {
1015 for(
int y=0; y<=10; y++) {
1016 double ydist = (5-y) * ystep;
1017 for(
int x=0; x<=10; x++) {
1020 double angh1, angh2, anglCM1, anglCM2, anghCM1, anghCM2, angCM;
1021 double Eh1, Eh2, El1, El2;
1025 double angphi = std::atan2(ydist,xdist);
1026 if(angphi>TMath::Pi()) angphi -= 2*TMath::Pi();
1030 flag =
Kinematics(
fBeam.A,
fTarget.isotope.A,
fBeam.A,
fTarget.isotope.A,Eint[z],Q,angdet,El1,El2,Eh1,Eh2,angh1,angh2,anglCM1,anglCM2,anghCM1,anghCM2);
1032 std::cerr <<
"Impossible particle-detection geometry! Check your values and try again (ensure horizontal detector distance is negative for back-scattered detection)." << std::endl;
1039 flag =
Kinematics(
fBeam.A,
fTarget.isotope.A,
fTarget.isotope.A,
fBeam.A,Eint[z],Q,angdet,El1,El2,Eh1,Eh2,angh1,angh2,anglCM1,anglCM2,anghCM1,anghCM2);
1041 std::cerr <<
"Impossible particle-detection geometry! Check your values and try again (ensure horizontal detector distance is negative for back-scattered detection)." << std::endl;
1046 angphi += TMath::Pi();
1049 std::cerr <<
"Bad reaction kinematics! Lighter nucleus must be detected after scattering." << std::endl;
1056 GP_AC_Tensors(Eint[z], angCM, level->fIndex, rhox[x], xsect);
1059 for(
int k=0; k<3; k++) {
1060 for(
int q=0; q<=k*2; q++) {
1061 std::complex<double> expqphi = std::exp(std::complex<double>(0,
double(q)*angphi));
1062 rhox[x][k][q] *= sfctrx[x] * expqphi;
1088 level->fCrossSection = sfctr;
1090 for(
int k=0; k<3; k++) {
1091 for(
int q=0; q<=k*2; q++) {
1092 rhoi[k][q] /= sfctr;
1093 retST->
Set(k*2,q,rhoi[k][q]);
1094 level->fStatTensor->Set(k*2,q,rhoi[k][q]);
1096 rhoi[k][q] *= std::pow(-1,q);
1097 retST->
Set(k*2,-q,rhoi[k][q]);
1098 level->fStatTensor->Set(k*2,-q,rhoi[k][q]);
1103 for(
int k=0; k<3; k++) {
1104 for(
int q=0; q<=k*2; q++) {
1105 rhoi[k][q] /= sfctr;
1106 level->fStatTensor->Set(k*2,q,rhoi[k][q]);
1108 rhoi[k][q] *= std::pow(-1,q);
1109 level->fStatTensor->Set(k*2,-q,rhoi[k][q]);
1117 for(
int i=0; i<=10; i++) {
1118 for(
int k=0; k<=2; k++) {
1119 if(i==0)
delete[] rhoi[k];
1120 delete[] rhox[i][k];
1121 delete[] rhoy[i][k];
1122 delete[] rhoz[i][k];
1124 if(i==0)
delete[] rhoi;
double ELoss(double E, int Zb, int Zt, double Tt, double Mb=0, double *ttime=nullptr, double *range=nullptr, double Mt=0, double denst=0, long acc=1000)
int Kinematics(double A1I, double A2I, double A3I, double A4I, double E1I, double QEFFI, double PSII, double &E3I, double &E3AI, double &E4I, double &E4AI, double &ZETAI, double &ZETAAI, double &thetaI, double &thetaaI, double &PHII, double &PHIAI)
int setupcoulex(int Zbeam, float Abeam, int Ztgt, float Atgt, int grouptype, std::vector< WDB_nuclvl > &nuclvls, std::vector< WDB_nuctrans > &nucEtrans, std::vector< WDB_nuctrans > &nucMtrans)