Shuttle debugging line removed.
[u/mrichter/AliRoot.git] / TOF / AliTOFDecoder.h
CommitLineData
2531be5d 1#ifndef ALITOFDECODER_H
2#define ALITOFDECODER_H
3
2531be5d 4/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
5 * See cxx source for full Copyright notice */
6
7/* $Id$ */
8
9///////////////////////////////////////////////////////////////
10// //
11// This class provides the basic TOF raw data decoder. //
12// //
13///////////////////////////////////////////////////////////////
14
15//define decoder status and bits
16#define DRM_BIT 0x1
17#define LTM_BIT 0x2
18#define TRM_BIT 0x4
19#define CHAIN_A_BIT 0x8
20#define CHAIN_B_BIT 0x10
21
22#define DRM_HEADER_STATUS 0x0
23#define DRM_TRAILER_STATUS (DRM_BIT)
24#define LTM_HEADER_STATUS (DRM_BIT)
25#define LTM_TRAILER_STATUS (DRM_BIT|LTM_BIT)
26#define TRM_HEADER_STATUS (DRM_BIT)
27#define TRM_TRAILER_STATUS (DRM_BIT|TRM_BIT)
28#define CHAIN_A_HEADER_STATUS (DRM_BIT|TRM_BIT)
29#define CHAIN_A_TRAILER_STATUS (DRM_BIT|TRM_BIT|CHAIN_A_BIT)
30#define CHAIN_B_HEADER_STATUS (DRM_BIT|TRM_BIT)
31#define CHAIN_B_TRAILER_STATUS (DRM_BIT|TRM_BIT|CHAIN_B_BIT)
32#define CHAIN_A_TDC_HIT_STATUS (DRM_BIT|TRM_BIT|CHAIN_A_BIT)
33#define CHAIN_B_TDC_HIT_STATUS (DRM_BIT|TRM_BIT|CHAIN_B_BIT)
34
35//define DRM/LTM fixed number of words
73620dbf 36#define DRM_DATA_WORDS 5
2531be5d 37#define LTM_DATA_WORDS 33
38
39//define masks
40#define WORD_TYPE_MASK 0xf0000000
41#define SLOT_ID_MASK 0x0000000f
42
43//define word types
44#define GLOBAL_HEADER 0x40000000
45#define GLOBAL_TRAILER 0x50000000
46#define CHAIN_A_HEADER 0x00000000
47#define CHAIN_A_TRAILER 0x10000000
48#define CHAIN_B_HEADER 0x20000000
49#define CHAIN_B_TRAILER 0x30000000
50#define ERROR 0x60000000
51#define FILLER 0x70000000
52
53//define TRM ACQ status
54#define PACKING_ENABLED_ACQ 0x0
55#define LEADING_ONLY_ACQ 0x1
56#define TRAILING_ONLY_ACQ 0x2
57#define PACKING_DISABLED_ACQ 0x3
58
59//define TDC hit PS status
60#define PACKED_HIT_PS 0x0
61#define LEADING_HIT_PS 0x1
62#define TRAILING_HIT_PS 0x2
63#define TOT_OVF_HIT_PS 0x3
64
65//define mandatory numbers
66#define N_EQUIPMENT 72
67#define N_DDL N_EQUIPMENT
68#define N_TRM 10
69#define N_CHAIN 2
70#define N_TDC 15
71#define N_CHANNEL 8
72#define TRM_FIRST_SLOT_ID 3
73#define TRM_LAST_SLOT_ID 12
74
75#define TIME_BIN_WIDTH 24.4e-3//ns
76#define TOT_BIN_WIDTH 48.8e-3//ns
77#define TIME_TO_TOT_BIN_WIDTH ( TIME_BIN_WIDTH / TOT_BIN_WIDTH )
78#define TOT_TO_TIME_BIN_WIDTH ( TOT_BIN_WIDTH / TIME_BIN_WIDTH )
79
80//max hit number in a TDC
81#define MAX_TDC_HIT_NUMBER 100
82//max TDC errors
83#define MAX_TDC_ERROR_NUMBER 1000
84//max hit number in a TRM
85#define MAX_TRM_HIT_NUMBER 2400
2531be5d 86
87#include "TObject.h"
88#include "AliTOFRawDataFormat.h"
b66e2b4b 89//#include "AliTOFHitData.h"
5c7c93fa 90//#include "AliTOFHitDataBuffer.h"
91//#include "AliTOFGeometry.h"
92
b66e2b4b 93class AliTOFHitData;
5c7c93fa 94class AliTOFHitDataBuffer;
2531be5d 95
96class AliTOFDecoder : public TObject
97{
98 public:
99 AliTOFDecoder(); //default constructor
100 AliTOFDecoder(AliTOFHitDataBuffer *DB, AliTOFHitDataBuffer *PDB); //constructor
101 AliTOFDecoder(const AliTOFDecoder &source); //copy constructor
102 AliTOFDecoder &operator = (const AliTOFDecoder &source); //operator =
103 ~AliTOFDecoder(); //distructor
104
105 Bool_t Decode(UInt_t *rawData, Int_t nWords); //main decode function
106 void SetVerbose(Int_t Verbose = 1) {fVerbose = Verbose;}; //set verbose level
107 void SetV2718Patch(Bool_t V2718Patch = kTRUE) {fV2718Patch = V2718Patch;}; //set V2718 patch (no DRM)
108 void SetDataBuffer(AliTOFHitDataBuffer *DB) {fDataBuffer = DB;}; //set up data buffer
109 void SetPackedDataBuffer(AliTOFHitDataBuffer *PDB) {fPackedDataBuffer = PDB;}; //set up packed data buffer
974c1ccc 110
111 void GetArrayDDL(Int_t* array, Int_t iDDL); // method to return array of TOFchannels corresponding to a given DDL id
112
113enum {
114 kMinPlate0=0,kMaxPlate0=2,
115 kMinStrip0=0,kMaxStrip0=6,
116 kMinPadz0=0,kMaxPadz0=1,
117 kMinPadx0=0,kMaxPadx0=23,
118
119 kMinPlate1=0,kMaxPlate1=2,
120 kMinStrip1=0,kMaxStrip1=7,
121 kMinPadz1=0,kMaxPadz1=1,
122 kMinPadx1=24,kMaxPadx1=47,
123
124 kMinPlate2=2,kMaxPlate2=4,
125 kMinStrip2=8,kMaxStrip2=14,
126 kMinPadz2=0,kMaxPadz2=1,
127 kMinPadx2=24,kMaxPadx2=47,
128
129 kMinPlate3=2,kMaxPlate3=4,
130 kMinStrip3=7,kMaxStrip3=14,
131 kMinPadz3=0,kMaxPadz3=1,
132 kMinPadx3=0,kMaxPadx3=23
133
134};
135
136
2531be5d 137 private:
138 /* SPIDER
139 * - Software Packing Inside Decoding Routines -
140 * developed by Roberto Preghenella (R+)
141 * use at your own risk
142 */
143 Bool_t InitializeSpider(); //initialize SPIDER routine
144 Bool_t ResetSpider(); //reset SPIDER routine
145 Bool_t Spider(AliTOFHitData hitData); //main SPIDER routine
146
147 Int_t fVerbose; //verbose flag
148 Bool_t fV2718Patch; //V2718 patch flag
149 AliTOFHitDataBuffer *fDataBuffer; //data buffer pointer
150 AliTOFHitDataBuffer *fPackedDataBuffer; //packed data buffe pointer
151
152 //decoding objects
153 AliTOFTRMGlobalHeader *fTRMGlobalHeader; //TRM global header
154 AliTOFTRMGlobalTrailer *fTRMGlobalTrailer; //TRM global trailer
155 AliTOFTRMChainHeader *fTRMChainHeader; //TRM chain header
156 AliTOFTRMChainTrailer *fTRMChainTrailer; //TRM chain trailer
157 AliTOFTDCPackedHit *fTDCPackedHit; //TDC packed hit
158 AliTOFTDCUnpackedHit *fTDCUnpackedHit; //TDC unpacked hit
159 AliTOFTRMTDCError *fTRMTDCError; //TRM TDC error
160 AliTOFTRMDiagnosticErrorWord1 *fTRMDiagnosticErrorWord1; //TRM diagnostic error word 1
161 AliTOFTRMDiagnosticErrorWord2 *fTRMDiagnosticErrorWord2; //TRM diagnostica error word 2
162
163 //SPIDER variables
164 Int_t fSpiderCurrentSlotID; //SPIDER current slot ID
165 Int_t fSpiderCurrentChain; //SPIDER current chain
166 Int_t fSpiderCurrentTDC; //SPIDER current TDC
167 Bool_t fSpiderLeadingFlag[N_CHANNEL]; //SPIDER channel leading flag
168 AliTOFHitData fSpiderLeadingHit[N_CHANNEL]; //SPIDER channel leading hit
169
974c1ccc 170 ClassDef(AliTOFDecoder, 2)
2531be5d 171};
172
173#endif /* ALITOFDECODER_H */