Belle II Software  release-08-01-10
Belle2::SVD Namespace Reference

Namespace to encapsulate code needed for simulation and reconstrucion of the SVD. More...

Classes

class  GeoSVDCreator
 The creator for the SVD geometry of the Belle II detector. More...
 
class  SensorInfo
 Specific implementation of SensorInfo for SVD Sensors which provides additional sensor specific information. More...
 
class  SVDBackgroundModule
 SVD Background module. More...
 
class  SVDBeamBackHitFilterModule
 The SVDBeamBackHitFilter module. More...
 
class  SVDDatabaseTestModule
 Return the calibration results for the noises and the constants measured during the svd local runs (charge, ADC pulse, peaking time, pulse width). More...
 
class  SVDDQMDoseModule
 The SVD dose-monitoring DQM module. More...
 
class  SVDDQMInjectionModule
 The SVD Occupancy after Injection DQM module. More...
 
class  SVDPackerModule
 SVDPackerModule: The SVD Raw Hits Creator. More...
 
class  SVDClusterizerDirectModule
 SVD Direct Clusterizer. More...
 
class  SVDClusterizerModule
 The SVD Clusterizer. More...
 
class  SVDMissingAPVsClusterCreatorModule
 SVDMissingAPVsClusterCreatorModule: The SVD MissingAPVsClusterCreator. More...
 
class  SVDNNClusterizerModule
 SVD NN Clusterizer. More...
 
class  SVDNNShapeReconstructorModule
 The SVD NNShapeReconstructor. More...
 
class  SVDRecoDigitCreatorModule
 The SVD RecoDigit Creator. More...
 
class  SVDShaperDigitSorterModule
 The SVDShaperDigitSorter module. More...
 
class  SVDSimpleClusterizerModule
 SVDSimpleClusterizerModule: The SVD SimpleClusterizer. More...
 
class  SVDDigitizerModule
 The SVD Digitizer module. More...
 
class  SVDUnpackerModule
 SVDUnpackerModule: The SVD Raw Hits Decoder. More...
 
class  NNWaveFitter
 The class uses a neural network to find a probability distribution of arrival times for a sextet of APX25 signal samples. More...
 
class  EmpiricalDistributionFunction
 Empirical distribution function object is basic for mainpulation of probabilities. More...
 
class  NNWaveFitTool
 The class holds arrays of bins and bin centers, and a wave generator object containing information on the waveform function. More...
 
class  NoiseMap
 Base Class to represent strip-dependent noise map. More...
 
struct  StripInRawCluster
 structure containing the relevant informations of each strip of the raw cluster More...
 
class  RawCluster
 Class representing a raw cluster candidate during clustering of the SVD. More...
 
struct  stripInCluster
 structure containing the relevant informations of eachstrip of the cluster More...
 
class  SimpleClusterCandidate
 Class representing a cluster candidate during simple clustering of the SVD. More...
 
class  SVDClusterCharge
 Abstract Class representing the SVD cluster charge. More...
 
class  SVDClusterPosition
 Abstract Class representing the SVD cluster position. More...
 
class  SVDClusterTime
 Abstract Class representing the SVD cluster time. More...
 
class  SVDCoG3Time
 Derived Class representing the SVD cluster time computed with the CoG3 algorithm. More...
 
class  SVDCoG6Time
 Derived Class representing the SVD cluster time computed with the CoG6 algorithm. More...
 
class  SVDCoGOnlyPosition
 Derived Class representing the SVD cluster position computed with the CoGOnly algorithm. More...
 
class  SVDELS3Charge
 Derived Class representing the SVD cluster charge computed with the ELS3 algorithm. More...
 
class  SVDELS3Time
 Derived Class representing the SVD cluster time computed with the ELS3 algorithm. More...
 
class  SVDMaxSampleCharge
 Derived Class representing the SVD cluster charge computed summing the max sample of each strip. More...
 
class  SVDMaxSumAlgorithm
 Class implementing the MaxSum algorithm. More...
 
class  SVDOldDefaultPosition
 Derived Class representing the SVD cluster position computed with the old algorithm (up to release-05). More...
 
class  SVDRecoChargeFactory
 Cluster Charge Factory Class. More...
 
class  SVDReconstructionBase
 Class to check whether the reconstruction algorithms are available or not. More...
 
class  SVDRecoPositionFactory
 Cluster Position Factory Class. More...
 
class  SVDRecoTimeFactory
 Cluster Time Factory Class. More...
 
