ATLAS Offline Software
TileTBDump.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 // Filename : TileTBDump.h
7 // Author : Alexander Solodkov
8 // Created : May, 2004
9 //
10 // DESCRIPTION
11 //
12 // To dump contents of TestBeam ByteStream file
13 // Old TileDump program converter to Athena Algorithm
14 //
15 // Properties (JobOption Parameters):
16 // drawerList - vector of frag IDs present in data (hex numbers as strings)
17 // drawerType - type for every frag from drawerList
18 // 1=B+, 2=B-, 3=EB+, 4=EB-
19 // these parameters are needed only for 2003 data
20 // (when 0x102 and 0x202 were ext.barrel modules)
21 // correct values for 2004 are set by default
22 //
23 // BUGS:
24 //
25 // History:
26 //
27 //
28 //****************************************************************************
29 
30 /* @class TileTBDump
31  @brief Class to dump TileCal bytestream fragments in a formatted way.
32  */
33 
34 #ifndef TileTBDump_H
35 #define TileTBDump_H
36 
37 // Gaudi includes
38 #include "GaudiKernel/ToolHandle.h"
39 #include "GaudiKernel/ServiceHandle.h"
40 
41 // Athena includes
43 
44 // Tile includes
48 #include <vector>
49 #include <map>
50 
52 class TileCablingService;
54 class TileCondToolTiming;
56 
57 
58 
59 class TileTBDump: public AthAlgorithm {
60  public:
61  //Constructor
62  TileTBDump(const std::string& name, ISvcLocator* pSvcLocator);
63 
64  //Destructor
65  virtual ~TileTBDump();
66 
67  //Gaudi Hooks
71 
72  private:
73 
74  int m_statFrag5[200];
75 
77 
80 
81  std::vector<std::string> m_drawerList; // list of frag IDs in correct order
82  std::vector<int> m_drawerType; // type of every drawer 1-4: B+, B-, EB+, EB-
83  std::map<unsigned int, unsigned int, std::less<unsigned int> > m_drawerMap; // map for frag IDs -> index
84  typedef std::map<unsigned int, unsigned int, std::less<unsigned int> >::iterator drawerMap_iterator;
85  typedef std::vector<std::vector<unsigned int> > FelixData_t;
86 
87  ToolHandle<TileCondToolTiming> m_tileToolTiming;
88  ToolHandle<TileCondToolOfcCool> m_tileCondToolOfcCool;
89  ToolHandle<TileCondToolEmscale> m_tileToolEmscale;
90 
92  bool m_dumpData;
94  bool m_dumpOnce;
97  bool m_v3Format;
99  unsigned int m_sizeOverhead;
100  int m_unit;
101 
106  int m_run_no;
109  int m_bc_id;
113 
114  std::vector<int> m_all_lvl1_trigger_types;
115 
116  /* the ROD data sub-fragment */
117  typedef struct T_RodDataFrag {
118  unsigned int size;
119  unsigned int id;
120  unsigned int data[1];
122 
123 #ifndef MAX_CHAN_SAMP
124 #define MAX_CHAN_SAMP 36
125 #endif
126 
127  typedef struct T_TileDigiChannel {
128  int chan;
129  unsigned int head;
130  unsigned int first;
131  unsigned int crc;
132  unsigned int id;
133  unsigned int gain;
134  unsigned int flag;
135  unsigned int bcid;
136  unsigned int err;
137  unsigned int par;
138  unsigned short sample[MAX_CHAN_SAMP];
140 
141  typedef struct T_TileRecoQuality {
155 
156  typedef struct T_TileRecoChannel {
157  int chan;
158  unsigned int word;
159  unsigned short gain;
160  unsigned short amp;
161  unsigned short time;
162  unsigned short quality;
163  double d_amp;
164  double d_time;
165  double d_quality;
167 
168  typedef struct T_TileRawComp { // Baxo
169  unsigned int words[4];
170  bool verif;
171  int chan;
172  unsigned short gain;
173  unsigned short samples[7];
175 
176  typedef struct T_TileRecoCalib { // Baxo
177  int chan;
178  unsigned int word;
179  unsigned short gain;
180  unsigned short amp;
181  unsigned short time;
182  unsigned short bad;
183  unsigned short quality;
184  double d_amp;
185  double d_time;
186  double d_quality;
188 
189 
190 /* void dump_TMDB(uint32_t subdet_id, const uint32_t* roddata, unsigned int rodsize
191  , uint32_t version, int verbosity, int robsource_id);*/
192 
193  void dump_data(const uint32_t* data, unsigned int size, unsigned int version, int verbosity);
194 
195  void dump_digi(unsigned int subdet_id, const uint32_t* data, unsigned int size, unsigned int version, int verbosity, unsigned int robsourceid, const EventContext& ctx);
196 
197  void dump_it(unsigned int nw, unsigned int* data);
198 
199  void find_frag(const uint32_t* rod, unsigned int size, unsigned int version, int verbosity, const T_RodDataFrag* frag[], int& nfrag);
200 
201  int tile_unpack_raw_comp(const T_RodDataFrag* frag, T_TileRawComp* rawcomp, int nchannel_max
202  , unsigned int version, int verbosity, int* ngain, int* nchannel, int* nsample); // Baxo
203 
204  int tile_unpack_digi(const T_RodDataFrag* frag, T_TileDigiChannel* channel, int nchannel_max
205  , unsigned int version, int verbosity, int* ngain, int* nchannel, int* nsample);
206 
207  int tile_unpack_reco(const T_RodDataFrag* frag, T_TileRecoChannel* channel, int nchannel_max
208  , unsigned int version, int verbosity, int* ngain, int* nchannel);
209 
210  int tile_unpack_reco_calib(const T_RodDataFrag* frag, T_TileRecoCalib* recocalib, int nchannel_max
211  , unsigned int version
212  , unsigned int unit
213  , int verbosity, int* ngain, int* nchannel); // Baxo
214 
215  int tile_unpack_quality(const T_RodDataFrag* frag, T_TileRecoQuality & DQword);
216 
217  void unpack_frag6(const uint32_t* data, unsigned int size, FelixData_t & digitsHighGain, FelixData_t & digitsLowGain, FelixData_t & digitsMetaData) const;
218 
219  unsigned int tile_check_parity(const unsigned int* frame, int length);
220 
221  unsigned int tile_check_startbit(const unsigned int* frame, int length, unsigned int startbit);
222 
223  unsigned int tile_check_CRC(const unsigned int* frame, int framelen, int delta);
224 
225  void tile_min_max(const unsigned short* frame, int frame_length, unsigned short* smin, unsigned short* smax);
226 
227  std::vector<uint32_t> get_correct_data(const uint32_t* p, unsigned int size) const;
228 
232 };
233 
234 #endif
xAOD::iterator
JetConstituentVector::iterator iterator
Definition: JetConstituentVector.cxx:68
TileTBDump::T_TileRecoQuality::sampleparity
uint16_t sampleparity
Definition: TileTBDump.h:151
TileTBDump::T_TileDigiChannel::sample
unsigned short sample[MAX_CHAN_SAMP]
Definition: TileTBDump.h:138
TileTBDump::m_lvl1_id
int m_lvl1_id
Definition: TileTBDump.h:108
data
char data[hepevt_bytes_allocation_ATLAS]
Definition: HepEvt.cxx:11
TileTBDump::T_TileRecoQuality::memory
uint16_t memory
Definition: TileTBDump.h:145
TileTBDump::T_TileRecoQuality
struct TileTBDump::T_TileRecoQuality T_TileRecoQuality
TileTBDump::T_TileDigiChannel::flag
unsigned int flag
Definition: TileTBDump.h:134
TileTBDump::T_TileRecoChannel::d_amp
double d_amp
Definition: TileTBDump.h:163
TileTBDump::m_tileToolEmscale
ToolHandle< TileCondToolEmscale > m_tileToolEmscale
Definition: TileTBDump.h:89
TileTBDump::T_TileRawComp::gain
unsigned short gain
Definition: TileTBDump.h:172
TileTBDump::tile_unpack_quality
int tile_unpack_quality(const T_RodDataFrag *frag, T_TileRecoQuality &DQword)
Definition: TileTBDump.cxx:2295
plotting.yearwise_efficiency.channel
channel
Definition: yearwise_efficiency.py:24
TileTBDump::T_TileDigiChannel::bcid
unsigned int bcid
Definition: TileTBDump.h:135
TileTBDump::T_TileDigiChannel::first
unsigned int first
Definition: TileTBDump.h:130
TileTBDump::tile_check_CRC
unsigned int tile_check_CRC(const unsigned int *frame, int framelen, int delta)
Definition: TileTBDump.cxx:2939
TileTBDump::T_TileRecoCalib::chan
int chan
Definition: TileTBDump.h:177
TileRawChannel2Bytes2.h
TileTBDump::T_TileRecoQuality::global_crc
uint16_t global_crc
Definition: TileTBDump.h:143
xAOD::uint32_t
setEventNumber uint32_t
Definition: EventInfo_v1.cxx:127
TileTBDump::T_TileRecoCalib::amp
unsigned short amp
Definition: TileTBDump.h:180
TileTBDump::T_TileRecoQuality::rod_chip_mask
uint16_t rod_chip_mask
Definition: TileTBDump.h:153
TileRawChannel2Bytes2
Converts the TileRawChannel object into bytes as it is defined at the testbeam.
Definition: TileRawChannel2Bytes2.h:58
TileTBDump::tile_min_max
void tile_min_max(const unsigned short *frame, int frame_length, unsigned short *smin, unsigned short *smax)
Definition: TileTBDump.cxx:3042
TileTBDump::m_statFrag5
int m_statFrag5[200]
Definition: TileTBDump.h:74
TileTBDump::m_global_id
int m_global_id
Definition: TileTBDump.h:104
TileTBDump::m_v3Format
bool m_v3Format
Definition: TileTBDump.h:97
TileRawChannel2Bytes4
Converts the TileRawChannel object into bytes as it is defined at the commissioning 2007....
Definition: TileRawChannel2Bytes4.h:66
TileTBDump::T_TileRecoCalib::word
unsigned int word
Definition: TileTBDump.h:178
TileTBDump::dump_digi
void dump_digi(unsigned int subdet_id, const uint32_t *data, unsigned int size, unsigned int version, int verbosity, unsigned int robsourceid, const EventContext &ctx)
Definition: TileTBDump.cxx:506
TileTBDump::m_dumpStatus
bool m_dumpStatus
Definition: TileTBDump.h:93
TileTBDump::m_lvl1_trigger_type
int m_lvl1_trigger_type
Definition: TileTBDump.h:110
TileTBDump::initialize
StatusCode initialize()
Definition: TileTBDump.cxx:164
TileTBDump::T_TileRecoCalib::d_amp
double d_amp
Definition: TileTBDump.h:184
TileTBDump::m_showUnknown
bool m_showUnknown
Definition: TileTBDump.h:96
TileTBDump::m_drawerMap
std::map< unsigned int, unsigned int, std::less< unsigned int > > m_drawerMap
Definition: TileTBDump.h:83
TileTBDump::T_TileRecoCalib::time
unsigned short time
Definition: TileTBDump.h:181
TileTBDump::T_TileRecoChannel::d_quality
double d_quality
Definition: TileTBDump.h:165
TileRawChannel2Bytes5.h
TileTBDump::T_RodDataFrag
struct TileTBDump::T_RodDataFrag T_RodDataFrag
TileTBDump::T_TileRecoChannel::time
unsigned short time
Definition: TileTBDump.h:161
TileTBDump::drawerMap_iterator
std::map< unsigned int, unsigned int, std::less< unsigned int > >::iterator drawerMap_iterator
Definition: TileTBDump.h:84
TileTBDump::TileTBDump
TileTBDump(const std::string &name, ISvcLocator *pSvcLocator)
Definition: TileTBDump.cxx:106
TileTBDump::m_run_no
int m_run_no
Definition: TileTBDump.h:106
TileTBDump::m_bc_time_seconds
int m_bc_time_seconds
Definition: TileTBDump.h:102
TileTBDump::T_TileDigiChannel
struct TileTBDump::T_TileDigiChannel T_TileDigiChannel
TileTBDump::m_runPeriod
int m_runPeriod
Definition: TileTBDump.h:79
TileTBDump::execute
StatusCode execute()
Definition: TileTBDump.cxx:219
TileRawChannel2Bytes4.h
TileTBDump::T_RodDataFrag::id
unsigned int id
Definition: TileTBDump.h:119
TileTBDump::T_RodDataFrag::size
unsigned int size
Definition: TileTBDump.h:118
AthAlgorithm.h
TileTBDump::m_frag5found
bool m_frag5found
Definition: TileTBDump.h:98
TileTBDump::m_rc2bytes2
TileRawChannel2Bytes2 m_rc2bytes2
Definition: TileTBDump.h:229
python.setupRTTAlg.size
int size
Definition: setupRTTAlg.py:39
TileTBDump::tile_check_parity
unsigned int tile_check_parity(const unsigned int *frame, int length)
Definition: TileTBDump.cxx:2851
IROBDataProviderSvc
Interface class for managing ROB for both online and offline.
Definition: IROBDataProviderSvc.h:23
TileTBDump::T_TileRecoCalib::gain
unsigned short gain
Definition: TileTBDump.h:179
TileTBDump::T_TileRecoQuality::headformat
uint16_t headformat
Definition: TileTBDump.h:148
TileTBDump::T_TileRecoCalib::d_quality
double d_quality
Definition: TileTBDump.h:186
python.utils.AtlRunQueryDQUtils.p
p
Definition: AtlRunQueryDQUtils.py:210
TileTBDump::T_TileRecoQuality::Dstrobe
uint16_t Dstrobe
Definition: TileTBDump.h:147
TileTBDump::T_TileDigiChannel::err
unsigned int err
Definition: TileTBDump.h:136
TileTBDump::tile_unpack_reco
int tile_unpack_reco(const T_RodDataFrag *frag, T_TileRecoChannel *channel, int nchannel_max, unsigned int version, int verbosity, int *ngain, int *nchannel)
Definition: TileTBDump.cxx:2371
xAOD::uint16_t
setWord1 uint16_t
Definition: eFexEMRoI_v1.cxx:88
TileTBDump::T_TileRawComp
struct TileTBDump::T_TileRawComp T_TileRawComp
TileTBDump::T_TileDigiChannel::par
unsigned int par
Definition: TileTBDump.h:137
TileTBDump::T_TileRecoChannel::d_time
double d_time
Definition: TileTBDump.h:164
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
TileTBDump::FelixData_t
std::vector< std::vector< unsigned int > > FelixData_t
Definition: TileTBDump.h:85
TileTBDump::T_TileDigiChannel::head
unsigned int head
Definition: TileTBDump.h:129
TileTBDump::T_TileRecoChannel::gain
unsigned short gain
Definition: TileTBDump.h:159
TileTBDump::T_TileRecoQuality::bcid
uint16_t bcid
Definition: TileTBDump.h:144
TileRawChannel2Bytes5
Converts the TileRawChannel object into bytes as it.
Definition: TileRawChannel2Bytes5.h:43
TileTBDump::m_tileCondToolOfcCool
ToolHandle< TileCondToolOfcCool > m_tileCondToolOfcCool
Definition: TileTBDump.h:88
TileTBDump
TileTBDump produces formatted dump for both RawChannels and Digits Properties (JobOption Parameters):...
Definition: TileTBDump.h:59
TileTBDump::tile_check_startbit
unsigned int tile_check_startbit(const unsigned int *frame, int length, unsigned int startbit)
Definition: TileTBDump.cxx:2898
TileTBDump::T_TileRecoCalib::bad
unsigned short bad
Definition: TileTBDump.h:182
TileTBDump::T_TileRecoQuality::fe_chip_mask
uint16_t fe_chip_mask
Definition: TileTBDump.h:152
TileTBDump::T_TileRecoQuality::headparity
uint16_t headparity
Definition: TileTBDump.h:149
TileCablingService
Definition: TileCablingService.h:23
RunTileMonitoring.rod
rod
Definition: RunTileMonitoring.py:134
TileTBDump::m_drawerType
std::vector< int > m_drawerType
Definition: TileTBDump.h:82
TileTBDump::finalize
StatusCode finalize()
Definition: TileTBDump.cxx:195
MAX_CHAN_SAMP
#define MAX_CHAN_SAMP
Definition: TileTBDump.h:124
AthAlgorithm
Definition: AthAlgorithm.h:47
TileTBDump::~TileTBDump
virtual ~TileTBDump()
Definition: TileTBDump.cxx:160
TileTBDump::T_TileDigiChannel
Definition: TileTBDump.h:127
TileTBDump::T_TileRecoCalib
struct TileTBDump::T_TileRecoCalib T_TileRecoCalib
TileTBDump::T_TileRecoQuality
Definition: TileTBDump.h:141
TileTBDump::unpack_frag6
void unpack_frag6(const uint32_t *data, unsigned int size, FelixData_t &digitsHighGain, FelixData_t &digitsLowGain, FelixData_t &digitsMetaData) const
Definition: TileTBDump.cxx:2119
TileTBDump::m_all_lvl1_trigger_types
std::vector< int > m_all_lvl1_trigger_types
Definition: TileTBDump.h:114
TileTBDump::T_TileRecoChannel::amp
unsigned short amp
Definition: TileTBDump.h:160
TileTBDump::T_RodDataFrag::data
unsigned int data[1]
Definition: TileTBDump.h:120
TileTBDump::m_cabling
const TileCablingService * m_cabling
Definition: TileTBDump.h:78
TileTBDump::m_lumi_block
int m_lumi_block
Definition: TileTBDump.h:107
TileTBDump::m_RobSvc
ServiceHandle< IROBDataProviderSvc > m_RobSvc
Definition: TileTBDump.h:76
TileCondToolOfcCool
extracts OFCs from database
Definition: TileCondToolOfcCool.h:28
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:221
TileTBDump::m_tileToolTiming
ToolHandle< TileCondToolTiming > m_tileToolTiming
Definition: TileTBDump.h:87
TileTBDump::T_TileRecoQuality::sampleformat
uint16_t sampleformat
Definition: TileTBDump.h:150
TileTBDump::T_TileRecoCalib::quality
unsigned short quality
Definition: TileTBDump.h:183
TileTBDump::m_unit
int m_unit
Definition: TileTBDump.h:100
covarianceTool.verbosity
verbosity
Definition: covarianceTool.py:513
TileTBDump::m_dumpHeader
bool m_dumpHeader
Definition: TileTBDump.h:91
TileCondToolEmscale
Calibration of TileCal channels and access to calibration factors.
Definition: TileCondToolEmscale.h:58
TileTBDump::T_TileDigiChannel::chan
int chan
Definition: TileTBDump.h:128
TileTBDump::T_TileDigiChannel::id
unsigned int id
Definition: TileTBDump.h:132
TileTBDump::m_drawerList
std::vector< std::string > m_drawerList
Definition: TileTBDump.h:81
TileTBDump::T_TileRawComp::words
unsigned int words[4]
Definition: TileTBDump.h:169
TileTBDump::find_frag
void find_frag(const uint32_t *rod, unsigned int size, unsigned int version, int verbosity, const T_RodDataFrag *frag[], int &nfrag)
Definition: TileTBDump.cxx:2030
TileTBDump::m_dumpData
bool m_dumpData
Definition: TileTBDump.h:92
get_generator_info.version
version
Definition: get_generator_info.py:33
TileTBDump::m_nlvl1_trigger_info
int m_nlvl1_trigger_info
Definition: TileTBDump.h:111
TileTBDump::T_TileRecoQuality::dspbcid
uint16_t dspbcid
Definition: TileTBDump.h:142
TileTBDump::T_TileRecoCalib::d_time
double d_time
Definition: TileTBDump.h:185
TileTBDump::tile_unpack_raw_comp
int tile_unpack_raw_comp(const T_RodDataFrag *frag, T_TileRawComp *rawcomp, int nchannel_max, unsigned int version, int verbosity, int *ngain, int *nchannel, int *nsample)
Definition: TileTBDump.cxx:2438
TileTBDump::get_correct_data
std::vector< uint32_t > get_correct_data(const uint32_t *p, unsigned int size) const
Definition: TileTBDump.cxx:3080
TileTBDump::T_TileRecoChannel::word
unsigned int word
Definition: TileTBDump.h:158
TileTBDump::T_TileRawComp
Definition: TileTBDump.h:168
unit
const PlainObject unit() const
This is a plugin that makes Eigen look like CLHEP & defines some convenience methods.
Definition: AmgMatrixBasePlugin.h:21
TileTBDump::T_TileRecoChannel::chan
int chan
Definition: TileTBDump.h:157
TileTBDump::m_digi_mode
int m_digi_mode
Definition: TileTBDump.h:112
TileTBDump::T_RodDataFrag
Definition: TileTBDump.h:117
TileTBDump::m_run_type
int m_run_type
Definition: TileTBDump.h:105
TileTBDump::m_dumpOnce
bool m_dumpOnce
Definition: TileTBDump.h:94
TileTBDump::m_rc2bytes5
TileRawChannel2Bytes5 m_rc2bytes5
Definition: TileTBDump.h:231
TileTBDump::m_rc2bytes4
TileRawChannel2Bytes4 m_rc2bytes4
Definition: TileTBDump.h:230
PlotCalibFromCool.ngain
ngain
Definition: PlotCalibFromCool.py:565
TileTBDump::m_bc_id
int m_bc_id
Definition: TileTBDump.h:109
TileTBDump::dump_it
void dump_it(unsigned int nw, unsigned int *data)
TileTBDump::m_sizeOverhead
unsigned int m_sizeOverhead
Definition: TileTBDump.h:99
TileTBDump::T_TileRecoChannel
struct TileTBDump::T_TileRecoChannel T_TileRecoChannel
TileTBDump::tile_unpack_reco_calib
int tile_unpack_reco_calib(const T_RodDataFrag *frag, T_TileRecoCalib *recocalib, int nchannel_max, unsigned int version, unsigned int unit, int verbosity, int *ngain, int *nchannel)
Definition: TileTBDump.cxx:2404
TileTBDump::tile_unpack_digi
int tile_unpack_digi(const T_RodDataFrag *frag, T_TileDigiChannel *channel, int nchannel_max, unsigned int version, int verbosity, int *ngain, int *nchannel, int *nsample)
Definition: TileTBDump.cxx:2638
TileTBDump::T_TileRecoChannel::quality
unsigned short quality
Definition: TileTBDump.h:162
TileTBDump::T_TileDigiChannel::crc
unsigned int crc
Definition: TileTBDump.h:131
TileTBDump::T_TileRawComp::samples
unsigned short samples[7]
Definition: TileTBDump.h:173
TileTBDump::m_bc_time_nanoseconds
int m_bc_time_nanoseconds
Definition: TileTBDump.h:103
TileTBDump::T_TileRecoQuality::Sstrobe
uint16_t Sstrobe
Definition: TileTBDump.h:146
TileTBDump::dump_data
void dump_data(const uint32_t *data, unsigned int size, unsigned int version, int verbosity)
Definition: TileTBDump.cxx:492
TileTBDump::T_TileRecoCalib
Definition: TileTBDump.h:176
TileTBDump::T_TileDigiChannel::gain
unsigned int gain
Definition: TileTBDump.h:133
length
double length(const pvec &v)
Definition: FPGATrackSimLLPDoubletHoughTransformTool.cxx:26
TileTBDump::T_TileRawComp::verif
bool verif
Definition: TileTBDump.h:170
TileTBDump::T_TileRawComp::chan
int chan
Definition: TileTBDump.h:171
TileCondToolTiming
Definition: TileCondToolTiming.h:18
TileTBDump::T_TileRecoChannel
Definition: TileTBDump.h:156
TileTBDump::m_dumpUnknown
bool m_dumpUnknown
Definition: TileTBDump.h:95
ServiceHandle< IROBDataProviderSvc >