improved ClassDetGeo.h

This commit is contained in:
Ryan Tang 2024-04-01 19:37:27 -04:00
parent 4f0b24f342
commit 9e1e0f86e5
2 changed files with 13 additions and 21 deletions

View File

@ -60,7 +60,7 @@ struct Array{
printf(" Blocker Position: %8.2f mm \n", firstPos > 0 ? firstPos - blocker : firstPos + blocker ); printf(" Blocker Position: %8.2f mm \n", firstPos > 0 ? firstPos - blocker : firstPos + blocker );
printf(" First Position: %8.2f mm \n", firstPos); printf(" First Position: %8.2f mm \n", firstPos);
printf(" number of det : %d x %d \n", mDet, nDet); printf(" number of det : %d x %d (side x col) \n", mDet, nDet);
printf(" detector facing : %s\n", detFaceOut ? "Out" : "In"); printf(" detector facing : %s\n", detFaceOut ? "Out" : "In");
printf(" energy resol.: %f MeV\n", eSigma); printf(" energy resol.: %f MeV\n", eSigma);
printf(" pos-Z resol.: %f mm \n", zSigma); printf(" pos-Z resol.: %f mm \n", zSigma);
@ -112,8 +112,6 @@ public:
int BfieldSign ; /// sign of B-field int BfieldSign ; /// sign of B-field
double bore; /// bore , mm double bore; /// bore , mm
short numSet; /// number of array and aux
double zMin, zMax; /// total range span of all arrays double zMin, zMax; /// total range span of all arrays
bool LoadDetectorGeo(TString fileName, bool verbose = true); bool LoadDetectorGeo(TString fileName, bool verbose = true);
@ -174,6 +172,8 @@ inline bool DetGeo::LoadDetectorGeo(TMacro * macro, bool verbose){
if( str[0].find("####") != std::string::npos ) break; if( str[0].find("####") != std::string::npos ) break;
if( str[0].find("#===") != std::string::npos ) { if( str[0].find("#===") != std::string::npos ) {
detFlag ++; detFlag ++;
array.push_back(Array());
aux.push_back(Auxillary());
detLine = 0; detLine = 0;
continue;; continue;;
} }
@ -184,14 +184,6 @@ inline bool DetGeo::LoadDetectorGeo(TMacro * macro, bool verbose){
BfieldSign = Bfield > 0 ? 1: -1; BfieldSign = Bfield > 0 ? 1: -1;
} }
if ( detLine == 1 ) bore = atof(str[0].c_str()); if ( detLine == 1 ) bore = atof(str[0].c_str());
if ( detLine == 2 ) {
numSet = atoi(str[0].c_str());
for( int i = 0; i < numSet; i++){
array.push_back(Array());
aux.push_back(Auxillary());
}
}
} }
if( detFlag > 0){ if( detFlag > 0){
@ -223,7 +215,7 @@ inline bool DetGeo::LoadDetectorGeo(TMacro * macro, bool verbose){
zMin = 99999; zMin = 99999;
zMax = -99999; zMax = -99999;
for( int i = 0; i < 2; i ++ ){ for( int i = 0; i < detFlag; i ++ ){
array[i].DeduceAbsolutePos(); array[i].DeduceAbsolutePos();
if (array[i].enable ) { if (array[i].enable ) {
double zmax = TMath::Max(array[i].zMin, array[i].zMax); double zmax = TMath::Max(array[i].zMin, array[i].zMax);
@ -242,16 +234,18 @@ inline bool DetGeo::LoadDetectorGeo(TMacro * macro, bool verbose){
inline void DetGeo::Print(bool printAll){ inline void DetGeo::Print(bool printAll){
printf("#####################################################\n"); printf("#####################################################\n");
printf(" B-field : %8.2f T, %s\n", Bfield, Bfield > 0 ? "out of plan" : "into plan"); printf(" B-field : %8.2f T, %s\n", Bfield, Bfield > 0 ? "out of plan" : "into plan");
printf(" Bore : %8.2f mm\n", bore); printf(" Bore : %8.2f mm\n", bore);
printf(" No. of det. Set. : %u \n", numSet); printf(" No. of det. Set. : %zu \n", array.size());
for( int i = 0; i < numSet ; i++){
printf("================================= %d-th Detector Info (%s)\n", i, array[i].enable ? "enabled" : "disabled"); printf(" z-Min : %8.2f mm\n", zMin);
printf(" z-Max : %8.2f mm\n", zMax);
for( size_t i = 0; i < array.size() ; i++){
printf("================================= %zu-th Detector Info (%s)\n", i, array[i].enable ? "enabled" : "disabled");
if( printAll || array[i].enable ) { if( printAll || array[i].enable ) {
array[i].Print(); array[i].Print();
aux[i].Print(); aux[i].Print();
} }
} }
printf("#####################################################\n"); printf("#####################################################\n");

View File

@ -1,8 +1,6 @@
-3.00 //Bfield_[T] -3.00 //Bfield_[T]
462.5 //bore_[mm] 462.5 //bore_[mm]
2 //number_of_array+recoil
#===============1st_Array + Recoil #===============1st_Array + Recoil
true ////is_this_array_exist_or_use_for_Simulation true ////is_this_array_exist_or_use_for_Simulation
1000 //recoil_position_+_for_downstream_[mm] 1000 //recoil_position_+_for_downstream_[mm]
@ -30,7 +28,7 @@ Out //detector_facing_Out_or_In
294.0 294.0
#===============2nd_Array + Recoil #===============2nd_Array + Recoil
false //is_this_array_exist_or_use_for_Simulation true //is_this_array_exist_or_use_for_Simulation
1000 //recoil_position_+_for_downstream_[mm] 1000 //recoil_position_+_for_downstream_[mm]
10.0 //inner_radius_of_recoil_detector_[mm] 10.0 //inner_radius_of_recoil_detector_[mm]
40.2 //outter_radius_of_recoil_detector_[mm] 40.2 //outter_radius_of_recoil_detector_[mm]