Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion installations/sbn-fd/ICARUS_OnlineMonitor.fcl
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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]
Expand Down
2 changes: 1 addition & 1 deletion installations/sbn-fd/ICARUS_OnlineMonitor_PMTOnly.fcl
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
5 changes: 4 additions & 1 deletion installations/sbn-fd/ICARUS_OnlineMonitor_TPCEast.fcl
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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]
Expand Down
5 changes: 4 additions & 1 deletion installations/sbn-fd/ICARUS_OnlineMonitor_TPCOnly.fcl
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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]
Expand Down
5 changes: 4 additions & 1 deletion installations/sbn-fd/ICARUS_OnlineMonitor_TPCWest.fcl
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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]
Expand Down
57 changes: 57 additions & 0 deletions installations/sbn-fd/startOMProdSpack.sh
Original file line number Diff line number Diff line change
@@ -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"
20 changes: 14 additions & 6 deletions sbndqm/dqmAnalysis/TPC/Analysis.cc
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,9 @@ Analysis::AnalysisConfig::AnalysisConfig(const fhicl::ParameterSet &param) {
// whether to use plane data in peakfinding
use_planes = param.get<bool>("use_planes", false);

//set true if input waveform is subtracted
is_baseline_subtracted = param.get<bool>("is_baseline_subtracted", false);

// method to calculate baseline:
// 0 == assume baseline is 0
// 1 == assume baseline is in digits.GetPedestal()
Expand Down Expand Up @@ -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();
}
Expand All @@ -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;
}
Expand All @@ -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);
Expand All @@ -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());
}
Expand All @@ -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
Expand Down
1 change: 1 addition & 0 deletions sbndqm/dqmAnalysis/TPC/Analysis.hh
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ public:
bool fill_waveforms;
bool reduce_data;
bool timing;
bool is_baseline_subtracted;

AnalysisConfig(const fhicl::ParameterSet &param);
AnalysisConfig() {}
Expand Down