modified ClassReactionConfig.h for many reactions

This commit is contained in:
Ryan Tang 2024-04-02 13:50:21 -04:00
parent 9e1e0f86e5
commit 0905fe73dc
2 changed files with 18 additions and 15 deletions

View File

@ -70,6 +70,7 @@ struct ExcitedEnergies {
} }
void Print() const { void Print() const {
printf("...................................\n");
printf("Energy[MeV] Rel.Xsec SF sigma\n"); printf("Energy[MeV] Rel.Xsec SF sigma\n");
for( size_t i = 0; i < ExList.size(); i++){ for( size_t i = 0; i < ExList.size(); i++){
ExList[i].Print("\n"); ExList[i].Print("\n");
@ -101,8 +102,8 @@ public:
float targetThickness; ///targetThickness_in_cm float targetThickness; ///targetThickness_in_cm
std::string beamStoppingPowerFile; ///stopping_power_for_beam std::string beamStoppingPowerFile; ///stopping_power_for_beam
Recoil recoil[2]; std::vector<Recoil> recoil;
ExcitedEnergies exList[2]; std::vector<ExcitedEnergies> exList;
int numEvents; ///number_of_Event_being_generated int numEvents; ///number_of_Event_being_generated
bool isRedo; ///isReDo bool isRedo; ///isReDo
@ -163,9 +164,6 @@ inline bool ReactionConfig::LoadReactionConfig(TMacro * macro){
if( macro == NULL ) return false; if( macro == NULL ) return false;
exList[0].Clear();
exList[1].Clear();
int recoilFlag = 0; int recoilFlag = 0;
int recoilLine = 0; int recoilLine = 0;
@ -184,6 +182,8 @@ inline bool ReactionConfig::LoadReactionConfig(TMacro * macro){
if( str[0].find("#===") != std::string::npos ) { if( str[0].find("#===") != std::string::npos ) {
recoilFlag ++; recoilFlag ++;
recoilLine = 0; recoilLine = 0;
recoil.push_back(Recoil());
exList.push_back(ExcitedEnergies());
continue; continue;
} }
@ -230,7 +230,7 @@ inline bool ReactionConfig::LoadReactionConfig(TMacro * macro){
} }
for( int i = 0; i < 2; i++){ for( size_t i = 0; i < recoil.size(); i++){
recoil[i].heavyA = beamA + targetA - recoil[i].lightA; recoil[i].heavyA = beamA + targetA - recoil[i].lightA;
recoil[i].heavyZ = beamZ + targetZ - recoil[i].lightZ; recoil[i].heavyZ = beamZ + targetZ - recoil[i].lightZ;
} }
@ -239,28 +239,29 @@ inline bool ReactionConfig::LoadReactionConfig(TMacro * macro){
inline void ReactionConfig::Print(int ID, bool withEx) const{ inline void ReactionConfig::Print(int ID, bool withEx) const{
printf("=====================================================\n"); printf("#####################################################\n");
printf("number of Simulation Events : %d \n", numEvents); printf("number of Simulation Events : %d \n", numEvents);
printf(" is Redo until hit array : %s \n", isRedo ? "Yes" : "No"); printf(" is Redo until hit array : %s \n", isRedo ? "Yes" : "No");
printf("------------------------------ Beam\n"); printf("================================= Beam\n");
printf(" beam : A = %3d, Z = %2d, Ex = %.2f MeV\n", beamA, beamZ, beamEx); printf(" beam : A = %3d, Z = %2d, Ex = %.2f MeV\n", beamA, beamZ, beamEx);
printf(" beam Energy : %.2f +- %.2f MeV/u, dE/E = %5.2f %%\n", beamEnergy, beamEnergySigma, beamEnergySigma/beamEnergy); printf(" beam Energy : %.2f +- %.2f MeV/u, dE/E = %5.2f %%\n", beamEnergy, beamEnergySigma, beamEnergySigma/beamEnergy);
printf(" Angle : %.2f +- %.2f mrad\n", beamTheta, beamThetaSigma); printf(" Angle : %.2f +- %.2f mrad\n", beamTheta, beamThetaSigma);
printf(" offset : (x,y) = (%.2f, %.2f) mmm \n", beamX, beamY); printf(" offset : (x,y) = (%.2f, %.2f) mmm \n", beamX, beamY);
printf("------------------------------ Target\n"); printf("================================= Target\n");
printf(" target : A = %3d, Z = %2d \n", targetA, targetZ); printf(" target : A = %3d, Z = %2d \n", targetA, targetZ);
printf(" is target scattering : %s \n", isTargetScattering ? "Yes" : "No"); printf(" enable scattering : %s \n", isTargetScattering ? "Yes" : "No");
if(isTargetScattering){ if(isTargetScattering){
printf(" target density : %.f g/cm3\n", targetDensity); printf(" target density : %.f g/cm3\n", targetDensity);
printf(" thickness : %.f cm\n", targetThickness); printf(" thickness : %.f cm\n", targetThickness);
printf(" beam stopping file : %s \n", beamStoppingPowerFile.c_str()); printf(" beam stopping file : %s \n", beamStoppingPowerFile.c_str());
} }
for( int i = 0; i < 2; i ++ ){ printf("================================= Number of recoil reactions : %zu\n", recoil.size());
printf("------------------------------ Recoil-%d\n", i); for( size_t i = 0; i < recoil.size(); i ++ ){
printf("------------------------------------------ Recoil-%zu\n", i);
if( ID == i || ID < 0 ){ if( ID == i || ID < 0 ){
recoil[i].Print(); recoil[i].Print();
if( withEx ) exList[i].Print(); if( withEx ) exList[i].Print();
@ -268,7 +269,7 @@ inline void ReactionConfig::Print(int ID, bool withEx) const{
} }
printf("=====================================================\n"); printf("#####################################################\n");
} }
#endif #endif

View File

@ -22,6 +22,9 @@ false //isTargetScattering
1000000 //number_of_Event_being_generated 1000000 //number_of_Event_being_generated
false //Redo_until_hit_array=all_events_hit_array false //Redo_until_hit_array=all_events_hit_array
#---- Number of Reaction Should equal to number of array in detectorGeo.txt
#---- If not, somethings funny would happens.
#=================reaction_for_1st_Array #=================reaction_for_1st_Array
1 //recoil_light_A 1 //recoil_light_A
1 //recoil-light_Z 1 //recoil-light_Z
@ -50,5 +53,4 @@ false //isDacay
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
################## end of file ################## end of file