diff --git a/installations/sbn-fd/ICARUS_OnlineMonitor.fcl b/installations/sbn-fd/ICARUS_OnlineMonitor.fcl index 90e473c..acc1768 100644 --- a/installations/sbn-fd/ICARUS_OnlineMonitor.fcl +++ b/installations/sbn-fd/ICARUS_OnlineMonitor.fcl @@ -53,6 +53,9 @@ analysis_config: { // Change tick period to be 0.4 for ICARUS tick_period: 0.4 + + // Baseline is already subtracted in daqROI + is_baseline_subtracted: true } END_PROLOG @@ -144,7 +147,7 @@ source: #decoder output outputs.decodedout:{ module_type: RootOutput - fileName: "/data/onmon_files/onmon_output_%r_%s_%tc_%#-decoded.root" + fileName: "/daq/scratch/onmon_files/onmon_output_%r_%s_%tc_%#-decoded.root" dataTier: "raw" compressionLevel: 3 SelectEvents: [pscale_OnMonFiles] diff --git a/installations/sbn-fd/ICARUS_OnlineMonitor_PMTOnly.fcl b/installations/sbn-fd/ICARUS_OnlineMonitor_PMTOnly.fcl index 8bca97b..6aa2ede 100644 --- a/installations/sbn-fd/ICARUS_OnlineMonitor_PMTOnly.fcl +++ b/installations/sbn-fd/ICARUS_OnlineMonitor_PMTOnly.fcl @@ -84,7 +84,7 @@ source: #decoder output outputs.decodedout:{ module_type: RootOutput - fileName: "/data/onmon_files/onmon_output_%r_%s_%tc_%#-decoded.root" + fileName: "/daq/scratch/onmon_files/onmon_output_%r_%s_%tc_%#-decoded.root" dataTier: "raw" compressionLevel: 3 SelectEvents: [pscale_OnMonFiles] diff --git a/installations/sbn-fd/ICARUS_OnlineMonitor_TPCEast.fcl b/installations/sbn-fd/ICARUS_OnlineMonitor_TPCEast.fcl index 5e66745..bf001b2 100644 --- a/installations/sbn-fd/ICARUS_OnlineMonitor_TPCEast.fcl +++ b/installations/sbn-fd/ICARUS_OnlineMonitor_TPCEast.fcl @@ -53,6 +53,9 @@ analysis_config: { // Change tick period to be 0.4 for ICARUS tick_period: 0.4 + + // Baseline is already subtracted in daqROI + is_baseline_subtracted: true } END_PROLOG @@ -144,7 +147,7 @@ source: #decoder output outputs.decodedout:{ module_type: RootOutput - fileName: "/data/onmon_files/onmon_output_%r_%s_%tc_%#-decoded.root" + fileName: "/daq/scratch/onmon_files/onmon_output_%r_%s_%tc_%#-decoded.root" dataTier: "raw" compressionLevel: 3 SelectEvents: [pscale_OnMonFiles] diff --git a/installations/sbn-fd/ICARUS_OnlineMonitor_TPCOnly.fcl b/installations/sbn-fd/ICARUS_OnlineMonitor_TPCOnly.fcl index ac8ff5d..599ab97 100644 --- a/installations/sbn-fd/ICARUS_OnlineMonitor_TPCOnly.fcl +++ b/installations/sbn-fd/ICARUS_OnlineMonitor_TPCOnly.fcl @@ -53,6 +53,9 @@ analysis_config: { // Change tick period to be 0.4 for ICARUS tick_period: 0.4 + + // Baseline is already subtracted in daqROI + is_baseline_subtracted: true } END_PROLOG @@ -144,7 +147,7 @@ source: #decoder output outputs.decodedout:{ module_type: RootOutput - fileName: "/data/onmon_files/onmon_output_%r_%s_%tc_%#-decoded.root" + fileName: "/daq/scratch/onmon_files/onmon_output_%r_%s_%tc_%#-decoded.root" dataTier: "raw" compressionLevel: 3 SelectEvents: [pscale_OnMonFiles] diff --git a/installations/sbn-fd/ICARUS_OnlineMonitor_TPCWest.fcl b/installations/sbn-fd/ICARUS_OnlineMonitor_TPCWest.fcl index 72db8c5..ffcb74f 100644 --- a/installations/sbn-fd/ICARUS_OnlineMonitor_TPCWest.fcl +++ b/installations/sbn-fd/ICARUS_OnlineMonitor_TPCWest.fcl @@ -53,6 +53,9 @@ analysis_config: { // Change tick period to be 0.4 for ICARUS tick_period: 0.4 + + // Baseline is already subtracted in daqROI + is_baseline_subtracted: true } END_PROLOG @@ -144,7 +147,7 @@ source: #decoder output outputs.decodedout:{ module_type: RootOutput - fileName: "/data/onmon_files/onmon_output_%r_%s_%tc_%#-decoded.root" + fileName: "/daq/scratch/onmon_files/onmon_output_%r_%s_%tc_%#-decoded.root" dataTier: "raw" compressionLevel: 3 SelectEvents: [pscale_OnMonFiles] diff --git a/installations/sbn-fd/startOMProdSpack.sh b/installations/sbn-fd/startOMProdSpack.sh new file mode 100755 index 0000000..438b830 --- /dev/null +++ b/installations/sbn-fd/startOMProdSpack.sh @@ -0,0 +1,57 @@ +#!/bin/bash + +# 18 March 2020 -- copied from commited version... +# Change name of terminal, suggested by Antoni +printf '\033]2;Online Monitoring\a' + +#defaults +my_env="sbn-fd" +my_devdir=$1 +my_redishost=icarus-db02.fnal.gov +my_swdir=/daq/software + +my_daqarea=${HOME}/DQM_SPACK_DevAreas + +fcl_file=$my_daqarea/$my_devdir/sbndqm/installations/sbn-fd/$2 +my_dispatcherfcl=" -f $fcl_file " + +printf "Environment:\n" +printf "\tenv=$my_env\n" +printf "\tdevdir=$my_devdir\n" +printf "\tdispatcherfcl=$fcl_file\n" +printf "\tredishost=$my_redishost\n\n" + +echo "Activating Spack environment..." +source /daq/software/spack_packages/spack/v1.0.1.sbnd/setup-env.sh +export SPACK_DISABLE_LOCAL_CONFIG=true +cd $my_daqarea/$my_devdir +spack env activate --prompt --dir . + +echo "$(spack find --format '{name}@{version} {variants.s} {variants.cxxstd} /{hash:7}' sbndqm-suite)" +echo "$(spack find --format '{name}@{version} {variants.cxxstd} /{hash:7}' sbndqm)" +echo "$(spack find --format '{name}@{version} {variants.cxxstd} /{hash:7}' sbndaq-online)" +echo "$(spack find --format '{name}@{version} {variants.cxxstd} /{hash:7}' icaruscode)" + +echo "Loaded Spack enviroment!" + +if [[ ! -d $my_daqarea/$my_devdir/python_virtualenv ]]; then + python3 -m venv $my_daqarea/$my_devdir/python_virtualenv + source $my_daqarea/$my_devdir/python_virtualenv/bin/activate + python3 -m pip install --upgrade pip + python3 -m pip install -r $my_daqarea/$my_devdir/sbndqm/sbndqm/AliveMonitor/requirements.txt + python3 -m pip list -v +else + source $my_daqarea/$my_devdir/python_virtualenv/bin/activate +fi + +export PYTHONPATH="$(spack location -i py-fhicl-py)/lib:$PYTHONPATH" + +FCL_DIR="$(dirname "$fcl_file")" +export FHICL_FILE_PATH="$FCL_DIR:$my_daqarea/$my_devdir:$FHICL_FILE_PATH" + +#cleanup +killall -9 lar +ipcrm -M 0x40471454 + +python $my_daqarea/$my_devdir/sbndqm/sbndqm/AliveMonitor/alive_monitor.py -s "$my_redishost" -k DAQConsumer \ +-c "python $my_daqarea/$my_devdir/sbndqm/sbndqm/DAQConsumer/daq_consumer.py $my_dispatcherfcl -l /daq/log/DAQConsumerOM/ -lo" diff --git a/sbndqm/dqmAnalysis/TPC/Analysis.cc b/sbndqm/dqmAnalysis/TPC/Analysis.cc index fe0ee61..f3c885b 100644 --- a/sbndqm/dqmAnalysis/TPC/Analysis.cc +++ b/sbndqm/dqmAnalysis/TPC/Analysis.cc @@ -90,6 +90,9 @@ Analysis::AnalysisConfig::AnalysisConfig(const fhicl::ParameterSet ¶m) { // whether to use plane data in peakfinding use_planes = param.get("use_planes", false); + //set true if input waveform is subtracted + is_baseline_subtracted = param.get("is_baseline_subtracted", false); + // method to calculate baseline: // 0 == assume baseline is 0 // 1 == assume baseline is in digits.GetPedestal() @@ -329,6 +332,11 @@ void Analysis::ProcessChannel(const raw::RawDigit &digits) { _timing.EndTime(&_timing.baseline_calc); } + float baseline_local = _per_channel_data[channel].baseline; + if (_config.is_baseline_subtracted) { + baseline_local = 0; + } + if (_config.timing) { _timing.StartTime(); } @@ -355,11 +363,11 @@ void Analysis::ProcessChannel(const raw::RawDigit &digits) { threshold = _config.threshold; } else if (_config.threshold_calc == 1) { - auto thresholds = Threshold(adc_vec, _per_channel_data[channel].baseline, _config.threshold_sigma, _config.verbose); + auto thresholds = Threshold(adc_vec, baseline_local, _config.threshold_sigma, _config.verbose); threshold = thresholds.Val(); } else if (_config.threshold_calc == 2) { - NoiseSample temp({{0, (unsigned)digits.NADC()-1}}, _per_channel_data[channel].baseline); + NoiseSample temp({{0, (unsigned)digits.NADC()-1}}, baseline_local); float raw_rms = temp.RMS(adc_vec); threshold = raw_rms * _config.threshold_sigma; } @@ -368,7 +376,7 @@ void Analysis::ProcessChannel(const raw::RawDigit &digits) { float n_sigma = _config.threshold_sigma; if (_config.use_planes && _channel_info.PlaneType(channel) == PeakFinder::collection) n_sigma = n_sigma * 1.5; - threshold = _thresholds[channel].Threshold(adc_vec, _per_channel_data[channel].baseline, n_sigma); + threshold = _thresholds[channel].Threshold(adc_vec, baseline_local, n_sigma); } if (_config.timing) { _timing.EndTime(&_timing.calc_threshold); @@ -384,7 +392,7 @@ void Analysis::ProcessChannel(const raw::RawDigit &digits) { if (_config.find_signal) { PeakFinder::plane_type plane = (_config.use_planes) ? _channel_info.PlaneType(channel) : PeakFinder::unspecified; - PeakFinder peaks(adc_vec, _per_channel_data[channel].baseline, threshold, + PeakFinder peaks(adc_vec, baseline_local, threshold, _config.n_smoothing_samples, _config.n_above_threshold, plane); _per_channel_data[channel].peaks.assign(peaks.Peaks()->begin(), peaks.Peaks()->end()); } @@ -399,11 +407,11 @@ void Analysis::ProcessChannel(const raw::RawDigit &digits) { // get noise samples if (_config.noise_range_sampling == 0) { // use first n_noise_samples - _noise_samples[channel] = NoiseSample( { { 0, _config.n_noise_samples -1 } }, _per_channel_data[channel].baseline); + _noise_samples[channel] = NoiseSample( { { 0, _config.n_noise_samples -1 } }, baseline_local); } else { // or use peak finding - _noise_samples[channel] = NoiseSample(_per_channel_data[channel].peaks, _per_channel_data[channel].baseline, digits.NADC()); + _noise_samples[channel] = NoiseSample(_per_channel_data[channel].peaks, baseline_local, digits.NADC()); } // Refine baseline values by taking the mean over the background range diff --git a/sbndqm/dqmAnalysis/TPC/Analysis.hh b/sbndqm/dqmAnalysis/TPC/Analysis.hh index 6ecd8b5..2716fd1 100644 --- a/sbndqm/dqmAnalysis/TPC/Analysis.hh +++ b/sbndqm/dqmAnalysis/TPC/Analysis.hh @@ -114,6 +114,7 @@ public: bool fill_waveforms; bool reduce_data; bool timing; + bool is_baseline_subtracted; AnalysisConfig(const fhicl::ParameterSet ¶m); AnalysisConfig() {}