Belle II Software  release-06-01-15
ECLDspUtilities Class Reference

This class contains static methods to make them accessible from pyROOT. More...

#include <ECLDspUtilities.h>

Static Public Member Functions

static ECLDspDatareadEclDsp (const char *raw_file, int boardNumber)
 Convert ECLDspData from *.dat file to Root object. More...
 
static void writeEclDsp (const char *raw_file, ECLDspData *obj)
 Convert ECLDspData from Root object to *.dat file. More...
 
static ECLShapeFit shapeFitter (int cid, std::vector< int > adc, int ttrig, bool adjusted_timing=true)
 Emulate shape fitting algorithm from ShaperDSP using algorithm from ecl/utility/src/ECLDspEmulator.cc See ecl/examples/eclShapeFitter.py for usage example. More...
 
static void initPedestalFit ()
 Load DSP coefficients used in the pedestal fit function. More...
 
static ECLPedestalFit pedestalFit (std::vector< int > adc)
 Fit pedestal part of the signal waveform (first 16 samples) This method will fit the first 16 samples of the waveform and return the amplitude of the peak found in that region. More...
 

Private Member Functions

 ECLDspUtilities ()
 Private constructor since class only contains static methods, no need to create an instance.
 

Static Private Attributes

static int pedestal_fit_initialized = 0
 Flag indicating whether arrays fg31,fg32 are filled.
 
static float pedfit_fg31 [768] = {}
 DSP coefficients used to determine amplitude in pedestalFit.
 
static float pedfit_fg32 [768] = {}
 DSP coefficients used to determine time in pedestalFit.
 

Detailed Description

This class contains static methods to make them accessible from pyROOT.

Definition at line 41 of file ECLDspUtilities.h.

Member Function Documentation

◆ initPedestalFit()

void initPedestalFit ( )
static

Load DSP coefficients used in the pedestal fit function.

If it is not done explicitly, pedestalFit will do it internally when it is called the first time.

However, it is preferable to call it explicitly, in a thread-safe context.

Definition at line 320 of file ECLDspUtilities.cc.

321 {
322  std::string path = FileSystem::findFile("ecl/data/ecl_pedestal_peak_fit.root");
323  TFile* file = new TFile(path.c_str(), "read");
324  if (!file->IsOpen()) {
325  B2FATAL("Unable to load coefficients for ECL pedestal fit");
326  }
327  TTree* tree = (TTree*)file->Get("dsp_coefs");
328  int nentries = tree->GetEntries();
329  float fg31_i, fg32_i;
330  tree->SetBranchAddress("fg31", &fg31_i);
331  tree->SetBranchAddress("fg32", &fg32_i);
332  //== Load DSP coefficients used in pedestal fitting
333  for (int i = 0; i < nentries; i++) {
334  tree->GetEntry(i);
335  pedfit_fg31[i] = fg31_i;
336  pedfit_fg32[i] = fg32_i;
337  }
338  file->Close();
339 
341 }
static int pedestal_fit_initialized
Flag indicating whether arrays fg31,fg32 are filled.
static float pedfit_fg32[768]
DSP coefficients used to determine time in pedestalFit.
static float pedfit_fg31[768]
DSP coefficients used to determine amplitude in pedestalFit.
static std::string findFile(const std::string &path, bool silent=false)
Search for given file or directory in local or central release directory, and return absolute path if...
Definition: FileSystem.cc:145

◆ pedestalFit()

ECLPedestalFit pedestalFit ( std::vector< int >  adc)
static

Fit pedestal part of the signal waveform (first 16 samples) This method will fit the first 16 samples of the waveform and return the amplitude of the peak found in that region.

Parameters
[in]adcvector of waveform samples (size >= 16)
Returns
struct with fit results

Definition at line 343 of file ECLDspUtilities.cc.

◆ readEclDsp()

ECLDspData * readEclDsp ( const char *  raw_file,
int  boardNumber 
)
static

Convert ECLDspData from *.dat file to Root object.

Parameters
[in]raw_filePath to dsp??.dat file.
[in]boardNumberNumber of shaperDSP board, from 1 to 52*12
Returns
ECLDspData object

Definition at line 46 of file ECLDspUtilities.cc.

◆ shapeFitter()

ECLShapeFit shapeFitter ( int  cid,
std::vector< int >  adc,
int  ttrig,
bool  adjusted_timing = true 
)
static

Emulate shape fitting algorithm from ShaperDSP using algorithm from ecl/utility/src/ECLDspEmulator.cc See ecl/examples/eclShapeFitter.py for usage example.

Parameters
[in]cidCellID, 1..8736
[in]adc[31]Waveform data from ECLDsp dataobject
[in]ttrigTrigger time from ECLTrig dataobject
[in]adjusted_timingOptional. Use adjusted formula to determine fit time. Implemented in ShaperDSP firmware since exp 14. If true, algorithm will determine time near 0 with higher precision, time of low-energy hits will be one of {-4,0,4} If false, time will be one of {-32, -16, 0}

Definition at line 253 of file ECLDspUtilities.cc.

◆ writeEclDsp()

void writeEclDsp ( const char *  raw_file,
ECLDspData obj 
)
static

Convert ECLDspData from Root object to *.dat file.

Parameters
[in]raw_filePath to dsp??.dat file to be created.
[in]objObject to be written

Definition at line 131 of file ECLDspUtilities.cc.


The documentation for this class was generated from the following files: