Warning, /epic-lfhcal-tbana/README.md is written in an unsupported language. File is not indexed.
0001 # epic-lfhcal-tbana software repo
0002
0003 This software repo is meant to serve as basis for the test beam root based analysis of the LFHCal test beams and test beam setups.
0004 The repo contains the initial code used in 2023 under OldStructure & the newer version of the code under NewStructure <br>
0005
0006 For convenience a linker script is provided, which can be used to recreate the software structure with soft links. Execute it in the directory where you would like to work after having added your user name and path to the software repo
0007
0008 ```console
0009 bash $PATHTOSCRIPT/prepareAnalysisDirectory.sh $USERNAME [new/old]
0010 ```
0011
0012
0013 ## OldStructure
0014
0015 This part of the software was initially used for the analysis of the test beam from 2023. The main root macro for the test beam analysis can is
0016
0017 ```c+
0018 OldStructure/makeSimplePlotsFromJanusTree.C
0019 ```
0020
0021 How to start it can be found in ```runJanusExtraction.sh```, which serves as primary steering script for the data analysis. It also contains several examples on how to compare the output of different runs included in: <br>
0022
0023 ```c+
0024 OldStructure/CompareDifferentRuns.C
0025 ```
0026
0027
0028 With this code also the single photon extraction can be done, this is steered by ```runSinglePhotonExtraction.sh``` for which the main root macro is
0029 ```c+
0030 OldStructure/makeSinglePhotonSpectraFitsFromJanusTree.C
0031 ```
0032 The comparisons for the single photon spectra are steered by ```runCompareRunsForSinglePhotons.sh``` which have as main root macro:
0033
0034 ```c+
0035 OldStructure/CompareDifferentRunsForSinglePhotonSpectra.C.C
0036 ```
0037
0038 ## NewStructure
0039 This part of hte software has been developed by Vincent Andrieux (@vandrie) primarily for the 2024 test beam analysis, it is being adapted to be usable also for the 2023 data.
0040
0041 ### Running the analysis through scripts
0042
0043 #### September 2023 data
0044
0045 The data taken in September 2023 at the SPS-H4 beam line, was taken without absorber plates presents. The logbook can be found [here](https://docs.google.com/spreadsheets/d/1GBmztS66Cagwr1mpXuaDmIfSKAuhBm1gmhhpk7qSgbg/edit?usp=sharing), if you don't have access please ask Friederike for it. <br>
0046 The raw data for this campaign was unfortunately partially lost and thus a separate routine had to be introduced reading the data from the initally converted root files. The conversion can be done with:
0047
0048 ```console
0049 bash convertData_Sept2023.sh $USERNAME [singe/all]
0050 ```
0051
0052 As for the ```prepareAnalysisDirectory.sh```, please add your username and the path to the data. The script is under construction and even under all might only have few runs commented in, feel free to uncomment the rest.<br>
0053
0054 The further analysis of this data is still under development and so far only the pedestal extraction is fully working as second step. The corresponding script can be run as follows:
0055
0056 ```console
0057 bash runCalibration_Sept2023.sh $USERNAME pedestal
0058 ```
0059 Same principle applies as for the converter script. As we further develop the code more functionality will become available.
0060
0061 #### October 2023 data
0062 The data taken in October 2023 at the PS-T09 beam line, was taken with only 14 layers, parasitic to the FOCal-E with various number of thin tungsten plates infront of the mini-LFHCal module. The logbook can be found [here](https://docs.google.com/spreadsheets/d/1oRI3KlPyHouo5P4J70wLrGlaFaeNuLCGMCwyNxyNMf4/edit?usp=sharing), if you don't have access please ask Friederike for it. <br>
0063 This data was taken with a previous version of the Janus software, as such the reading works a little differently. So far only the data converter has been tested and adapted
0064
0065 ```console
0066 bash convertData_Oct2023.sh $USERNAME [singe/all]
0067 ```
0068 As for the ```prepareAnalysisDirectory.sh```, please add your username and the path to the data. The script is under construction and even under all might only have few runs commented in, feel free to uncomment the rest.<br>
0069 Attention for a few runs (201,202,203,204,205), the converter will fail as a few channels were accidentally masked breaking the conversion. This data will have to be discarded. As we further develop the code more functionality will become available.
0070
0071 #### 2024 data
0072 The data taken in August/September 2024 at the PS-T09 beam line is the first data available for a full module. The logbook can be found [here](https://docs.google.com/spreadsheets/d/1XaiSmG4jBaBOyjbjdiNuSeehjeZC03_2A7Ccoq0nIbI/edit?usp=sharing), if you don't have access please ask Friederike for it. A summary of the CAEN data taking campaign can be found on our [wiki](https://wiki.bnl.gov/EPIC/index.php?title=LFHCal_Fall_2024_Test_Beam).<br>
0073 The data conversion can be done using the script
0074
0075 ```console
0076 bash convertData_2024.sh $USERNAME [single/all]
0077 ```
0078 As for the ```prepareAnalysisDirectory.sh```, please add your username and the path to the data. This script so far contains all pedestal and muon runs under the flag ```all```. Further runs will be added in the future. <br>
0079 The analysis of the 2024 muon runs is furthest developed. The pedestal extraction can be starting with the following command for all pedestal runs
0080 ```console
0081 bash runCalibration_2024.sh $USERNAME pedestal
0082 ```
0083 As for the ```prepareAnalysisDirectory.sh```, please add your username and the path to the data, as well as the calibration output directory. The further steps in the analysis , like merging of the raw data for different muon runs can be started with the argument ```mergemuons``` instead of ```pedestal```. In the script all combinations of muon runs and pedestal runs are defined with corresponding variables, i.e.
0084 ```console
0085 muonHVScan_44V='305'
0086 pedHVScan_44V='303'
0087 ```
0088 The corresponding analysis of the muon calib extraction can be started with
0089 ```console
0090 bash runCalibration_2024.sh $USERNAME muoncalibHV44 transfer
0091 ```
0092 the last argument only needs to be used in case a new pedestal calibration has been created and needs to be transferred to the corresponding muon run file. Otherwise the following command is sufficient.
0093 ```console
0094 bash runCalibration_2024.sh $USERNAME muoncalibHV44
0095 ```
0096 The muon calibration can be started for all muon runs ```muoncalib``` or for specific parts of the campaign ```muoncalib[HV44|HV43|HV42|HV41|HV40|A|B|C|D|E|F|G|H]```. Please be careful if you start all runs, this will take a while and will produce quite some control plots.
0097
0098 ### Individual calls of the analysis steps
0099 Here an example of running the code from ASCII input to calibrated ROOT output format is provided:
0100
0101 1. Compile the code with
0102 ```console
0103 make Analyse
0104 ```
0105 if you changed something in the base classes majorly first
0106 ```console
0107 make clean
0108 make Analyse
0109 ```
0110
0111 2. As always please run the helper function first to make yourself familar with the options
0112 ```console
0113 ./Analyse -h
0114 ```
0115
0116 3. Convert ASCII to root (step to be done for every single ASCII file):
0117 ```console
0118 ./Analyse -c PATH_INPUT_FILE/RunXXX_list.txt -o PATH_OUTPUT_FILE/WhateverName.root -m ../configs/mappingFile_202409_CAEN.txt -r ../configs/DataTakingDB_202409_CAEN.csv
0119 ```
0120
0121 ```console
0122 ./Analyse -c Run375_list.txt -o RawMuonBeamPlus5.root -m ../configs/mappingFile_202409_CAEN.txt -r ../configs/DataTakingDB_202409_CAEN.csv
0123 ./Analyse -c Run376_list.txt -o RawMuonBeamMinus5.root -m ../configs/mappingFile_202409_CAEN.txt -r ../configs/DataTakingDB_202409_CAEN.csv
0124 ./Analyse -c Run377_list.txt -o RawPedestal.root -m ../configs/mappingFile_202409_CAEN.txt -r ../configs/DataTakingDB_202409_CAEN.csv
0125 ./Analyse -c Run379_list.txt -o RawElectron1GeV.root -m ../configs/mappingFile_202409_CAEN.txt -r ../configs/DataTakingDB_202409_CAEN.csv
0126 ```
0127
0128 4. Extract pedestal value (currently simple gaussian fit):
0129
0130 ```console
0131 ./Analyse (-f) -p -i RawPedestal.root -o PedestalCalib.root
0132 ```
0133
0134
0135
0136 5. Extract MIP calibration:
0137 1. Conveniently hadd the input file to make sure we should see MIP signal on all tiles (included furthest Jura or Saleve)
0138 ```console
0139 hadd RawMuonBeamFullAcceptance.root RawMuonBeamPlus5.root RawMuonBeamMinus5.root
0140 ```
0141
0142
0143 2. Transfer Calibration object from Pedestal file to MIP file
0144 ```console
0145 ./Analyse (-f) -P PedestalCalib.root -i RawMuonBeamFullAcceptance.root -o RawMuonBeamFullAcceptancePedCalib.root
0146 ```
0147
0148
0149 3. Extract MIP signal based on Landau fit (request the Pedestal file to shift the ADC distribution to get rid of most of the noise, the tail is still taken into account from the values stored in the calibration object and due to potential deviation in the tail, a decreasing exponential is also added)
0150
0151 ```console
0152 ./Analyse (-f) -s -i RawMuonBeamFullAcceptancePedCalib.root -o RawMuonBeamFullAcceptancePedAndScaleCalib.root
0153 ```
0154
0155 => Plenty of room for improvement in this step. Could also be more interesting to save only the histograms and deal with the fit outside<br>
0156 => Potentially interesting to add a method to load or overwite calib objets from information read in txt file with cellID and values (like in case of fit failure, which we would may want/need to address on a case by case basis)
0157
0158
0159
0160
0161 6. Apply Calibration to physics data
0162 ```console
0163 ./Analyse (-f) -C RawMuonBeamFullAcceptancePedAndScaleCalib.root -i RawElectron1GeV.root -o CalibratedElectron1GeV.root
0164 ```
0165
0166
0167 Status:
0168 Not all functions that were foreseen are fully implemented and there are several location where improvement can be done.
0169 At least the most dangerous ones which could prevent execution or meaningful output are:
0170 The location of mapping file which is currently taken from hard coded and oblige the user to launch the executable from the location of the source code (although an option exist to redefine it but it is not yet taken into account)
0171 The DB of runs is saved in a txt file and is also hard coded.
0172