During simulation: fill STU region w/ non null time sums
[u/mrichter/AliRoot.git] / TPC / AliTPCMonitorAltro.h
CommitLineData
48265b32 1#ifndef ALITPCMONITORALTRO_H
2#define ALITPCMONITORALTRO_H
3
4/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
5 * See cxx source for full Copyright notice */
6
7/* $Id$ */
8
9////////////////////////////////////////////////////////////////////////
ca7b8371 10////
11//// AliTPCMonitorAltro class
12////
13//// Class for decoding raw TPC data in the ALTRO format
14////
15//// Authors: Roland Bramm,
16//// Stefan Kniege, IKF, Frankfurt
17////
48265b32 18/////////////////////////////////////////////////////////////////////////
19
c60053f6 20#include <TString.h>
21#include <TNamed.h>
48265b32 22
23class AliTPCMonitorAltro : public TNamed {
24 public:
25 AliTPCMonitorAltro(UInt_t* memory, Int_t size, Int_t fformat);
ca7b8371 26 AliTPCMonitorAltro(const AliTPCMonitorAltro &altro);
27 AliTPCMonitorAltro& operator= (const AliTPCMonitorAltro& altro);
48265b32 28 ~AliTPCMonitorAltro();
29
30 void Allocate40BitArray();
31 void Allocate10BitArray();
32
33 void Decodeto40Bit();
34 void Decodeto10Bit(Int_t equipment = -1);
35
36 Int_t DecodeTrailer(Int_t pos);
5312f439 37 Int_t DecodeTrailerVbb(Int_t pos);
38
48265b32 39 Long64_t* Get40BitArray();
fb3305d1 40 Short_t *Get10BitArray();
5312f439 41 Int_t Get40BitArraySize() const { return fmemory[fsize-GetRCUTrailerSize()];} //hier ´┐Żndern
4c6d06dc 42 Int_t Get10BitArraySize() const { return fmemory[fsize-GetRCUTrailerSize()]*4;} //number of 10 bit words from trailer
c60053f6 43 const Char_t* GetActFileName() const { return ffilename.Data();}
48265b32 44
ca7b8371 45 static Int_t GetHwMaskFEC() { return fgkHwMaskFEC;}
46 static Int_t GetHwMaskBranch() { return fgkHwMaskBranch;}
47 static Int_t GetHwMaskFECChannel() { return fgkHwMaskFECChannel;}
48 static Int_t GetHwMaskAltroChannel() { return fgkHwMaskAltroChannel;}
49 static Int_t GetHwMaskAltroChip() { return fgkHwMaskAltroChip;}
48265b32 50
ca7b8371 51 static Int_t GetHwMaskRCU() { return fgkHwMaskRCU;}
48265b32 52
ca7b8371 53 Int_t GetNextTrailerPos() const { return fNextPos;}
48265b32 54
ca7b8371 55 Int_t GetTrailerNWords() const { return fTrailerNWords ;}
56 Int_t GetTrailerHwAddress() const { return fTrailerHwAddress;}
57 Int_t GetTrailerDataPos() const { return fTrailerDataPos ;}
58 Int_t GetTrailerBlockPos() const { return fTrailerBlockPos ;}
59 Int_t GetTrailerPos() const { return fTrailerPos ;}
48265b32 60
5312f439 61 Int_t GetRCUTrailerSize() const { Int_t ts=(GetAltroVersion()==0xaaaa||GetAltroVersion()==0xaabb)*
62 (fmemory[fsize-1]&0x3F); return (ts>0)?ts:1;}
63 UInt_t GetAltroVersion() const { return fmemory[fsize-1]>>16; }
4c6d06dc 64
48265b32 65 void SetDataOffset(Int_t val){ foffset =val ;}
66 void SetWrite10Bit(Int_t wr) { fwrite10bit =wr ;}
67
68
c60053f6 69 void SetActFilename(const Char_t* name){ ffilename=name; }
48265b32 70 void SetVerbose(Int_t val) { fverb=val;}
71
72 private:
73
74 Int_t fverb; // verbose flag
75 UInt_t* fmemory; // memory pointer fo payload
76 Int_t fsize; // size of fmemory
77 Long64_t* f40BitArray; // array to store 40 bit words
78 Short_t* f10BitArray; // array to store 10 bit words
79 Int_t fdecoderPos; // start position for decoding 40 bit words
80
81 Bool_t fallocate40BitArray; // flag for decoding to 40 bit words
82 Bool_t fallocate10BitArray; // flag for decoding to 10 bit words
83 Int_t foffset ; // data offset (CDH length)
84 Int_t fwrite10bit; // flag for writing 10 bit words to file
85
86 Int_t fTrailerNWords ; // from Trailer: number of 40 bit words for channel
87 Int_t fTrailerHwAddress; // from Trailer: hardware address for current channel
88 Int_t fTrailerDataPos; // from Trailer: position of first adc value
89 Int_t fTrailerBlockPos; // from Trailer: number of 40 bit words for channel
90 Int_t fTrailerPos; // trailer position
4c6d06dc 91
48265b32 92 Int_t fNextPos; // position of next trailer
c60053f6 93 TString ffilename; // name of processed file
48265b32 94
ca7b8371 95 static const Int_t fgk24BitOn = 16777215; // bit masks for first 24 bits of 32 for decoding 32 bit words
96 static const Int_t fgk16BitOn = 65535; // bit masks for first 24 bits of 24
97 static const Int_t fgk08BitOn = 255; // bit masks for first 24 bits of 8
48265b32 98
99
ca7b8371 100 static const Long64_t fgkmask10 = (Long64_t)0x00000000000003FFULL; // mask first 10 bit out of 4o0 bit word
101 static const Long64_t fgkmask20 = (Long64_t)0x00000000000FFC00ULL; // mask second 10 bit out of 4o0 bit word
102 static const Long64_t fgkmask30 = (Long64_t)0x000000003FF00000ULL; // mask third 10 bit out of 4o0 bit word
103 static const Long64_t fgkmask40 = (Long64_t)0x000000FFC0000000ULL; // mask fourth 10 bit out of 4o0 bit word
48265b32 104
ca7b8371 105 static const Long64_t fgkTrailerTail = (Long64_t)0x0000000000002AAAULL; // Tail of the Trailer set to 2AAA
5312f439 106 static const Long64_t fgkTrailerTailErr = (Long64_t)0x0000000000002AEEULL; // Tail of the Trailer set to 2AEE if an error occured
107 static const Long64_t fgkTrailerMaskTail = (Long64_t)0x000000fffC000000ULL; // mask for trailer
ca7b8371 108 static const Long64_t fgkTrailerMaskHardw = (Long64_t)0x0000000000000FFFULL; // mask for hardware address
109 static const Long64_t fgkTrailerMaskNWords = (Long64_t)0x0000000003FF0000ULL; // mask for nwords (number of 40 bit data words)
48265b32 110
ca7b8371 111 static const Int_t fgkHwMaskFEC = 0x0780; // mask for fec in hardware address
112 static const Int_t fgkHwMaskBranch = 0x0800; // mask for branch in hardware address
113 static const Int_t fgkHwMaskFECChannel = 0x007f; // mask for fec channel in hardware address
114 static const Int_t fgkHwMaskAltroChannel = 0x000f; // mask for altro channel in hardware address
115 static const Int_t fgkHwMaskAltroChip = 0x0070; // mask for altro chip in hardware address
116 static const Int_t fgkHwMaskRCU = 0x7000; // not part of the trailer added afterwards
48265b32 117
118 ClassDef(AliTPCMonitorAltro,1);
119};
120#endif