class  SVDSumSamplesCharge
 Derived Class representing the SVD cluster charge computed summing the samples of each strip. More...
 
class  DefaultWave
 A functor to provide a simple model of APV25 strip response. More...
 
class  WaveFitter
 Waveform fitter class. More...
 
class  WaveGenerator
 Waveform generator This is a functor to calculate APV samples from waveform. More...
 
class  TauEncoder
 Encoder/decoder for neural network tau values. More...
 
class  SVDWaveform
 The SVD waveform class. More...
 

Typedefs

typedef std::map< short int, SVDWaveformStripWaveforms
 Map of all channels' waveforms in one sensor side.
 
typedef std::pair< StripWaveforms, StripWaveformsSensorWaveforms
 Waveforms of u- and v- channels in one sensor.
 
typedef std::map< VxdID, SensorWaveformsWaveforms
 Map of all waveforms in all sensors.
 
typedef std::vector< double > nnFitterBinData
 Vector of values defined for bins, such as bin times or bin probabilities.
 
typedef std::vector< double > nnFitterBins
 Vector of bin edges, nnFitterBinData.size() + 1.
 
typedef VXD::SensitiveDetector< SVDSimHit, SVDTrueHitSensitiveDetector
 The SVD Sensitive Detector class.
 
typedef double apvSampleBaseType
 Vector of input samples in float form.
 
typedef std::array< apvSampleBaseType, nAPVSamplesapvSamples
 vector od apvSample BaseType objects
 
typedef std::function< double(double)> WaveformShape
 WaveformShape type. More...
 

Functions

double w_expo (double t)
 Gamma waveform shape, x.exp(-x) This is only historically useful. More...
 
double w_poly3 (double t)
 Polynomial waveform shape, x. More...
 
double w_betaprime (double t)
 Beta-prime waveform shape, x^alpha/(1+x)^beta. More...
 
double w_adjacentU (double t)
 Adjacent-channel waveform U-side. More...
 
double w_adjacentV (double t)
 Adjacent-channel waveform V-side. More...
 
template<typename T >
void zeroSuppress (T &a, double thr)
 pass zero suppression
 
template<typename T >
bool pass3Samples (const T &a, double thr)
 pass 3-samples
 
double tau_raw2real (double raw_tau)
 Convert Hao's raw tau (integral, in latency units) to correct betaprime scale. More...
 
 TEST (NNTimeFitter, DISABLED_CompareNetworkCoefficient)
 Compare NN fitter parameter dump from Python with internal data representation in C++ to verify that the network coefficients were transferred without a significant loss of accuracy. More...
 
 TEST (NNTimeFitter, DISABLED_CompareFits)
 Read a sample of fits from the Python NN suite and check that the C++ NN fitter produces the same results. More...
 
 TEST (SVDModeByte, Constructor)
 Check that both constructors yield the same result.
 
 TEST (SVDModeByte, getters)
 Check getters and setters.
 
 TEST (SVDRecoDigit, ConstructEmpty)
 Check empty object creation and data getters.
 
 TEST (SVDRecoDigit, ConstructFromContainer)
 Check object creation and data getters using a stl container of probabilities.
 
 TEST (SVDRecoDigit, ToString)
 Check object creation and data getters using a stl container of probabilities.
 
 TEST (SVDRecoTimeBase, ConstructEmpty)
 Check empty object creation and data getters.
 
 TEST (SVDRecoTimeBase, ConstructFromContainer)
 Check object creation and data getters.
 
 TEST (SVDRecoTimeBase, toString)
 Check object printout.
 
 TEST (SVDShaperDigit, ConstructEmpty)
 Check empty object creation and data getters.
 
 TEST (SVDShaperDigit, ConstructFromContainer)
 Check object creation and data getters using a stl container of samples.
 
 TEST (SVDShaperDigit, ConstructFromCArray)
 Check object creation and data getters using a c-array of samples.
 
 TEST (SVDShaperDigit, ConstructDefaultTimeMode)
 Check standard object creation without FADC time and mode information.
 
 TEST (SVDShaperDigit, SampleTrimming)
 test sample trimming
 
 TEST (SVDShaperDigit, TrimmingFunction)
 test sample trimming
 
 TEST (SVDWaveform, Getters)
 Check object creation and simple object getters.
 
 TEST (SVDWaveform, Constructors)
 Check the different constructors.
 
 TEST (SVDWaveform, Assignment)
 Check assignment operators.
 
 TEST (SVDWaveform, Waveform)
 Check the waveform values and relations.
 
 TEST (SVDWaveform, toString)
 Check the waveform string representation.
 
 TEST (TNiel, output)
 Check correct functioning of the class.
 

