]> git.uio.no Git - u/mrichter/AliRoot.git/blob - TPC/AliTPCMonitorAltro.h
Further fixes to the par file generation
[u/mrichter/AliRoot.git] / TPC / AliTPCMonitorAltro.h
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 ////////////////////////////////////////////////////////////////////////
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 ////       
18 /////////////////////////////////////////////////////////////////////////
19
20 #include "TNamed.h"
21
22 class AliTPCMonitorAltro : public TNamed {
23  public:
24     AliTPCMonitorAltro(UInt_t* memory, Int_t size, Int_t fformat);
25     AliTPCMonitorAltro(const  AliTPCMonitorAltro &altro);
26     AliTPCMonitorAltro& operator= (const AliTPCMonitorAltro& altro);
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);
36
37     Long64_t*    Get40BitArray();
38     Short_t     *Get10BitArray();     
39     Int_t        Get40BitArraySize()     const { return fmemory[fsize-1];}  
40     Int_t        Get10BitArraySize()     const { return fmemory[fsize-1]*4;}  
41     Char_t*      GetActFileName()        const { return ffilename;}
42     
43     static Int_t GetHwMaskFEC()                { return fgkHwMaskFEC;}
44     static Int_t GetHwMaskBranch()             { return fgkHwMaskBranch;}
45     static Int_t GetHwMaskFECChannel()         { return fgkHwMaskFECChannel;}
46     static Int_t GetHwMaskAltroChannel()       { return fgkHwMaskAltroChannel;}
47     static Int_t GetHwMaskAltroChip()          { return fgkHwMaskAltroChip;}
48
49     static Int_t GetHwMaskRCU()                { return fgkHwMaskRCU;}
50     
51     Int_t        GetNextTrailerPos()     const { return fNextPos;}
52
53     Int_t        GetTrailerNWords()      const { return fTrailerNWords   ;}
54     Int_t        GetTrailerHwAddress()   const { return fTrailerHwAddress;}
55     Int_t        GetTrailerDataPos()     const { return fTrailerDataPos  ;}
56     Int_t        GetTrailerBlockPos()    const { return fTrailerBlockPos ;}
57     Int_t        GetTrailerPos()         const { return fTrailerPos      ;} 
58
59     void         SetDataOffset(Int_t val){ foffset     =val ;} 
60     void         SetWrite10Bit(Int_t wr) { fwrite10bit =wr  ;}
61     
62   
63     void         SetActFilename(Char_t* name){ sprintf(ffilename,"%s",name); } 
64     void         SetVerbose(Int_t val)   { fverb=val;}
65      
66  private:
67     
68     Int_t                    fverb;                                                     // verbose flag           
69     UInt_t*                  fmemory;                                                   // memory pointer fo payload               
70     Int_t                    fsize;                                                     // size of fmemory 
71     Long64_t*                f40BitArray;                                               // array to store 40 bit words 
72     Short_t*                 f10BitArray;                                               // array to store 10 bit words   
73     Int_t                    fdecoderPos;                                               // start position for decoding 40 bit words
74          
75     Bool_t                   fallocate40BitArray;                                       // flag for decoding to 40 bit words
76     Bool_t                   fallocate10BitArray;                                       // flag for decoding to 10 bit words
77     Int_t                    foffset ;                                                   // data offset (CDH length) 
78     Int_t                    fwrite10bit;                                               // flag for writing 10 bit words to file 
79     
80     Int_t                    fTrailerNWords ;                                           // from Trailer: number of 40 bit words for channel  
81     Int_t                    fTrailerHwAddress;                                         // from Trailer: hardware address for current channel
82     Int_t                    fTrailerDataPos;                                           // from Trailer: position of first adc value 
83     Int_t                    fTrailerBlockPos;                                          // from Trailer: number of 40 bit words for channel
84     Int_t                    fTrailerPos;                                               // trailer position
85     
86     Int_t                    fNextPos;                                                  // position of next trailer
87     Char_t*                  ffilename;                                                 // name of processed file
88     
89     static const Int_t       fgk24BitOn                = 16777215;                        // bit masks for first 24 bits of 32  for decoding 32 bit words
90     static const Int_t       fgk16BitOn                = 65535;                           // bit masks for first 24 bits of 24
91     static const Int_t       fgk08BitOn                = 255;                             // bit masks for first 24 bits of 8
92     
93     
94     static const Long64_t    fgkmask10                 = (Long64_t)0x00000000000003FFULL; // mask first   10 bit out of 4o0 bit word 
95     static const Long64_t    fgkmask20                 = (Long64_t)0x00000000000FFC00ULL; // mask second  10 bit out of 4o0 bit word 
96     static const Long64_t    fgkmask30                 = (Long64_t)0x000000003FF00000ULL; // mask third   10 bit out of 4o0 bit word 
97     static const Long64_t    fgkmask40                 = (Long64_t)0x000000FFC0000000ULL; // mask fourth  10 bit out of 4o0 bit word 
98     
99     static const Long64_t    fgkTrailerTail            = (Long64_t)0x0000000000002AAAULL; // Tail of the Trailer set to 2AAA 
100     static const Long64_t    fgkTrailerMaskTail        = (Long64_t)0x000000fffC000000ULL; // mask for trailer 
101     static const Long64_t    fgkTrailerMaskHardw       = (Long64_t)0x0000000000000FFFULL; // mask for hardware address
102     static const Long64_t    fgkTrailerMaskNWords      = (Long64_t)0x0000000003FF0000ULL; // mask for nwords  (number of 40 bit data words)
103     
104     static const Int_t       fgkHwMaskFEC              = 0x0780;                          // mask for fec in hardware address
105     static const Int_t       fgkHwMaskBranch           = 0x0800;                          // mask for branch in hardware address
106     static const Int_t       fgkHwMaskFECChannel       = 0x007f;                          // mask for fec channel  in hardware address
107     static const Int_t       fgkHwMaskAltroChannel     = 0x000f;                          // mask for altro channel in hardware address
108     static const Int_t       fgkHwMaskAltroChip        = 0x0070;                          // mask for altro chip  in hardware address
109     static const Int_t       fgkHwMaskRCU              = 0x7000;                          // not part of the trailer added afterwards
110     
111     ClassDef(AliTPCMonitorAltro,1);
112 };
113 #endif