bug fix; ClassTransfer can set reaction from ClassReaction

This commit is contained in:
HELIOS_Mac 2024-07-28 19:52:35 -05:00
parent d01d26988d
commit 95bff19bb4
5 changed files with 38 additions and 12 deletions

View File

@ -213,13 +213,13 @@ inline bool ReactionConfig::LoadReactionConfig(TMacro * macro){
targetA = target.A; targetA = target.A;
targetZ = target.Z; targetZ = target.Z;
} }
if( recoilLine == 10 ) isTargetScattering = str[0].compare("true") == 0 ? true: false; if( recoilLine == 9 ) isTargetScattering = str[0].compare("true") == 0 ? true: false;
if( recoilLine == 11 ) targetDensity = atof(str[0].c_str()); if( recoilLine == 10 ) targetDensity = atof(str[0].c_str());
if( recoilLine == 12 ) targetThickness = atof(str[0].c_str()); if( recoilLine == 11 ) targetThickness = atof(str[0].c_str());
if( recoilLine == 13 ) beamStoppingPowerFile = str[0]; if( recoilLine == 12 ) beamStoppingPowerFile = str[0];
if( recoilLine == 14 ) numEvents = atoi(str[0].c_str()); if( recoilLine == 13 ) numEvents = atoi(str[0].c_str());
if( recoilLine == 15 ) isRedo = str[0].compare("true" ) == 0 ? true : false; if( recoilLine == 14 ) isRedo = str[0].compare("true" ) == 0 ? true : false;
} }
if( recoilFlag > 0 ){ if( recoilFlag > 0 ){

View File

@ -490,10 +490,11 @@ std::vector<double> Plotter::FindRange(TString branch){
TH1F * temp1 = (TH1F *) gROOT->FindObjectAny("temp1"); TH1F * temp1 = (TH1F *) gROOT->FindObjectAny("temp1");
std::vector<double> output; std::vector<double> output;
output.push_back( temp1->GetXaxis()->GetXmax() ); if( temp1 != nullptr){
output.push_back( temp1->GetXaxis()->GetXmin() ); output.push_back( temp1->GetXaxis()->GetXmax() );
output.push_back( temp1->GetXaxis()->GetXmin() );
delete temp1; delete temp1;
}
return output; return output;
} }

View File

@ -39,6 +39,7 @@ public:
void SetB(int A, int Z); void SetB(int A, int Z);
void SetIncidentEnergyAngle(double KEA, double theta, double phi); void SetIncidentEnergyAngle(double KEA, double theta, double phi);
void SetReactionFromReactionConfigClass(ReactionConfig reactConfigClassObject, unsigned short ID = 0);
void SetReactionFromFile(std::string configFile, unsigned short ID = 0); void SetReactionFromFile(std::string configFile, unsigned short ID = 0);
void SetReactionFromTMacro(TMacro configMacro, unsigned short ID = 0); void SetReactionFromTMacro(TMacro configMacro, unsigned short ID = 0);
void SetReactionSimple(int beamA, int beamZ, void SetReactionSimple(int beamA, int beamZ,
@ -283,6 +284,30 @@ void TransferReaction::SetExB(double Ex){
isReady = false; isReady = false;
} }
void TransferReaction::SetReactionFromReactionConfigClass(ReactionConfig reactConfigClassObject, unsigned short ID){
config = reactConfigClassObject;
SetA(config.beamA, config.beamZ);
Seta(config.targetA, config.targetZ);
SetExA(config.beamEx);
if( ID > config.recoil.size() ){
printf("Reaction Config only has %zu recoil settings. input is %u. Abort.\n", config.recoil.size(), ID);
return;
}
recoil = config.recoil[ID];
exList = config.exList[ID];
Setb(recoil.lightA, recoil.lightZ);
SetB(recoil.heavyA, recoil.heavyZ);
SetIncidentEnergyAngle(config.beamEnergy, 0, 0);
CalReactionConstant();
}
void TransferReaction::SetReactionFromFile(std::string configFile, unsigned short ID){ void TransferReaction::SetReactionFromFile(std::string configFile, unsigned short ID){
if( config.LoadReactionConfig(configFile) ){ if( config.LoadReactionConfig(configFile) ){

View File

@ -72,7 +72,7 @@ void Transfer(
int count = 0; int count = 0;
for( unsigned short i = 0 ; i < numDetGeo; i++){ for( unsigned short i = 0 ; i < numDetGeo; i++){
if( detGeoConfig.array[i].enable ){ if( detGeoConfig.array[i].enable ){
transfer[count].SetReactionFromFile(basicConfig, i); transfer[count].SetReactionFromReactionConfigClass(reactionConfig, i);
if(transfer[count].GetRecoil().isDecay) { if(transfer[count].GetRecoil().isDecay) {
decay[count].SetMotherDaugther(transfer[count].GetRecoil()); decay[count].SetMotherDaugther(transfer[count].GetRecoil());
} }

View File

@ -36,7 +36,7 @@ false //isDacay
#0.000 1.0 1.0 0.01 #0.000 1.0 1.0 0.01
#1.000 1.0 1.0 0.01 #1.000 1.0 1.0 0.01
#2.000 1.0 1.0 0.01 #2.000 1.0 1.0 0.01
12.000 1.0 1.0 0.01 1.000 1.0 1.0 0.01
IAEA + 10 0.01 IAEA + 10 0.01
#==================_reaction_for_2nd_Array_use_ony_when_2nd_array_used #==================_reaction_for_2nd_Array_use_ony_when_2nd_array_used