Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:15:45

0001 #! /bin/bash
0002 
0003 function MuonCalib()
0004 {
0005         runNrFile='../configs/DataTakingDB_202409_CAEN.csv'
0006         echo "=================================================================================="
0007         echo "option $1"
0008         echo "run Nr Pedestal: $2"
0009         echo "run Nr Muon: $3"
0010         echo "dataRawDir: $4"
0011         echo "dataOutDir: $5"
0012         echo "OutNameRun:" $6
0013         if [ $1 == "transfer" ]; then 
0014                 echo "badchannelMap:" $7
0015         fi
0016         echo "=================================================================================="
0017         if [ $1 == "transfer" ]; then 
0018                 ./Analyse -d 1 -e -f -P $5/PedestalCalib_$2.root -i $4/raw_$3.root -o $4/rawPed_$3.root -r ../configs/DataTakingDB_202409_CAEN.csv -O ../PlotsCalibTransfer_2024/$6 -r $runNrFile
0019         elif [ $1 == "default" ]; then 
0020                 time ./Analyse -f -d 1  -s -i $4/rawPed_$3.root -o $5/rawPedAndMuon_$3.root -O ../PlotsCalibMuon_2024/$6 -r $runNrFile
0021         elif [ $1 == "improved" ]; then 
0022                 time ./Analyse -f -d 1  -S -i $5/rawPedAndMuon_$3.root -o $5/rawPedAndMuonImp_$3.root -O ../PlotsCalibMuonImproved_2024/$6 -r $runNrFile
0023         elif [ $1 == "improved2nd" ]; then 
0024                 ./Analyse -f -d 1  -S -i $5/rawPedAndMuonImp_$3.root -o $5/rawPedAndMuonImp2nd_$3.root -O ../PlotsCalibMuonImproved_2024/$6_2ndIte -r $runNrFile
0025         elif [ $1 == "improved3rd" ]; then 
0026                 ./Analyse -f -d 1  -S -i $5/rawPedAndMuonImp2nd_$3.root -o $5/rawPedAndMuonImp3rd_$3.root -O ../PlotsCalibMuonImproved_2024/$6_3rdIte -r $runNrFile
0027         elif [ $1 == "transferWithBC" ]; then 
0028                 time ./Analyse -d 1 -a -e -f -P $5/PedestalCalib_$2.root -i $4/raw_$3.root -o $4/rawPedWBC_$3.root -B $7 -O ../PlotsCalibTransferBC_2024/$6 -r $runNrFile
0029         elif [ $1 == "defaultWithBC" ]; then 
0030                 time ./Analyse -e -a -f -d 1  -s -i $4/rawPedWBC_$3.root -o $5/rawPedAndMuonWBC_$3.root -O ../PlotsCalibMuonBC_2024/$6 -r $runNrFile
0031         elif [ $1 == "improvedWBC" ]; then 
0032                 time ./Analyse -f -d 1 -a -S -i $5/rawPedAndMuonWBC_$3.root -o $5/rawPedAndMuonWBCImp_$3.root -O ../PlotsCalibMuonImprovedBC_2024/$6 -r $runNrFile
0033         elif [ $1 == "improvedWBC2nd" ]; then 
0034                 time ./Analyse -f -d 1 -a -S -i $5/rawPedAndMuonWBCImp_$3.root -o $5/rawPedAndMuonWBCImp2nd_$3.root -O ../PlotsCalibMuonImprovedBC_2024/$6_2ndIte -r $runNrFile
0035         elif [ $1 == "improvedWBC3rd" ]; then 
0036                 time ./Analyse -f -d 1 -a -S -i $5/rawPedAndMuonWBCImp2nd_$3.root -o $5/rawPedAndMuonWBCImp3rd_$3.root -O ../PlotsCalibMuonImprovedBC_2024/$6_3rdIte -r $runNrFile
0037         elif [ $1 == "improvedWBC4th" ]; then 
0038                 time ./Analyse -f -d 1 -a -S -i $5/rawPedAndMuonWBCImp3rd_$3.root -o $5/rawPedAndMuonWBCImp4th_$3.root -O ../PlotsCalibMuonImprovedBC_2024/$6_4thIte -r $runNrFile
0039         elif [ $1 == "improvedWBC5th" ]; then 
0040                 time ./Analyse -f -d 1 -a -S -i $5/rawPedAndMuonWBCImp4th_$3.root -o $5/rawPedAndMuonWBCImp5th_$3.root -O ../PlotsCalibMuonImprovedBC_2024/$6_5thIte -r $runNrFile
0041         elif [ $1 == "noise" ]; then 
0042                 ./Analyse -f -d 1  -n -i $5/rawPedAndMuon_$3.root -o $5/rawPedAndMuonNoise_$2.root -O ../PlotsCalibNoiseRe_2024/$6 -r $runNrFile
0043         elif [ $1 == "transferAlt" ]; then 
0044                 ./Analyse -d 1  -f -P $5/rawPedAndMuonNoise_$3.root -i $4/raw_$3.root -o $4/rawPedImp_$3.root -r $runNrFile
0045         elif [ $1 == "defaultImpPed" ]; then 
0046                 ./Analyse -f -d 1  -s -i $4/rawPedImp_$3.root -o $5/rawPedImpAndMuon_$3.root -O ../PlotsCalibMuonPedImp_2024/$6 -r $runNrFile
0047         elif [ $1 == "saveNewPed" ]; then 
0048                 ./Analyse -f -d 1 -N -i $5/rawPedAndMuonNoise_$3.root -o $4/raw_pedonly_$3.root 
0049         elif [ $1 == "saveNewMuon" ]; then 
0050                 time ./Analyse -f -d 1 -M -i $5/rawPedAndMuon_$3.root -o $4/raw_muononly_$3.root 
0051         elif [ $1 == "improvedMinimal" ]; then 
0052                 time ./Analyse -f -d 1  -S -i $4/raw_muononly_$3.root -o $5/rawPedAndMuonImpMinimal_$2.root -O ../PlotsCalibMuonImproved_2024/$6_MinimalSet -r $runNrFile
0053         elif [ $1 == "improvedMinimal2nd" ]; then 
0054                 time ./Analyse -f -d 1  -S -i $5/rawPedAndMuonImpMinimal_$3.root -o $5/rawPedAndMuonImpMinimal2nd_$3.root -O ../PlotsCalibMuonImproved_2024/$6_MinimalSet2nd -r $runNrFile
0055         elif [ $1 == "improvedMinimal3rd" ]; then 
0056                 time ./Analyse -f -d 1  -S -i $5/rawPedAndMuonImpMinimal2nd_$3.root -o $5/rawPedAndMuonImpMinimal3rd_$3.root -O ../PlotsCalibMuonImproved_2024/$6_MinimalSet3rd -r $runNrFile
0057         fi
0058 }
0059 
0060 
0061 dataDirRaw=""
0062 dataDirOut=""
0063 if [ $1 = "fbock" ]; then 
0064         dataDirRaw=/media/fbock/Samsung_T5/LFHCAL_TB/202408_PST09/CAENdata/MuonRuns
0065         dataDirRawE=/media/fbock/Samsung_T5/LFHCAL_TB/202408_PST09/CAENdata/ElectronRuns
0066         dataDirRawH=/media/fbock/Samsung_T5/LFHCAL_TB/202408_PST09/CAENdata/HadronRuns
0067         dataDirOut=/home/fbock/EIC/Analysis/LFHCalTB2024/CAENdata/MuonRuns
0068         dataDirOutE=/home/fbock/EIC/Analysis/LFHCalTB2024/CAENdata/ElectronRuns
0069         dataDirOutH=/home/fbock/EIC/Analysis/LFHCalTB2024/CAENdata/HadronRuns
0070 else
0071         echo "Please select a known user name, otherwise I don't know where the data is"
0072         exit
0073 fi
0074 
0075 # pedestal runs 
0076 # pedestalRuns='303 306 308 311 315 271 277 420 454 528 552 553 332 369 377 404 465 476 492 505 521'
0077 # pedestalRuns='420'
0078 # pedestalRuns='417 412'
0079 pedestalRuns='492 505'
0080 if [ $2 = "pedestal" ]; then
0081         for runNr in $pedestalRuns; do
0082                 ./Analyse -d 1 -p -i $dataDirRaw/raw_$runNr.root -f -o $dataDirOut/PedestalCalib_$runNr.root -O ../PlotsCalib_2024/Run$runNr -r ../configs/DataTakingDB_202409_CAEN.csv
0083         done;
0084 fi
0085 
0086 if [ $2 == "mergemuons" ]; then
0087 #       hadd -f $dataDirRaw/raw_muonScanA1_45V.root $dataDirRaw/raw_244.root $dataDirRaw/raw_250.root
0088 #       hadd -f $dataDirRaw/raw_muonScanA2_45V.root $dataDirRaw/raw_283.root $dataDirRaw/raw_282.root
0089         hadd -f $dataDirRaw/raw_muonScanD1_45V.root $dataDirRaw/raw_412.root $dataDirRaw/raw_417.root
0090 #       hadd -f $dataDirRaw/raw_muonScanD2_45V.root $dataDirRaw/raw_460.root $dataDirRaw/raw_456.root $dataDirRaw/raw_457.root
0091 #       hadd -f $dataDirRaw/raw_muonScanH1_45V.root $dataDirRaw/raw_526.root $dataDirRaw/raw_527.root
0092 #       hadd -f $dataDirRaw/raw_muonScanH2_45V.root $dataDirRaw/raw_554.root $dataDirRaw/raw_559.root
0093 #       hadd -f $dataDirRaw/raw_muonScanB1_42V.root $dataDirRaw/raw_331.root $dataDirRaw/raw_322.root
0094 #       hadd -f $dataDirRaw/raw_muonScanB2_42V.root $dataDirRaw/raw_370.root $dataDirRaw/raw_371.root $dataDirRaw/raw_374.root
0095 #       hadd -f $dataDirRaw/raw_muonScanC1_43_5V.root $dataDirRaw/raw_376.root $dataDirRaw/raw_375.root
0096 #       hadd -f $dataDirRaw/raw_muonScanC2_43_5V.root $dataDirRaw/raw_405.root $dataDirRaw/raw_410.root $dataDirRaw/raw_408.root
0097 #       hadd -f $dataDirRaw/raw_muonScanE1_40V.root $dataDirRaw/raw_464.root $dataDirRaw/raw_463.root
0098 #       hadd -f $dataDirRaw/raw_muonScanE2_40V.root $dataDirRaw/raw_481.root $dataDirRaw/raw_478.root
0099 #       hadd -f $dataDirRaw/raw_muonScanF1_41V.root $dataDirRaw/raw_486.root $dataDirRaw/raw_489.root
0100 #       hadd -f $dataDirRaw/raw_muonScanF2_41V.root $dataDirRaw/raw_507.root $dataDirRaw/raw_506.root
0101 #       hadd -f $dataDirRaw/raw_muonScanG_46V.root $dataDirRaw/raw_508.root $dataDirRaw/raw_510.root $dataDirRaw/raw_511.root $dataDirRaw/raw_525.root
0102 fi
0103 
0104 
0105 badChannelMap='../configs/badChannelMap_TBSetup_CAEN_202408.txt'
0106 # # muon runs different scans in groups with separate pedestal
0107 #50.3 events
0108 muonHVScan_44V='305'
0109 pedHVScan_44V='303'
0110 if [ $2 == "muoncalibHV" ] || [ $2 == "muoncalibHV44" ]; then
0111         echo "running muon calib for 44V runs"
0112         MuonCalib $3 $pedHVScan_44V $muonHVScan_44V $dataDirRaw $dataDirOut muonHVScan_44V $badChannelMap
0113 fi
0114 
0115 #50.1K events
0116 muonHVScan_43V='307'
0117 pedHVScan_43V='306'
0118 if [ $2 == "muoncalibHV" ] || [ $2 == "muoncalibHV43" ]; then
0119         echo "running muon calib for 43V runs"
0120         MuonCalib $3 $pedHVScan_43V $muonHVScan_43V $dataDirRaw $dataDirOut muonHVScan_43V $badChannelMap
0121 fi
0122 
0123 #50.6K events
0124 muonHVScan_42V='309'
0125 pedHVScan_42V='308'
0126 if [ $2 == "muoncalibHV" ] || [ $2 == "muoncalibHV42" ]; then
0127         echo "running muon calib for 42V runs"
0128         MuonCalib $3 $pedHVScan_42V $muonHVScan_42V $dataDirRaw $dataDirOut muonHVScan_42V $badChannelMap
0129 fi
0130 
0131 #51K events
0132 muonHVScan_41V='312'
0133 pedHVScan_41V='311'
0134 if [ $2 == "muoncalibHV" ] || [ $2 == "muoncalibHV41" ]; then
0135         echo "running muon calib for 41V runs"
0136         MuonCalib $3 $pedHVScan_41V $muonHVScan_41V $dataDirRaw $dataDirOut muonHVScan_41V $badChannelMap
0137 fi
0138 
0139 #50.8K events
0140 muonHVScan_40V='316'
0141 pedHVScan_40V='315'
0142 if [ $2 == "muoncalibHV" ] || [ $2 == "muoncalibHV40" ]; then
0143         echo "running muon calib for 40V runs"
0144         MuonCalib $3 $pedHVScan_40V $muonHVScan_40V $dataDirRaw $dataDirOut muonHVScan_40V $badChannelMap
0145 fi
0146 
0147 muonScanA_45V='244 250 282 283'
0148 pedScanA_45V='271 277'
0149 if [ $2 == "muoncalibAll" ] || [ $2 == "muoncalibA1" ]; then
0150         # 192K events
0151         echo "running muon calib for 45V runs, campaing A1"
0152         MuonCalib $3 271 muonScanA1_45V $dataDirRaw $dataDirOut muonScanA1_45V $badChannelMap
0153 fi
0154 if [ $2 == "muoncalibAll" ] || [ $2 == "muoncalibA2" ]; then    
0155         # 201.6K events
0156         echo "running muon calib for 45V runs, campaing A2"
0157         MuonCalib $3 277 muonScanA2_45V $dataDirRaw $dataDirOut muonScanA2_45V $badChannelMap
0158 fi
0159 
0160 #102.2K events
0161 muonScanD1_45V='412 417'                # these runs are messed up don't analyze
0162 pedScanD1_45V='420'
0163 # if [ $2 == "muoncalibAll" ] || [ $2 == "muoncalibD1" ]; then
0164 #       echo "running muon calib for 45V runs, campaing D1"
0165 # #     MuonCalib $3 $pedScanD1_45V muonScanD1_45V $dataDirRaw $dataDirOut muonScanD1_45V  $badChannelMap
0166 # #     MuonCalib $3 $pedScanD1_45V 412 $dataDirRaw $dataDirOut 412
0167 # #     MuonCalib $3 $pedScanD1_45V 417 $dataDirRaw $dataDirOut 417
0168 # fi
0169 
0170 # 29.3K events
0171 muonScanD2_45V='460 456 457'
0172 pedScanD2_45V='454'
0173 if [ $2 == "muoncalibAll" ] || [ $2 == "muoncalibD2" ]; then
0174         echo "running muon calib for 45V runs, campaing D2"
0175         MuonCalib $3 $pedScanD2_45V muonScanD2_45V $dataDirRaw $dataDirOut muonScanD2_45V $badChannelMap
0176 fi
0177 
0178 # 50.6K events 2nd column underrespresented
0179 muonScanH1_45V='526 527'
0180 pedScanH1_45V='528'
0181 if [ $2 == "muoncalibAll" ] || [ $2 == "muoncalibH1" ]; then
0182         echo "running muon calib for 45V runs, campaing H1"
0183         MuonCalib $3 $pedScanH1_45V muonScanH1_45V $dataDirRaw $dataDirOut muonScanH1_45V $badChannelMap
0184 fi
0185 
0186 #33.5K events 1st-2nd column only
0187 muonScanH2_45V='554 559'
0188 # pedScanH2_45V='552 553'
0189 pedScanH2_45V='552'
0190 if [ $2 == "muoncalibAll" ] || [ $2 == "muoncalibH2" ]; then
0191         echo "running muon calib for 45V runs, campaing H2"
0192         MuonCalib $3 $pedScanH2_45V muonScanH2_45V $dataDirRaw $dataDirOut muonScanH2_45V $badChannelMap
0193 fi
0194 
0195 # 202.6K events
0196 muonScanB1_42V='331 322'
0197 pedScanB1_42V='332'
0198 if [ $2 == "muoncalibAll" ] || [ $2 == "muoncalibB1" ]; then
0199         echo "running muon calib for 42V runs, campaing B1"
0200         MuonCalib $3 $pedScanB1_42V muonScanB1_42V $dataDirRaw $dataDirOut muonScanB1_42V $badChannelMap
0201 fi
0202 
0203 # 214.8k events
0204 muonScanB2_42V='370 371 374'
0205 pedScanB2_42V='369'
0206 if [ $2 == "muoncalibAll" ] || [ $2 == "muoncalibB2" ]; then
0207         echo "running muon calib for 42V runs, campaing B2"
0208         MuonCalib $3 $pedScanB2_42V muonScanB2_42V $dataDirRaw $dataDirOut muonScanB2_42V $badChannelMap
0209 fi
0210 
0211 # 240.2K events
0212 muonScanC1_43_5V='376 375'
0213 pedScanC1_43_5V='377'
0214 if [ $2 == "muoncalibAll" ] || [ $2 == "muoncalibC1" ]; then
0215         echo "running muon calib for 43.5V runs, campaing C1"
0216         MuonCalib $3 $pedScanC1_43_5V muonScanC1_43_5V $dataDirRaw $dataDirOut muonScanC1_43_5V $badChannelMap
0217 fi
0218 muonScanC2_43_5V='405 410 408'
0219 pedScanC2_43_5V='404'
0220 if [ $2 == "muoncalibAll" ] || [ $2 == "muoncalibC2" ]; then
0221         echo "running muon calib for 43.5V runs, campaing C2"
0222         MuonCalib $3 $pedScanC2_43_5V muonScanC2_43_5V $dataDirRaw $dataDirOut muonScanC2_43_5V $badChannelMap
0223 fi
0224 
0225 # 40.7K events
0226 muonScanE1_40V='463 464'
0227 pedScanE1_40V='465'
0228 if [ $2 == "muoncalibAll" ] || [ $2 == "muoncalibE1" ]; then
0229         echo "running muon calib for 40V runs, campaing E1"
0230         MuonCalib $3 $pedScanE1_40V muonScanE1_40V $dataDirRaw $dataDirOut muonScanE1_40V $badChannelMap
0231 fi
0232 
0233 muonScanE2_40V='481 478'
0234 pedScanE2_40V='476'
0235 if [ $2 == "muoncalibAll" ] || [ $2 == "muoncalibE2" ]; then
0236         MuonCalib $3 $pedScanE2_40V muonScanE2_40V $dataDirRaw $dataDirOut muonScanE2_40V $badChannelMap
0237 fi
0238 
0239 # 22.6K events
0240 muonScanF1_41V='486 489'
0241 pedScanF1_41V='492'
0242 if [ $2 == "muoncalibAll" ] || [ $2 == "muoncalibF1" ]; then
0243         echo "running muon calib for 41V runs, campaing F1"
0244         MuonCalib $3 $pedScanF1_41V muonScanF1_41V $dataDirRaw $dataDirOut muonScanF1_41V $badChannelMap
0245 fi
0246 
0247 # 42.8K events
0248 muonScanF2_41V='507 506'
0249 pedScanF2_41V='505'
0250 if [ $2 == "muoncalibAll" ] || [ $2 == "muoncalibF2" ]; then
0251         echo "running muon calib for 41V runs, campaing F2"
0252         MuonCalib $3 $pedScanF2_41V muonScanF2_41V $dataDirRaw $dataDirOut muonScanF2_41V $badChannelMap
0253 fi
0254 
0255 # 101.7K events
0256 muonScanG_46V='508 510 511 525'
0257 pedScanG_46V='521'
0258 if [ $2 == "muoncalibAll" ] || [ $2 == "muoncalibG" ]; then
0259         echo "running muon calib for 46V runs, campaing G"
0260         MuonCalib $3 $pedScanG_46V muonScanG_46V $dataDirRaw $dataDirOut muonScanG_46V $badChannelMap
0261 fi
0262 
0263 
0264 # apply calibration
0265 runNrFile='../configs/DataTakingDB_202409_CAEN.csv'
0266 muonScanA_45V='244 250 282 283'
0267 pedScanA_45V='271 277'
0268 if [ $2 == "calibrate" ]; then
0269         # 192K events
0270         echo "running calibrate for 45V runs, campaing A1"
0271         runs='261 264 265 269 270 272 274 275 ' 
0272         for runNr in $runs; do 
0273                 time ./Analyse -f -d 1 -a -C $dataDirOut/rawPedAndMuonWBCImp4th_muonScanA1_45V.root -i $dataDirRawH/raw_$runNr.root -o  -O ../PlotsHadronCalibrated_2024/Run_$runNr -r $runNrFile
0274         done;
0275         time ./Analyse -f -d 1 -a -C $dataDirOut/rawPedAndMuonWBCImp4th_muonScanA1_45V.root -i $dataDirRaw/raw_muonScanA1_45V.root -o $dataDirOut/calibratedMuon_muonScanA1_45V.root -O ../PlotsMuonCalibrated_2024/MuonA1 -r $runNrFile
0276         time ./Analyse -f -d 1 -a -C $dataDirOut/rawPedAndMuonWBCImp3rd_muonScanA2_45V.root -i $dataDirRaw/raw_muonScanA2_45V.root -o $dataDirOut/calibratedMuon_muonScanA2_45V.root -O ../PlotsMuonCalibrated_2024/MuonA2 -r $runNrFile
0277         runs='251 252 254 257 258 ' 
0278         for runNr in $runs; do 
0279                 time ./Analyse -f -d 1 -a -C $dataDirOut/rawPedAndMuonWBCImp4th_muonScanA1_45V.root -i $dataDirRawE/raw_$runNr.root -o $dataDirOutE/calibrated_Run_$runNr.root -O ../PlotsElectronCalibrated_2024/Run_$runNr -r $runNrFile
0280         done;
0281 
0282 fi
0283 
0284 if [ $2 == "reducemuons" ]; then
0285         runs='261 264 265 269 270 272 274 275 ' 
0286         for runNr in $runs; do 
0287                 time ./Analyse -f -d 1 -M -i $dataDirOutH/calibrated_Run_$runNr.root -o $dataDirOutH/calibrated_localmuononly_Run_$runNr.root 
0288         done
0289         runs='251 252 254 257 258 ' 
0290         for runNr in $runs; do 
0291                 time ./Analyse -f -d 1 -M -i $dataDirOutE/calibrated_Run_$runNr.root -o $dataDirOutE/calibrated_localmuononly_Run_$runNr.root 
0292         done    
0293         time ./Analyse -f -d 1 -M -i $dataDirOut/calibratedMuon_muonScanA1_45V.root -o $dataDirOut/calibratedMuon_localmuononly_muonScanA1_45V.root 
0294         time ./Analyse -f -d 1 -M -i $dataDirOut/calibratedMuon_muonScanA2_45V.root -o $dataDirOut/calibratedMuon_localmuononly_muonScanA2_45V.root 
0295 fi