Belle II Software  release-05-02-19
TOPTBCComparatorModule.h
1 /**************************************************************************
2  * BASF2 (Belle Analysis Framework 2) *
3  * Copyright(C) 2017 - Belle II Collaboration *
4  * *
5  * Author: The Belle II Collaboration *
6  * Contributors: Umberto Tamponi (tamponi@to.infn.it) *
7  * *
8  * This software is provided "as is" without any warranty. *
9  **************************************************************************/
10 
11 #pragma once
12 
13 #include <framework/core/HistoModule.h>
14 #include "TH1F.h"
15 #include "TH2F.h"
16 #include <string>
17 #include <vector>
18 
19 namespace Belle2 {
74  class TOPTBCComparatorModule : public HistoModule {
75  public:
80 
85 
90  void defineHisto() override;
91 
95  void initialize() override;
96 
100  void beginRun() override;
101 
105  void event() override;
106 
113  void endRun() override;
114 
119  void terminate() override;
120 
125  int analyzeCalFile();
126 
131  int makeComparisons();
132 
133 
134 
138  int parseSlotAndScrodIDfromFileName(std::string);
139 
144  int parseInputDirectoryLine(std::string);
145 
150  TH1F* calculateHistoRatio(TH1F*, TH1F*, TH1F*);
151 
156  TH2F* calculateHistoRatio(TH2F*, TH2F*, TH2F*);
157 
158 
159 
160 
161  private:
162  // steering parameters
163  std::string m_inputDirectoryList =
164  "";
166  true;
167  std::string m_outputFile = "";
168  short m_minCalPulses = 200;
169  short m_numSamples = 256;
172  // utilities
173  std::string m_calSetDirectory;
174  TFile* m_calSetFile =
175  nullptr;
176  std::string m_calSetLabel;
177  short m_slotID = -1;
178  short m_boardstackID = -1;
179  short m_scrodID = -1;
180  short m_calSetID = 0;
181  short m_totCalSets = 0;
184  // Delta T plots, slot-by-slot
185  std::vector<TH1F*>
187  std::vector<TH1F*>
189  std::vector<TH2F*>
191  std::vector<TH2F*>
194  // Average timing plots, all the detector at once
195  std::vector<TH1F*>
197  std::vector<TH1F*>
201  // Occupancy plots, slot-by-slot
202  std::vector<TH1F*>
204  std::vector<TH1F*>
205  m_slotEmptySamples[16];
206  std::vector<TH2F*>
208  std::vector<TH2F*>
211  // Occupancy plot, all the detector at once
212  std::vector<TH1F*>
216  // Delta T ratio plots, slot-by-slot
217  std::vector<TH1F*>
219  std::vector<TH1F*>
221  std::vector<TH2F*>
223  std::vector<TH2F*>
227  // Delta T ratio plots, whole detector
228  std::vector<TH1F*>
230  std::vector<TH1F*>
232  std::vector<TH1F*>
239  };
240 
242 } //namespace Belle2
Belle2::TOPTBCComparatorModule::~TOPTBCComparatorModule
~TOPTBCComparatorModule()
Destructor.
Definition: TOPTBCComparatorModule.h:92
Belle2::TOPTBCComparatorModule::m_slotSampleOccupancy
std::vector< TH1F * > m_slotSampleOccupancy[16]
Average number of calpulses per sample used in the minimization, as function of the channel number.
Definition: TOPTBCComparatorModule.h:211
Belle2::TOPTBCComparatorModule::m_slotSampleOccupancyMap
std::vector< TH2F * > m_slotSampleOccupancyMap[16]
Map of the average number of calpulses per sample used in the minimizat on.
Definition: TOPTBCComparatorModule.h:215
Belle2::TOPTBCComparatorModule::calculateHistoRatio
TH1F * calculateHistoRatio(TH1F *, TH1F *, TH1F *)
Utility function to take the ratio of two histograms using TH1::Divide(), without overwriting the out...
Definition: TOPTBCComparatorModule.cc:584
Belle2::TOPTBCComparatorModule::m_calSetFile
TFile * m_calSetFile
File containing the calibration constants of the SCROD being analyzed.
Definition: TOPTBCComparatorModule.h:182
Belle2::TOPTBCComparatorModule::m_calSetLabel
std::string m_calSetLabel
Label to be used to identify the histograms of a the calibration set.
Definition: TOPTBCComparatorModule.h:184
Belle2::TOPTBCComparatorModule::m_topSigmaDeltaTComparison
std::vector< TH1F * > m_topSigmaDeltaTComparison
Standard deviation of the DeltaT (time difference petween the calibraiton pulses) distribution,...
Definition: TOPTBCComparatorModule.h:239
Belle2::TOPTBCComparatorModule::event
void event() override
Event processor.
Definition: TOPTBCComparatorModule.cc:340
Belle2::TOPTBCComparatorModule::m_slotSigmaDeltaTMapComparison
std::vector< TH2F * > m_slotSigmaDeltaTMapComparison[16]
Map of Ratio of the Standard deviation on DeltaT (time difference petween the calibraiton pulses)
Definition: TOPTBCComparatorModule.h:232
Belle2::TOPTBCComparatorModule::terminate
void terminate() override
Termination action.
Definition: TOPTBCComparatorModule.cc:446
Belle2::TOPTBCComparatorModule::m_slotSigmaDeltaT
std::vector< TH1F * > m_slotSigmaDeltaT[16]
Standard deviation of the DeltaT (time difference petween the calibraiton pulses) distribution,...
Definition: TOPTBCComparatorModule.h:196
Belle2::TOPTBCComparatorModule::m_outputFile
std::string m_outputFile
File in which the output histograms are stored.
Definition: TOPTBCComparatorModule.h:175
Belle2::TOPTBCComparatorModule::m_topAverageDeltaT
std::vector< TH1F * > m_topAverageDeltaT
Average of the DeltaT (time difference petween the calibraiton pulses) distribution,...
Definition: TOPTBCComparatorModule.h:204
Belle2::TOPTBCComparatorModule::m_numSamples
short m_numSamples
Number of samples that have been calibrated.
Definition: TOPTBCComparatorModule.h:177
Belle2::TOPTBCComparatorModule::makeComparisons
int makeComparisons()
Last function to be called, compared the histograms of different datasets filled by analyzeCalFile() ...
Definition: TOPTBCComparatorModule.cc:294
Belle2::TOPTBCComparatorModule::m_calSetID
short m_calSetID
Internal ID of the calibration set that is being analyzed.
Definition: TOPTBCComparatorModule.h:188
Belle2::TOPTBCComparatorModule::m_slotAverageDeltaTMapComparison
std::vector< TH2F * > m_slotAverageDeltaTMapComparison[16]
Map of the Ratio of the average DeltaT (time difference petween the calibraiton pulses)
Definition: TOPTBCComparatorModule.h:230
Belle2::TOPTBCComparatorModule::beginRun
void beginRun() override
Called when entering a new run.
Definition: TOPTBCComparatorModule.cc:334
Belle2::TOPTBCComparatorModule::m_slotAverageDeltaTMap
std::vector< TH2F * > m_slotAverageDeltaTMap[16]
Map of the average of the DeltaT (time difference petween the calibraiton pulses) distribution.
Definition: TOPTBCComparatorModule.h:198
Belle2::TOPTBCComparatorModule::parseInputDirectoryLine
int parseInputDirectoryLine(std::string)
Utility function to get the directory name and the label from a line of the m_inputDirectoryList file...
Definition: TOPTBCComparatorModule.cc:502
Belle2::TOPTBCComparatorModule::m_totCalSets
short m_totCalSets
Total number of calibration sets, as counted int defineHistos.
Definition: TOPTBCComparatorModule.h:189
Belle2::TOPTBCComparatorModule::endRun
void endRun() override
End-of-run action.
Definition: TOPTBCComparatorModule.cc:349
Belle2::TOPTBCComparatorModule::m_slotEmptySamplesMap
std::vector< TH2F * > m_slotEmptySamplesMap[16]
Map of the number of (semi-)empty samples.
Definition: TOPTBCComparatorModule.h:217
Belle2::TOPTBCComparatorModule::m_inputDirectoryList
std::string m_inputDirectoryList
List of the directories (one per IOV) in which the files with the calibration constants of the SCODS ...
Definition: TOPTBCComparatorModule.h:171
Belle2
Abstract base class for different kinds of events.
Definition: MillepedeAlgorithm.h:19
Belle2::TOPTBCComparatorModule::m_calSetDirectory
std::string m_calSetDirectory
Label to be used to indetify the histograms of a the calibration set.
Definition: TOPTBCComparatorModule.h:181
Belle2::TOPTBCComparatorModule::m_slotAverageDeltaT
std::vector< TH1F * > m_slotAverageDeltaT[16]
Average of the DeltaT (time difference petween the calibraiton pulses) distribution,...
Definition: TOPTBCComparatorModule.h:194
Belle2::TOPTBCComparatorModule::TOPTBCComparatorModule
TOPTBCComparatorModule()
Constructor.
Definition: TOPTBCComparatorModule.cc:34
Belle2::TOPTBCComparatorModule::m_boardstackID
short m_boardstackID
ID of the slot whose calibrations are being analyzed.
Definition: TOPTBCComparatorModule.h:186
Belle2::TOPTBCComparatorModule::m_slotID
short m_slotID
ID of the slot whose calibrations are being analyzed.
Definition: TOPTBCComparatorModule.h:185
Belle2::TOPTBCComparatorModule::m_scrodID
short m_scrodID
ID of the scrod whose calibrations are being analyzed.
Definition: TOPTBCComparatorModule.h:187
Belle2::TOPTBCComparatorModule::m_minCalPulses
short m_minCalPulses
Minimum number of calpulses to declare a sample as non-empty.
Definition: TOPTBCComparatorModule.h:176
Belle2::TOPTBCComparatorModule::analyzeCalFile
int analyzeCalFile()
Analyzes the calibrations stored in the file m_calSetFile.
Definition: TOPTBCComparatorModule.cc:200
Belle2::TOPTBCComparatorModule::initialize
void initialize() override
Initialize the module.
Definition: TOPTBCComparatorModule.cc:329
Belle2::TOPTBCComparatorModule::m_slotAverageDeltaTComparison
std::vector< TH1F * > m_slotAverageDeltaTComparison[16]
Ratio of the average of the DeltaT (time difference petween the calibraiton pulses) distribution,...
Definition: TOPTBCComparatorModule.h:226
Belle2::TOPTBCComparatorModule::defineHisto
void defineHisto() override
Defining the histograms.
Definition: TOPTBCComparatorModule.cc:54
Belle2::TOPTBCComparatorModule::parseSlotAndScrodIDfromFileName
int parseSlotAndScrodIDfromFileName(std::string)
Utility function to parse the slot and BS id from the calibration file names.
Definition: TOPTBCComparatorModule.cc:540
Belle2::TOPTBCComparatorModule::m_slotSigmaDeltaTMap
std::vector< TH2F * > m_slotSigmaDeltaTMap[16]
Map of the Standard deviation of the DeltaT (time difference petween the calibraiton pulses) distribu...
Definition: TOPTBCComparatorModule.h:200
Belle2::TOPTBCComparatorModule::m_slotSigmaDeltaTComparison
std::vector< TH1F * > m_slotSigmaDeltaTComparison[16]
Ratio of the Standard deviation of the DeltaT (time difference petween the calibraiton pulses) distri...
Definition: TOPTBCComparatorModule.h:228
Belle2::TOPTBCComparatorModule::m_compareToPreviousSet
bool m_compareToPreviousSet
Determines if the reverence set for the ratio is the first CalSet of the list (if false) or if each C...
Definition: TOPTBCComparatorModule.h:173
Belle2::TOPTBCComparatorModule::m_topAverageDeltaTComparison
std::vector< TH1F * > m_topAverageDeltaTComparison
Average of the DeltaT (time difference petween the calibraiton pulses) distribution,...
Definition: TOPTBCComparatorModule.h:237
Belle2::TOPTBCComparatorModule::m_slotEmptySamples
std::vector< TH1F * > m_slotEmptySamples[16]
Number of (semi-)empty samples in each channel.
Definition: TOPTBCComparatorModule.h:213
Belle2::TOPTBCComparatorModule::m_topSigmaDeltaT
std::vector< TH1F * > m_topSigmaDeltaT
Standard deviation of the DeltaT (time difference petween the calibraiton pulses) distribution,...
Definition: TOPTBCComparatorModule.h:206
Belle2::TOPTBCComparatorModule::m_topSampleOccupancyComparison
std::vector< TH1F * > m_topSampleOccupancyComparison
Ratios of the average sample occupancy on the whole detector.
Definition: TOPTBCComparatorModule.h:241
Belle2::TOPTBCComparatorModule::m_topSampleOccupancy
std::vector< TH1F * > m_topSampleOccupancy
Average number of calpulses per sample used in the minimization, as function of the channel number on...
Definition: TOPTBCComparatorModule.h:221