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