]> git.uio.no Git - u/mrichter/AliRoot.git/blame - ITS/AliITSspdTestBeam.h
Analysis using Stavinsky mixing method
[u/mrichter/AliRoot.git] / ITS / AliITSspdTestBeam.h
CommitLineData
37c3bb97 1#include <Rtypes.h>
5590a2e3 2#ifndef ALIITSSPDTESTBEAM_H
3#define ALIITSSPDTESTBEAM_H
4
5/* Copyright (c) 1998-2001, ALICE Experiment at CERN, All rights reserved *
6 * See cxx source for full Copyright notice */
7
8#include <TTask.h>
9
10//class ifstream;
11class AliITS;
12class AliITSspdTestBeamHeader;
13class AliITSspdTestBeamTail;
14class AliITSspdTestBeamBurst;
15class AliITSspdTestBeamData;
16
17class AliITSspdTestBeam : public TTask{
18 public:
19 AliITSspdTestBeam();
20 AliITSspdTestBeam(const Char_t *filename,const Char_t *opt="2002",
21 AliITS *its=0);
888c388d 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!
5590a2e3 24 virtual ~AliITSspdTestBeam();
25 //
26 virtual Int_t OpenInputFile(const Char_t *filename,Int_t start=0,
27 Int_t end=-1);
28 virtual Int_t Read(Int_t i=0);
29 virtual Int_t Decode();
888c388d 30 virtual Int_t GetNumberOfPilots()const{return 3;}
5590a2e3 31 private:
32 void SetTerminationWord(){fTermination=0xffffd9f0;}
33 //
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.
888c388d 53
5590a2e3 54 ClassDef(AliITSspdTestBeam,1) // Task to read SPD test beam data
55};
56#endif
37c3bb97 57//======================================================================
58#ifndef ALIITSTESTBEAMDATA_H
59#define ALIITSTESTBEAMDATA_H
60
61/* Copyright (c) 1998-2001, ALICE Experiment at CERN, All rights reserved *
62 * See cxx source for full Copyright notice */
63
64/*
65 $Id$
66 */
67
68// Pure virtual class, no data
69class AliITSTestBeamData{
70 public:
71 AliITSTestBeamData(){};
72 virtual ~AliITSTestBeamData(){};
888c388d 73 virtual Int_t SizeOf()const{return 0;}
37c3bb97 74 enum {kData,kHead,kTail,kAbort,kFail};
75 private:
76};
77
78#endif
79//======================================================================
80#ifndef ALIITSSPDTESTBEAMHEADER_H
81#define ALIITSSPDTESTBEAMHEADER_H
82
888c388d 83#include <Riostream.h>
84
37c3bb97 85//class ostream;
86
87/* Copyright (c) 1998-2001, ALICE Experiment at CERN, All rights reserved *
88 * See cxx source for full Copyright notice */
89
90class AliITSspdTestBeamHeader : public AliITSTestBeamData{
91 public:
5590a2e3 92 AliITSspdTestBeamHeader(){};
93 virtual ~AliITSspdTestBeamHeader(){};
888c388d 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);};
37c3bb97 98 private:
99 union headder{
100 struct {
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
888c388d 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
37c3bb97 116 } fHead;
888c388d 117 UChar_t fBuf[24904]; // Equivalent char buffer
5590a2e3 118 } fUnion;
37c3bb97 119};
120ostream &operator<<(ostream &os,AliITSspdTestBeamHeader &source);
121#endif
122//----------------------------------------------------------------------
123#ifndef ALIITSSPDTESTBEAMTAIL_H
124#define ALIITSSPDTESTBEAMTAIL_H
125
126/* Copyright (c) 1998-2001, ALICE Experiment at CERN, All rights reserved *
127 * See cxx source for full Copyright notice */
888c388d 128
129#include <Riostream.h>
130
37c3bb97 131//class ostream;
132
133class AliITSspdTestBeamTail : public AliITSTestBeamData{
134 public:
5590a2e3 135 AliITSspdTestBeamTail(){};
136 virtual ~AliITSspdTestBeamTail(){};
888c388d 137 virtual Int_t SizeOf()const{return sizeof(AliITSspdTestBeamTail);}
138 virtual void Print(ostream *os)const;
37c3bb97 139 private:
140 union tail{
141 struct {
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
148 } fTail;
888c388d 149 UChar_t fBuf[32]; //Equivalent char buffer
5590a2e3 150 } fUnion;
37c3bb97 151};
152ostream &operator<<(ostream &os,AliITSspdTestBeamTail &source);
153#endif
154//----------------------------------------------------------------------
155#ifndef ALIITSSPDTESTBEAMBURST_H
156#define ALIITSSPDTESTBEAMBURST_H
157
158/* Copyright (c) 1998-2001, ALICE Experiment at CERN, All rights reserved *
159 * See cxx source for full Copyright notice */
888c388d 160
161#include <Riostream.h>
162
37c3bb97 163//class ostream;
164
165class AliITSspdTestBeamBurst : public AliITSTestBeamData{
166 public:
5590a2e3 167 AliITSspdTestBeamBurst(){};
168 virtual ~AliITSspdTestBeamBurst(){};
888c388d 169 virtual Int_t SizeOf()const{return sizeof(AliITSspdTestBeamBurst);}
170 virtual void Print(ostream *os)const;
37c3bb97 171 private:
172 union tail{
173 struct {
174 // UInt_t 4 bytes long.
175 UInt_t fNumber; // Burst Number
176 UInt_t fTransfers;// Number of Transfers
177 } fBrst;
178 ULong64_t fBuf; // a strictly 64 bit long unsinged int
5590a2e3 179 } fUnion;
37c3bb97 180};
181ostream &operator<<(ostream &os,AliITSspdTestBeamBurst &source);
182#endif
183//----------------------------------------------------------------------
184#ifndef ALIITSSPDTESTBEAMDATA_H
185#define ALIITSSPDTESTBEAMDATA_H
186
187/* Copyright (c) 1998-2001, ALICE Experiment at CERN, All rights reserved *
188 * See cxx source for full Copyright notice */
888c388d 189
190#include <Riostream.h>
191
37c3bb97 192//class ostream;
193
194class AliITSspdTestBeamData : public AliITSTestBeamData {
195 public:
196 //
5590a2e3 197 AliITSspdTestBeamData(){};
198 //AliITSspdTestBeamData(UInt_t *i){SetAddress(i);}
888c388d 199 virtual Int_t SizeOf()const{return sizeof(AliITSspdTestBeamData);}
37c3bb97 200 virtual ~AliITSspdTestBeamData(){};
201 //
888c388d 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;
37c3bb97 214 private:
215 union data{
5590a2e3 216 struct {
217 unsigned fDate:12; // Not Used
37c3bb97 218 unsigned fEventSync:6;// Event syncronization counter
219 unsigned fFlag:3; // =2or3 Header
220 unsigned fPadding:12; // Not used
221 } fDataH;
5590a2e3 222 struct {
37c3bb97 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
228 } fDataD;
5590a2e3 229 struct {
37c3bb97 230 unsigned fTrans:17; // Transmitted word count
231 unsigned fFlag:3; // =0 Trialer
232 unsigned fPadding:12; // Not used
233 } fDataT;
5590a2e3 234 struct {
37c3bb97 235 unsigned fTrans:17; // Transmitted word count
236 unsigned fFlag:3; // =1 Abort
237 unsigned fPadding:12; // Not used
238 } fDataA;
888c388d 239 UChar_t fBuf[4]; // Equivalent char buffer
5590a2e3 240 } fUnion;
37c3bb97 241};
242ostream &operator<<(ostream &os,AliITSspdTestBeamData &source);
243#endif