Belle II Software  release-08-01-10
eclDQMExtended.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 /* ECL headers. */
12 #include <ecl/dataobjects/ECLDigit.h>
13 #include <ecl/dataobjects/ECLDsp.h>
14 #include <ecl/dataobjects/ECLTrig.h>
15 #include <ecl/dbobjects/ECLCrystalCalib.h>
16 #include <ecl/dbobjects/ECLDspData.h>
17 #include <ecl/mapper/ECLChannelMapper.h>
18 
19 /* Basf2 headers. */
20 #include <framework/core/HistoModule.h>
21 #include <framework/database/DBArray.h>
22 #include <framework/database/DBObjPtr.h>
23 #include <framework/datastore/StoreArray.h>
24 #include <framework/datastore/StoreObjPtr.h>
25 #include <mdst/dataobjects/TRGSummary.h>
26 
27 /* C++ headers. */
28 #include <map>
29 #include <string>
30 #include <vector>
31 
32 class TH1F;
33 class TH2F;
34 
35 namespace Belle2 {
46  public:
47 
50 
52  virtual ~ECLDQMEXTENDEDModule() override;
53 
55  virtual void initialize() override;
57  virtual void beginRun() override;
59  virtual void event() override;
61  virtual void endRun() override;
63  virtual void terminate() override;
64 
66  virtual void defineHisto() override;
67 
68  private:
72  std::string m_InitKey;
74  std::string m_DSPDirectoryName;
76  std::string m_RunName;
81 
86  std::vector<int> m_skipEvents = {};
87 
94 
97 
100 
103 
106 
113 
116 
118  std::map<int, std::map<std::string, std::vector<short int>>> map_container_vec;
120  std::map<int, std::map<std::string, short int>> map_container_coef;
121 
123  std::vector<short int> v_totalthrA0 = {};
125  std::vector<short int> v_totalthrAhard = {};
127  std::vector<short int> v_totalthrAskip = {};
128 
130  int m_AmpFit{0};
132  int m_TimeFit{0};
134  int m_QualityFit{0};
135 
137  int m_AmpData{0};
139  int m_TimeData{0};
142 
144  int m_CellId{0};
146  int m_TrigTime{0};
147 
149  std::vector<TH1F*> h_amp_timefail = {};
151  std::vector<TH1F*> h_time_ampfail = {};
153  std::vector<std::vector<TH1F*>> h_amp_qualityfail = {};
155  std::vector<std::vector<TH1F*>> h_time_qualityfail = {};
156 
158  TH1F* h_ampfail_quality{nullptr};
160  TH1F* h_timefail_quality{nullptr};
161 
163  TH1F* h_ampfail_cellid{nullptr};
165  TH1F* h_timefail_cellid{nullptr};
167  TH1F* h_amptimefail_cellid{nullptr};
169  TH1F* h_qualityfail_cellid{nullptr};
171  TH1F* h_ampfail_shaperid{nullptr};
173  TH1F* h_timefail_shaperid{nullptr};
175  TH1F* h_amptimefail_shaperid{nullptr};
177  TH1F* h_qualityfail_shaperid{nullptr};
179  TH1F* h_fail_shaperid{nullptr};
181  TH1F* h_ampfail_crateid{nullptr};
183  TH1F* h_timefail_crateid{nullptr};
185  TH1F* h_amptimefail_crateid{nullptr};
187  TH1F* h_qualityfail_crateid{nullptr};
189  TH1F* h_fail_crateid{nullptr};
190 
192  TH2F* h_ampdiff_cellid{nullptr};
194  TH2F* h_timediff_cellid{nullptr};
196  TH2F* h_ampdiff_shaperid{nullptr};
198  TH2F* h_timediff_shaperid{nullptr};
200  TH2F* h_ampdiff_quality{nullptr};
202  TH2F* h_timediff_quality{nullptr};
204  TH2F* h_quality_fit_data{nullptr};
206  TH2F* h_ampflag_qualityfail{nullptr};
208  TH2F* h_timeflag_qualityfail{nullptr};
210  TH1F* h_missing_ecldigits{nullptr};
211 
213  int conversion(int);
215  const short int* vectorsplit(const std::vector<short int>&, int);
217  void callbackCalibration(DBObjPtr<ECLCrystalCalib>&, std::vector<short int>&);
219  void callbackCalibration(const ECLDspData*, std::map<std::string, std::vector<short int>>&, std::map<std::string, short int>&);
221  void initDspfromDB();
223  void initDspfromFile();
225  void emulator(int, int, std::vector<int>);
226  };
228 }; // end Belle2 namespace
Class for accessing arrays of objects in the database.
Definition: DBArray.h:26
Class for accessing objects in the database.
Definition: DBObjPtr.h:21
This module is created to monitor ECL electronics logic in frame of DQM system.
TH2F * h_timediff_cellid
Histogram: Time diff.
virtual ~ECLDQMEXTENDEDModule() override
Destructor.
TH1F * h_amptimefail_shaperid
Histogram: ShaperIDs w/ failed amplitudes and times.
int m_TimeData
Signal time from ECL data.
void initDspfromDB()
Get DSP coeffs and auxiliary constants from DB.
TH2F * h_timediff_shaperid
Histogram: Time diff.
TH1F * h_ampfail_crateid
Histogram: CrateIDs w/ failed amplitudes.
TH1F * h_fail_crateid
Histogram: CrateIDs w/ failed logic.
bool m_SaveDetailedFitData
Save detailed fit data for failed fits.
std::vector< short int > v_totalthrA0
Vector to store Low amplitude thresholds.
TH1F * h_timefail_quality
Histogram: Time control flags in bins of QualityData.
bool m_adjusted_timing
Use modified time determination algorithm in emulator, same as in ShaperDSP version >= 1....
int m_AmpFit
Signal amplitude obtaining from DSP emulator.
int m_TrigTime
Trigger time value.
int m_CellId
Cell ID number.
StoreArray< ECLDsp > m_ECLDsps
ECL DSP data.
virtual void initialize() override
Initialize the module.
TH1F * h_timefail_shaperid
Histogram: ShaperIDs w/ failed times.
std::vector< short int > v_totalthrAhard
Vector to store hit thresholds.
int m_QualityData
Quality flag from ECL data.
TH1F * h_qualityfail_shaperid
Histogram: ShaperIDs w/ failed qualities.
virtual void event() override
Event processor.
TH1F * h_fail_shaperid
Histogram: ShaperIDs w/ failed logic.
void emulator(int, int, std::vector< int >)
Call for DSP emulator.
TH2F * h_timediff_quality
Histogram: Time diff.
virtual void endRun() override
Call when a run ends.
TH1F * h_qualityfail_crateid
Histogram: CrateIDs w/ failed qualities.
TH1F * h_amptimefail_crateid
Histogram: CrateIDs w/ failed amplitudes and times.
virtual void terminate() override
Terminate.
int m_AmpData
Signal amplitude from ECL data.
void callbackCalibration(DBObjPtr< ECLCrystalCalib > &, std::vector< short int > &)
Read calibration values for thresholds from DBObject.
std::vector< short int > v_totalthrAskip
Vector to store skip amplitude threshold.
std::map< int, std::map< std::string, std::vector< short int > > > map_container_vec
Map to store DSP coeffs.
std::vector< int > m_skipEvents
Skip events with specified type of timing source (see TRGSummary class, ETimingType enum)
StoreArray< ECLDigit > m_ECLDigits
ECL digits.
DBArray< ECLDspData > m_ECLDspDataArray2
DBArray for payload 'ECLDSPPars2'.
std::vector< TH1F * > h_amp_timefail
Histogram vector: Amplitude for time mismacthes (AmplitudeFit == AmplitudeData) w/ various QualityDat...
TH1F * h_amptimefail_cellid
Histogram: CellIDs w/ failed amplitudes and times.
TH2F * h_ampflag_qualityfail
Histogram: Amp flag (0/1) w/ failed qualities in bins of QualityData.
DBObjPtr< ECLCrystalCalib > m_calibrationThrAhard
Hit threshold.
TH1F * h_timefail_crateid
Histogram: CrateIDs w/ failed times.
const short int * vectorsplit(const std::vector< short int > &, int)
Select from vector of DSP coeffs a subvector corresponding to accurate channel number.
std::string m_InitKey
Key to initialize DSP coeffs.
TH2F * h_quality_fit_data
Histogram: QualityFit vs QualityData for quality fails.
DBObjPtr< ECLCrystalCalib > m_calibrationThrAskip
Skip amplitude threshold.
int conversion(int)
Convert a CellID number to the global Shaper number.
virtual void beginRun() override
Call when a run begins.
std::string m_histogramDirectoryName
Histogram directory in ROOT file.
ECL::ECLChannelMapper mapper
ECL channel mapper.
ECLDQMEXTENDEDModule()
< derived from HistoModule class.
TH2F * h_ampdiff_quality
Histogram: Amp.
DBArray< ECLDspData > m_ECLDspDataArray1
DBArray for payload 'ECLDSPPars1'.
TH1F * h_ampfail_cellid
Histogram: CellIDs w/ failed amplitudes.
TH2F * h_ampdiff_shaperid
Histogram: Amp.
TH1F * h_ampfail_quality
Histogram: Amp.
int m_QualityFit
Quality flag obtaining from DSP emulator.
std::string m_RunName
Run with valid DSP coeffs.
DBArray< ECLDspData > m_ECLDspDataArray0
DBArray for payload 'ECLDSPPars0'.
TH2F * h_ampdiff_cellid
Histogram: Amplitude diff.
TH1F * h_ampfail_shaperid
Histogram: ShaperIDs w/ failed amplitudes.
TH1F * h_timefail_cellid
Histogram: CellIDs w/ failed times.
StoreArray< ECLTrig > m_ECLTrigs
ECL trigger data.
DBObjPtr< ECLCrystalCalib > m_calibrationThrA0
Low amplitude threshold.
TH1F * h_qualityfail_cellid
Histogram: CellIDs w/ failed qualities.
std::map< int, std::map< std::string, short int > > map_container_coef
Map to store auxiliary constants for all shapers.
std::vector< std::vector< TH1F * > > h_amp_qualityfail
Histogram vector: AmplitudeData for quality mismathes w/ various QualityFit (raw) and QualityData (co...
StoreObjPtr< TRGSummary > m_TRGSummary
StoreObjPtr TRGSummary
std::vector< TH1F * > h_time_ampfail
Histogram vector: Time for amplitude mismathces (TimeFit == TimeData) w/ various QualityData values.
std::string m_DSPDirectoryName
Directory name consisting of DSP coeffs.
int m_TimeFit
Signal time obtaining from DSP emulator.
void initDspfromFile()
Get DSP coeffs and auxiliary constants from Files.
TH2F * h_timeflag_qualityfail
Histogram: Time flag (0/1) w/ failed qualities in bins of Quality Data.
TH1F * h_missing_ecldigits
Histogram: Quality flag (from emulator) for the waveforms where fit result (ECLDigit) should have bee...
std::vector< std::vector< TH1F * > > h_time_qualityfail
Histogram vector: TimeData for quality mismacthes w/ various QualitFit (raw) and QualityData (column)...
virtual void defineHisto() override
Function to define histograms.
This object contains ECL DSP coefs – electromagnetic calorimeter digital signal processing coefficien...
Definition: ECLDspData.h:34
This class provides access to ECL channel map that is either a) Loaded from the database (see ecl/dbo...
HistoModule.h is supposed to be used instead of Module.h for the modules with histogram definitions t...
Definition: HistoModule.h:29
Accessor to arrays stored in the data store.
Definition: StoreArray.h:113
Type-safe access to single objects in the data store.
Definition: StoreObjPtr.h:96
Abstract base class for different kinds of events.