]>
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;} |
da090841 | 124 | |
125 | UInt_t GetDetectorPattern() const {return fDetPattern;} | |
126 | ||
127 | Int_t GetTriggerInput2CTP() const {return *fCPTInput;} | |
128 | Bool_t IsCPTInputMBTrigger() | |
129 | {if(fCPTInput[0]==1) return kTRUE; else return kFALSE;} | |
130 | Bool_t IsCPTInputCentralTrigger() | |
131 | {if(fCPTInput[1]==1) return kTRUE; else return kFALSE;} | |
132 | Bool_t IsCPTInputSemiCentralTrigger() | |
133 | {if(fCPTInput[2]==1) return kTRUE; else return kFALSE;} | |
134 | Bool_t IsCPTInputEMDTrigger() | |
135 | {if(fCPTInput[3]==1) return kTRUE; else return kFALSE;} | |
136 | ||
f70a5526 | 137 | Bool_t IsADCEventGood() const {return fIsADCEventGood;} |
138 | Bool_t IsL0BitSet() const {return fIsL0BitSet;} | |
139 | Bool_t IsPileUpEvent() const {return fIsPileUpEvent;} | |
9d0b658a | 140 | |
141 | void SetNChannelsOn(Int_t val) {fNChannelsOn = val;} | |
1ee299a5 | 142 | void SetSector(Int_t i, Int_t val) {fSector[i] = val;} |
143 | void SetMapADCMod(Int_t iraw, Int_t imod) {fMapADC[iraw][0]=imod;} | |
fee50699 | 144 | void SetMapADCCh(Int_t iraw, Int_t ich) {fMapADC[iraw][1]=ich;} |
1ee299a5 | 145 | void SetMapADCSig(Int_t iraw, Int_t isig) {fMapADC[iraw][2]=isig;} |
fee50699 | 146 | void SetMapDet(Int_t iraw, Int_t idet) {fMapADC[iraw][3]=idet;} |
147 | void SetMapTow(Int_t iraw, Int_t itow) {fMapADC[iraw][4]=itow;} | |
148 | ||
149 | void SetSODReading(Bool_t iset) {fSODReading = iset;} | |
27afc0c8 | 150 | |
8309c1ab | 151 | private : |
152 | AliZDCRawStream(const AliZDCRawStream& stream); | |
153 | AliZDCRawStream& operator = (const AliZDCRawStream& stream); | |
154 | ||
1ee299a5 | 155 | AliRawReader* fRawReader; // object for reading the raw data |
f9f99efb | 156 | |
157 | // Data for buffer decoding | |
44455047 | 158 | UInt_t fBuffer; // [DARC header +] ADC buffer |
159 | Int_t fReadOutCard; // 0 for DARC, 1 for ZRC | |
1ee299a5 | 160 | UInt_t fEvType; // Event type |
161 | Int_t fPosition; // bit position in buffer data word | |
162 | ||
f9f99efb | 163 | // Boolean variables indicating data type |
1ee299a5 | 164 | Bool_t fIsCalib; // True when calibration run |
165 | Bool_t fIsDARCHeader; // True when DARC header | |
c3986754 | 166 | Bool_t fIsHeaderMapping; // True when reading header mapping |
1ee299a5 | 167 | Bool_t fIsChMapping; // True when reading ch. mapping |
168 | Bool_t fIsADCDataWord; // True when data word | |
169 | Bool_t fIsADCHeader; // True when ADC header | |
170 | Bool_t fIsADCEOB; // True when EOB | |
fee50699 | 171 | Bool_t fSODReading; // True when reading SOD (DA) |
172 | Bool_t fIsMapRead; // True if map is already read | |
1ee299a5 | 173 | |
1ee299a5 | 174 | Int_t fDeadfaceOffset; // deadface offset |
175 | Int_t fDeadbeefOffset; // deadbeef offset | |
176 | Int_t fDataOffset; // data offset | |
177 | ||
178 | // ADC signal | |
179 | Int_t fSector[2]; // [detector, sector] | |
180 | Int_t fModType; // Module type | |
c3986754 | 181 | Int_t fADCModule; // ADC module = GEO address for scaler, trigger card, P.U. |
1ee299a5 | 182 | Int_t fADCNChannels; // number of ADC ch. |
c3986754 | 183 | Int_t fADCChannel; // ADC channel = ch. for scaler, trigger card, P.U. |
1ee299a5 | 184 | Int_t fADCValue; // ADC channel |
185 | Int_t fADCGain; // ADC gain (0=high range; 1=low range) | |
c33b6ca6 | 186 | Bool_t fIsUnderflow; // ADC underflow |
187 | Bool_t fIsOverflow; // ADC overflow | |
1ee299a5 | 188 | |
e42bdf10 | 189 | // Scaler |
e42bdf10 | 190 | UInt_t fScGeo; // scaler GEO address |
c083685e | 191 | UInt_t fScNWords; // no. of words in scaler event |
192 | UInt_t fScTriggerSource; // Trigger source | |
e42bdf10 | 193 | UInt_t fScTriggerNumber; // no. of triggers |
f70a5526 | 194 | Bool_t fIsScEventGood; // true if scaler event is good |
195 | Bool_t fIsScHeaderRead; // true if scaler header is read | |
c083685e | 196 | Int_t fScStartCounter; // position in the buffer where scaler data begins |
197 | UInt_t fScEvCounter; // event counter | |
e42bdf10 | 198 | |
da090841 | 199 | // Pattern Unit |
200 | UInt_t fDetPattern; // word from the pattern unit | |
201 | ||
202 | // Trigger card | |
203 | // (1) trigger counts | |
204 | Int_t fTrigCountNWords; // no. of words to read from trigger card scalers | |
f70a5526 | 205 | Bool_t fIsTriggerScaler;// Trigger card scalers - 1st word read |
da090841 | 206 | Int_t fTrigCountStart; // Trigger card scalers - counter |
207 | Int_t fMBTrigInput; // MB trigger input to trigger card | |
208 | Int_t fCentralTrigInput; // CENTRAL trigger input to trigger card | |
209 | Int_t fSCentralTrigInput;// SEMICENTRAL trigger input to trigger card | |
210 | Int_t fEMDTrigInput; // EMD trigger input to trigger card | |
211 | Int_t fL0Received; // L0 received by the trigger card | |
212 | Int_t fMBtrig2CTP; // trigger input to the CTP for MB | |
213 | Int_t fCentralTrig2CTP; // trigger input to the CTP for CENTRAL | |
214 | Int_t fSCentralTrig2CTP; // trigger input to the CTP for SEMICENTRAL | |
215 | Int_t fEMDTrig2CTP; // trigger input to the CTP for EMD | |
216 | // (2) trigger history | |
217 | Int_t fTrigHistNWords; // no. of words to read from trigger history data | |
f70a5526 | 218 | Bool_t fIsTriggerHistory; // Trigger history - 1st word read |
219 | Int_t fTrigHistStart; // Trigger card history - counter | |
da090841 | 220 | Int_t fPileUpBit1stWord; // Pile up bit from 1st word |
221 | Int_t fL0Bit1stWord; // L0 bit from 1st word | |
222 | UInt_t fCentralTrigHist; // history for CENTRAL trigger | |
223 | UInt_t fMBTrigHist; // history for CENTRAL trigger | |
224 | Int_t fPileUpBit2ndWord; // Pile up bit from 2nd word | |
225 | Int_t fL0Bit2ndWord; // L0 bit from 2nd word | |
226 | UInt_t fSCentralTrigHist; // history for SEMICENTRAL trigger | |
227 | UInt_t fEMDTrigHist; // history for EMD trigger | |
228 | Int_t fCPTInput[4]; // Trigger sent to the CTP | |
229 | ||
1ee299a5 | 230 | // Channel mapping |
c3986754 | 231 | Int_t fNChannelsOn; // No. of signals/ADC ch. used |
232 | Int_t fCurrentCh; // current mapped ADC ch. | |
233 | Int_t fCabledSignal; // physics signal (from enum) | |
234 | Int_t fMapADC[48][5]; // ADC map {ADC mod., ch., signal, det., sec.} | |
235 | Int_t fCurrScCh; // current mapped scaler ch. | |
236 | Int_t fScalerMap[32][5]; // Scaler map {Scaler mod., ch., signal, det., sec.} | |
237 | ||
238 | // Checks over raw data event quality | |
da090841 | 239 | Bool_t fIsADCEventGood; // true if not valid datum not corrupted |
240 | Bool_t fIsL0BitSet; // true if L0 bit in history words = 1 | |
241 | Bool_t fIsPileUpEvent; // true if pile up bits in history words = 0 | |
c3986754 | 242 | |
44455047 | 243 | ClassDef(AliZDCRawStream, 15) // class for reading ZDC raw data |
8309c1ab | 244 | }; |
245 | ||
246 | #endif |