Variables

geometry::CreatorFactory< GeoSVDCreatorGeoSVDFactory ("SVDCreator")
 Register the creator.
 
const std::size_t nAPVSamples = 6
 Number of APV samples.
 
const double dt_APV = 31.44 * Unit::ns
 APV sampling time.
 
const apvSamples apvTimeBase
 APV time base - times for the 6 signals. More...
 

Detailed Description

Namespace to encapsulate code needed for simulation and reconstrucion of the SVD.

Typedef Documentation

◆ WaveformShape

typedef std::function<double(double)> WaveformShape

WaveformShape type.

This is the type for a naked waveform function, giving a single value for a properly scaled arguemnt. The functions are scaled to 1.0 at mode, location (shift) 0.0, and scale 1.0.

Definition at line 54 of file SVDSimulationTools.h.

Function Documentation

◆ tau_raw2real()

double Belle2::SVD::tau_raw2real ( double  raw_tau)
inline

Convert Hao's raw tau (integral, in latency units) to correct betaprime scale.

Includes scaling and fit adjustmenta

Definition at line 205 of file SVDSimulationTools.h.

205 { return 7.32313 * raw_tau; }

◆ TEST() [1/2]

Belle2::SVD::TEST ( NNTimeFitter  ,
DISABLED_CompareFits   
)

Read a sample of fits from the Python NN suite and check that the C++ NN fitter produces the same results.

This is the result of select_t0_fits.columns: Index([ 'test', 'amplitude', 't0', 'tau', 'sigma', 's1', 's2', 's3', 's4', 's5', 's6', 'normed_tau', 't0_bin', 'abin', 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 'a_fit', 'a_sigma', 'chi2_ndf', 't_fit', 't_sigma', 't_true', 'tau', 'a_true', 't_bin', 'a_bin', 't_diff','a_diff'], dtype='object') Columns labeled by numerals contain probabilities.

Definition at line 53 of file NNFitterTest.cc.

54  {
55  const size_t max_lines = 100; // maximum number of lines to be read
56 
57  // Create an instance of the NN fitter and the fitter tool.
58  NNWaveFitter fitter("SVDTimeNet_6samples");
59  auto fitTool = fitter.getFitTool();
60  size_t nProbs = fitTool.getBinCenters().size();
61 
62  ifstream infile("svd/data/test_sample.csv");
63 
64  // Read the rows one by one and compare results
65  string line;
66  getline(infile, line);
67 
68  for (size_t i_line = 0; i_line < max_lines; i_line++) {
69 
70  getline(infile, line);
71  if (line.size() < 10) break;
72  istringstream sline(line);
73 
74  // Parse header. We want the dimennsion of the probability array.
75  // not needed
76  string cell;
77  getline(sline, cell, ','); // index
78  getline(sline, cell, ','); // test
79 
80  // true values. Read from the file, though not used.
81  getline(sline, cell, ',');
82  [[maybe_unused]] double true_amp = stod(cell);
83  getline(sline, cell, ',');
84  [[maybe_unused]] double true_t0 = stod(cell);
85  getline(sline, cell, ',');
86  [[maybe_unused]] double width = stod(cell);
87  getline(sline, cell, ',');
88  [[maybe_unused]] double noise = stod(cell);
89 
90  // normalized samples
91  apvSamples normedSamples;
92  for (size_t iSample = 0; iSample < nAPVSamples; ++iSample) {
93  getline(sline, cell, ',');
94  normedSamples[iSample] = stod(cell);
95  }
96 
97  // not needed
98  getline(sline, cell, ',');
99  getline(sline, cell, ',');
100  getline(sline, cell, ',');
101 
102  // probabilities
103  nnFitterBinData ProbsPy(nProbs);
104  for (size_t iSample = 0; iSample < nProbs; ++iSample) {
105  getline(sline, cell, ',');
106  ProbsPy[iSample] = stod(cell);
107  }
108 
109  // fit results
110  getline(sline, cell, ',');
111  double fitPy_amp = stod(cell);
112  getline(sline, cell, ',');
113  double fitPy_ampSigma = stod(cell);
114  getline(sline, cell, ',');
115  [[maybe_unused]] double fitPy_chi2 = stod(cell);
116  getline(sline, cell, ',');
117  double fitPy_t0 = stod(cell);
118  getline(sline, cell, ',');
119  double fitPy_t0Sigma = stod(cell);
120 
121  // now do the Cpp fit
122  const shared_ptr<nnFitterBinData> ProbsCpp = fitter.getFit(normedSamples, width);
123  for (size_t iBin = 0; iBin < nProbs; ++iBin)
124  EXPECT_NEAR((*ProbsCpp)[iBin], ProbsPy[iBin], 5.0e-3);
125 
126  double t0_cpp, t0_err_cpp;
127  tie(t0_cpp, t0_err_cpp) = fitTool.getTimeShift(*ProbsCpp);
128  EXPECT_NEAR(t0_cpp, fitPy_t0, 5);
129  EXPECT_NEAR(t0_err_cpp, fitPy_t0Sigma, 2);
130 
131  double amp_cpp, amp_err_cpp, chi2_cpp;
132  tie(amp_cpp, amp_err_cpp, chi2_cpp) = fitTool.getAmplitudeChi2(normedSamples, t0_cpp, width);
133  EXPECT_NEAR(amp_cpp, fitPy_amp, 1.0);
134  EXPECT_NEAR(amp_err_cpp, fitPy_ampSigma, 0.1);
135  // FIXME: This is calculated slightly differently in Python, and it shows.
136  // EXPECT_NEAR(chi2_cpp, fitPy_chi2, 1);
137  }
138  }
std::array< apvSampleBaseType, nAPVSamples > apvSamples
vector od apvSample BaseType objects
const std::size_t nAPVSamples
Number of APV samples.
std::vector< double > nnFitterBinData
Vector of values defined for bins, such as bin times or bin probabilities.
Definition: NNWaveFitTool.h:30

