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