Belle II Software  release-08-01-10
TOPTBCComparatorModule.h
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 #pragma once
10 
11 #include <framework/core/HistoModule.h>
12 #include "TH1F.h"
13 #include "TH2F.h"
14 #include <string>
15 #include <vector>
16 
17 namespace Belle2 {
73  public:
78 
83 
88  void defineHisto() override;
89 
93  void initialize() override;
94 
98  void beginRun() override;
99 
103  void event() override;
104 
111  void endRun() override;
112 
117  void terminate() override;
118 
123  int analyzeCalFile();
124 
129  int makeComparisons();
130 
131 
132 
136  int parseSlotAndScrodIDfromFileName(std::string);
137 
142  int parseInputDirectoryLine(std::string);
143 
148  TH1F* calculateHistoRatio(TH1F*, TH1F*, TH1F*);
149 
154  TH2F* calculateHistoRatio(TH2F*, TH2F*, TH2F*);
155 
156 
157 
158 
159  private:
160  // steering parameters
161  std::string m_inputDirectoryList =
162  "";
164  true;
165  std::string m_outputFile = "";
166  short m_minCalPulses = 200;
167  short m_numSamples = 256;
170  // utilities
171  std::string m_calSetDirectory;
172  TFile* m_calSetFile =
173  nullptr;
174  std::string m_calSetLabel;
175  short m_slotID = -1;
176  short m_boardstackID = -1;
177  short m_scrodID = -1;
178  short m_calSetID = 0;
179  short m_totCalSets = 0;
182  // Delta T plots, slot-by-slot
183  std::vector<TH1F*>
185  std::vector<TH1F*>
187  std::vector<TH2F*>
189  std::vector<TH2F*>
192  // Average timing plots, all the detector at once
193  std::vector<TH1F*>
195  std::vector<TH1F*>
199  // Occupancy plots, slot-by-slot
200  std::vector<TH1F*>
202  std::vector<TH1F*>
204  std::vector<TH2F*>
206  std::vector<TH2F*>
209  // Occupancy plot, all the detector at once
210  std::vector<TH1F*>
214  // Delta T ratio plots, slot-by-slot
215  std::vector<TH1F*>
217  std::vector<TH1F*>
219  std::vector<TH2F*>
221  std::vector<TH2F*>
225  // Delta T ratio plots, whole detector
226  std::vector<TH1F*>
228  std::vector<TH1F*>
230  std::vector<TH1F*>
237  };
238 
240 } //namespace Belle2
HistoModule.h is supposed to be used instead of Module.h for the modules with histogram definitions t...
Definition: HistoModule.h:29
Module for the comparison of different sets of time base correction (TBC) constants and to produce mo...
short m_boardstackID
ID of the slot whose calibrations are being analyzed.
std::vector< TH1F * > m_topAverageDeltaTComparison
Average of the DeltaT (time difference petween the calibraiton pulses) distribution,...
std::string m_inputDirectoryList
List of the directories (one per IOV) in which the files with the calibration constants of the SCODS ...
std::vector< TH1F * > m_slotSigmaDeltaT[16]
Standard deviation of the DeltaT (time difference petween the calibraiton pulses) distribution,...
short m_totCalSets
Total number of calibration sets, as counted int defineHistos.
std::vector< TH1F * > m_slotSampleOccupancy[16]
Average number of calpulses per sample used in the minimization, as function of the channel number.
short m_numSamples
Number of samples that have been calibrated.
std::string m_outputFile
File in which the output histograms are stored.
std::vector< TH1F * > m_topSigmaDeltaTComparison
Standard deviation of the DeltaT (time difference petween the calibraiton pulses) distribution,...
std::vector< TH1F * > m_topSigmaDeltaT
Standard deviation of the DeltaT (time difference petween the calibraiton pulses) distribution,...
std::vector< TH2F * > m_slotAverageDeltaTMap[16]
Map of the average of the DeltaT (time difference petween the calibraiton pulses) distribution.
std::string m_calSetDirectory
Label to be used to indetify the histograms of a the calibration set.
std::vector< TH2F * > m_slotAverageDeltaTMapComparison[16]
Map of the Ratio of the average DeltaT (time difference petween the calibraiton pulses)
bool m_compareToPreviousSet
Determines if the reverence set for the ratio is the first CalSet of the list (if false) or if each C...
std::vector< TH1F * > m_topSampleOccupancy
Average number of calpulses per sample used in the minimization, as function of the channel number on...
short m_calSetID
Internal ID of the calibration set that is being analyzed.
std::vector< TH2F * > m_slotSigmaDeltaTMapComparison[16]
Map of Ratio of the Standard deviation on DeltaT (time difference petween the calibraiton pulses)
TFile * m_calSetFile
File containing the calibration constants of the SCROD being analyzed.
std::vector< TH1F * > m_slotEmptySamples[16]
Number of (semi-)empty samples in each channel.
short m_slotID
ID of the slot whose calibrations are being analyzed.
short m_minCalPulses
Minimum number of calpulses to declare a sample as non-empty.
std::vector< TH1F * > m_slotSigmaDeltaTComparison[16]
Ratio of the Standard deviation of the DeltaT (time difference petween the calibraiton pulses) distri...
std::vector< TH1F * > m_topSampleOccupancyComparison
Ratios of the average sample occupancy on the whole detector.
std::string m_calSetLabel
Label to be used to identify the histograms of a the calibration set.
std::vector< TH1F * > m_slotAverageDeltaT[16]
Average of the DeltaT (time difference petween the calibraiton pulses) distribution,...
short m_scrodID
ID of the scrod whose calibrations are being analyzed.
std::vector< TH2F * > m_slotEmptySamplesMap[16]
Map of the number of (semi-)empty samples.
std::vector< TH1F * > m_slotAverageDeltaTComparison[16]
Ratio of the average of the DeltaT (time difference petween the calibraiton pulses) distribution,...
std::vector< TH2F * > m_slotSigmaDeltaTMap[16]
Map of the Standard deviation of the DeltaT (time difference petween the calibraiton pulses) distribu...
std::vector< TH1F * > m_topAverageDeltaT
Average of the DeltaT (time difference petween the calibraiton pulses) distribution,...
std::vector< TH2F * > m_slotSampleOccupancyMap[16]
Map of the average number of calpulses per sample used in the minimizat on.
int parseInputDirectoryLine(std::string)
Utility function to get the directory name and the label from a line of the m_inputDirectoryList file...
int makeComparisons()
Last function to be called, compared the histograms of different datasets filled by analyzeCalFile() ...
int parseSlotAndScrodIDfromFileName(std::string)
Utility function to parse the slot and BS id from the calibration file names.
void initialize() override
Initialize the module.
void event() override
Event processor.
void endRun() override
End-of-run action.
void terminate() override
Termination action.
int analyzeCalFile()
Analyzes the calibrations stored in the file m_calSetFile.
void beginRun() override
Called when entering a new run.
TH1F * calculateHistoRatio(TH1F *, TH1F *, TH1F *)
Utility function to take the ratio of two histograms using TH1::Divide(), without overwriting the out...
void defineHisto() override
Defining the histograms.
Abstract base class for different kinds of events.