From 0905fe73dcfbbd777d912f8910ca2dfeee7d2a9b Mon Sep 17 00:00:00 2001 From: "Ryan@WorkStation" Date: Tue, 2 Apr 2024 13:50:21 -0400 Subject: [PATCH] modified ClassReactionConfig.h for many reactions --- Armory/ClassReactionConfig.h | 29 +++++++++++++++-------------- working/reactionConfig.txt | 4 +++- 2 files changed, 18 insertions(+), 15 deletions(-) diff --git a/Armory/ClassReactionConfig.h b/Armory/ClassReactionConfig.h index e33a00d..8856b4f 100644 --- a/Armory/ClassReactionConfig.h +++ b/Armory/ClassReactionConfig.h @@ -70,6 +70,7 @@ struct ExcitedEnergies { } void Print() const { + printf("...................................\n"); printf("Energy[MeV] Rel.Xsec SF sigma\n"); for( size_t i = 0; i < ExList.size(); i++){ ExList[i].Print("\n"); @@ -101,8 +102,8 @@ public: float targetThickness; ///targetThickness_in_cm std::string beamStoppingPowerFile; ///stopping_power_for_beam - Recoil recoil[2]; - ExcitedEnergies exList[2]; + std::vector recoil; + std::vector exList; int numEvents; ///number_of_Event_being_generated bool isRedo; ///isReDo @@ -163,9 +164,6 @@ inline bool ReactionConfig::LoadReactionConfig(TMacro * macro){ if( macro == NULL ) return false; - exList[0].Clear(); - exList[1].Clear(); - int recoilFlag = 0; int recoilLine = 0; @@ -184,6 +182,8 @@ inline bool ReactionConfig::LoadReactionConfig(TMacro * macro){ if( str[0].find("#===") != std::string::npos ) { recoilFlag ++; recoilLine = 0; + recoil.push_back(Recoil()); + exList.push_back(ExcitedEnergies()); 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].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{ - printf("=====================================================\n"); + printf("#####################################################\n"); printf("number of Simulation Events : %d \n", numEvents); 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 Energy : %.2f +- %.2f MeV/u, dE/E = %5.2f %%\n", beamEnergy, beamEnergySigma, beamEnergySigma/beamEnergy); printf(" Angle : %.2f +- %.2f mrad\n", beamTheta, beamThetaSigma); printf(" offset : (x,y) = (%.2f, %.2f) mmm \n", beamX, beamY); - printf("------------------------------ Target\n"); - printf(" target : A = %3d, Z = %2d \n", targetA, targetZ); - printf(" is target scattering : %s \n", isTargetScattering ? "Yes" : "No"); + printf("================================= Target\n"); + printf(" target : A = %3d, Z = %2d \n", targetA, targetZ); + printf(" enable scattering : %s \n", isTargetScattering ? "Yes" : "No"); if(isTargetScattering){ printf(" target density : %.f g/cm3\n", targetDensity); printf(" thickness : %.f cm\n", targetThickness); printf(" beam stopping file : %s \n", beamStoppingPowerFile.c_str()); } - for( int i = 0; i < 2; i ++ ){ - printf("------------------------------ Recoil-%d\n", i); + printf("================================= Number of recoil reactions : %zu\n", recoil.size()); + for( size_t i = 0; i < recoil.size(); i ++ ){ + printf("------------------------------------------ Recoil-%zu\n", i); if( ID == i || ID < 0 ){ recoil[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 \ No newline at end of file diff --git a/working/reactionConfig.txt b/working/reactionConfig.txt index 4b7f261..0bb1ab1 100644 --- a/working/reactionConfig.txt +++ b/working/reactionConfig.txt @@ -22,6 +22,9 @@ false //isTargetScattering 1000000 //number_of_Event_being_generated 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 1 //recoil_light_A 1 //recoil-light_Z @@ -50,5 +53,4 @@ false //isDacay 1.000 1.0 1.0 0.01 2.000 1.0 1.0 0.01 - ################## end of file