diff --git a/macro/geometry/switch_defaults.sh b/macro/geometry/switch_defaults.sh index a4aed5598707b90aaa86f71c84f860d94679572e..fae0ffdf5c0aff457bb0c95c9735ea73f37f83b1 100644 --- a/macro/geometry/switch_defaults.sh +++ b/macro/geometry/switch_defaults.sh @@ -5,17 +5,22 @@ echo "programme starts" -if false; then -if [ -z ${VMWORKDIR} ]; -then -cat << EOT -BUILT AND CONFIGURATION CBMROOT ENIVORNMENT NOT DETECTED\n -HAVE YOU -. build/config.sh -a -SCRIPTS REQUIRES A RUNNING SYSTEM. -EOT -exit -fi +# Detecting the GEOMETRY and PARAMETER GIT DIRECTORIES +if [ -d ${PWD}/../../geometry/.git -a -d ${PWD}/../../parameters/.git ]; then +GEO_SRC_DIR="$PWD/../../geometry" +PAR_SRC_DIR="$PWD/../../parameters" +cd $PWD/../run +RUN_SRC_DIR=$PWD +cd - +else + if [ -z ${VMWORKDIR} -a -d ${VMCWORKDIR}/geometry/.git -a -d ${VMCWORKDIR}/parameters/.git ]; then + PAR_SRC_DIR="${VMCWORKDIR}/parameters" + GEO_SRC_DIR="${VMCWORKDIR}/geometry" + RUN_SRC_DIR="${VMCWORKDIR}/macro/run" + else + echo "Geometry or Parameter Git Source Directory not detected" + exit + fi fi # TAG FOR THE OFFICIAL APR 2019 CBMROOT SW Release @@ -34,9 +39,6 @@ TEST_PARATAG="21bed5c5e746efdb63b696f4053b9e5f65f940a8" GIT_GEOREPO="https://git.cbm.gsi.de/e.clerkin/cbmroot_geometry.git" GIT_PARAREPO="https://git.cbm.gsi.de/e.clerkin/cbmroot_parameter.git" - - - ##########1234567890##########1234567890##########1234567890##########1234567890########## cat << EOT ******************************************************************************************* @@ -57,12 +59,16 @@ EOT read RELEASE case "${RELEASE}" in - APR20) echo "You specified APR20"; GEOMETRY_TAG=${APR20_GEOTAG}; PARAMETER_TAG=${APR20_PARATAG} ;; - APR21) echo "You specified APR21"; GEOMETRY_TAG=${APR21_GEOTAG}; PARAMETER_TAG=${APR21_PARATAG} ;; - TEST) echo "You specified TEST "; GEOMETRY_TAG=${TEST_GEOTAG}; PARAMETER_TAG=${TEST_PARATAG} ;; + APR20) echo "You specified APR20"; GEOMETRY_TAG=${APR20_GEOTAG}; PARAMETER_TAG=${APR20_PARATAG}; TARGET_Z_POS=0 ;; + APR21) echo "You specified APR21"; GEOMETRY_TAG=${APR21_GEOTAG}; PARAMETER_TAG=${APR21_PARATAG}; TARGET_Z_POS=0 ;; + TEST) echo "You specified ORIGIN_SHIFT "; GEOMETRY_TAG=${TEST_GEOTAG}; PARAMETER_TAG=${TEST_PARATAG}; TARGET_Z_POS=-40 ;; *) echo "$ANSWER is an unknown option"; exit 1 ;; esac + + + + cat << EOT Have you read above, and understand that you will need to rerun the script to revert the changes? TYPE Yes for confirmation ???? @@ -74,10 +80,10 @@ if (echo "${CONFIRMATION}" | sed -n '/^Yes$/!{q10}') then echo "Yes typed!" - + sed -i 's/Double_t[[:space:]]targetZpos.*$/Double_t targetZpos = '${TARGET_Z_POS}'/' ${RUN_SRC_DIR}/run_tra_file.C; # Geometry Repostiory - cd ${VMCWORKDIR}/geometry + cd ${GEO_SRC_DIR} git checkout ${GEOMETRY_TAG} if [ $? -ne 0 ]; then git fetch ${GIT_GEOREPO} ${GEOMETRY_TAG} @@ -90,7 +96,7 @@ then cd $OLDPWD # Parameter Repository - cd ${VMCWORKDIR}/parameters + cd ${PAR_SRC_DIR} git checkout ${PARAMETER_TAG} if [ $? -ne 0 ]; then git fetch ${GIT_PARAREPO} ${PARAMETER_TAG} @@ -108,17 +114,16 @@ else echo "No changed to geometry and parameter repositoroes made" fi - cat << EOT +The position of the target is at ${TARGET_Z_POS} cm from the origin. You may now run the standard CBMROOT macros, e.g. -root -l run_tra_file.C -root -l run_digi.C -root -l run_reco.C +root -l -q ${RUN_SRC_DIR}/run_tra_file.C +root -l -q ${RUN_SRC_DIR}/run_digi.C +root -l -q ${RUN_SRC_DIR}/run_reco.C and the specified default geometries will be used. To revert these changes, you may re-run this script or rebuild the CBMROOT framework. EOT - echo "Program Ended" diff --git a/macro/run/run_tra_file.C b/macro/run/run_tra_file.C index d88a3618e4ae70a680401552198f726b9bb72876..e188d9710c4658a5239eef8e352cedffbbef5a26 100644 --- a/macro/run/run_tra_file.C +++ b/macro/run/run_tra_file.C @@ -103,12 +103,14 @@ void run_tra_file(const char* input = "", Int_t nEvents = 1, const char* output // For flexibility, the target volume is not part of the predefined // geometry setup. It thus has to be specified in this macro. By default, // a Gold target of 250 micrometer thickness and 2.5 cm diameter is used. + // The target shifts by 4 cm upstream by decision of the technical board + // in Apr 2020 which is 40 cm from center of magnet. const char* targetMedium = "Gold"; Double_t targetThickness = 0.025; // in cm Double_t targetDiameter = 2.5; // in cm + Double_t targetZpos = -40 // ------------------------------------------------------------------------ - // ----- Beam properties ---------------------------------------------- // The beam particles themselves are not subject to the transport, // but the properties of the beam determine where the main collision @@ -149,7 +151,8 @@ void run_tra_file(const char* input = "", Int_t nEvents = 1, const char* output run.SetParFileName(parFile); run.SetGeoFileName(geoFile); run.LoadSetup(setup); - run.SetTarget(targetMedium, targetThickness, targetDiameter); +// run.SetTarget(targetMedium, targetThickness, targetDiameter); + run.SetTarget(targetMedium, targetThickness, targetDiameter, 0, 0, targetZpos); run.SetBeamPosition(beamPosX, beamPosY, beamSigmaX, beamSigmaY); if (rotateEvents) run.SetRandomEventPlane(); run.SetRandomSeed(randomSeed);