diff --git a/Armory/ClassReactionConfig.h b/Armory/ClassReactionConfig.h index df4532d..b7f6ed5 100644 --- a/Armory/ClassReactionConfig.h +++ b/Armory/ClassReactionConfig.h @@ -213,13 +213,13 @@ inline bool ReactionConfig::LoadReactionConfig(TMacro * macro){ targetA = target.A; targetZ = target.Z; } - if( recoilLine == 10 ) isTargetScattering = str[0].compare("true") == 0 ? true: false; - if( recoilLine == 11 ) targetDensity = atof(str[0].c_str()); - if( recoilLine == 12 ) targetThickness = atof(str[0].c_str()); - if( recoilLine == 13 ) beamStoppingPowerFile = str[0]; + if( recoilLine == 9 ) isTargetScattering = str[0].compare("true") == 0 ? true: false; + if( recoilLine == 10 ) targetDensity = atof(str[0].c_str()); + if( recoilLine == 11 ) targetThickness = atof(str[0].c_str()); + if( recoilLine == 12 ) beamStoppingPowerFile = str[0]; - if( recoilLine == 14 ) numEvents = atoi(str[0].c_str()); - if( recoilLine == 15 ) isRedo = str[0].compare("true" ) == 0 ? true : false; + if( recoilLine == 13 ) numEvents = atoi(str[0].c_str()); + if( recoilLine == 14 ) isRedo = str[0].compare("true" ) == 0 ? true : false; } if( recoilFlag > 0 ){ diff --git a/Cleopatra/ClassSimPlotter.h b/Cleopatra/ClassSimPlotter.h index 453e009..752c8a0 100644 --- a/Cleopatra/ClassSimPlotter.h +++ b/Cleopatra/ClassSimPlotter.h @@ -490,10 +490,11 @@ std::vector Plotter::FindRange(TString branch){ TH1F * temp1 = (TH1F *) gROOT->FindObjectAny("temp1"); std::vector output; - output.push_back( temp1->GetXaxis()->GetXmax() ); - output.push_back( temp1->GetXaxis()->GetXmin() ); - - delete temp1; + if( temp1 != nullptr){ + output.push_back( temp1->GetXaxis()->GetXmax() ); + output.push_back( temp1->GetXaxis()->GetXmin() ); + delete temp1; + } return output; } diff --git a/Cleopatra/ClassTransfer.h b/Cleopatra/ClassTransfer.h index 819e4cc..a54511c 100644 --- a/Cleopatra/ClassTransfer.h +++ b/Cleopatra/ClassTransfer.h @@ -39,6 +39,7 @@ public: void SetB(int A, int Z); 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 SetReactionFromTMacro(TMacro configMacro, unsigned short ID = 0); void SetReactionSimple(int beamA, int beamZ, @@ -283,6 +284,30 @@ void TransferReaction::SetExB(double Ex){ 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){ if( config.LoadReactionConfig(configFile) ){ diff --git a/Cleopatra/SimTransfer.C b/Cleopatra/SimTransfer.C index 6110a3a..62dd3c7 100644 --- a/Cleopatra/SimTransfer.C +++ b/Cleopatra/SimTransfer.C @@ -72,7 +72,7 @@ void Transfer( int count = 0; for( unsigned short i = 0 ; i < numDetGeo; i++){ if( detGeoConfig.array[i].enable ){ - transfer[count].SetReactionFromFile(basicConfig, i); + transfer[count].SetReactionFromReactionConfigClass(reactionConfig, i); if(transfer[count].GetRecoil().isDecay) { decay[count].SetMotherDaugther(transfer[count].GetRecoil()); } diff --git a/working/reactionConfig.txt b/working/reactionConfig.txt index e9e6013..bfde1b9 100644 --- a/working/reactionConfig.txt +++ b/working/reactionConfig.txt @@ -36,7 +36,7 @@ false //isDacay #0.000 1.0 1.0 0.01 #1.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 #==================_reaction_for_2nd_Array_use_ony_when_2nd_array_used