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 Int_t **fBrstSize; //! Size of each burst for each pilot
47 AliITSspdTestBeamBurst **fBrst; //! Array of bursts.
48 Int_t **fNData; //! array of the number of data points
49 AliITSspdTestBeamData ***fData; //! Data
50 AliITSspdTestBeamData ***fHData; //! pointer to headers
51 AliITSspdTestBeamData ***fTData; //! pointer to Tail and Aborts
52 UInt_t fTermination; //! Termination word
53 Int_t fNEvents; // Number of events in file
54 Int_t fBuffSize; // Read Buffere Size
55 UChar_t *fBuff; // Read buffer
56 AliITS *fITS; // Pointer to the ITS.
57 Int_t fNfiles; // Number of input files to read from
58 Int_t fMaxFiles; // The size of the pointer array fFiles.
59 ifstream **fFiles; //! Array of Pointer to the input streams
60 Int_t *fNeventsStart; // Starting event number for each file
61 Int_t *fNeventsEnd; // Ending number of events for each file.
63 ClassDef(AliITSspdTestBeam,1) // Task to read SPD test beam data
66 //======================================================================
67 #ifndef ALIITSTESTBEAMDATA_H
68 #define ALIITSTESTBEAMDATA_H
70 /* Copyright (c) 1998-2001, ALICE Experiment at CERN, All rights reserved *
71 * See cxx source for full Copyright notice */
77 // Pure virtual class, no data
78 class AliITSTestBeamData{
80 AliITSTestBeamData(){};
81 virtual ~AliITSTestBeamData(){};
82 virtual Int_t SizeOf()const{return 0;}
83 enum {kData,kHead,kTail,kAbort,kFail};
88 //======================================================================
89 #ifndef ALIITSSPDTESTBEAMHEADER_H
90 #define ALIITSSPDTESTBEAMHEADER_H
92 /* Copyright (c) 1998-2001, ALICE Experiment at CERN, All rights reserved *
93 * See cxx source for full Copyright notice */
95 #include <Riostream.h>
97 class AliITSspdTestBeamHeader : public AliITSTestBeamData{
99 AliITSspdTestBeamHeader(){};
100 virtual ~AliITSspdTestBeamHeader(){};
101 virtual void Print(ostream *os)const;
102 virtual Int_t GetNumberOfEvents()const{return fUnion.fHead.fNEvents;};
103 virtual Int_t GetBurstSize(Int_t i=0)const{return fUnion.fHead.fBuffSize[i];};
104 virtual Int_t SizeOf()const{return sizeof(AliITSspdTestBeamHeader);};
108 // Double_t must be 8 bytes long, Char_t 1 byte long,
109 // Int_t 4 bytes long. 8*1+4*26+1*(2*12+3*20+3*44+3*8192)=24904 by
110 Double_t fVersion; // Version number
111 Char_t fDate[12];// Date Field
112 Char_t fTime[12];// Time Field
113 UInt_t fBuffSize[3]; // Buffer Sizes
114 UInt_t fTestPulse; // Test Pulse flag
115 UInt_t fTrigger[3]; // Array of triggers
116 UInt_t fTriggerMode; // Trigger mode flag
117 UInt_t fBurstSize; // Burst Size
118 UInt_t fNEvents; // Number of event to write
119 UInt_t fRes[16]; // not sure
120 UChar_t fMBDACS[3][20]; // not sure
121 UChar_t fA1DACS[3][44]; // not sure
122 UChar_t fA12Matrix[3][8192]; // not sure
124 UChar_t fBuf[24904]; // Equivalent char buffer
127 ostream &operator<<(ostream &os,AliITSspdTestBeamHeader &source);
129 //----------------------------------------------------------------------
130 #ifndef ALIITSSPDTESTBEAMTAIL_H
131 #define ALIITSSPDTESTBEAMTAIL_H
133 /* Copyright (c) 1998-2001, ALICE Experiment at CERN, All rights reserved *
134 * See cxx source for full Copyright notice */
136 #include <Riostream.h>
138 class AliITSspdTestBeamTail : public AliITSTestBeamData{
140 AliITSspdTestBeamTail(){};
141 virtual ~AliITSspdTestBeamTail(){};
142 virtual Int_t SizeOf()const{return sizeof(AliITSspdTestBeamTail);}
143 virtual void Print(ostream *os)const;
147 // Char_t 1 byte long,
148 // UInt_t 4 bytes long. size = 4+4+12*1+12*1 = 32 bytes
149 UInt_t fEvents; // number of events written
150 UInt_t fTermMode;// Termination flag
151 Char_t fDate[12];// Date Field
152 Char_t fTime[12];// Time Field
154 UChar_t fBuf[32]; //Equivalent char buffer
157 ostream &operator<<(ostream &os,AliITSspdTestBeamTail &source);
159 //----------------------------------------------------------------------
160 #ifndef ALIITSSPDTESTBEAMBURST_H
161 #define ALIITSSPDTESTBEAMBURST_H
163 /* Copyright (c) 1998-2001, ALICE Experiment at CERN, All rights reserved *
164 * See cxx source for full Copyright notice */
166 #include <Riostream.h>
168 class AliITSspdTestBeamBurst : public AliITSTestBeamData{
170 AliITSspdTestBeamBurst(){};
171 virtual ~AliITSspdTestBeamBurst(){};
172 virtual Int_t SizeOf()const{return sizeof(AliITSspdTestBeamBurst);}
173 virtual void Print(ostream *os)const;
177 // UInt_t 4 bytes long.
178 UInt_t fNumber; // Burst Number
179 UInt_t fTransfers;// Number of Transfers
181 ULong64_t fBuf; // a strictly 64 bit long unsinged int
184 ostream &operator<<(ostream &os,AliITSspdTestBeamBurst &source);
186 //----------------------------------------------------------------------
187 #ifndef ALIITSSPDTESTBEAMDATA_H
188 #define ALIITSSPDTESTBEAMDATA_H
190 /* Copyright (c) 1998-2001, ALICE Experiment at CERN, All rights reserved *
191 * See cxx source for full Copyright notice */
193 #include <Riostream.h>
197 class AliITSspdTestBeamData : public AliITSTestBeamData {
200 AliITSspdTestBeamData(){};
201 //AliITSspdTestBeamData(UInt_t *i){SetAddress(i);}
202 virtual Int_t SizeOf()const{return sizeof(AliITSspdTestBeamData);}
203 virtual ~AliITSspdTestBeamData(){};
205 virtual Bool_t IsHeader()const{return (fUnion.fDataH.fFlag==2||fUnion.fDataH.fFlag==3);}
206 virtual Bool_t IsData()const{return (fUnion.fDataD.fFlag>3)&&(fUnion.fDataD.fFlag<8);}
207 virtual Bool_t IsTrailer()const{return (fUnion.fDataT.fFlag==0);}
208 virtual Bool_t IsAbort()const{return (fUnion.fDataA.fFlag==1);}
209 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;}
210 virtual Int_t TransWordCount()const{if(IsTrailer()||IsAbort()) return fUnion.fDataT.fTrans;else return -1;}
211 virtual Int_t EventCounter()const{if(IsHeader()) return fUnion.fDataH.fEventSync;else return -1;}
212 virtual Int_t Chip()const{if(IsData()) return fUnion.fDataD.fChip;else return -1;}
213 virtual Int_t Row() const{if(IsData()) return fUnion.fDataD.fRow; else return -1;}
214 virtual Int_t Colm()const{if(IsData()) return fUnion.fDataD.fColm;else return -1;}
215 virtual void Dataconst(Int_t &ch,Int_t &rw,Int_t &cl)const{ch=Chip();rw=Row();cl=Colm();}
216 virtual void Print(ostream *os)const;
220 unsigned fDate:12; // Not Used
221 unsigned fEventSync:6;// Event syncronization counter
222 unsigned fFlag:3; // =2or3 Header
223 unsigned fPadding:12; // Not used
226 unsigned fColm:5; // Pixel (Hit) Column Address
227 unsigned fRow:8; // Pixel Row Adress
228 unsigned fChip:4; // Pixel Chip Address
229 unsigned fFlag:3; // =4or5or6or7 Data
230 unsigned fPadding:12; // Not used
233 unsigned fTrans:17; // Transmitted word count
234 unsigned fFlag:3; // =0 Trialer
235 unsigned fPadding:12; // Not used
238 unsigned fTrans:17; // Transmitted word count
239 unsigned fFlag:3; // =1 Abort
240 unsigned fPadding:12; // Not used
242 UChar_t fBuf[4]; // Equivalent char buffer
245 ostream &operator<<(ostream &os,AliITSspdTestBeamData &source);