]> git.uio.no Git - u/mrichter/AliRoot.git/blob - ITS/AliITSspdTestBeam.h
Incrementing ClassDefs (Y.Schutz)
[u/mrichter/AliRoot.git] / ITS / AliITSspdTestBeam.h
1 #ifndef ALIITSSPDTESTBEAM_H
2 #define ALIITSSPDTESTBEAM_H
3
4 /* Copyright (c) 1998-2001, ALICE Experiment at CERN, All rights reserved *
5  * See cxx source for full Copyright notice                               */
6
7 /* $Id$ */
8
9 //
10 // Class for the reading of the SPD 
11 // Test beam data
12 // More information on this class will follow
13 // 
14
15 #include <Rtypes.h>
16 #include <TTask.h>
17
18 class AliITS;
19 class AliITSspdTestBeamHeader;
20 class AliITSspdTestBeamTail;
21 class AliITSspdTestBeamBurst;
22 class AliITSspdTestBeamData;
23
24 class AliITSspdTestBeam : public TTask
25 {
26 public:
27     AliITSspdTestBeam();
28     AliITSspdTestBeam(const Char_t *filename,const Char_t *opt="2002",
29                       AliITS *its=0);
30     virtual ~AliITSspdTestBeam();
31     //
32     virtual Int_t OpenInputFile(const Char_t *filename,Int_t start=0,
33                                 Int_t end=-1);
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;}
38 private:
39     AliITSspdTestBeam(const AliITSspdTestBeam &);
40     AliITSspdTestBeam & operator=(const AliITSspdTestBeam &);
41     void SetTerminationWord(){fTermination=0xffffd9f0;}
42     //
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.
62
63     ClassDef(AliITSspdTestBeam,1) // Task to read SPD test beam data
64 };
65 #endif
66 //======================================================================
67 #ifndef ALIITSTESTBEAMDATA_H
68 #define ALIITSTESTBEAMDATA_H
69
70 /* Copyright (c) 1998-2001, ALICE Experiment at CERN, All rights reserved *
71  * See cxx source for full Copyright notice                               */
72
73 /*
74   $Id$
75  */
76
77 // Pure virtual class, no data
78 class AliITSTestBeamData{
79   public:
80     AliITSTestBeamData(){};
81     virtual ~AliITSTestBeamData(){};
82     virtual Int_t SizeOf()const{return 0;}
83     enum {kData,kHead,kTail,kAbort,kFail};
84   private:
85 };
86
87 #endif
88 //======================================================================
89 #ifndef ALIITSSPDTESTBEAMHEADER_H
90 #define ALIITSSPDTESTBEAMHEADER_H
91
92 /* Copyright (c) 1998-2001, ALICE Experiment at CERN, All rights reserved *
93  * See cxx source for full Copyright notice                               */
94
95 #include <Riostream.h>
96
97 class AliITSspdTestBeamHeader : public AliITSTestBeamData{
98   public:
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);};
105   private:
106     union headder{
107          struct {
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
123         } fHead;
124         UChar_t fBuf[24904]; // Equivalent char buffer
125     } fUnion;
126 };
127 ostream &operator<<(ostream &os,AliITSspdTestBeamHeader &source);
128 #endif
129 //----------------------------------------------------------------------
130 #ifndef ALIITSSPDTESTBEAMTAIL_H
131 #define ALIITSSPDTESTBEAMTAIL_H
132
133 /* Copyright (c) 1998-2001, ALICE Experiment at CERN, All rights reserved *
134  * See cxx source for full Copyright notice                               */
135
136 #include <Riostream.h>
137
138 class AliITSspdTestBeamTail : public AliITSTestBeamData{
139   public:
140     AliITSspdTestBeamTail(){};
141     virtual ~AliITSspdTestBeamTail(){};
142     virtual Int_t SizeOf()const{return sizeof(AliITSspdTestBeamTail);}
143     virtual void Print(ostream *os)const;
144   private:
145     union tail{
146         struct {
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
153         } fTail;
154         UChar_t fBuf[32]; //Equivalent char buffer
155     } fUnion;
156 };
157 ostream &operator<<(ostream &os,AliITSspdTestBeamTail &source);
158 #endif
159 //----------------------------------------------------------------------
160 #ifndef ALIITSSPDTESTBEAMBURST_H
161 #define ALIITSSPDTESTBEAMBURST_H
162
163 /* Copyright (c) 1998-2001, ALICE Experiment at CERN, All rights reserved *
164  * See cxx source for full Copyright notice                               */
165
166 #include <Riostream.h>
167
168 class AliITSspdTestBeamBurst : public AliITSTestBeamData{
169   public:
170     AliITSspdTestBeamBurst(){};
171     virtual ~AliITSspdTestBeamBurst(){};
172     virtual Int_t SizeOf()const{return sizeof(AliITSspdTestBeamBurst);}
173     virtual void Print(ostream *os)const;
174   private:
175     union tail{
176         struct {
177             // UInt_t 4 bytes long.
178             UInt_t   fNumber;   // Burst Number
179             UInt_t   fTransfers;// Number of Transfers
180         } fBrst;
181         ULong64_t fBuf;  // a strictly 64 bit long unsinged int
182     } fUnion;
183 };
184 ostream &operator<<(ostream &os,AliITSspdTestBeamBurst &source);
185 #endif
186 //----------------------------------------------------------------------
187 #ifndef ALIITSSPDTESTBEAMDATA_H
188 #define ALIITSSPDTESTBEAMDATA_H
189
190 /* Copyright (c) 1998-2001, ALICE Experiment at CERN, All rights reserved *
191  * See cxx source for full Copyright notice                               */
192
193 #include <Riostream.h>
194
195 //class ostream;
196
197 class AliITSspdTestBeamData : public AliITSTestBeamData {
198   public:
199     //
200     AliITSspdTestBeamData(){};
201     //AliITSspdTestBeamData(UInt_t *i){SetAddress(i);}
202     virtual Int_t SizeOf()const{return sizeof(AliITSspdTestBeamData);}
203     virtual ~AliITSspdTestBeamData(){};
204     //
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;
217   private:
218     union data{
219         struct {
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
224         } fDataH;
225         struct {
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
231         } fDataD;
232         struct {
233             unsigned fTrans:17;   // Transmitted word count
234             unsigned fFlag:3;     // =0 Trialer
235             unsigned fPadding:12; // Not used
236         } fDataT;
237         struct {
238             unsigned fTrans:17;   // Transmitted word count
239             unsigned fFlag:3;     // =1 Abort
240             unsigned fPadding:12; // Not used
241         } fDataA;
242         UChar_t fBuf[4]; // Equivalent char buffer
243     } fUnion;
244 };
245 ostream &operator<<(ostream &os,AliITSspdTestBeamData &source);
246 #endif