1 #ifndef ALIITSSPDTESTBEAM_H
2 #define ALIITSSPDTESTBEAM_H
4 /* Copyright (c) 1998-2001, ALICE Experiment at CERN, All rights reserved *
5 * See cxx source for full Copyright notice */
10 // Class for the reading of the SPD
12 // More information on this class will follow
19 class AliITSspdTestBeamHeader;
20 class AliITSspdTestBeamTail;
21 class AliITSspdTestBeamBurst;
22 class AliITSspdTestBeamData;
24 class AliITSspdTestBeam : public TTask
28 AliITSspdTestBeam(const Char_t *filename,const Char_t *opt="2002",
30 virtual ~AliITSspdTestBeam();
32 virtual Int_t OpenInputFile(const Char_t *filename,Int_t start=0,
34 virtual Int_t Read(Int_t i=0);
35 virtual Int_t Read(const char *name) {return TObject::Read(name);}
36 virtual Int_t Decode();
37 virtual Int_t GetNumberOfPilots()const{return 3;}
39 AliITSspdTestBeam(const AliITSspdTestBeam &);
40 AliITSspdTestBeam & operator=(const AliITSspdTestBeam &);
41 void SetTerminationWord(){fTermination=0xffffd9f0;}
43 AliITSspdTestBeamHeader *fRH; //! Run Header
44 AliITSspdTestBeamTail *fRT; //! Run Trailer
45 Int_t fNBrst; //! Number of burts (size of array).
46 //orig Int_t **fBrstSize; //! Size of each burst for each pilot
47 UInt_t ***fBrstSize; //! Size of each burst for each pilot
48 AliITSspdTestBeamBurst **fBrst; //! Array of bursts.
49 Int_t **fNData; //! array of the number of data points
50 AliITSspdTestBeamData ***fData; //! Data
51 AliITSspdTestBeamData ***fHData; //! pointer to headers
52 AliITSspdTestBeamData ***fTData; //! pointer to Tail and Aborts
53 UInt_t fTermination; //! Termination word
54 Int_t fNEvents; // Number of events in file
55 Int_t fBuffSize; // Read Buffere Size
56 UChar_t *fBuff; // Read buffer
57 AliITS *fITS; // Pointer to the ITS.
58 Int_t fNfiles; // Number of input files to read from
59 Int_t fMaxFiles; // The size of the pointer array fFiles.
60 ifstream **fFiles; //! Array of Pointer to the input streams
61 Int_t *fNeventsStart; // Starting event number for each file
62 Int_t *fNeventsEnd; // Ending number of events for each file.
64 ClassDef(AliITSspdTestBeam,1) // Task to read SPD test beam data
67 //======================================================================
68 #ifndef ALIITSTESTBEAMDATA_H
69 #define ALIITSTESTBEAMDATA_H
71 /* Copyright (c) 1998-2001, ALICE Experiment at CERN, All rights reserved *
72 * See cxx source for full Copyright notice */
78 // Pure virtual class, no data
79 class AliITSTestBeamData{
81 AliITSTestBeamData(){};
82 virtual ~AliITSTestBeamData(){};
83 virtual Int_t SizeOf()const{return 0;}
84 enum {kData,kHead,kTail,kAbort,kFail};
89 //======================================================================
90 #ifndef ALIITSSPDTESTBEAMHEADER_H
91 #define ALIITSSPDTESTBEAMHEADER_H
93 /* Copyright (c) 1998-2001, ALICE Experiment at CERN, All rights reserved *
94 * See cxx source for full Copyright notice */
96 #include <Riostream.h>
98 class AliITSspdTestBeamHeader : public AliITSTestBeamData{
100 AliITSspdTestBeamHeader(){};
101 virtual ~AliITSspdTestBeamHeader(){};
102 virtual void Print(ostream *os)const;
103 virtual Int_t GetNumberOfEvents()const{return fUnion.fHead.fNEvents;};
104 virtual Int_t GetBurstSize(Int_t i=0)const{return fUnion.fHead.fBuffSize[i];};
105 virtual Int_t SizeOf()const{return sizeof(AliITSspdTestBeamHeader);};
109 // Double_t must be 8 bytes long, Char_t 1 byte long,
110 // Int_t 4 bytes long. 8*1+4*26+1*(2*12+3*20+3*44+3*8192)=24904 by
111 Double_t fVersion; // Version number
112 Char_t fDate[12];// Date Field
113 Char_t fTime[12];// Time Field
114 UInt_t fBuffSize[3]; // Buffer Sizes
115 UInt_t fTestPulse; // Test Pulse flag
116 UInt_t fTrigger[3]; // Array of triggers
117 UInt_t fTriggerMode; // Trigger mode flag
118 UInt_t fBurstSize; // Burst Size
119 UInt_t fNEvents; // Number of event to write
120 UInt_t fRes[16]; // not sure
121 UChar_t fMBDACS[3][20]; // not sure
122 UChar_t fA1DACS[3][44]; // not sure
123 UChar_t fA12Matrix[3][8192]; // not sure
125 UChar_t fBuf[24904]; // Equivalent char buffer
128 ostream &operator<<(ostream &os,AliITSspdTestBeamHeader &source);
130 //----------------------------------------------------------------------
131 #ifndef ALIITSSPDTESTBEAMTAIL_H
132 #define ALIITSSPDTESTBEAMTAIL_H
134 /* Copyright (c) 1998-2001, ALICE Experiment at CERN, All rights reserved *
135 * See cxx source for full Copyright notice */
137 #include <Riostream.h>
139 class AliITSspdTestBeamTail : public AliITSTestBeamData{
141 AliITSspdTestBeamTail(){};
142 virtual ~AliITSspdTestBeamTail(){};
143 virtual Int_t SizeOf()const{return sizeof(AliITSspdTestBeamTail);}
144 virtual void Print(ostream *os)const;
148 // Char_t 1 byte long,
149 // UInt_t 4 bytes long. size = 4+4+12*1+12*1 = 32 bytes
150 UInt_t fEvents; // number of events written
151 UInt_t fTermMode;// Termination flag
152 Char_t fDate[12];// Date Field
153 Char_t fTime[12];// Time Field
155 UChar_t fBuf[32]; //Equivalent char buffer
158 ostream &operator<<(ostream &os,AliITSspdTestBeamTail &source);
160 //----------------------------------------------------------------------
161 #ifndef ALIITSSPDTESTBEAMBURST_H
162 #define ALIITSSPDTESTBEAMBURST_H
164 /* Copyright (c) 1998-2001, ALICE Experiment at CERN, All rights reserved *
165 * See cxx source for full Copyright notice */
167 #include <Riostream.h>
169 class AliITSspdTestBeamBurst : public AliITSTestBeamData{
171 AliITSspdTestBeamBurst(){};
172 virtual ~AliITSspdTestBeamBurst(){};
173 virtual Int_t SizeOf()const{return sizeof(AliITSspdTestBeamBurst);}
174 virtual void Print(ostream *os)const;
178 // UInt_t 4 bytes long.
179 UInt_t fNumber; // Burst Number
180 UInt_t fTransfers;// Number of Transfers
182 ULong64_t fBuf; // a strictly 64 bit long unsinged int
185 ostream &operator<<(ostream &os,AliITSspdTestBeamBurst &source);
187 //----------------------------------------------------------------------
188 #ifndef ALIITSSPDTESTBEAMDATA_H
189 #define ALIITSSPDTESTBEAMDATA_H
191 /* Copyright (c) 1998-2001, ALICE Experiment at CERN, All rights reserved *
192 * See cxx source for full Copyright notice */
194 #include <Riostream.h>
198 class AliITSspdTestBeamData : public AliITSTestBeamData {
201 AliITSspdTestBeamData(){};
202 //AliITSspdTestBeamData(UInt_t *i){SetAddress(i);}
203 virtual Int_t SizeOf()const{return sizeof(AliITSspdTestBeamData);}
204 virtual ~AliITSspdTestBeamData(){};
206 virtual Bool_t IsHeader()const{return (fUnion.fDataH.fFlag==2||fUnion.fDataH.fFlag==3);}
207 virtual Bool_t IsData()const{return (fUnion.fDataD.fFlag>3)&&(fUnion.fDataD.fFlag<8);}
208 virtual Bool_t IsTrailer()const{return (fUnion.fDataT.fFlag==0);}
209 virtual Bool_t IsAbort()const{return (fUnion.fDataA.fFlag==1);}
210 virtual Int_t Mode()const{if(IsData()) return kData;else if(IsHeader()) return kHead;else if(IsTrailer()) return kTail;else if(IsAbort()) return kAbort;else return kFail;}
211 virtual Int_t TransWordCount()const{if(IsTrailer()||IsAbort()) return fUnion.fDataT.fTrans;else return -1;}
212 virtual Int_t EventCounter()const{if(IsHeader()) return fUnion.fDataH.fEventSync;else return -1;}
213 virtual Int_t Chip()const{if(IsData()) return fUnion.fDataD.fChip;else return -1;}
214 virtual Int_t Row() const{if(IsData()) return fUnion.fDataD.fRow; else return -1;}
215 virtual Int_t Colm()const{if(IsData()) return fUnion.fDataD.fColm;else return -1;}
216 virtual void Dataconst(Int_t &ch,Int_t &rw,Int_t &cl)const{ch=Chip();rw=Row();cl=Colm();}
217 virtual void Print(ostream *os)const;
221 unsigned fDate:12; // Not Used
222 unsigned fEventSync:6;// Event syncronization counter
223 unsigned fFlag:3; // =2or3 Header
224 unsigned fPadding:12; // Not used
227 unsigned fColm:5; // Pixel (Hit) Column Address
228 unsigned fRow:8; // Pixel Row Adress
229 unsigned fChip:4; // Pixel Chip Address
230 unsigned fFlag:3; // =4or5or6or7 Data
231 unsigned fPadding:12; // Not used
234 unsigned fTrans:17; // Transmitted word count
235 unsigned fFlag:3; // =0 Trialer
236 unsigned fPadding:12; // Not used
239 unsigned fTrans:17; // Transmitted word count
240 unsigned fFlag:3; // =1 Abort
241 unsigned fPadding:12; // Not used
243 UChar_t fBuf[4]; // Equivalent char buffer
246 ostream &operator<<(ostream &os,AliITSspdTestBeamData &source);