ATLAS Offline Software
TileRawChannelMonTool.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 // ********************************************************************
6 //
7 // NAME: TileRawChannelMonTool.h
8 // PACKAGE:
9 //
10 // AUTHOR: Alexander Solodkov
11 //
12 //
13 // ********************************************************************
14 #ifndef TILEMONITORING_TILERAWCHANNELMONTOOL_H
15 #define TILEMONITORING_TILERAWCHANNELMONTOOL_H
16 
17 #include "TilePaterMonTool.h"
19 #include "TileEvent/TileDQstatus.h"
21 #include <map>
22 #include <vector>
23 #include <memory>
24 #include <string>
25 
26 class TileRawChannel;
28 class TileInfo;
29 
34 class ATLAS_NOT_THREAD_SAFE TileRawChannelMonTool: public TilePaterMonTool { // deprecated: ATLASRECTS-7259
35 
36  public:
37 
38  TileRawChannelMonTool(const std::string & type, const std::string & name, const IInterface* parent);
39 
40  virtual ~TileRawChannelMonTool();
41 
42  virtual StatusCode initialize() override;
43 
44  //pure virtual methods
45  virtual StatusCode bookHists() override;
46  virtual StatusCode fillHists() override;
47  virtual StatusCode finalHists() override;
48  virtual StatusCode checkHists(bool fromFinalize) override;
49 
50  void bookHists(int ros, int drawer);
51  void drawHists(int ros, int drawer, const std::string& moduleName);
52  void ratioErrorBar(TH1S* hist, double& xmin, double& xmax, double mean);
53  void rangeErrorBar(double& xmin, double& max, double mean);
54  void bookDsp(int ros, int drawer);
55  StatusCode fillDsp(std::map<int, std::vector<double> > &efitMap, std::map<int, std::vector<double> > &tfitMap);
56  StatusCode finalDsp(int ros, int drawer);
57 
58  void drawDsp(int ros, int drawer, const std::string& moduleName);
59  void drawOptFilt(int ros, int drawer, const std::string& moduleName);
60  TF1* GetTimeFitFunc(TH2S* hist2d);
61  void LaserFancyPlotting(int ros, int drawer, int maxgain, const std::string& moduleName);
62 
63  private:
64 
65  void bookSummaryHistograms(int ros, int drawer);
66  StatusCode fillSummaryHistograms();
67  void resetSummaryHistograms();
68 
69  bool m_bookAll{};
70  bool m_book2D{};
71  bool m_overlaphists{};
72  int m_runType{};
73  std::string m_contName;
74  std::string m_contNameDSP;
75  std::string m_contNameOF;
76  double m_DownLimit{}; // Down Threshold for Amp/Q ratio plots
77  double m_UpLimit{}; // Up Threshold for Amp/Q ratio plots
78  double m_lo_IntegralLimit{}; // Warning error bar Low limit for Amp/Q ratio plots
79  double m_med_IntegralLimit{}; // Warning error bar Med limit for Amp/Q ratio plots
80  double m_hi_IntegralLimit{}; // Warning error bar High limit for Amp/Q ratio plots
81  bool m_useratioerror{}; //use ratioerror bar or rangeerror bar ?
82  //bool m_plotOptFilt; //book Optimal Filter histograms?
83  bool m_plotDsp{}; //book Optimal Filter histograms?
84  bool m_storeGraph{}; //Store TGraph to file: necessary due to THistSvc bug
85  std::map<int, std::vector<double> > m_efitMap;
86  std::map<int, std::vector<double> > m_tfitMap;
87  ToolHandle<TileCondToolEmscale> m_tileToolEmscale;
88  double m_efitThresh{};
89 
91 
93 
94  bool checkDmuHeader(std::vector<uint32_t>* headerVec, int dmu);
95  //vector to hold data corruption information
96  // std::vector<bool> corrup[5][64][2]; //ros, drawer, gain (index of each vector is channel)
97  bool m_corrup[5][64][2][16]={}; //ros, drawer, gain, DMU
98 
104  if (((header >> 31 & 0x1) == 1) && ((header >> 17 & 0x1) == 0))
105  return false; //no error
106  else
107  return true; //error
108  };
109 
114  uint32_t parity(0);
115  for (int i = 0; i < 32; ++i)
116  parity += ((header >> i) & 0x1);
117 
118  if ((parity % 2) == 1) return false; //no error
119  else return true; //error
120 
121  };
122 
123  enum RunType {
124  Unknown = 0, PhysRun = 1, // expect monogain
125  LasRun = 2, // expect monogain
126  LedRun = 3, // expect monogain
127  PedRun = 4, // expect bigain
128  CisRun = 8, // expect bigain
129  MonoRun = 9, // expect monogain
130  CisRamp = 10 // expect monogain
131  };
132 
133  enum DspPlot {
134  Edsp = 0, Tdsp = 1, chi2dsp = 2, Edsp_fit = 3, Tdsp_fit = 4
135  };
136 
137  enum sumDspPlot {
138  sumEdsp_fit = 0, sumTdsp_fit = 1, sumEdsp = 2, NsumDsp = 3
139  };
140 
142 
143  bool m_bigain{};
144  int m_nEventsTileMon{};
145  struct Data {
146  float m_rangeQ[2][2][3][48];
147  double m_timeCov[5][64][48][2][2][6];
148  double m_timeCovCorr[5][64][48][2][2][3]; //Lukas
149 
150  //Pointers to Histograms
151  std::vector<TH1S *> m_hist1[5][64][48][2]; // ros,drawer,channel,gain
152  std::vector<TH2S *> m_hist2[5][64][48][2];
153  std::vector<TH1F *> m_finalHist1[5][64][2][2]; //ros, drawer,capacitor, gain
154  std::vector<TH2F *> m_finalHist2[256][2];
155 
156  std::vector<TH1F *> m_histDsp1[5][64][48][2]; // ros,drawer,channel,gain
157  std::vector<TH2F *> m_histDsp2[5][64][48][2];
158  std::vector<TH1F *> m_finalHistDsp1[5][64][2]; //ros,drawer,gain
159  std::vector<TH2F *> m_finalHistDsp2[5][64][2];
160  std::vector<TH1F *> m_hBarDsp1[5][64][2]; // ros, drawer,gain
161 
162  std::vector<TH1F *> m_summaryPmts[5][64][2][2];
163  };
164  std::unique_ptr<Data> m_data;
165 
167 
168  int m_summaryUpdateFrequency{};
169  bool m_resetAfterSummaryUpdate{};
170  bool m_doLaserSummaryVsPMT{};
171  bool m_drawHists{};
172  float m_minAmpForCorrectedTime{};
173  // TileInfo
174  std::string m_infoName{};
175  const TileInfo* m_tileInfo{};
176  bool m_is12bit{};
178  int m_intCalibUnit{};
179  double m_dac2Charge[3]={};
180 };
181 
182 #endif
TileRawChannelMonTool::m_contNameDSP
std::string m_contNameDSP
Definition: TileRawChannelMonTool.h:74
TileRawChannelMonTool
Class for TileCal monitoring at channel level.
Definition: TileRawChannelMonTool.h:34
ReadHandleKey.h
Property holding a SG store/key/clid from which a ReadHandle is made.
GetLCDefs::Unknown
@ Unknown
Definition: GetLCDefs.h:21
plotBeamSpotCompare.x1
x1
Definition: plotBeamSpotCompare.py:216
TileRawChannelMonTool::m_tfitMap
std::map< int, std::vector< double > > m_tfitMap
Definition: TileRawChannelMonTool.h:86
TileRawChannelMonTool::checkDmuHeaderFormat
bool checkDmuHeaderFormat(uint32_t header)
Function to check that the DMU header format is correct bit_31 of the DMU header must be 1 and bit_17...
Definition: TileRawChannelMonTool.h:103
mean
void mean(std::vector< double > &bins, std::vector< double > &values, const std::vector< std::string > &files, const std::string &histname, const std::string &tplotname, const std::string &label="")
Definition: dependence.cxx:254
header
Definition: hcg.cxx:526
max
#define max(a, b)
Definition: cfImp.cxx:41
TileRawChannelMonTool::sumDspPlot
sumDspPlot
Definition: TileRawChannelMonTool.h:137
TilePaterMonTool::initialize
virtual StatusCode initialize() override
Definition: TilePaterMonTool.cxx:106
TileRawChannelMonTool::m_data
std::unique_ptr< Data > m_data
Definition: TileRawChannelMonTool.h:164
ManagedMonitorToolBase::fillHists
virtual StatusCode fillHists()
Calls fillHists( bool, bool, bool ); if an eventBlock,lumiBlock, or run has turned over,...
Definition: ManagedMonitorToolBase.cxx:793
ATLAS_NOT_THREAD_SAFE
#define ATLAS_NOT_THREAD_SAFE
getNoisyStrip() Find noisy strips from hitmaps and write out into xml/db formats
Definition: checker_macros.h:212
xAOD::uint32_t
setEventNumber uint32_t
Definition: EventInfo_v1.cxx:127
plotmaker.hist
hist
Definition: plotmaker.py:148
TilePaterMonTool
Base class for tilecal calibration monitoring tools.
Definition: TilePaterMonTool.h:53
TileInfo
Definition: TileInfo.h:49
SG::ReadHandleKey< TileDQstatus >
TileRawChannelMonTool::m_tileToolEmscale
ToolHandle< TileCondToolEmscale > m_tileToolEmscale
Definition: TileRawChannelMonTool.h:87
Example_ReadSampleNoise.drawer
drawer
Definition: Example_ReadSampleNoise.py:39
ManagedMonitorToolBase::checkHists
virtual StatusCode checkHists(bool calledFromFinalize)
This implementation does nothing; equivalent functionality may be provided by procHists(....
Definition: ManagedMonitorToolBase.cxx:1902
TileRawChannelMonTool::m_cispar
const uint32_t * m_cispar
Definition: TileRawChannelMonTool.h:141
TH2S
Definition: rootspy.cxx:400
TilePaterMonTool.h
TileRawChannelMonTool::checkDmuHeaderParity
bool checkDmuHeaderParity(uint32_t header)
Function to check that the DMU header parity is correct Parity of the DMU header should be odd Return...
Definition: TileRawChannelMonTool.h:113
lumiFormat.i
int i
Definition: lumiFormat.py:92
xmin
double xmin
Definition: listroot.cxx:60
TileRawChannelMonTool::drawOptFilt
void drawOptFilt(int ros, int drawer, const std::string &moduleName)
TileRawChannelMonTool::m_contName
std::string m_contName
Definition: TileRawChannelMonTool.h:73
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
TileRawChannel
Definition: TileRawChannel.h:35
test_pyathena.parent
parent
Definition: test_pyathena.py:15
TileRawChannelMonTool::m_DQstatusKey
SG::ReadHandleKey< TileDQstatus > m_DQstatusKey
Definition: TileRawChannelMonTool.h:177
maskDeadModules.ros
ros
Definition: maskDeadModules.py:35
ManagedMonitorToolBase::bookHists
virtual StatusCode bookHists()
Calls bookHists( true, true, true ) and initializes lumiBlock and run numbers.
Definition: ManagedMonitorToolBase.cxx:783
TileDQstatus.h
Information produced by TileDQstatusAlg (used to be done by TileBeamInfoProvider).
TileRawChannelUnit::UNIT
UNIT
Definition: TileRawChannelUnit.h:16
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:195
TileRawChannelMonTool::RunType
RunType
Definition: TileRawChannelMonTool.h:123
TileRawChannelMonTool::DspPlot
DspPlot
Definition: TileRawChannelMonTool.h:133
TileCondToolEmscale
Calibration of TileCal channels and access to calibration factors.
Definition: TileCondToolEmscale.h:58
TileRawChannelUnit.h
TileRawChannelMonTool::m_contNameOF
std::string m_contNameOF
Definition: TileRawChannelMonTool.h:75
TH1S
Definition: rootspy.cxx:362
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
ManagedMonitorToolBase::finalHists
virtual StatusCode finalHists()
Calls procHists( true, true, true ).
Definition: ManagedMonitorToolBase.cxx:1334
TileRawChannelMonTool::Data
Definition: TileRawChannelMonTool.h:145
xmax
double xmax
Definition: listroot.cxx:61
TileRawChannelMonTool::m_efitMap
std::map< int, std::vector< double > > m_efitMap
Definition: TileRawChannelMonTool.h:85