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 */
8 //////////////////////////////////////////////////
10 // Class to provide access to ZDC raw data //
11 // Author: Chiara Oppedisano //
13 //////////////////////////////////////////////////
16 #include "AliCDBManager.h"
17 #include "AliCDBStorage.h"
18 #include "AliZDCChMap.h"
21 class AliRawDataHeader;
24 class AliZDCRawStream: public TObject {
26 AliZDCRawStream(AliRawReader* rawReader);
27 virtual ~AliZDCRawStream();
28 virtual Bool_t Next();
30 virtual void ReadChMap();
32 virtual void ReadCDHHeader();
34 UInt_t GetRawBuffer() const {return fBuffer;}
36 Int_t GetDeadfaceOffset() const {return fDeadfaceOffset;}
37 Int_t GetDeadbeefOffset() const {return fDeadbeefOffset;}
38 Int_t GetDataOffset() const {return fDataOffset;}
40 Int_t GetSector(Int_t i) const {return fSector[i];}
41 Int_t GetModType() const {return fModType;}
42 Int_t GetADCModule() const {return fADCModule;}
43 Int_t GetADCNChannels() const {return fADCNChannels;}
44 Int_t GetADCChannel() const {return fADCChannel;}
45 Int_t GetADCValue() const {return fADCValue;}
46 Int_t GetADCGain() const {return fADCGain;}
48 AliCDBStorage *SetStorage(const char* uri);
51 AliZDCChMap *GetChMap() const;
53 Int_t GetNChannelsOn() const {return fNChannelsOn;}
54 Int_t GetCabledSignal() const {return fCabledSignal;}
55 Int_t GetADCModFromMap(Int_t i) const {return fMapADC[i][0];}
56 Int_t GetADCChFromMap(Int_t i) const {return fMapADC[i][1];}
57 Int_t GetADCSignFromMap(Int_t i) const {return fMapADC[i][2];}
58 Int_t GetDetectorFromMap(Int_t i) const {return fMapADC[i][3];}
59 Int_t GetTowerFromMap(Int_t i) const {return fMapADC[i][4];}
61 Int_t GetScalerModFromMap(Int_t i) const {return fScalerMap[i][0];}
62 Int_t GetScalerChFromMap(Int_t i) const {return fScalerMap[i][1];}
63 Int_t GetScalerSignFromMap(Int_t i) const {return fScalerMap[i][2];}
64 Int_t GetScDetectorFromMap(Int_t i) const {return fScalerMap[i][3];}
65 Int_t GetScTowerFromMap(Int_t i) const {return fScalerMap[i][4];}
67 Bool_t IsCalibration() const {return fIsCalib;}
68 Bool_t IsDARCHeader() const {return fIsDARCHeader;}
69 Bool_t IsHeaderMapping() const {return fIsHeaderMapping;}
70 Bool_t IsChMapping() const {return fIsChMapping;}
71 Bool_t IsADCDataWord() const {return fIsADCDataWord;}
72 Bool_t IsADCHeader() const {return fIsADCHeader;}
73 Bool_t IsADCEOB() const {return fIsADCEOB;}
74 Bool_t IsUnderflow() const {return fIsUnderflow;}
75 Bool_t IsOverflow() const {return fIsOverflow;}
77 UInt_t GetScGeo() const {return fScGeo;}
78 UInt_t GetScNWords() const {return fScNWords;}
79 UInt_t GetScTriggerSource() const {return fScTriggerSource;}
80 UInt_t GetTriggerNumber() const {return fScTriggerNumber;}
81 UInt_t GetTriggerCount() const {return fScEvCounter;}
83 UInt_t GetDetectorPattern() const {return fDetPattern;}
85 Int_t GetTriggerInput2CTP() const {return *fCPTInput;}
86 Bool_t IsCPTInputMBTrigger()
87 {if(fCPTInput[0]==1) return kTRUE; else return kFALSE;}
88 Bool_t IsCPTInputCentralTrigger()
89 {if(fCPTInput[1]==1) return kTRUE; else return kFALSE;}
90 Bool_t IsCPTInputSemiCentralTrigger()
91 {if(fCPTInput[2]==1) return kTRUE; else return kFALSE;}
92 Bool_t IsCPTInputEMDTrigger()
93 {if(fCPTInput[3]==1) return kTRUE; else return kFALSE;}
95 Bool_t IsEventGood() const {return fIsADCEventGood;}
96 Bool_t IsL0BitSet() const {return fIsL0BitSet;}
97 Bool_t IsPileUpEvent() const {return fIsPileUpEvent;}
99 void SetNChannelsOn(Int_t val) {fNChannelsOn = val;}
100 void SetSector(Int_t i, Int_t val) {fSector[i] = val;}
101 void SetMapADCMod(Int_t iraw, Int_t imod) {fMapADC[iraw][0]=imod;}
102 void SetMapADCCh(Int_t iraw, Int_t ich) {fMapADC[iraw][1]=ich;}
103 void SetMapADCSig(Int_t iraw, Int_t isig) {fMapADC[iraw][2]=isig;}
104 void SetMapDet(Int_t iraw, Int_t idet) {fMapADC[iraw][3]=idet;}
105 void SetMapTow(Int_t iraw, Int_t itow) {fMapADC[iraw][4]=itow;}
107 void SetSODReading(Bool_t iset) {fSODReading = iset;}
109 // Error codes in raw data streaming
110 enum EZDCRawStreamError{
114 kInvalidADCModule = 4,
118 enum{kV965=1, kV830=2, kTRG=3, kTRGI=4, kPU=5};
120 // Signal codes for ZDC
121 // Same codes used in DAQ configuration file
122 // To be changed ONLY IF this file is changed!!!
123 // **** DO NOT CHANGE THE FOLLOWING LINES!!! ****
124 enum ZDCSignal{kNotConnected=0, kVoid=1,
125 kZNAC=2, kZNA1=3, kZNA2=4, kZNA3=5, kZNA4=6,
126 kZPAC=7, kZPA1=8, kZPA2=9, kZPA3=10, kZPA4=11,
127 kZNCC=12, kZNC1=13, kZNC2=14, kZNC3=15, kZNC4=16,
128 kZPCC=17, kZPC1=18, kZPC2=19, kZPC3=20, kZPC4=21,
130 kZDCAMon=24, kZDCCMon=25,
131 kZNACoot=26, kZNA1oot=27, kZNA2oot=28, kZNA3oot=29, kZNA4oot=30,
132 kZPACoot=31, kZPA1oot=32, kZPA2oot=33, kZPA3oot=34, kZPA4oot=35,
133 kZNCCoot=36, kZNC1oot=37, kZNC2oot=38, kZNC3oot=39, kZNC4oot=40,
134 kZPCCoot=41, kZPC1oot=42, kZPC2oot=43, kZPC3oot=44, kZPC4oot=45,
135 kZEM1oot=46, kZEM2oot=47,
136 kZDCAMonoot=48, kZDCCMonoot=49,
137 kL1MBI=50, kL1CNI=51, kL1SCI=52, kL1EMDI=53, kL0I=54,
138 kL1MBO=55, kL1CNO=56, kL1SCO=57, kL1EMDO=58,
139 kHMBCN=59, kHSCEMD=60};
142 AliZDCRawStream(const AliZDCRawStream& stream);
143 AliZDCRawStream& operator = (const AliZDCRawStream& stream);
145 AliRawReader* fRawReader; // object for reading the raw data
147 // Data for buffer decoding
148 UInt_t fBuffer; // DARC header + ADC buffer
149 UInt_t fEvType; // Event type
150 Int_t fPosition; // bit position in buffer data word
152 // Boolean variables indicating data type
153 Bool_t fIsCalib; // True when calibration run
154 Bool_t fIsDARCHeader; // True when DARC header
155 Bool_t fIsHeaderMapping; // True when reading header mapping
156 Bool_t fIsChMapping; // True when reading ch. mapping
157 Bool_t fIsADCDataWord; // True when data word
158 Bool_t fIsADCHeader; // True when ADC header
159 Bool_t fIsADCEOB; // True when EOB
160 Bool_t fSODReading; // True when reading SOD (DA)
161 Bool_t fIsMapRead; // True if map is already read
164 UInt_t fDARCEvBlockLenght; // DARC block length
165 UInt_t fDARCBlockAttributes;// DARC block attributes
167 Int_t fDeadfaceOffset; // deadface offset
168 Int_t fDeadbeefOffset; // deadbeef offset
169 Int_t fDataOffset; // data offset
172 Int_t fSector[2]; // [detector, sector]
173 Int_t fModType; // Module type
174 Int_t fADCModule; // ADC module = GEO address for scaler, trigger card, P.U.
175 Int_t fADCNChannels; // number of ADC ch.
176 Int_t fADCChannel; // ADC channel = ch. for scaler, trigger card, P.U.
177 Int_t fADCValue; // ADC channel
178 Int_t fADCGain; // ADC gain (0=high range; 1=low range)
179 Bool_t fIsUnderflow; // ADC underflow
180 Bool_t fIsOverflow; // ADC overflow
183 UInt_t fScGeo; // scaler GEO address
184 UInt_t fScNWords; // no. of words in scaler event
185 UInt_t fScTriggerSource; // Trigger source
186 UInt_t fScTriggerNumber; // no. of triggers
187 UInt_t fIsScEventGood; // true if scaler event is good
188 UInt_t fIsScHeaderRead; // true if scaler event is good
189 Int_t fScStartCounter; // position in the buffer where scaler data begins
190 UInt_t fScEvCounter; // event counter
193 UInt_t fDetPattern; // word from the pattern unit
196 // (1) trigger counts
197 Int_t fTrigCountNWords; // no. of words to read from trigger card scalers
198 Bool_t fIsTrig1stWordRead;// Trigger card scalers - 1st word read
199 Int_t fTrigCountStart; // Trigger card scalers - counter
200 Int_t fMBTrigInput; // MB trigger input to trigger card
201 Int_t fCentralTrigInput; // CENTRAL trigger input to trigger card
202 Int_t fSCentralTrigInput;// SEMICENTRAL trigger input to trigger card
203 Int_t fEMDTrigInput; // EMD trigger input to trigger card
204 Int_t fL0Received; // L0 received by the trigger card
205 Int_t fMBtrig2CTP; // trigger input to the CTP for MB
206 Int_t fCentralTrig2CTP; // trigger input to the CTP for CENTRAL
207 Int_t fSCentralTrig2CTP; // trigger input to the CTP for SEMICENTRAL
208 Int_t fEMDTrig2CTP; // trigger input to the CTP for EMD
209 // (2) trigger history
210 Int_t fTrigHistNWords; // no. of words to read from trigger history data
211 Bool_t fIsHist1stWordRead;// Trigger history - 1st word read
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
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.}
230 // Checks over raw data event quality
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
235 ClassDef(AliZDCRawStream, 12) // class for reading ZDC raw data