]> git.uio.no Git - u/mrichter/AliRoot.git/blob - MUON/AliMUONRegHeader.h
fix
[u/mrichter/AliRoot.git] / MUON / AliMUONRegHeader.h
1 #ifndef ALIMUONREGHEADER_H
2 #define ALIMUONREGHEADER_H
3 /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4  * See cxx source for full Copyright notice                               */
5
6 /*$Id$*/
7
8 /// \ingroup raw
9 /// \class AliMUONRegHeader
10 /// \brief MUON regional header for trigger
11 ///
12 //  Author Christian Finck
13
14 #include <TObject.h>
15 #include <TClonesArray.h>
16
17 class AliMUONLocalStruct;
18
19 class AliMUONRegHeader : public TObject{
20  
21 public:
22    AliMUONRegHeader();
23    AliMUONRegHeader(const AliMUONRegHeader& event);
24    AliMUONRegHeader& operator=(const AliMUONRegHeader& event);
25
26    virtual ~AliMUONRegHeader();
27
28    /// Return darc word
29    UInt_t   GetDarcWord()      const {return fDarcWord;}
30    /// Return first reg word
31    UInt_t   GetWord()          const {return fWord;}
32    /// Return regional input
33    UInt_t   GetInput(Int_t n)  const {return fInput[n];}
34    /// Return L0
35    UShort_t GetL0()            const {return fL0   & 0xFFFF;}
36    /// Return mask
37    UShort_t GetMask()          const {return fMask & 0xFFFF;}
38
39    //word: phys type:1, reset: 6, serialNb:5, Id:4, version: 8, regional output:8
40    //true for phys, false for soft
41    /// Return RegPhysFlag
42    Bool_t    GetRegPhysFlag() const {return (fWord & 0x80000000);} 
43    /// Return ResetNb
44    UChar_t   GetResetNb()    const {return (UChar_t)(fWord >> 25) &  0x3F;}
45    /// Return SerialNb
46    UChar_t   GetSerialNb()   const {return (UChar_t)(fWord >> 20) &  0x1F;}
47    /// Return Id
48    UChar_t   GetId()         const {return (UChar_t)(fWord >> 16) &  0x0F;}
49    /// Return Version
50    UChar_t   GetVersion()    const {return (UChar_t)(fWord >> 8)  &  0xFF;}
51    /// Return Output
52    UChar_t   GetOutput()     const {return (UChar_t)(fWord       &  0xFF);}
53
54    //Darc Status: error:10, #fpag:3, MBZ:3, phys type:1, present:1, not_full:1
55    // not_empty:1, L2Rej:1, L2Acc:1, L1:1, L0:1, #evt:4, busy:4
56    /// Return ErrorBits
57    UShort_t GetErrorBits()       const {return (UShort_t)(fDarcWord >> 22) &  0x3FF;}
58    /// Return FPGANumber
59    UChar_t  GetFPGANumber()      const {return (UChar_t)  (fDarcWord >> 19) &  0x7;}
60    /// Return DarcPhysFlag
61    Bool_t   GetDarcPhysFlag()    const {return (fDarcWord  &  0x8000);}
62    /// Return PresentFlag
63    Bool_t   GetPresentFlag()     const {return (fDarcWord  &  0x4000);}
64    /// Return RamNotFullFlag
65    Bool_t   GetRamNotFullFlag()  const {return (fDarcWord  &  0x2000);}
66    /// Return RamNotEmptyFlag
67    Bool_t   GetRamNotEmptyFlag() const {return (fDarcWord  &  0x1000);}
68    /// Return L2RejStatus
69    Bool_t   GetL2RejStatus()     const {return (fDarcWord  &  0x800);}
70    /// Return L2AccStatus
71    Bool_t   GetL2AccStatus()     const {return (fDarcWord  &  0x400);}
72    /// Return L1Status
73    Bool_t   GetL1Status()        const {return (fDarcWord  &  0x200);}
74    /// Return L0Status
75    Bool_t   GetL0Status()        const {return (fDarcWord  &  0x100);}
76    /// Return EventInRam
77    UChar_t  GetEventInRam()      const {return (UChar_t)  (fDarcWord >> 4)  &  0x4;}
78    /// Return Busy
79    UChar_t  GetBusy()            const {return (UChar_t)  (fDarcWord)       &  0x4;}
80
81    /// Set darc word
82    void    SetDarcWord(UInt_t w) {fDarcWord = w;}
83    /// Set first reg word
84    void    SetWord(UInt_t w)     {fWord = w;}
85    /// Set local mask ("poids faible" 16 bits)
86    void    SetMask(UShort_t m)   {fMask = m;}
87    /// Set L0
88    void    SetL0(UShort_t l)     {fL0   = (l & 0xFFFF);}
89    /// Set regional input
90    void    SetInput(UInt_t in, Int_t n) {fInput[n] = in;}
91  
92
93    /// Return header length in word
94    Int_t   GetHeaderLength() const {return fgkHeaderLength;}
95    /// Return end of regional info word
96    UInt_t  GetEndOfReg()     const {return fgkEndOfReg;}
97   /// Return error word
98    UInt_t  GetErrorWord()    const {return fgkErrorWord;}
99
100    /// Return header
101    UInt_t* GetHeader() {return &fDarcWord;}
102
103   // scalar methods
104    /// Return regional clock
105    UInt_t  GetClock()   const {return fClk;}
106     /// Return regional ouput
107    const UInt_t* GetScaler()  const {return fScaler;}
108    /// Return regional hold (dead time)
109    UInt_t  GetHold()    const {return fHold;}
110
111    /// Return scalers
112    UInt_t* GetScalers()    {return &fClk;}   
113
114    /// get scaler length
115    Int_t GetScalerLength()  const {return fgkScalerLength;} 
116
117    /// set random numbers to fill variable
118    void SetScalersNumbers();
119
120    /// get TClonesArray
121    TClonesArray*  GetLocalArray()  const {return fLocalArray;}
122
123    /// get entries
124    Int_t GetLocalEntries()  const {return fLocalArray->GetEntriesFast();}
125
126    /// get entry
127    AliMUONLocalStruct* GetLocalEntry(Int_t i) const {
128      return (AliMUONLocalStruct*)fLocalArray->At(i);}
129
130    // clear
131    void Clear(Option_t* opt);
132
133  private:
134    
135    // regional header
136    UInt_t    fDarcWord;      ///< darc word
137    UInt_t    fWord;          ///< first reg word
138    UInt_t    fInput[2];      ///< regional input
139    UShort_t  fMask;          ///< local mask ("poids faible" 16 bits)
140    UShort_t  fL0;            ///< L0 counter (16 bits)
141
142    // regional card scalers   
143    UInt_t     fClk;        ///< regional clock
144    UInt_t     fScaler[8];  ///< regional ouput
145    UInt_t     fHold;       ///< regional hold (dead time)
146
147    static const Int_t  fgkScalerLength;  ///< length of regional scaler in word
148    static const Int_t  fgkHeaderLength;  ///< header length in word
149    static const UInt_t fgkEndOfReg;      ///< end of regional info word
150    static const UInt_t fgkErrorWord;     ///< error word when a regional board is missing
151    
152    TClonesArray* fLocalArray;   ///< array of local structure
153
154    ClassDef(AliMUONRegHeader,4) //MUON regional header for trigger
155 };
156 #endif