#!/bin/bash if [ -z "$MacroDir" ]; then if [ -z "$1" ]; then echo 'no macro directory specified' exit 1 else MacroDir=$1 fi fi if [ -z "$UnpackDir" ]; then if [ -z "$2" ]; then echo 'no unpack directory specified' exit 1 else UnpackDir=$2 fi fi if [ -z "$CluDir" ]; then if [ -z "$3" ]; then echo 'no clu directory specified' exit 1 else CluDir=$3 fi fi if [ -z "$CalibInputDir" ]; then if [ -z "$4" ]; then echo 'no calib input directory specified' exit 1 else CalibInputDir=$4 fi fi if [ -z "$SimulationDir" ]; then if [ -z "$5" ]; then echo 'no simulation directory specified' exit 1 else SimulationDir=$5 fi fi if [ -z "$MCFileName" ]; then if [ -z "$6" ]; then echo 'no MC file name specified' exit 1 else MCFileName=$6 fi fi if [ -z "$iNMCFiles" ]; then if [ -z "$7" ]; then echo 'no number of MC files specified' exit 1 else iNMCFiles=$7 fi fi if [ -z "$iDut" -o "${#iDut}" != "3" ]; then if [ -z "$8" -o "${#8}" != "3" ]; then echo 'no valid Dut specified' exit 1 else iDut=$8 fi fi if [ -z "$iMRef" -o "${#iMRef}" != "3" ]; then if [ -z "$9" -o "${#9}" != "3" ]; then echo 'no valid MRef specified' exit 1 else iMRef=$9 fi fi if [ -z "$iBRef" -o "${#iBRef}" != "3" ]; then if [ -z "${10}" -o "${#10}" != "3" ]; then echo 'no valid BRef specified' exit 1 else iBRef=${10} fi fi if [ -z "$iSel2" -o "${#iSel2}" != "3" ]; then if [ -z "${11}" -o "${#11}" != "3" ]; then echo 'no valid Sel2 specified' exit 1 else iSel2=${11} fi fi if [ -z "$iDeadTime" ]; then if [ -z "${12}" ]; then echo 'no dead time specified' exit 1 else iDeadTime=${12} fi fi if [ -z "$bHeavyIonCollisions" ]; then if [ -z "${13}" ]; then echo 'no collision flag specified' exit 1 else bHeavyIonCollisions=${13} fi fi if [ -z "$bIdealClustering" ]; then if [ -z "${14}" ]; then echo 'no clustering flag specified' exit 1 else bIdealClustering=${14} fi fi if [ -z "$bClusteringQA" ]; then if [ -z "${15}" ]; then echo 'no QA flag specified' exit 1 else bClusteringQA=${15} fi fi if [ -z "$bAverageSerialSpills" ]; then if [ -z "${16}" ]; then echo 'no averaging method specified' exit 1 else bAverageSerialSpills=${16} fi fi if [ -z "$dSpillLength" ]; then if [ -z "${17}" ]; then echo 'no spill length specified' exit 1 else dSpillLength=${17} fi fi if [ -z "$dSpillBreakLength" ]; then if [ -z "${18}" ]; then echo 'no spill break length specified' exit 1 else dSpillBreakLength=${18} fi fi if [ -z "$iNSerialSpills" ]; then if [ -z "${19}" ]; then echo 'number of serial spills not specified' exit 1 else iNSerialSpills=${19} fi fi if [ -z "$iNDigiFiles" ]; then if [ -z "${20}" ]; then echo 'number of digi files not specified' exit 1 else iNDigiFiles=${20} fi fi if [ -z "$cGeometry" ]; then if [ -z "${21}" ]; then echo 'no geometry tag specified' exit 1 else cGeometry=${21} fi fi if [ -z "$bSpotResponse" ]; then if [ -z "${22}" ]; then echo 'no response type specified' exit 1 else bSpotResponse=${22} fi fi if [ -z "$bIdealCalibration" ]; then if [ -z "${23}" ]; then echo 'no calibration flag specified' exit 1 else bIdealCalibration=${23} fi fi if [ -z "$cSetupName" ]; then if [ -z "${24}" ]; then echo 'no setup specified' exit 1 else cSetupName=${24} fi fi if [ -z "$bHitBuilding" ]; then if [ -z "${25}" ]; then echo 'no hit building flag specified' exit 1 else bHitBuilding=${25} fi fi if [ -z "$bSimData" ]; then if [ -z "${26}" ]; then echo 'no data type specified' exit 1 else bSimData=${26} fi fi if [ -z "$iCalibrationMode" ]; then if [ -z "${27}" ]; then echo 'no calibration mode specified' exit 1 else iCalibrationMode=${27} fi fi if [ -z "$VMCWORKDIR" ]; then echo 'no ROOT environment available' exit 1 fi if [ ! -d "${MacroDir}" ]; then echo 'macro directory does not exist' exit 1 fi if [ ! -d "${UnpackDir}" -o ! -d "${CluDir}" ]; then echo 'unpack/clu directory does not exist' exit 1 fi if [ ! -d "${CalibInputDir}" ]; then echo 'calib input directory does not exist' exit 1 fi if [ "${bHitBuilding}" == "1" ]; then echo "Finalize clusterizer calibration for run ${UnpackDir}" if [ "${bIdealClustering}" == "0" ]; then echo "Calibration setup is ${iDut}${iMRef}${iBRef}_${iSel2}" fi mkdir ${CluDir}/hst mkdir ${CluDir}/plots fi mkdir ${CluDir}/data if [ "${bClusteringQA}" == "1" ]; then mkdir ${CluDir}/qa rm ${CluDir}/qa/hist.qa.root fi cp -v ${MacroDir}/.rootrc ${CluDir}/ cp -v ${MacroDir}/rootlogon.C ${CluDir}/ cd ${CluDir} if [ "${bIdealCalibration}" == "0" ]; then if [ "${iCalibrationMode}" != "0" ]; then cp -v ${CalibInputDir}/hst/final_calib_cluster_iter.cor_out.root ${CluDir}/hst/calib_cluster.cor_in.root fi fi if [ "${iCalibrationMode}" == "0" ]; then iCalMode=83 else iCalMode=93 fi root -b -q ''${MacroDir}'/ana_digi_qa.C(100000000,'${iCalMode}',1,'${iMRef}',0,'${iDut}','${iMRef}','${iBRef}','${iSel2}','${iDeadTime}',1,\ "'${UnpackDir}'","'${SimulationDir}'",'${iNDigiFiles}',"'${MCFileName}'",'${iNMCFiles}',\ "'${cGeometry}'",'${bHeavyIonCollisions}','${bIdealClustering}','${bClusteringQA}',\ '${bAverageSerialSpills}','${dSpillLength}','${dSpillBreakLength}','${iNSerialSpills}',\ "'${cSetupName}'",'${bHitBuilding}','${bIdealCalibration}','${bSimData}',\ "'${CalibInputDir}'",'${iCalibrationMode}')' if [ "${bHitBuilding}" == "1" ]; then mv -v ${CluDir}/*.pdf ${CluDir}/plots/ fi rm ${CluDir}/all_* if [ "${bClusteringQA}" == "1" ]; then cp -v ${MacroDir}/.rootrc ${CluDir}/qa/ cp -v ${MacroDir}/rootlogon.C ${CluDir}/qa/ cp -v ${VMCWORKDIR}/macro/tof/digitizer/pl_response_tb.C ${CluDir}/ cd ${CluDir}/qa root -b -q ''${VMCWORKDIR}'/macro/tof/digitizer/pl_response_tb.C("hist.qa.root", '${iNDigiFiles}', kTRUE, "'${cGeometry}'", '${bSpotResponse}')' fi