more secure string operations
[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
48265b32 20#include "TNamed.h"
48265b32 21
22class AliTPCMonitorAltro : public TNamed {
23 public:
24 AliTPCMonitorAltro(UInt_t* memory, Int_t size, Int_t fformat);
ca7b8371 25 AliTPCMonitorAltro(const AliTPCMonitorAltro &altro);
26 AliTPCMonitorAltro& operator= (const AliTPCMonitorAltro& altro);
48265b32 27 ~AliTPCMonitorAltro();
28
29 void Allocate40BitArray();
30 void Allocate10BitArray();
31
32 void Decodeto40Bit();
33 void Decodeto10Bit(Int_t equipment = -1);
34
35 Int_t DecodeTrailer(Int_t pos);
5312f439 36 Int_t DecodeTrailerVbb(Int_t pos);
37
48265b32 38 Long64_t* Get40BitArray();
fb3305d1 39 Short_t *Get10BitArray();
5312f439 40 Int_t Get40BitArraySize() const { return fmemory[fsize-GetRCUTrailerSize()];} //hier ´┐Żndern
4c6d06dc 41 Int_t Get10BitArraySize() const { return fmemory[fsize-GetRCUTrailerSize()]*4;} //number of 10 bit words from trailer
ca7b8371 42 Char_t* GetActFileName() const { return ffilename;}
48265b32 43
ca7b8371 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;}
48265b32 49
ca7b8371 50 static Int_t GetHwMaskRCU() { return fgkHwMaskRCU;}
48265b32 51
ca7b8371 52 Int_t GetNextTrailerPos() const { return fNextPos;}
48265b32 53
ca7b8371 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 ;}
48265b32 59
5312f439 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; }
4c6d06dc 63
48265b32 64 void SetDataOffset(Int_t val){ foffset =val ;}
65 void SetWrite10Bit(Int_t wr) { fwrite10bit =wr ;}
66
67
5dbad769 68 void SetActFilename(Char_t* name){ snprintf(ffilename,256,"%s",name); }
48265b32 69 void SetVerbose(Int_t val) { fverb=val;}
70
71 private:
72
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
79
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
84
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
4c6d06dc 90
48265b32 91 Int_t fNextPos; // position of next trailer
92 Char_t* ffilename; // name of processed file
93
ca7b8371 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
48265b32 97
98
ca7b8371 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
48265b32 103
ca7b8371 104 static const Long64_t fgkTrailerTail = (Long64_t)0x0000000000002AAAULL; // Tail of the Trailer set to 2AAA
5312f439 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
ca7b8371 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)
48265b32 109
ca7b8371 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
48265b32 116
117 ClassDef(AliTPCMonitorAltro,1);
118};
119#endif