ATLAS Offline Software
Loading...
Searching...
No Matches
TileRawChNoiseCalibAlg.h
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3*/
4
5#ifndef TILERAWCHNOISECALIBALG_H
6#define TILERAWCHNOISECALIBALG_H
7
8// ********************************************************************
9//
10// NAME: TileRawChNoiseCalib.h
11// PACKAGE: TileCalib
12//
13// AUTHOR: Luca Fiorini (Luca.Fiorini@cern.ch)
14//
15// April 2008
16// ********************************************************************
17
18// Gaudi includes
19#include "GaudiKernel/ToolHandle.h"
20
21// Athena includes
25
26// Tile includes
34
35#include <cmath>
36#include <vector>
37#include <string>
38#include <map>
39#include <cstdint>
40
41class TileHWID;
43class TileDQstatus;
44class TileRawChannel;
45class TH1F;
46
48
49 public:
50 static constexpr int NSIDES = 2;
51 static constexpr int NSAMPLES = 4;
52 static constexpr int NTOWERS = 17;
53 static constexpr int NCELLGAINS = 6;
54 static constexpr int NPARS = 8;
55
56 TileRawChNoiseCalibAlg(const std::string& name, ISvcLocator* pSvcLocator);
58
59 // Functions
60 virtual StatusCode initialize() override; //only array initialization is done here
61 virtual StatusCode execute() override;
62 virtual StatusCode finalize() override;
63 void finalRawCh(int rctype);
64
65 private:
66
67 enum RCtype {
68 Fit = 0, Fixed = 1, Opt = 2, Dsp = 3, OF1 = 4, MF = 5, RCnum = 6
69 };
70
71 enum trigtype {
72 Unknown = 0, Phys = 1, Las = 2, Ped = 4, Cis = 8
73 };
74
75 StatusCode FirstEvt_initialize(); // real initialization is done in this method
76
77 StatusCode fillRawChannels(const TileDQstatus* dqStatus,
78 const SG::ReadHandleKey<TileRawChannelContainer>& rawChannelContainerKey,
79 RCtype rctype); // raw chans variables is done here
80 void StoreRunInfo(const TileDQstatus* dqStatus); // called only at the first event. General variables
81
82 void fillCell(TileRawChannelUnit::UNIT RChUnit, const TileRawChannel * rch);
83 void fillCellHist(); //fill HGHG and LGLG histograms
84 void finalCell(); //fills the cell variables of the ntuple
85 static void doFit(TH1F* h, float* gp, bool invert = true); //double gaussian fit
86
87 void deleteHist(); // delete all histograms
88
89 inline int digiChannel2PMT(int ros, int chan) {
90 return (abs(m_cabling->channel2hole(ros, chan)) - 1);
91 }
92
93 // If data should be put in calib mode
95
96 bool m_doFit;
98 bool m_doOpt;
99 bool m_doDsp;
101 bool m_doMF;
104
106
108
109 // by default we use channels
111
113
114 // Tools / storegate info
117 // Identifiers
120 ToolHandle<TileCondToolEmscale> m_tileToolEmscale{this,
121 "TileCondToolEmscale", "TileCondToolEmscale", "Tile em scale tool"};
122 ToolHandle<ITileBadChanTool> m_tileBadChanTool{this,
123 "TileBadChanTool", "TileBadChanTool", "Tile bad channel tool"};
125 ToolHandle<TileCondIdTransforms> m_tileIdTrans{this,
126 "TileCondIdTransforms", "TileCondIdTransforms", "Tile Id transforms tool"};
127 const uint32_t* m_cispar;
128
130 "EventInfo", "EventInfo", "EventInfo key"};
132 "TileRawChannelContainerFixed", "TileRawChannelFixed",
133 "Input Tile raw channel container reconstructed with ATLAS method"};
135 "TileRawChannelContainerFit", "TileRawChannelFit",
136 "Input Tile raw channel container reconstructed with Fit method"};
138 "TileRawChannelContainerOpt", "TileRawChannelOpt2",
139 "Input Tile raw channel container reconstructed with Opt method"};
141 "TileRawChannelContainerDsp", "TileRawChannelCnt",
142 "Input Tile raw channel container from DSP"};
144 "TileRawChannelContainerOF1", "TileRawChannelOF1",
145 "Input Tile raw channel container reconstructed with OF1 method"};
147 "TileRawChannelContainerMF", "TileRawChannelMF",
148 "Input Tile raw channel container reconstructed with MF method"};
149
150 // jobOptions
151
152 // Name of ntuple and file
153 std::string m_ntupleID;
154 std::string m_file;
155 int64_t m_treeSize;
156 //unsigned int m_nDrawers;
157
158 // Container Parameters
159 std::string m_digitsContainer;
167
169
171 TH1F* (*m_histCellAmp)[Tile::MAX_DRAWER][NSAMPLES][NTOWERS][NCELLGAINS];
172
173 // event number
180 // Trigger items
184 int m_day;
187 int m_min;
188 int m_run;
190 //int m_nsamples;
191
192 // RawCh items
204
205 float (*m_rc_ggpar)[Tile::MAX_ROS][Tile::MAX_DRAWER][Tile::MAX_CHAN][Tile::MAX_GAIN][NPARS]; // sigma gauss1, rel normalization of the gaussians, sigma gauss2, chi2/ndf, error in sigma1, sigma2 and normalization, correlation between sigma1 and sigma2
214
215 //Cell items
216 //structure is side: A=0 C=1,
217 // drawer: 0-63,
218 // sample: A=0, BC=1, D=2, E=3
219 // tower: 0-16,
220 // gain combination: LGLG, LG-, -LG, HGHG, HG-, -HG
226
230
231 int (*m_cell_nch)[Tile::MAX_DRAWER][NSAMPLES][NTOWERS][Tile::MAX_GAIN]; // number of good channels in given cell in given event - 0 or 1 or 2
233 float (*m_ggpar)[Tile::MAX_DRAWER][NSAMPLES][NTOWERS][NCELLGAINS][NPARS]; // sigma gauss1, rel normalization of the gaussians, sigma gauss2, chi2/ndf, error in sigma1, sigma2 and normalization, correlation between sigma1 and sigma2
242
244};
245
246#endif // TILENOISECALIBALG_H
Property holding a SG store/key/clid from which a ReadHandle is made.
Information produced by TileDQstatusAlg (used to be done by TileBeamInfoProvider).
AthAlgorithm(const std::string &name, ISvcLocator *pSvcLocator)
Constructor with parameters:
Header file for AthHistogramAlgorithm.
Property holding a SG store/key/clid from which a ReadHandle is made.
This AthConstConverter class provides conversion from ByteStream to TileBeamElemContainer.
Static class providing several utility functions and constants.
static const unsigned int MAX_ROS
Number of ROSs.
static const unsigned int MAX_GAIN
Number of gains per channel.
static const unsigned int MAX_DRAWER
Number of drawers in ROS 1-4.
static const unsigned int MAX_CHAN
Number of channels in drawer.
Class that holds Data Quality fragment information and provides functions to extract the data quality...
Helper class for TileCal online (hardware) identifiers.
Definition TileHWID.h:49
Helper class for TileCal offline identifiers.
Definition TileID.h:67
float(* m_rc_mean_err)[Tile::MAX_ROS][Tile::MAX_DRAWER][Tile::MAX_CHAN][Tile::MAX_GAIN]
float(* m_rc_av)[Tile::MAX_ROS][Tile::MAX_DRAWER][Tile::MAX_CHAN][Tile::MAX_GAIN]
uint8_t(* m_ros)[Tile::MAX_DRAWER][Tile::MAX_CHAN][Tile::MAX_GAIN]
uint32_t(* m_ecell_hash)[Tile::MAX_DRAWER][NSAMPLES][NTOWERS]
float(* m_rc_probC2)[Tile::MAX_ROS][Tile::MAX_DRAWER][Tile::MAX_CHAN][Tile::MAX_GAIN]
SG::ReadHandleKey< TileRawChannelContainer > m_rawChannelContainerMFKey
bool(* m_side)[Tile::MAX_DRAWER][NSAMPLES][NTOWERS][NCELLGAINS]
float(* m_rc_kurtosis)[Tile::MAX_ROS][Tile::MAX_DRAWER][Tile::MAX_CHAN][Tile::MAX_GAIN]
float(* m_rc_sigma_err)[Tile::MAX_ROS][Tile::MAX_DRAWER][Tile::MAX_CHAN][Tile::MAX_GAIN]
float(* m_rc_gsigma2)[Tile::MAX_ROS][Tile::MAX_DRAWER][Tile::MAX_CHAN][Tile::MAX_GAIN]
float(* m_rc_mean)[Tile::MAX_ROS][Tile::MAX_DRAWER][Tile::MAX_CHAN][Tile::MAX_GAIN]
uint8_t(* m_drawer)[Tile::MAX_DRAWER][Tile::MAX_CHAN][Tile::MAX_GAIN]
float(* m_gerrsigma1)[Tile::MAX_DRAWER][NSAMPLES][NTOWERS][NCELLGAINS]
void finalRawCh(int rctype)
finalDigits is called during finalize Here the average Ped, lfn, hfn and covariance are calculated.
uint8_t(* m_gg)[Tile::MAX_DRAWER][NSAMPLES][NTOWERS][NCELLGAINS]
TileBeamElemContByteStreamCnv * m_beamCnv
float(* m_rc_gerrsigma1)[Tile::MAX_ROS][Tile::MAX_DRAWER][Tile::MAX_CHAN][Tile::MAX_GAIN]
static constexpr int NSIDES
uint8_t(* m_sample)[Tile::MAX_DRAWER][NSAMPLES][NTOWERS][NCELLGAINS]
SG::ReadHandleKey< TileDQstatus > m_dqStatusKey
uint8_t(* m_tower)[Tile::MAX_DRAWER][NSAMPLES][NTOWERS][NCELLGAINS]
void fillCellHist()
fillCellHist is called during execute It fill the HGHG and LGLG combination of the cell energies
uint8_t(* m_phi)[Tile::MAX_DRAWER][NSAMPLES][NTOWERS][NCELLGAINS]
virtual StatusCode execute() override
Main method.
float(* m_gerrnorm)[Tile::MAX_DRAWER][NSAMPLES][NTOWERS][NCELLGAINS]
bool(* m_gain)[Tile::MAX_DRAWER][Tile::MAX_CHAN][Tile::MAX_GAIN]
StatusCode fillRawChannels(const TileDQstatus *dqStatus, const SG::ReadHandleKey< TileRawChannelContainer > &rawChannelContainerKey, RCtype rctype)
float(* m_rc_chi2)[Tile::MAX_ROS][Tile::MAX_DRAWER][Tile::MAX_CHAN][Tile::MAX_GAIN]
float(* m_ecell_ene)[Tile::MAX_DRAWER][NSAMPLES][NTOWERS][Tile::MAX_GAIN]
float(* m_rc_rms)[Tile::MAX_ROS][Tile::MAX_DRAWER][Tile::MAX_CHAN][Tile::MAX_GAIN]
float(* m_rc_gerrnorm)[Tile::MAX_ROS][Tile::MAX_DRAWER][Tile::MAX_CHAN][Tile::MAX_GAIN]
float(* m_rc_gchi2)[Tile::MAX_ROS][Tile::MAX_DRAWER][Tile::MAX_CHAN][Tile::MAX_GAIN]
SG::ReadHandleKey< TileRawChannelContainer > m_rawChannelContainerFixedKey
float(* m_rc_sigma)[Tile::MAX_ROS][Tile::MAX_DRAWER][Tile::MAX_CHAN][Tile::MAX_GAIN]
float(* m_rc_gsigma1)[Tile::MAX_ROS][Tile::MAX_DRAWER][Tile::MAX_CHAN][Tile::MAX_GAIN]
SG::ReadHandleKey< TileRawChannelContainer > m_rawChannelContainerDspKey
ToolHandle< ITileBadChanTool > m_tileBadChanTool
float(* m_rc_ndf)[Tile::MAX_ROS][Tile::MAX_DRAWER][Tile::MAX_CHAN][Tile::MAX_GAIN]
ToolHandle< TileCondToolEmscale > m_tileToolEmscale
float(* m_rc_skewness)[Tile::MAX_ROS][Tile::MAX_DRAWER][Tile::MAX_CHAN][Tile::MAX_GAIN]
float(* m_gcorrsigma1sigma2)[Tile::MAX_DRAWER][NSAMPLES][NTOWERS][NCELLGAINS]
float(* m_ecell_av)[Tile::MAX_DRAWER][NSAMPLES][NTOWERS][NCELLGAINS]
float(* m_gsigma1)[Tile::MAX_DRAWER][NSAMPLES][NTOWERS][NCELLGAINS]
float(* m_gnorm)[Tile::MAX_DRAWER][NSAMPLES][NTOWERS][NCELLGAINS]
const TileCablingService * m_cabling
void fillCell(TileRawChannelUnit::UNIT RChUnit, const TileRawChannel *rch)
float(* m_ggpar)[Tile::MAX_DRAWER][NSAMPLES][NTOWERS][NCELLGAINS][NPARS]
float(* m_rc_gnorm)[Tile::MAX_ROS][Tile::MAX_DRAWER][Tile::MAX_CHAN][Tile::MAX_GAIN]
SG::ReadHandleKey< TileRawChannelContainer > m_rawChannelContainerOptKey
SG::ReadHandleKey< TileRawChannelContainer > m_rawChannelContainerOF1Key
StatusCode FirstEvt_initialize()
Initialization done at the first event.
void StoreRunInfo(const TileDQstatus *dqStatus)
StoreRunInfo is called only during the first event.
float(* m_gsigma2)[Tile::MAX_DRAWER][NSAMPLES][NTOWERS][NCELLGAINS]
static constexpr int NTOWERS
float(* m_rc_gcorrsigma1sigma2)[Tile::MAX_ROS][Tile::MAX_DRAWER][Tile::MAX_CHAN][Tile::MAX_GAIN]
void finalCell()
finalCell is called during finalize Here the cell variables of the ntuple are filled.
static constexpr int NSAMPLES
SG::ReadHandleKey< TileRawChannelContainer > m_rawChannelContainerFitKey
static constexpr int NCELLGAINS
float(* m_gchi2)[Tile::MAX_DRAWER][NSAMPLES][NTOWERS][NCELLGAINS]
uint8_t(* m_channel)[Tile::MAX_DRAWER][Tile::MAX_CHAN][Tile::MAX_GAIN]
int(* m_evt)[Tile::MAX_DRAWER][Tile::MAX_CHAN][Tile::MAX_GAIN]
void deleteHist()
deleteHist is called at finalize to ensure that no histogram goes into any output root file delete []...
int digiChannel2PMT(int ros, int chan)
virtual StatusCode initialize() override
Only array initialization is done here All the helpers initialization is done at the first event.
int(* m_cell_nch)[Tile::MAX_DRAWER][NSAMPLES][NTOWERS][Tile::MAX_GAIN]
virtual StatusCode finalize() override
The output ntuple is created in finalize method.
float(* m_gerrsigma2)[Tile::MAX_DRAWER][NSAMPLES][NTOWERS][NCELLGAINS]
float(* m_rc_ggpar)[Tile::MAX_ROS][Tile::MAX_DRAWER][Tile::MAX_CHAN][Tile::MAX_GAIN][NPARS]
ToolHandle< TileCondIdTransforms > m_tileIdTrans
float(* m_rc_gerrsigma2)[Tile::MAX_ROS][Tile::MAX_DRAWER][Tile::MAX_CHAN][Tile::MAX_GAIN]
TileRawChNoiseCalibAlg(const std::string &name, ISvcLocator *pSvcLocator)
float(* m_ecell_rms)[Tile::MAX_DRAWER][NSAMPLES][NTOWERS][NCELLGAINS]
SG::ReadHandleKey< xAOD::EventInfo > m_eventInfoKey
bool doFit
TH1F(name, title, nxbins, bins_par2, bins_par3=None, path='', **kwargs)