Belle II Software development
SVDLatencyCalibrationModule.cc
1/**************************************************************************
2 * basf2 (Belle II Analysis Software Framework) *
3 * Author: The Belle II Collaboration *
4 * *
5 * See git log for contributors and copyright holders. *
6 * This file is licensed under LGPL-3.0, see LICENSE.md. *
7 **************************************************************************/
8
9#include <svd/modules/svdCalibration/SVDLatencyCalibrationModule.h>
10
11
12using namespace Belle2;
13
14//-----------------------------------------------------------------
15// Register the Module
16//-----------------------------------------------------------------
17REG_MODULE(SVDLatencyCalibration);
18
19//-----------------------------------------------------------------
20// Implementation
21//-----------------------------------------------------------------
22
24{
25 // Set module properties
26 setDescription("this module perfoms an analysis to find the APV25 latency");
27
28 // Parameter definitions
29 addParam("ShaperDigitsName", m_shapersListName, "SVDShaperDigits list name", std::string(""));
30 addParam("outputFileName", m_rootFileName, "Name of output root file.", std::string("SVDLatencyCalibration_output.root"));
31
32
33}
34
35
37{
38 m_digits.isRequired(m_shapersListName);
39
40 m_rootFilePtr = new TFile(m_rootFileName.c_str(), "RECREATE");
41
42 // m_histoList = new TList;
43
44}
45
47{
48 TH1F h_maxAmplitude("maxAmpl_L@layerL@ladderS@sensor@view",
49 "bin containing the max of the sampled Amplitude for L@layerL@ladder@sensor@view", 6, -0.5, 5.5);
50 h_maxAmplitude.GetXaxis()->SetTitle("max bin");
51
52 m_histo_maxAmplitude = new SVDHistograms<TH1F>(h_maxAmplitude);
53}
54
56{
57
58 //start loop on SVDShaperDigits
60
61 for (const SVDShaperDigit& shaper : m_digits) {
62
63 samples = shaper.getSamples();
64
65 VxdID sensorID = shaper.getSensorID();
66
67 float amplitude = 0;
68 int maxbin = 0 ;
69 const int nAPVSamples = 6;
70 for (int k = 0; k < nAPVSamples; k ++) {
71 if (samples[k] > amplitude) {
72 amplitude = samples[k];
73 maxbin = k;
74 }
75 }
76
77 m_histo_maxAmplitude->fill(sensorID, shaper.isUStrip() ? 1 : 0, maxbin);
78
79 }
80}
81
83{
84
85 if (m_rootFilePtr != nullptr) {
86 m_rootFilePtr->cd();
87
89 for (auto layer : geoCache.getLayers(VXD::SensorInfoBase::SVD))
90 for (auto ladder : geoCache.getLadders(layer))
91 for (Belle2::VxdID sensor : geoCache.getSensors(ladder))
92 for (int view = SVDHistograms<TH1F>::VIndex ; view < SVDHistograms<TH1F>::UIndex + 1; view++)
93 (m_histo_maxAmplitude->getHistogram(sensor, view))->Write();
94
95 m_rootFilePtr->Close();
96 }
97
98 // m_histo_maxAmplitude->clean();
99
100}
101
Base class for Modules.
Definition: Module.h:72
void setDescription(const std::string &description)
Sets the description of the module.
Definition: Module.cc:214
template class for SVd histograms
Definition: SVDHistograms.h:24
void fill(const VxdID &vxdID, int view, Types ... args)
fill the histogram for
Definition: SVDHistograms.h:77
H * getHistogram(const VxdID &vxdID, int view)
get a reference to the histogram for
Definition: SVDHistograms.h:56
SVDHistograms< TH1F > * m_histo_maxAmplitude
vector of histograms containing the max bin distribution
virtual void initialize() override
initialize
virtual void beginRun() override
begin run
StoreArray< SVDShaperDigit > m_digits
SVD digits.
std::string m_shapersListName
shapers list name
TFile * m_rootFilePtr
pointer at root file used for storing histograms
SVDLatencyCalibrationModule()
Constructor: Sets the description, the properties and the parameters of the module.
The SVD ShaperDigit class.
std::array< APVFloatSampleType, c_nAPVSamples > APVFloatSamples
array of APVFloatSampleType objects
Class to faciliate easy access to sensor information of the VXD like coordinate transformations or pi...
Definition: GeoCache.h:39
static GeoCache & getInstance()
Return a reference to the singleton instance.
Definition: GeoCache.cc:214
Class to uniquely identify a any structure of the PXD and SVD.
Definition: VxdID.h:33
void addParam(const std::string &name, T &paramVariable, const std::string &description, const T &defaultValue)
Adds a new parameter to the module.
Definition: Module.h:560
#define REG_MODULE(moduleName)
Register the given module (without 'Module' suffix) with the framework.
Definition: Module.h:650
Abstract base class for different kinds of events.