]> git.uio.no Git - u/mrichter/AliRoot.git/blame - ZDC/AliZDCRawStream.h
Added method AliAODRecoDecayHF::IsLikeSign()
[u/mrichter/AliRoot.git] / ZDC / AliZDCRawStream.h
CommitLineData
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
20class AliRawReader;
1ee299a5 21class AliRawDataHeader;
8309c1ab 22
23
24class 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
c93c022b 34 UInt_t GetRawBuffer() const {return fBuffer;}
1ee299a5 35
c93c022b 36 Int_t GetDeadfaceOffset() const {return fDeadfaceOffset;}
37 Int_t GetDeadbeefOffset() const {return fDeadbeefOffset;}
38 Int_t GetDataOffset() const {return fDataOffset;}
39
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;}
fee50699 47
fee50699 48 AliCDBStorage *SetStorage(const char* uri);
c3986754 49
50 // Map from OCDB
fee50699 51 AliZDCChMap *GetChMap() const;
c3986754 52 // ADC map
9d0b658a 53 Int_t GetNChannelsOn() const {return fNChannelsOn;}
fee50699 54 Int_t GetCabledSignal() const {return fCabledSignal;}
c93c022b 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];}
c3986754 60 // Scaler map
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];}
66
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;}
e42bdf10 76
da090841 77 UInt_t GetScGeo() const {return fScGeo;}
78 UInt_t GetScNWords() const {return fScNWords;}
c083685e 79 UInt_t GetScTriggerSource() const {return fScTriggerSource;}
da090841 80 UInt_t GetTriggerNumber() const {return fScTriggerNumber;}
81 UInt_t GetTriggerCount() const {return fScEvCounter;}
82
83 UInt_t GetDetectorPattern() const {return fDetPattern;}
84
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;}
94
95 Bool_t IsEventGood() const {return fIsADCEventGood;}
96 Bool_t IsL0BitSet() const {return fIsL0BitSet;}
97 Bool_t IsPileUpEvent() const {return fIsPileUpEvent;}
9d0b658a 98
99 void SetNChannelsOn(Int_t val) {fNChannelsOn = val;}
1ee299a5 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;}
fee50699 102 void SetMapADCCh(Int_t iraw, Int_t ich) {fMapADC[iraw][1]=ich;}
1ee299a5 103 void SetMapADCSig(Int_t iraw, Int_t isig) {fMapADC[iraw][2]=isig;}
fee50699 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;}
106
107 void SetSODReading(Bool_t iset) {fSODReading = iset;}
1ee299a5 108
f9f99efb 109 // Error codes in raw data streaming
1ee299a5 110 enum EZDCRawStreamError{
111 kCDHError = 1,
112 kDARCError = 2,
113 kZDCDataError = 3,
612c76c4 114 kInvalidADCModule = 4,
115 kInvalidSector = 5};
f9f99efb 116
c3986754 117 // Module type codes
118 enum{kV965=1, kV830=2, kTRG=3, kTRGI=4, kPU=5};
119
f9f99efb 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!!! ****
1ee299a5 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,
129 kZEM1=22, kZEM2=23,
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,
c3986754 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};
1ee299a5 140
8309c1ab 141 private :
142 AliZDCRawStream(const AliZDCRawStream& stream);
143 AliZDCRawStream& operator = (const AliZDCRawStream& stream);
144
1ee299a5 145 AliRawReader* fRawReader; // object for reading the raw data
f9f99efb 146
147 // Data for buffer decoding
1ee299a5 148 UInt_t fBuffer; // DARC header + ADC buffer
149 UInt_t fEvType; // Event type
150 Int_t fPosition; // bit position in buffer data word
151
f9f99efb 152 // Boolean variables indicating data type
1ee299a5 153 Bool_t fIsCalib; // True when calibration run
154 Bool_t fIsDARCHeader; // True when DARC header
c3986754 155 Bool_t fIsHeaderMapping; // True when reading header mapping
1ee299a5 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
fee50699 160 Bool_t fSODReading; // True when reading SOD (DA)
161 Bool_t fIsMapRead; // True if map is already read
1ee299a5 162
163 // From CDH
164 UInt_t fDARCEvBlockLenght; // DARC block length
165 UInt_t fDARCBlockAttributes;// DARC block attributes
8309c1ab 166
1ee299a5 167 Int_t fDeadfaceOffset; // deadface offset
168 Int_t fDeadbeefOffset; // deadbeef offset
169 Int_t fDataOffset; // data offset
170
171 // ADC signal
172 Int_t fSector[2]; // [detector, sector]
173 Int_t fModType; // Module type
c3986754 174 Int_t fADCModule; // ADC module = GEO address for scaler, trigger card, P.U.
1ee299a5 175 Int_t fADCNChannels; // number of ADC ch.
c3986754 176 Int_t fADCChannel; // ADC channel = ch. for scaler, trigger card, P.U.
1ee299a5 177 Int_t fADCValue; // ADC channel
178 Int_t fADCGain; // ADC gain (0=high range; 1=low range)
c33b6ca6 179 Bool_t fIsUnderflow; // ADC underflow
180 Bool_t fIsOverflow; // ADC overflow
1ee299a5 181
e42bdf10 182 // Scaler
e42bdf10 183 UInt_t fScGeo; // scaler GEO address
c083685e 184 UInt_t fScNWords; // no. of words in scaler event
185 UInt_t fScTriggerSource; // Trigger source
e42bdf10 186 UInt_t fScTriggerNumber; // no. of triggers
c083685e 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
e42bdf10 191
da090841 192 // Pattern Unit
193 UInt_t fDetPattern; // word from the pattern unit
194
195 // Trigger card
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
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
da090841 235 ClassDef(AliZDCRawStream, 12) // class for reading ZDC raw data
8309c1ab 236};
237
238#endif