◆ TEST() [2/2]

Belle2::SVD::TEST ( NNTimeFitter  ,
DISABLED_CompareNetworkCoefficient   
)

Compare NN fitter parameter dump from Python with internal data representation in C++ to verify that the network coefficients were transferred without a significant loss of accuracy.

FIXME (Oct 12,2017: This test fails on buildbot, but ran successfully on all machines I tried.

Definition at line 35 of file NNFitterTest.cc.

◆ w_adjacentU()

double Belle2::SVD::w_adjacentU ( double  t)
inline

Adjacent-channel waveform U-side.

The exact parametrisation is to be determined.

Parameters
tProperly scaled time, (t - t0)/tau.
Returns
Waveform value (TBD).

Definition at line 99 of file SVDSimulationTools.h.

◆ w_adjacentV()

double Belle2::SVD::w_adjacentV ( double  t)
inline

Adjacent-channel waveform V-side.

The exact parametrisation is to be determined.

Parameters
tProperly scaled time, (t - t0)/tau.
Returns
Waveform value (TBD).

Definition at line 125 of file SVDSimulationTools.h.

◆ w_betaprime()

double Belle2::SVD::w_betaprime ( double  t)
inline

Beta-prime waveform shape, x^alpha/(1+x)^beta.

This is the function for general use.

Parameters
tProperly scaled time, (t - t0)/tau.
Returns
Waveform value 149.012 * t^2 / (1+t)^10 for t > 0, else 0

Definition at line 86 of file SVDSimulationTools.h.

◆ w_expo()

double Belle2::SVD::w_expo ( double  t)
inline

Gamma waveform shape, x.exp(-x) This is only historically useful.

Use beta-prime instead.

Parameters
tproperly scaled time, (t-t0)/tau
Returns
Waveform value t * exp(1 - t) for t > 0, else 0

Definition at line 61 of file SVDSimulationTools.h.

◆ w_poly3()

double Belle2::SVD::w_poly3 ( double  t)
inline

Polynomial waveform shape, x.

(1-x)^2 This is used in signal calibration in SVD hardware tests. Do not use for signal simulation.

Parameters
tproperly scaled time, (t-t0)/tau
Returns
Waveform value 27/4 * t * (1 - t)^2 for t in <0,1>, else 0

Definition at line 73 of file SVDSimulationTools.h.

Variable Documentation

◆ apvTimeBase

const apvSamples apvTimeBase
Initial value:
=
{{ -dt_APV, 0.0, dt_APV, 2 * dt_APV, 3 * dt_APV, 4 * dt_APV}}
const double dt_APV
APV sampling time.

APV time base - times for the 6 signals.

Definition at line 42 of file SVDSimulationTools.h.