]>
Commit | Line | Data |
---|---|---|
8309c1ab | 1 | #ifndef ALIZDCRAWSTREAM_H |
2 | #define ALIZDCRAWSTREAM_H | |
3 | /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * | |
4 | * See cxx source for full Copyright notice */ | |
5 | ||
6 | /* $Id$ */ | |
7 | ||
1ee299a5 | 8 | ////////////////////////////////////////////////// |
9 | // // | |
10 | // Class to provide access to ZDC raw data // | |
11 | // Author: Chiara Oppedisano // | |
12 | // // | |
13 | ////////////////////////////////////////////////// | |
8309c1ab | 14 | |
15 | #include <TObject.h> | |
fee50699 | 16 | #include "AliCDBManager.h" |
17 | #include "AliCDBStorage.h" | |
18 | #include "AliZDCChMap.h" | |
8309c1ab | 19 | |
20 | class AliRawReader; | |
1ee299a5 | 21 | class AliRawDataHeader; |
8309c1ab | 22 | |
23 | ||
24 | class AliZDCRawStream: public TObject { | |
25 | public : | |
27afc0c8 | 26 | |
27 | // Module type codes | |
28 | enum{kV965=1, kV830=2, kTRG=3, kTRGI=4, kPU=5}; | |
29 | ||
30 | // Signal codes for ZDC | |
31 | // Same codes used in DAQ configuration file | |
32 | // To be changed ONLY IF this file is changed!!! | |
33 | // **** DO NOT CHANGE THE FOLLOWING LINES!!! **** | |
34 | enum ZDCSignal{kNotConnected=0, kVoid=1, | |
35 | kZNAC=2, kZNA1=3, kZNA2=4, kZNA3=5, kZNA4=6, | |
36 | kZPAC=7, kZPA1=8, kZPA2=9, kZPA3=10, kZPA4=11, | |
37 | kZNCC=12, kZNC1=13, kZNC2=14, kZNC3=15, kZNC4=16, | |
38 | kZPCC=17, kZPC1=18, kZPC2=19, kZPC3=20, kZPC4=21, | |
39 | kZEM1=22, kZEM2=23, | |
40 | kZDCAMon=24, kZDCCMon=25, | |
41 | kZNACoot=26, kZNA1oot=27, kZNA2oot=28, kZNA3oot=29, kZNA4oot=30, | |
42 | kZPACoot=31, kZPA1oot=32, kZPA2oot=33, kZPA3oot=34, kZPA4oot=35, | |
43 | kZNCCoot=36, kZNC1oot=37, kZNC2oot=38, kZNC3oot=39, kZNC4oot=40, | |
44 | kZPCCoot=41, kZPC1oot=42, kZPC2oot=43, kZPC3oot=44, kZPC4oot=45, | |
45 | kZEM1oot=46, kZEM2oot=47, | |
46 | kZDCAMonoot=48, kZDCCMonoot=49, | |
47 | kL1MBI=50, kL1CNI=51, kL1SCI=52, kL1EMDI=53, kL0I=54, | |
48 | kL1MBO=55, kL1CNO=56, kL1SCO=57, kL1EMDO=58, | |
49 | kHMBCN=59, kHSCEMD=60, | |
50 | kZNACD=61, kZNA1CD=62, kZNA2D=63, kZNA3D=64, kZNA4D=65, | |
51 | kZPACD=66, kZPA1CD=67, kZPA2D=68, kZPA3D=69, kZPA4D=70, | |
52 | kZNCCD=71, kZNC1CD=72, kZNC2D=73, kZNC3D=74, kZNC4D=75, | |
53 | kZPCCD=76, kZPC1CD=77, kZPC2D=78, kZPC3D=79, kZPC4D=80, | |
54 | kZEM1D=81, kZEM2D=82, | |
55 | kZDCAMonD=83, kZDCCMonD=84, | |
56 | kZNAD=85, kZPAD=86, kZNCD=87, kZPCD=88, kZEMD=89}; | |
57 | ||
58 | // Error codes in raw data streaming | |
59 | enum EZDCRawStreamError{ | |
60 | kCDHError = 1, | |
61 | kDARCError = 2, | |
62 | kZDCDataError = 3, | |
63 | kInvalidADCModule = 4, | |
64 | kInvalidSector = 5}; | |
65 | ||
cc2abffd | 66 | AliZDCRawStream(AliRawReader* rawReader); |
8309c1ab | 67 | virtual ~AliZDCRawStream(); |
8309c1ab | 68 | virtual Bool_t Next(); |
c93c022b | 69 | |
70 | virtual void ReadChMap(); | |
8309c1ab | 71 | |
1ee299a5 | 72 | virtual void ReadCDHHeader(); |
8309c1ab | 73 | |
44455047 | 74 | UInt_t GetRawBuffer() const {return fBuffer;} |
75 | Int_t GetReadOutCard() const {return fReadOutCard;} | |
1ee299a5 | 76 | |
c93c022b | 77 | Int_t GetDeadfaceOffset() const {return fDeadfaceOffset;} |
78 | Int_t GetDeadbeefOffset() const {return fDeadbeefOffset;} | |
79 | Int_t GetDataOffset() const {return fDataOffset;} | |
80 | ||
81 | Int_t GetSector(Int_t i) const {return fSector[i];} | |
82 | Int_t GetModType() const {return fModType;} | |
83 | Int_t GetADCModule() const {return fADCModule;} | |
84 | Int_t GetADCNChannels() const {return fADCNChannels;} | |
85 | Int_t GetADCChannel() const {return fADCChannel;} | |
86 | Int_t GetADCValue() const {return fADCValue;} | |
87 | Int_t GetADCGain() const {return fADCGain;} | |
fee50699 | 88 | |
fee50699 | 89 | AliCDBStorage *SetStorage(const char* uri); |
c3986754 | 90 | |
91 | // Map from OCDB | |
fee50699 | 92 | AliZDCChMap *GetChMap() const; |
c3986754 | 93 | // ADC map |
9d0b658a | 94 | Int_t GetNChannelsOn() const {return fNChannelsOn;} |
fee50699 | 95 | Int_t GetCabledSignal() const {return fCabledSignal;} |
c93c022b | 96 | Int_t GetADCModFromMap(Int_t i) const {return fMapADC[i][0];} |
97 | Int_t GetADCChFromMap(Int_t i) const {return fMapADC[i][1];} | |
98 | Int_t GetADCSignFromMap(Int_t i) const {return fMapADC[i][2];} | |
99 | Int_t GetDetectorFromMap(Int_t i) const {return fMapADC[i][3];} | |
100 | Int_t GetTowerFromMap(Int_t i) const {return fMapADC[i][4];} | |
c3986754 | 101 | // Scaler map |
102 | Int_t GetScalerModFromMap(Int_t i) const {return fScalerMap[i][0];} | |
103 | Int_t GetScalerChFromMap(Int_t i) const {return fScalerMap[i][1];} | |
104 | Int_t GetScalerSignFromMap(Int_t i) const {return fScalerMap[i][2];} | |
105 | Int_t GetScDetectorFromMap(Int_t i) const {return fScalerMap[i][3];} | |
106 | Int_t GetScTowerFromMap(Int_t i) const {return fScalerMap[i][4];} | |
107 | ||
108 | Bool_t IsCalibration() const {return fIsCalib;} | |
109 | Bool_t IsDARCHeader() const {return fIsDARCHeader;} | |
110 | Bool_t IsHeaderMapping() const {return fIsHeaderMapping;} | |
111 | Bool_t IsChMapping() const {return fIsChMapping;} | |
112 | Bool_t IsADCDataWord() const {return fIsADCDataWord;} | |
113 | Bool_t IsADCHeader() const {return fIsADCHeader;} | |
114 | Bool_t IsADCEOB() const {return fIsADCEOB;} | |
115 | Bool_t IsUnderflow() const {return fIsUnderflow;} | |
116 | Bool_t IsOverflow() const {return fIsOverflow;} | |
e42bdf10 | 117 | |
da090841 | 118 | UInt_t GetScGeo() const {return fScGeo;} |
119 | UInt_t GetScNWords() const {return fScNWords;} | |
c083685e | 120 | UInt_t GetScTriggerSource() const {return fScTriggerSource;} |
da090841 | 121 | UInt_t GetTriggerNumber() const {return fScTriggerNumber;} |
122 | UInt_t GetTriggerCount() const {return fScEvCounter;} | |
f70a5526 | 123 | Bool_t IsScHeaderRead() const {return fIsScHeaderRead;} |
81f09162 | 124 | Bool_t IsScEventGood() const {return fIsScEventGood;} |
da090841 | 125 | |
126 | UInt_t GetDetectorPattern() const {return fDetPattern;} | |
127 | ||
81f09162 | 128 | Bool_t IstriggerHistoryWord() const {return fIsTriggerHistory;} |
da090841 | 129 | Int_t GetTriggerInput2CTP() const {return *fCPTInput;} |
130 | Bool_t IsCPTInputMBTrigger() | |
131 | {if(fCPTInput[0]==1) return kTRUE; else return kFALSE;} | |
132 | Bool_t IsCPTInputCentralTrigger() | |
133 | {if(fCPTInput[1]==1) return kTRUE; else return kFALSE;} | |
134 | Bool_t IsCPTInputSemiCentralTrigger() | |
135 | {if(fCPTInput[2]==1) return kTRUE; else return kFALSE;} | |
136 | Bool_t IsCPTInputEMDTrigger() | |
137 | {if(fCPTInput[3]==1) return kTRUE; else return kFALSE;} | |
138 | ||
f70a5526 | 139 | Bool_t IsADCEventGood() const {return fIsADCEventGood;} |
140 | Bool_t IsL0BitSet() const {return fIsL0BitSet;} | |
141 | Bool_t IsPileUpEvent() const {return fIsPileUpEvent;} | |
9d0b658a | 142 | |
143 | void SetNChannelsOn(Int_t val) {fNChannelsOn = val;} | |
1ee299a5 | 144 | void SetSector(Int_t i, Int_t val) {fSector[i] = val;} |
145 | void SetMapADCMod(Int_t iraw, Int_t imod) {fMapADC[iraw][0]=imod;} | |
fee50699 | 146 | void SetMapADCCh(Int_t iraw, Int_t ich) {fMapADC[iraw][1]=ich;} |
1ee299a5 | 147 | void SetMapADCSig(Int_t iraw, Int_t isig) {fMapADC[iraw][2]=isig;} |
fee50699 | 148 | void SetMapDet(Int_t iraw, Int_t idet) {fMapADC[iraw][3]=idet;} |
149 | void SetMapTow(Int_t iraw, Int_t itow) {fMapADC[iraw][4]=itow;} | |
150 | ||
151 | void SetSODReading(Bool_t iset) {fSODReading = iset;} | |
27afc0c8 | 152 | |
8309c1ab | 153 | private : |
154 | AliZDCRawStream(const AliZDCRawStream& stream); | |
155 | AliZDCRawStream& operator = (const AliZDCRawStream& stream); | |
156 | ||
1ee299a5 | 157 | AliRawReader* fRawReader; // object for reading the raw data |
f9f99efb | 158 | |
159 | // Data for buffer decoding | |
44455047 | 160 | UInt_t fBuffer; // [DARC header +] ADC buffer |
161 | Int_t fReadOutCard; // 0 for DARC, 1 for ZRC | |
1ee299a5 | 162 | UInt_t fEvType; // Event type |
163 | Int_t fPosition; // bit position in buffer data word | |
164 | ||
f9f99efb | 165 | // Boolean variables indicating data type |
1ee299a5 | 166 | Bool_t fIsCalib; // True when calibration run |
167 | Bool_t fIsDARCHeader; // True when DARC header | |
c3986754 | 168 | Bool_t fIsHeaderMapping; // True when reading header mapping |
1ee299a5 | 169 | Bool_t fIsChMapping; // True when reading ch. mapping |
170 | Bool_t fIsADCDataWord; // True when data word | |
171 | Bool_t fIsADCHeader; // True when ADC header | |
172 | Bool_t fIsADCEOB; // True when EOB | |
fee50699 | 173 | Bool_t fSODReading; // True when reading SOD (DA) |
174 | Bool_t fIsMapRead; // True if map is already read | |
1ee299a5 | 175 | |
1ee299a5 | 176 | Int_t fDeadfaceOffset; // deadface offset |
177 | Int_t fDeadbeefOffset; // deadbeef offset | |
178 | Int_t fDataOffset; // data offset | |
179 | ||
180 | // ADC signal | |
181 | Int_t fSector[2]; // [detector, sector] | |
182 | Int_t fModType; // Module type | |
c3986754 | 183 | Int_t fADCModule; // ADC module = GEO address for scaler, trigger card, P.U. |
1ee299a5 | 184 | Int_t fADCNChannels; // number of ADC ch. |
c3986754 | 185 | Int_t fADCChannel; // ADC channel = ch. for scaler, trigger card, P.U. |
1ee299a5 | 186 | Int_t fADCValue; // ADC channel |
187 | Int_t fADCGain; // ADC gain (0=high range; 1=low range) | |
c33b6ca6 | 188 | Bool_t fIsUnderflow; // ADC underflow |
189 | Bool_t fIsOverflow; // ADC overflow | |
1ee299a5 | 190 | |
e42bdf10 | 191 | // Scaler |
e42bdf10 | 192 | UInt_t fScGeo; // scaler GEO address |
c083685e | 193 | UInt_t fScNWords; // no. of words in scaler event |
194 | UInt_t fScTriggerSource; // Trigger source | |
e42bdf10 | 195 | UInt_t fScTriggerNumber; // no. of triggers |
f70a5526 | 196 | Bool_t fIsScEventGood; // true if scaler event is good |
197 | Bool_t fIsScHeaderRead; // true if scaler header is read | |
c083685e | 198 | Int_t fScStartCounter; // position in the buffer where scaler data begins |
199 | UInt_t fScEvCounter; // event counter | |
e42bdf10 | 200 | |
da090841 | 201 | // Pattern Unit |
202 | UInt_t fDetPattern; // word from the pattern unit | |
203 | ||
204 | // Trigger card | |
205 | // (1) trigger counts | |
206 | Int_t fTrigCountNWords; // no. of words to read from trigger card scalers | |
81f09162 | 207 | Bool_t fIsTriggerScaler; // Trigger card scalers - 1st word read |
da090841 | 208 | Int_t fTrigCountStart; // Trigger card scalers - counter |
209 | Int_t fMBTrigInput; // MB trigger input to trigger card | |
210 | Int_t fCentralTrigInput; // CENTRAL trigger input to trigger card | |
211 | Int_t fSCentralTrigInput;// SEMICENTRAL trigger input to trigger card | |
212 | Int_t fEMDTrigInput; // EMD trigger input to trigger card | |
213 | Int_t fL0Received; // L0 received by the trigger card | |
214 | Int_t fMBtrig2CTP; // trigger input to the CTP for MB | |
215 | Int_t fCentralTrig2CTP; // trigger input to the CTP for CENTRAL | |
216 | Int_t fSCentralTrig2CTP; // trigger input to the CTP for SEMICENTRAL | |
217 | Int_t fEMDTrig2CTP; // trigger input to the CTP for EMD | |
218 | // (2) trigger history | |
219 | Int_t fTrigHistNWords; // no. of words to read from trigger history data | |
f70a5526 | 220 | Bool_t fIsTriggerHistory; // Trigger history - 1st word read |
221 | Int_t fTrigHistStart; // Trigger card history - counter | |
da090841 | 222 | Int_t fPileUpBit1stWord; // Pile up bit from 1st word |
223 | Int_t fL0Bit1stWord; // L0 bit from 1st word | |
224 | UInt_t fCentralTrigHist; // history for CENTRAL trigger | |
225 | UInt_t fMBTrigHist; // history for CENTRAL trigger | |
226 | Int_t fPileUpBit2ndWord; // Pile up bit from 2nd word | |
227 | Int_t fL0Bit2ndWord; // L0 bit from 2nd word | |
228 | UInt_t fSCentralTrigHist; // history for SEMICENTRAL trigger | |
229 | UInt_t fEMDTrigHist; // history for EMD trigger | |
230 | Int_t fCPTInput[4]; // Trigger sent to the CTP | |
231 | ||
1ee299a5 | 232 | // Channel mapping |
c3986754 | 233 | Int_t fNChannelsOn; // No. of signals/ADC ch. used |
234 | Int_t fCurrentCh; // current mapped ADC ch. | |
235 | Int_t fCabledSignal; // physics signal (from enum) | |
236 | Int_t fMapADC[48][5]; // ADC map {ADC mod., ch., signal, det., sec.} | |
237 | Int_t fCurrScCh; // current mapped scaler ch. | |
238 | Int_t fScalerMap[32][5]; // Scaler map {Scaler mod., ch., signal, det., sec.} | |
239 | ||
240 | // Checks over raw data event quality | |
da090841 | 241 | Bool_t fIsADCEventGood; // true if not valid datum not corrupted |
242 | Bool_t fIsL0BitSet; // true if L0 bit in history words = 1 | |
243 | Bool_t fIsPileUpEvent; // true if pile up bits in history words = 0 | |
c3986754 | 244 | |
44455047 | 245 | ClassDef(AliZDCRawStream, 15) // class for reading ZDC raw data |
8309c1ab | 246 | }; |
247 | ||
248 | #endif |