ATLAS Offline Software
TileDigiNoiseCalibAlg.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 TILEDIGINOISECALIBALG_H
6 #define TILEDIGINOISECALIBALG_H
7 
8 // ********************************************************************
9 //
10 // NAME: TileDigiNoiseCalib.h
11 // PACKAGE: TileCalib
12 //
13 // AUTHOR: Luca Fiorini (Luca.Fiorini@cern.ch)
14 //
15 // February 2008
16 // ********************************************************************
17 
18 // Gaudi includes
19 #include "GaudiKernel/ToolHandle.h"
20 
21 // Athena includes
25 
26 // Tile includes
28 #include "TileEvent/TileDQstatus.h"
32 
33 #include <cmath>
34 #include <vector>
35 #include <string>
36 #include <map>
37 #include <cstdint>
38 
39 #define NVALS 36
40 
41 // Forward declaration
42 class TileHWID;
44 class TileOFCorrelation;
45 
47  public:
48  TileDigiNoiseCalibAlg(const std::string& name, ISvcLocator* pSvcLocator);
49  virtual ~TileDigiNoiseCalibAlg();
50 
51  // Functions
52  virtual StatusCode initialize() override; //only array initialization is done here
53  virtual StatusCode execute() override;
54  virtual StatusCode finalize() override;
55 
56  private:
57 
58  enum trigtype {
59  Unknown = 0
60  , Phys = 1
61  , Las = 2
62  , Ped = 4
63  , Cis = 8
64  };
65 
66  StatusCode FirstEvt_initialize(); // real initialization is done in this method
67 
68  StatusCode fillDigits (const TileDQstatus* theDQstatus); //accumulate statistics for pedestal, lfn, hfn, noise_cov calculation
69  void finalDigits(); // pedestal, lfn, hfn, noise_cov calculation is done here
70  void StoreRunInfo (const TileDQstatus* dqStatus); // called only at the first event. General variables
71 
72  inline int digiChannel2PMT(int ros, int chan) {
73  return (abs(m_cabling->channel2hole(ros, chan)) - 1);
74  }
75 
76  // If data should be put in calib mode
78 
79  // by default we use channels
80  bool m_usePMT;
81 
82  // Toggle usage of average correlation calcualtion or rigorous
83  // Default: Rigorous
85 
86  // Toggle usage of robust method to calculate covariance matrix or standard method
87  // Default: use standard
89 
92  "TileDigitsContainer", "TileDigitsCnt", "Tile digits container"};
94  "EventInfo", "EventInfo", "EventInfo key"};
95 
96  // Tools / storegate info
97  ToolHandle<TileRawChannelBuilderFlatFilter> m_adderFilterAlgTool{this,
98  "TileAdderFlatFilter","TileRawChannelBuilderFlatFilter/TileAdderFlatFilter","Tile adder flat filter"};
102 
103  // Identifiers
104  const TileID* m_tileID;
106 
108 
109  // Name of ntuple and file
110  std::string m_ntupleID;
111  std::string m_file;
112  int64_t m_treeSize;
114 // unsigned int m_nDrawers;
115 
116  // Container Parameters
117  std::string m_digitsContainer;
118  std::string m_beamElemContainer;
119  /* std::string m_flatRawChannelContainer;
120  std::string m_fitRawChannelContainer;
121  std::string m_optRawChannelContainer;*/
123 
125 
130 
131  // event number
132  int m_evtNr;
134 
135  // Trigger items
136  int m_time;
137  int m_year;
138  int m_month;
139  int m_day;
140  int m_yday;
141  int m_hour;
142  int m_min;
143  int m_run;
154 };
155 
156 #endif // TILENOISECALIBALG_H
ReadHandleKey.h
Property holding a SG store/key/clid from which a ReadHandle is made.
TileDigiNoiseCalibAlg::m_treeSize
int64_t m_treeSize
Definition: TileDigiNoiseCalibAlg.h:112
TileDigiNoiseCalibAlg::m_usePMT
bool m_usePMT
Definition: TileDigiNoiseCalibAlg.h:80
xAOD::uint8_t
uint8_t
Definition: Muon_v1.cxx:557
CaloCellPos2Ntuple.int
int
Definition: CaloCellPos2Ntuple.py:24
TileDigiNoiseCalibAlg::m_digitsContainer
std::string m_digitsContainer
Definition: TileDigiNoiseCalibAlg.h:117
xAOD::uint32_t
setEventNumber uint32_t
Definition: EventInfo_v1.cxx:127
TileDigiNoiseCalibAlg::m_sumRms2
double(* m_sumRms2)[Tile::MAX_DRAWER][Tile::MAX_CHAN][Tile::MAX_GAIN]
Definition: TileDigiNoiseCalibAlg.h:127
TileDigiNoiseCalibAlg::execute
virtual StatusCode execute() override
Main method.
Definition: TileDigiNoiseCalibAlg.cxx:195
TileDigiNoiseCalibAlg::m_adderFilterAlgTool
ToolHandle< TileRawChannelBuilderFlatFilter > m_adderFilterAlgTool
Definition: TileDigiNoiseCalibAlg.h:97
TileDigiNoiseCalibAlg::m_file
std::string m_file
Definition: TileDigiNoiseCalibAlg.h:111
TileDigiNoiseCalibAlg::m_eventInfoKey
SG::ReadHandleKey< xAOD::EventInfo > m_eventInfoKey
Definition: TileDigiNoiseCalibAlg.h:93
TileRawChannelBuilderFlatFilter.h
TileDigiNoiseCalibAlg::m_calibMode
bool m_calibMode
Definition: TileDigiNoiseCalibAlg.h:77
TileCalibUtils.h
TileDigiNoiseCalibAlg::m_cispar
const uint32_t * m_cispar
Definition: TileDigiNoiseCalibAlg.h:107
TileDigiNoiseCalibAlg::m_ped
float(* m_ped)[Tile::MAX_DRAWER][Tile::MAX_CHAN][Tile::MAX_GAIN]
Definition: TileDigiNoiseCalibAlg.h:149
TileDigiNoiseCalibAlg::digiChannel2PMT
int digiChannel2PMT(int ros, int chan)
Definition: TileDigiNoiseCalibAlg.h:72
TileDigiNoiseCalibAlg::m_day
int m_day
Definition: TileDigiNoiseCalibAlg.h:139
SG::ReadHandleKey< TileDQstatus >
TileDigiNoiseCalibAlg::m_hour
int m_hour
Definition: TileDigiNoiseCalibAlg.h:141
TileOFCorrelation
Definition: TileOFCorrelation.h:32
TileDigiNoiseCalibAlg::trigtype
trigtype
Definition: TileDigiNoiseCalibAlg.h:58
TileDigiNoiseCalibAlg::~TileDigiNoiseCalibAlg
virtual ~TileDigiNoiseCalibAlg()
Definition: TileDigiNoiseCalibAlg.cxx:96
TileDigiNoiseCalibAlg::Unknown
@ Unknown
Definition: TileDigiNoiseCalibAlg.h:59
TileDigiNoiseCalibAlg::Phys
@ Phys
Definition: TileDigiNoiseCalibAlg.h:60
TileDigiNoiseCalibAlg::m_evt
int(* m_evt)[Tile::MAX_DRAWER][Tile::MAX_CHAN][Tile::MAX_GAIN]
Definition: TileDigiNoiseCalibAlg.h:133
TileCalibUtils::MAX_DRAWER
static const unsigned int MAX_DRAWER
Number of drawers in ROS 1-4.
Definition: TileCalibUtils.h:139
TileDigiNoiseCalibAlg::StoreRunInfo
void StoreRunInfo(const TileDQstatus *dqStatus)
StoreRunInfo is called only during the first event.
Definition: TileDigiNoiseCalibAlg.cxx:298
TileDigiNoiseCalibAlg::finalDigits
void finalDigits()
finalDigits is called during finalize Here the average Ped, m_lfn, m_hfn and covariance are calculate...
Definition: TileDigiNoiseCalibAlg.cxx:503
TileDigiNoiseCalibAlg::m_gain
bool(* m_gain)[Tile::MAX_DRAWER][Tile::MAX_CHAN][Tile::MAX_GAIN]
Definition: TileDigiNoiseCalibAlg.h:148
TileDigiNoiseCalibAlg::m_tileID
const TileID * m_tileID
Definition: TileDigiNoiseCalibAlg.h:104
AthAlgorithm.h
TileHWID
Helper class for TileCal online (hardware) identifiers.
Definition: TileHWID.h:49
TileDQstatus
Class that holds Data Quality fragment information and provides functions to extract the data quality...
Definition: TileDQstatus.h:49
Tile
Definition: TileVolumeBuilder.h:43
TileDigiNoiseCalibAlg::Cis
@ Cis
Definition: TileDigiNoiseCalibAlg.h:63
TileCablingService.h
TileDigiNoiseCalibAlg::m_ros
uint8_t(* m_ros)[Tile::MAX_DRAWER][Tile::MAX_CHAN][Tile::MAX_GAIN]
Definition: TileDigiNoiseCalibAlg.h:145
ReadCellNoiseFromCool.chan
chan
Definition: ReadCellNoiseFromCool.py:52
TileID
Helper class for TileCal offline identifiers.
Definition: TileID.h:68
TileDigitsContainer.h
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
TileDigiNoiseCalibAlg::m_evtNr
int m_evtNr
Definition: TileDigiNoiseCalibAlg.h:132
TileDigiNoiseCalibAlg::m_beamElemContainer
std::string m_beamElemContainer
Definition: TileDigiNoiseCalibAlg.h:118
TileDigiNoiseCalibAlg::TileDigiNoiseCalibAlg
TileDigiNoiseCalibAlg(const std::string &name, ISvcLocator *pSvcLocator)
Definition: TileDigiNoiseCalibAlg.cxx:43
TileDigiNoiseCalibAlg::m_tileHWID
const TileHWID * m_tileHWID
Definition: TileDigiNoiseCalibAlg.h:105
TileDigiNoiseCalibAlg::m_lfn
float(* m_lfn)[Tile::MAX_DRAWER][Tile::MAX_CHAN][Tile::MAX_GAIN]
Definition: TileDigiNoiseCalibAlg.h:150
TileDigiNoiseCalibAlg::m_year
int m_year
Definition: TileDigiNoiseCalibAlg.h:137
TileDigiNoiseCalibAlg::m_doRobustCov
bool m_doRobustCov
Definition: TileDigiNoiseCalibAlg.h:88
TileDigiNoiseCalibAlg::m_cabling
const TileCablingService * m_cabling
Definition: TileDigiNoiseCalibAlg.h:100
TileDigiNoiseCalibAlg::m_doAvgCorr
bool m_doAvgCorr
Definition: TileDigiNoiseCalibAlg.h:84
TileDigiNoiseCalibAlg::FirstEvt_initialize
StatusCode FirstEvt_initialize()
Initialization done at the first event.
Definition: TileDigiNoiseCalibAlg.cxx:131
xAOD::double
double
Definition: CompositeParticle_v1.cxx:159
maskDeadModules.ros
ros
Definition: maskDeadModules.py:35
TileCablingService
Definition: TileCablingService.h:23
TileDQstatus.h
Information produced by TileDQstatusAlg (used to be done by TileBeamInfoProvider).
TileDigiNoiseCalibAlg::m_ntupleID
std::string m_ntupleID
Definition: TileDigiNoiseCalibAlg.h:110
TileBeamElemContByteStreamCnv
This AthConstConverter class provides conversion from ByteStream to TileBeamElemContainer.
Definition: TileBeamElemContByteStreamCnv.h:48
AthAlgorithm
Definition: AthAlgorithm.h:47
TileDigiNoiseCalibAlg::m_min
int m_min
Definition: TileDigiNoiseCalibAlg.h:142
TileDigiNoiseCalibAlg
Definition: TileDigiNoiseCalibAlg.h:46
NVALS
#define NVALS
Definition: TileDigiNoiseCalibAlg.h:39
TileDigiNoiseCalibAlg::m_nSamples
int m_nSamples
Definition: TileDigiNoiseCalibAlg.h:113
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:228
TileDigiNoiseCalibAlg::finalize
virtual StatusCode finalize() override
The output ntuple is created in finalize method.
Definition: TileDigiNoiseCalibAlg.cxx:236
TileDigiNoiseCalibAlg::m_meanAmp_ij
double(* m_meanAmp_ij)[Tile::MAX_DRAWER][Tile::MAX_CHAN][Tile::MAX_CHAN][Tile::MAX_GAIN]
Definition: TileDigiNoiseCalibAlg.h:129
TileDigiNoiseCalibAlg::Ped
@ Ped
Definition: TileDigiNoiseCalibAlg.h:62
TileDigiNoiseCalibAlg::m_sumPed2
double(* m_sumPed2)[Tile::MAX_DRAWER][Tile::MAX_CHAN][Tile::MAX_GAIN]
Definition: TileDigiNoiseCalibAlg.h:126
TileDigiNoiseCalibAlg::m_noise_cov
float(* m_noise_cov)[Tile::MAX_DRAWER][Tile::MAX_GAIN]
Definition: TileDigiNoiseCalibAlg.h:152
EventInfo.h
TileDigiNoiseCalibAlg::m_dqStatusKey
SG::ReadHandleKey< TileDQstatus > m_dqStatusKey
Definition: TileDigiNoiseCalibAlg.h:90
TileDigiNoiseCalibAlg::m_tileOFCorrelation
TileOFCorrelation * m_tileOFCorrelation
Definition: TileDigiNoiseCalibAlg.h:101
TileDigiNoiseCalibAlg::m_auto_corr
float(* m_auto_corr)[Tile::MAX_DRAWER][Tile::MAX_CHAN][Tile::MAX_GAIN][NVALS]
Definition: TileDigiNoiseCalibAlg.h:153
TileDigiNoiseCalibAlg::fillDigits
StatusCode fillDigits(const TileDQstatus *theDQstatus)
fillDigits is called at every events.
Definition: TileDigiNoiseCalibAlg.cxx:378
TileDigiNoiseCalibAlg::m_yday
int m_yday
Definition: TileDigiNoiseCalibAlg.h:140
TileCablingService::channel2hole
static int channel2hole(int ros, int channel)
Definition: TileCablingService.cxx:1946
python.Classes.TileCalibUtils
TileCalibUtils
Definition: TileCalib/TileCalibBlobObjs/python/Classes.py:5
TileDigiNoiseCalibAlg::m_run
int m_run
Definition: TileDigiNoiseCalibAlg.h:143
TileDigiNoiseCalibAlg::m_meanAmp
double(* m_meanAmp)[Tile::MAX_DRAWER][Tile::MAX_CHAN][Tile::MAX_GAIN]
Definition: TileDigiNoiseCalibAlg.h:128
TileDigiNoiseCalibAlg::m_channel
uint8_t(* m_channel)[Tile::MAX_DRAWER][Tile::MAX_CHAN][Tile::MAX_GAIN]
Definition: TileDigiNoiseCalibAlg.h:147
TileDigiNoiseCalibAlg::m_beamCnv
TileBeamElemContByteStreamCnv * m_beamCnv
Definition: TileDigiNoiseCalibAlg.h:99
TileDigiNoiseCalibAlg::m_digitsContainerKey
SG::ReadHandleKey< TileDigitsContainer > m_digitsContainerKey
Definition: TileDigiNoiseCalibAlg.h:91
TileDigiNoiseCalibAlg::m_time
int m_time
Definition: TileDigiNoiseCalibAlg.h:136
TileDigiNoiseCalibAlg::Las
@ Las
Definition: TileDigiNoiseCalibAlg.h:61
TileDigiNoiseCalibAlg::m_dspRawChannelContainer
std::string m_dspRawChannelContainer
Definition: TileDigiNoiseCalibAlg.h:122
TileDigiNoiseCalibAlg::m_hfn
float(* m_hfn)[Tile::MAX_DRAWER][Tile::MAX_CHAN][Tile::MAX_GAIN]
Definition: TileDigiNoiseCalibAlg.h:151
TileCalibUtils::MAX_CHAN
static const unsigned int MAX_CHAN
Number of channels in drawer.
Definition: TileCalibUtils.h:141
TileDigiNoiseCalibAlg::m_drawer
uint8_t(* m_drawer)[Tile::MAX_DRAWER][Tile::MAX_CHAN][Tile::MAX_GAIN]
Definition: TileDigiNoiseCalibAlg.h:146
xAOD::bool
setBGCode setTAP setLVL2ErrorBits bool
Definition: TrigDecision_v1.cxx:60
TileDigiNoiseCalibAlg::m_month
int m_month
Definition: TileDigiNoiseCalibAlg.h:138
TileDigiNoiseCalibAlg::m_trigType
int m_trigType
Definition: TileDigiNoiseCalibAlg.h:144
readCCLHist.float
float
Definition: readCCLHist.py:83
TileDigiNoiseCalibAlg::initialize
virtual StatusCode initialize() override
Only array initialization is done here All the helpers initialization is done at the first event.
Definition: TileDigiNoiseCalibAlg.cxx:116
TileCalibUtils::MAX_GAIN
static const unsigned int MAX_GAIN
Number of gains per channel
Definition: TileCalibUtils.h:142