]> git.uio.no Git - u/mrichter/AliRoot.git/blame - ZDC/AliZDCRawStream.h
Cosmetic changes and correction of comments with use case.
[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
48 // Map from OCDB
49 AliCDBStorage *SetStorage(const char* uri);
50 AliZDCChMap *GetChMap() const;
51
9d0b658a 52 Int_t GetNChannelsOn() const {return fNChannelsOn;}
fee50699 53 Int_t GetCabledSignal() const {return fCabledSignal;}
c93c022b 54 Int_t GetADCModFromMap(Int_t i) const {return fMapADC[i][0];}
55 Int_t GetADCChFromMap(Int_t i) const {return fMapADC[i][1];}
56 Int_t GetADCSignFromMap(Int_t i) const {return fMapADC[i][2];}
57 Int_t GetDetectorFromMap(Int_t i) const {return fMapADC[i][3];}
58 Int_t GetTowerFromMap(Int_t i) const {return fMapADC[i][4];}
58671297 59
60 Bool_t IsCalibration() const {return fIsCalib;}
c93c022b 61 Bool_t IsDARCHeader() const {return fIsDARCHeader;}
62 Bool_t IsChMapping() const {return fIsChMapping;}
63 Bool_t IsADCDataWord() const {return fIsADCDataWord;}
64 Bool_t IsADCHeader() const {return fIsADCHeader;}
65 Bool_t IsADCEOB() const {return fIsADCEOB;}
bd94dbdd 66 Bool_t IsUnderflow() const {return fIsUnderflow;}
67 Bool_t IsOverflow() const {return fIsOverflow;}
e42bdf10 68
e42bdf10 69 UInt_t GetScGeo() const {return fScGeo;}
c083685e 70 UInt_t GetScNWords() const {return fScNWords;}
71 UInt_t GetScTriggerSource() const {return fScTriggerSource;}
e42bdf10 72 UInt_t GetTriggerNumber() const {return fScTriggerNumber;}
c083685e 73 UInt_t GetTriggerCount() const {return fScEvCounter;}
9d0b658a 74
75 void SetNChannelsOn(Int_t val) {fNChannelsOn = val;}
1ee299a5 76 void SetSector(Int_t i, Int_t val) {fSector[i] = val;}
77 void SetMapADCMod(Int_t iraw, Int_t imod) {fMapADC[iraw][0]=imod;}
fee50699 78 void SetMapADCCh(Int_t iraw, Int_t ich) {fMapADC[iraw][1]=ich;}
1ee299a5 79 void SetMapADCSig(Int_t iraw, Int_t isig) {fMapADC[iraw][2]=isig;}
fee50699 80 void SetMapDet(Int_t iraw, Int_t idet) {fMapADC[iraw][3]=idet;}
81 void SetMapTow(Int_t iraw, Int_t itow) {fMapADC[iraw][4]=itow;}
82
83 void SetSODReading(Bool_t iset) {fSODReading = iset;}
1ee299a5 84
f9f99efb 85 // Error codes in raw data streaming
1ee299a5 86 enum EZDCRawStreamError{
87 kCDHError = 1,
88 kDARCError = 2,
89 kZDCDataError = 3,
612c76c4 90 kInvalidADCModule = 4,
91 kInvalidSector = 5};
f9f99efb 92
93 // Signal codes for ZDC
94 // Same codes used in DAQ configuration file
95 // To be changed ONLY IF this file is changed!!!
96 // **** DO NOT CHANGE THE FOLLOWING LINES!!! ****
1ee299a5 97 enum ZDCSignal{kNotConnected=0, kVoid=1,
98 kZNAC=2, kZNA1=3, kZNA2=4, kZNA3=5, kZNA4=6,
99 kZPAC=7, kZPA1=8, kZPA2=9, kZPA3=10, kZPA4=11,
100 kZNCC=12, kZNC1=13, kZNC2=14, kZNC3=15, kZNC4=16,
101 kZPCC=17, kZPC1=18, kZPC2=19, kZPC3=20, kZPC4=21,
102 kZEM1=22, kZEM2=23,
103 kZDCAMon=24, kZDCCMon=25,
104 kZNACoot=26, kZNA1oot=27, kZNA2oot=28, kZNA3oot=29, kZNA4oot=30,
105 kZPACoot=31, kZPA1oot=32, kZPA2oot=33, kZPA3oot=34, kZPA4oot=35,
106 kZNCCoot=36, kZNC1oot=37, kZNC2oot=38, kZNC3oot=39, kZNC4oot=40,
107 kZPCCoot=41, kZPC1oot=42, kZPC2oot=43, kZPC3oot=44, kZPC4oot=45,
108 kZEM1oot=46, kZEM2oot=47,
109 kZDCAMonoot=48, kZDCCMonoot=49};
110
8309c1ab 111 private :
112 AliZDCRawStream(const AliZDCRawStream& stream);
113 AliZDCRawStream& operator = (const AliZDCRawStream& stream);
114
1ee299a5 115 AliRawReader* fRawReader; // object for reading the raw data
f9f99efb 116
117 // Data for buffer decoding
1ee299a5 118 UInt_t fBuffer; // DARC header + ADC buffer
119 UInt_t fEvType; // Event type
120 Int_t fPosition; // bit position in buffer data word
121
f9f99efb 122 // Boolean variables indicating data type
1ee299a5 123 Bool_t fIsCalib; // True when calibration run
124 Bool_t fIsDARCHeader; // True when DARC header
125 Bool_t fIsChMapping; // True when reading ch. mapping
126 Bool_t fIsADCDataWord; // True when data word
127 Bool_t fIsADCHeader; // True when ADC header
128 Bool_t fIsADCEOB; // True when EOB
fee50699 129 Bool_t fSODReading; // True when reading SOD (DA)
130 Bool_t fIsMapRead; // True if map is already read
1ee299a5 131
132 // From CDH
133 UInt_t fDARCEvBlockLenght; // DARC block length
134 UInt_t fDARCBlockAttributes;// DARC block attributes
8309c1ab 135
1ee299a5 136 Int_t fDeadfaceOffset; // deadface offset
137 Int_t fDeadbeefOffset; // deadbeef offset
138 Int_t fDataOffset; // data offset
139
140 // ADC signal
141 Int_t fSector[2]; // [detector, sector]
142 Int_t fModType; // Module type
143 Int_t fADCModule; // ADC module
144 Int_t fADCNChannels; // number of ADC ch.
145 Int_t fADCChannel; // ADC channel
146 Int_t fADCValue; // ADC channel
147 Int_t fADCGain; // ADC gain (0=high range; 1=low range)
c33b6ca6 148 Bool_t fIsUnderflow; // ADC underflow
149 Bool_t fIsOverflow; // ADC overflow
1ee299a5 150
e42bdf10 151 // Scaler
e42bdf10 152 UInt_t fScGeo; // scaler GEO address
c083685e 153 UInt_t fScNWords; // no. of words in scaler event
154 UInt_t fScTriggerSource; // Trigger source
e42bdf10 155 UInt_t fScTriggerNumber; // no. of triggers
c083685e 156 UInt_t fIsScEventGood; // true if scaler event is good
157 UInt_t fIsScHeaderRead; // true if scaler event is good
158 Int_t fScStartCounter; // position in the buffer where scaler data begins
159 UInt_t fScEvCounter; // event counter
e42bdf10 160
1ee299a5 161 // Channel mapping
9d0b658a 162 Int_t fNChannelsOn; // No. of signals/ADC ch. used
1ee299a5 163 Int_t fNConnCh; // current mapped ch.
164 Int_t fCabledSignal; // physics signal (from enum)
c93c022b 165 Int_t fMapADC[48][5]; // ADC map for the current run
1ee299a5 166
c083685e 167 ClassDef(AliZDCRawStream, 10) // class for reading ZDC raw digits
8309c1ab 168};
169
170#endif