2 #ifndef ALIITSSPDTESTBEAM_H
3 #define ALIITSSPDTESTBEAM_H
5 /* Copyright (c) 1998-2001, ALICE Experiment at CERN, All rights reserved *
6 * See cxx source for full Copyright notice */
12 class AliITSspdTestBeamHeader;
13 class AliITSspdTestBeamTail;
14 class AliITSspdTestBeamBurst;
15 class AliITSspdTestBeamData;
17 class AliITSspdTestBeam : public TTask{
20 AliITSspdTestBeam(const Char_t *filename,const Char_t *opt="2002",
22 AliITSspdTestBeam(const AliITSspdTestBeam &s):TTask(s){if(this==&s) return;Error("Copy constructor","You are not allowed to make a copy of AliITSspdTestBeam");exit(1);} //Not to be used!
23 AliITSspdTestBeam& operator=(AliITSspdTestBeam &s){if(this==&s) return *this;Error("operator=","You are not allowed to make a copy of AliITSspdTestBeam");exit(1);return *this;} //Not to be used!
24 virtual ~AliITSspdTestBeam();
26 virtual Int_t OpenInputFile(const Char_t *filename,Int_t start=0,
28 virtual Int_t Read(Int_t i=0);
29 virtual Int_t Decode();
30 virtual Int_t GetNumberOfPilots()const{return 3;}
32 void SetTerminationWord(){fTermination=0xffffd9f0;}
34 AliITSspdTestBeamHeader *fRH; //! Run Header
35 AliITSspdTestBeamTail *fRT; //! Run Trailer
36 Int_t fNBrst; //! Number of burts (size of array).
37 Int_t **fBrstSize; //! Size of each burst for each pilot
38 AliITSspdTestBeamBurst **fBrst; //! Array of bursts.
39 Int_t **fNData; //! array of the number of data points
40 AliITSspdTestBeamData ***fData; //! Data
41 AliITSspdTestBeamData ***fHData; //! pointer to headers
42 AliITSspdTestBeamData ***fTData; //! pointer to Tail and Aborts
43 UInt_t fTermination; //! Termination word
44 Int_t fNEvents; // Number of events in file
45 Int_t fBuffSize; // Read Buffere Size
46 UChar_t *fBuff; // Read buffer
47 AliITS *fITS; // Pointer to the ITS.
48 Int_t fNfiles; // Number of input files to read from
49 Int_t fMaxFiles; // The size of the pointer array fFiles.
50 ifstream **fFiles; //! Array of Pointer to the input streams
51 Int_t *fNeventsStart; // Starting event number for each file
52 Int_t *fNeventsEnd; // Ending number of events for each file.
54 ClassDef(AliITSspdTestBeam,1) // Task to read SPD test beam data
57 //======================================================================
58 #ifndef ALIITSTESTBEAMDATA_H
59 #define ALIITSTESTBEAMDATA_H
61 /* Copyright (c) 1998-2001, ALICE Experiment at CERN, All rights reserved *
62 * See cxx source for full Copyright notice */
68 // Pure virtual class, no data
69 class AliITSTestBeamData{
71 AliITSTestBeamData(){};
72 virtual ~AliITSTestBeamData(){};
73 virtual Int_t SizeOf()const{return 0;}
74 enum {kData,kHead,kTail,kAbort,kFail};
79 //======================================================================
80 #ifndef ALIITSSPDTESTBEAMHEADER_H
81 #define ALIITSSPDTESTBEAMHEADER_H
83 #include <Riostream.h>
87 /* Copyright (c) 1998-2001, ALICE Experiment at CERN, All rights reserved *
88 * See cxx source for full Copyright notice */
90 class AliITSspdTestBeamHeader : public AliITSTestBeamData{
92 AliITSspdTestBeamHeader(){};
93 virtual ~AliITSspdTestBeamHeader(){};
94 virtual void Print(ostream *os)const;
95 virtual Int_t GetNumberOfEvents()const{return fUnion.fHead.fNEvents;};
96 virtual Int_t GetBurstSize(Int_t i=0)const{return fUnion.fHead.fBuffSize[i];};
97 virtual Int_t SizeOf()const{return sizeof(AliITSspdTestBeamHeader);};
101 // Double_t must be 8 bytes long, Char_t 1 byte long,
102 // Int_t 4 bytes long. 8*1+4*26+1*(2*12+3*20+3*44+3*8192)=24904 by
103 Double_t fVersion; // Version number
104 Char_t fDate[12];// Date Field
105 Char_t fTime[12];// Time Field
106 UInt_t fBuffSize[3]; // Buffer Sizes
107 UInt_t fTestPulse; // Test Pulse flag
108 UInt_t fTrigger[3]; // Array of triggers
109 UInt_t fTriggerMode; // Trigger mode flag
110 UInt_t fBurstSize; // Burst Size
111 UInt_t fNEvents; // Number of event to write
112 UInt_t fRes[16]; // not sure
113 UChar_t fMBDACS[3][20]; // not sure
114 UChar_t fA1DACS[3][44]; // not sure
115 UChar_t fA12Matrix[3][8192]; // not sure
117 UChar_t fBuf[24904]; // Equivalent char buffer
120 ostream &operator<<(ostream &os,AliITSspdTestBeamHeader &source);
122 //----------------------------------------------------------------------
123 #ifndef ALIITSSPDTESTBEAMTAIL_H
124 #define ALIITSSPDTESTBEAMTAIL_H
126 /* Copyright (c) 1998-2001, ALICE Experiment at CERN, All rights reserved *
127 * See cxx source for full Copyright notice */
129 #include <Riostream.h>
133 class AliITSspdTestBeamTail : public AliITSTestBeamData{
135 AliITSspdTestBeamTail(){};
136 virtual ~AliITSspdTestBeamTail(){};
137 virtual Int_t SizeOf()const{return sizeof(AliITSspdTestBeamTail);}
138 virtual void Print(ostream *os)const;
142 // Char_t 1 byte long,
143 // UInt_t 4 bytes long. size = 4+4+12*1+12*1 = 32 bytes
144 UInt_t fEvents; // number of events written
145 UInt_t fTermMode;// Termination flag
146 Char_t fDate[12];// Date Field
147 Char_t fTime[12];// Time Field
149 UChar_t fBuf[32]; //Equivalent char buffer
152 ostream &operator<<(ostream &os,AliITSspdTestBeamTail &source);
154 //----------------------------------------------------------------------
155 #ifndef ALIITSSPDTESTBEAMBURST_H
156 #define ALIITSSPDTESTBEAMBURST_H
158 /* Copyright (c) 1998-2001, ALICE Experiment at CERN, All rights reserved *
159 * See cxx source for full Copyright notice */
161 #include <Riostream.h>
165 class AliITSspdTestBeamBurst : public AliITSTestBeamData{
167 AliITSspdTestBeamBurst(){};
168 virtual ~AliITSspdTestBeamBurst(){};
169 virtual Int_t SizeOf()const{return sizeof(AliITSspdTestBeamBurst);}
170 virtual void Print(ostream *os)const;
174 // UInt_t 4 bytes long.
175 UInt_t fNumber; // Burst Number
176 UInt_t fTransfers;// Number of Transfers
178 ULong64_t fBuf; // a strictly 64 bit long unsinged int
181 ostream &operator<<(ostream &os,AliITSspdTestBeamBurst &source);
183 //----------------------------------------------------------------------
184 #ifndef ALIITSSPDTESTBEAMDATA_H
185 #define ALIITSSPDTESTBEAMDATA_H
187 /* Copyright (c) 1998-2001, ALICE Experiment at CERN, All rights reserved *
188 * See cxx source for full Copyright notice */
190 #include <Riostream.h>
194 class AliITSspdTestBeamData : public AliITSTestBeamData {
197 AliITSspdTestBeamData(){};
198 //AliITSspdTestBeamData(UInt_t *i){SetAddress(i);}
199 virtual Int_t SizeOf()const{return sizeof(AliITSspdTestBeamData);}
200 virtual ~AliITSspdTestBeamData(){};
202 virtual Bool_t IsHeader()const{return (fUnion.fDataH.fFlag==2||fUnion.fDataH.fFlag==3);}
203 virtual Bool_t IsData()const{return (fUnion.fDataD.fFlag>3)&&(fUnion.fDataD.fFlag<8);}
204 virtual Bool_t IsTrailer()const{return (fUnion.fDataT.fFlag==0);}
205 virtual Bool_t IsAbort()const{return (fUnion.fDataA.fFlag==1);}
206 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;}
207 virtual Int_t TransWordCount()const{if(IsTrailer()||IsAbort()) return fUnion.fDataT.fTrans;else return -1;}
208 virtual Int_t EventCounter()const{if(IsHeader()) return fUnion.fDataH.fEventSync;else return -1;}
209 virtual Int_t Chip()const{if(IsData()) return fUnion.fDataD.fChip;else return -1;}
210 virtual Int_t Row() const{if(IsData()) return fUnion.fDataD.fRow; else return -1;}
211 virtual Int_t Colm()const{if(IsData()) return fUnion.fDataD.fColm;else return -1;}
212 virtual void Dataconst(Int_t &ch,Int_t &rw,Int_t &cl)const{ch=Chip();rw=Row();cl=Colm();}
213 virtual void Print(ostream *os)const;
217 unsigned fDate:12; // Not Used
218 unsigned fEventSync:6;// Event syncronization counter
219 unsigned fFlag:3; // =2or3 Header
220 unsigned fPadding:12; // Not used
223 unsigned fColm:5; // Pixel (Hit) Column Address
224 unsigned fRow:8; // Pixel Row Adress
225 unsigned fChip:4; // Pixel Chip Address
226 unsigned fFlag:3; // =4or5or6or7 Data
227 unsigned fPadding:12; // Not used
230 unsigned fTrans:17; // Transmitted word count
231 unsigned fFlag:3; // =0 Trialer
232 unsigned fPadding:12; // Not used
235 unsigned fTrans:17; // Transmitted word count
236 unsigned fFlag:3; // =1 Abort
237 unsigned fPadding:12; // Not used
239 UChar_t fBuf[4]; // Equivalent char buffer
242 ostream &operator<<(ostream &os,AliITSspdTestBeamData &source);