# WaveAna **Repository Path**: schg_ucas/wave-ana ## Basic Information - **Project Name**: WaveAna - **Description**: Wave form analysis code - **Primary Language**: C++ - **License**: MulanPSL-2.0 - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2022-10-01 - **Last Updated**: 2025-12-24 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # Compile and install mkdir build cd build cmake ../ make sudo make install Then you can use WaveAna in any directory # Parameters WaveAna use a Json control file as an input including input file directory and other parameters, see ./example/ Meanings of parameters: 1. ID: Channel ID Number, if ch0 date is to be read, then this is 0. The waveform data file should be acquired by newest Read751 2. N_Sigma: The signal trigger threshold, if the value of one point exceeds baseline + sigma_of_baseline * N_Sigma, then one peak is considered found 3. TOri: Starting time of the waveform 4. TStep: Time interval of the ADC sampling points. An ADC with sampling rate of 1GHz has a TStep of 1ns. 5. IsBLFlux: If the baseline is fluctuating, another baseline handling algorithm is applied. 6. Polarity: Expected signal polarity. For PMT Anode signal, it is negtive: -1. For PMT Dynode signal, it is positive: 1. 7. size: the length of this waveform 8. blstart: starting point of baseline range 9. blend: ending point of baseline range 10. default_BL: default baseline value 11. default_STD: default std of baseline 12. psd_start: starting point of psd region. It is suggested to be set to 0 when no outher special requirements are considered. 13. psd_end: end point of psd region. It is suggested to be set to THE SIZE OF THE WAVEFORM when no outher special requirements are considered. Difference with psd_length: [psd_start, psd_end] is the region where PSD algorithm is applied, ignoring other peaks outside this region. While psd_length is used to do the PSD algorithm to achieve the best PSD effect. [psd_start, psd_end] is related to the arrival time of the signal but the psd_length is related to the decay time of the LS. 14. psd_length: waveform length put into psd analysis, the psd ana region start from the max peak in the region. ATTENTION: For Dynode signal, this psd_length is recomended to be set to 114 15. PSD_Para: a list like parameter allows you to choose the PSD Parameter. PDS_Para must be smaller than 1 and larger than 0. If it is 0.25, it means in PSD process we regard the point that reaching 25% of the maximum amplitude int the falling edge as the start point of tail. This can be used to scan the best PSD parameter. Once it is decided, it is recomended to use only one so that the software can be speeded up. 16. PeakPSDAmpCut: Do PSD for peaks with amplitude larger than this value 17. PSD_Short: short integral window length of fixed time window PSD 18. PSD_Long: long integral window length of fixed time window PSD 19. DISelDef_Start : start point of self defined direct integral 20. DISelDef_End : end point of self defined direct integral # Usage In any directory, you can this in commond line: WaveAna ${your control Json file directory} For example: WaveAna /mnt/g/CSNS_data/WaveAna/example/WaveAnaConfig.json Then WaveAna will read the parameters in corresponding config file and do data analysis. The output file will be generated with name "WaveAna.root" in the same directory of the config file # Output File Structure 1. "ID": Event ID 2. "AbsTime": Absolute time of the event 3. "DTTimeTag" : Trigger Time tag of DT clocl 4. "STD": Standard deviation of baseline 5. "PeakIntegral": Integral of peaks of this event 6. "DirectIntegral_All" : DirectIntegral except the BL region 7. "DirectIntegral_BL" : DirectIntegral of the BL region 8. "DirectIntegral_SelDef: DirectIntegral of Self Defined Region 9. "T_0_50": Time inverval of signal integral from 0% - 50% 10. "T_10_90": Time inverval of signal integral from 10%-90% 11. "T_10": Time reaching 10% of total integral 12. "T_90": Time reaching 90% of total integral 13. "T_0": Time start of first peak 14. "T_0_Max": Time start of the peak with maximum amplitude 15. "T_50": Time reaching 50% of total integral 16. "PSD": PSD Factor 17. "PNRatio": Maximum positive and negative amplitude ratio 18. "N_Peaks": Number of peaks 19. "MaxPeakWidth": Widest peak width 20. "MaxAmplitude": Max amplitude 21. "PeakQ": Peak integral of all peaks 22. "Amplitude": Peak amplitude of all peaks 23. "PeakStart": Start time of each peak 23. "PeakPSD": PSD of each peaks with amplitude > PeakPSDAmpCut. The PSD Para used ist he PSDPara[0]. if the peak does not pass the amplitude cut, it will be tagged with -1 in this vector 24. "PSD_FixTWindow" : PSD with fixed time window algorithm. It is definded as 1-Qs/Ql. Qs is the integral from T_0_Max to T_0_Max + PSD_Short, Ql alike. 25. "PSD_AveTIme" : Pulse hight weighted averaged arrival time of the waveform 26. "PeakPSDAveTime" :AveTime of each peak with respect to the peak start # About Json if Json is not installed in your computer please intall it. 1. Fedora: sudo dnf install jsoncpp jsoncpp-devel 2. Ubuntu: sudo apt-get install libjsoncpp-dev or sudo apt-get install nlohmann-json3-dev # If you are using this code, please cite: arxiv: 2402.05026 and this repository address