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