1 #ifndef ALITPCMONITORALTRO_H
2 #define ALITPCMONITORALTRO_H
4 /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
5 * See cxx source for full Copyright notice */
9 ////////////////////////////////////////////////////////////////////////
11 //// AliTPCMonitorAltro class
13 //// Class for decoding raw TPC data in the ALTRO format
15 //// Authors: Roland Bramm,
16 //// Stefan Kniege, IKF, Frankfurt
18 /////////////////////////////////////////////////////////////////////////
22 class AliTPCMonitorAltro : public TNamed {
24 AliTPCMonitorAltro(UInt_t* memory, Int_t size, Int_t fformat);
25 AliTPCMonitorAltro(const AliTPCMonitorAltro &altro);
26 AliTPCMonitorAltro& operator= (const AliTPCMonitorAltro& altro);
27 ~AliTPCMonitorAltro();
29 void Allocate40BitArray();
30 void Allocate10BitArray();
33 void Decodeto10Bit(Int_t equipment = -1);
35 Int_t DecodeTrailer(Int_t pos);
36 Int_t DecodeTrailerVbb(Int_t pos);
38 Long64_t* Get40BitArray();
39 Short_t *Get10BitArray();
40 Int_t Get40BitArraySize() const { return fmemory[fsize-GetRCUTrailerSize()];} //hier �ndern
41 Int_t Get10BitArraySize() const { return fmemory[fsize-GetRCUTrailerSize()]*4;} //number of 10 bit words from trailer
42 Char_t* GetActFileName() const { return ffilename;}
44 static Int_t GetHwMaskFEC() { return fgkHwMaskFEC;}
45 static Int_t GetHwMaskBranch() { return fgkHwMaskBranch;}
46 static Int_t GetHwMaskFECChannel() { return fgkHwMaskFECChannel;}
47 static Int_t GetHwMaskAltroChannel() { return fgkHwMaskAltroChannel;}
48 static Int_t GetHwMaskAltroChip() { return fgkHwMaskAltroChip;}
50 static Int_t GetHwMaskRCU() { return fgkHwMaskRCU;}
52 Int_t GetNextTrailerPos() const { return fNextPos;}
54 Int_t GetTrailerNWords() const { return fTrailerNWords ;}
55 Int_t GetTrailerHwAddress() const { return fTrailerHwAddress;}
56 Int_t GetTrailerDataPos() const { return fTrailerDataPos ;}
57 Int_t GetTrailerBlockPos() const { return fTrailerBlockPos ;}
58 Int_t GetTrailerPos() const { return fTrailerPos ;}
60 Int_t GetRCUTrailerSize() const { Int_t ts=(GetAltroVersion()==0xaaaa||GetAltroVersion()==0xaabb)*
61 (fmemory[fsize-1]&0x3F); return (ts>0)?ts:1;}
62 UInt_t GetAltroVersion() const { return fmemory[fsize-1]>>16; }
64 void SetDataOffset(Int_t val){ foffset =val ;}
65 void SetWrite10Bit(Int_t wr) { fwrite10bit =wr ;}
68 void SetActFilename(Char_t* name){ sprintf(ffilename,"%s",name); }
69 void SetVerbose(Int_t val) { fverb=val;}
73 Int_t fverb; // verbose flag
74 UInt_t* fmemory; // memory pointer fo payload
75 Int_t fsize; // size of fmemory
76 Long64_t* f40BitArray; // array to store 40 bit words
77 Short_t* f10BitArray; // array to store 10 bit words
78 Int_t fdecoderPos; // start position for decoding 40 bit words
80 Bool_t fallocate40BitArray; // flag for decoding to 40 bit words
81 Bool_t fallocate10BitArray; // flag for decoding to 10 bit words
82 Int_t foffset ; // data offset (CDH length)
83 Int_t fwrite10bit; // flag for writing 10 bit words to file
85 Int_t fTrailerNWords ; // from Trailer: number of 40 bit words for channel
86 Int_t fTrailerHwAddress; // from Trailer: hardware address for current channel
87 Int_t fTrailerDataPos; // from Trailer: position of first adc value
88 Int_t fTrailerBlockPos; // from Trailer: number of 40 bit words for channel
89 Int_t fTrailerPos; // trailer position
91 Int_t fNextPos; // position of next trailer
92 Char_t* ffilename; // name of processed file
94 static const Int_t fgk24BitOn = 16777215; // bit masks for first 24 bits of 32 for decoding 32 bit words
95 static const Int_t fgk16BitOn = 65535; // bit masks for first 24 bits of 24
96 static const Int_t fgk08BitOn = 255; // bit masks for first 24 bits of 8
99 static const Long64_t fgkmask10 = (Long64_t)0x00000000000003FFULL; // mask first 10 bit out of 4o0 bit word
100 static const Long64_t fgkmask20 = (Long64_t)0x00000000000FFC00ULL; // mask second 10 bit out of 4o0 bit word
101 static const Long64_t fgkmask30 = (Long64_t)0x000000003FF00000ULL; // mask third 10 bit out of 4o0 bit word
102 static const Long64_t fgkmask40 = (Long64_t)0x000000FFC0000000ULL; // mask fourth 10 bit out of 4o0 bit word
104 static const Long64_t fgkTrailerTail = (Long64_t)0x0000000000002AAAULL; // Tail of the Trailer set to 2AAA
105 static const Long64_t fgkTrailerTailErr = (Long64_t)0x0000000000002AEEULL; // Tail of the Trailer set to 2AEE if an error occured
106 static const Long64_t fgkTrailerMaskTail = (Long64_t)0x000000fffC000000ULL; // mask for trailer
107 static const Long64_t fgkTrailerMaskHardw = (Long64_t)0x0000000000000FFFULL; // mask for hardware address
108 static const Long64_t fgkTrailerMaskNWords = (Long64_t)0x0000000003FF0000ULL; // mask for nwords (number of 40 bit data words)
110 static const Int_t fgkHwMaskFEC = 0x0780; // mask for fec in hardware address
111 static const Int_t fgkHwMaskBranch = 0x0800; // mask for branch in hardware address
112 static const Int_t fgkHwMaskFECChannel = 0x007f; // mask for fec channel in hardware address
113 static const Int_t fgkHwMaskAltroChannel = 0x000f; // mask for altro channel in hardware address
114 static const Int_t fgkHwMaskAltroChip = 0x0070; // mask for altro chip in hardware address
115 static const Int_t fgkHwMaskRCU = 0x7000; // not part of the trailer added afterwards
117 ClassDef(AliTPCMonitorAltro,1);