]> git.uio.no Git - u/mrichter/AliRoot.git/blob - MUON/AliMUONLocalStruct.h
Extended include path to cover all directories needed by all
[u/mrichter/AliRoot.git] / MUON / AliMUONLocalStruct.h
1 #ifndef ALIMUONLOCALSTRUCT_H
2 #define ALIMUONLOCALSTRUCT_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 AliMUONLocalStruct
10 /// \brief rawdata local card structure for trigger
11 ///
12 //  Author Christian Finck
13
14 #include <TObject.h>
15 #include <TMath.h>
16 #include <TArrayS.h>
17
18
19 class AliMUONLocalStruct : public TObject{
20  
21 public:
22    AliMUONLocalStruct();
23    AliMUONLocalStruct(const AliMUONLocalStruct& event);
24    AliMUONLocalStruct& operator=(const AliMUONLocalStruct& event);
25
26
27    virtual ~AliMUONLocalStruct();
28
29    // local board info
30             /// Return local data
31    UInt_t  GetData(Int_t n) const {return fData[n];}
32
33             /// Return X2
34    UShort_t GetX2() const {return (fData[0]     >> 16) &  0xFFFF;}
35             /// Return X1
36    UShort_t GetX1() const {return (fData[0])           &  0xFFFF;}
37             /// Return X4
38    UShort_t GetX4() const {return (fData[1] >> 16) &  0xFFFF;}
39             /// Return X3
40    UShort_t GetX3() const {return (fData[1])       &  0xFFFF;}
41            /// return X pattern array
42    void    GetXPattern(TArrayS& array) const;
43            /// return Y pattern array
44    void    GetYPattern(TArrayS& array) const;
45
46             /// Return Y2
47    UShort_t GetY2() const {return (fData[2] >> 16) &  0xFFFF;}
48             /// Return Y1
49    UShort_t GetY1() const {return (fData[2])       &  0xFFFF;}
50             /// Return Y4
51    UShort_t GetY4() const {return (fData[3] >> 16) &  0xFFFF;}
52             /// Return Y3
53    UShort_t GetY3() const {return (fData[3])       &  0xFFFF;}
54
55             /// Return Id
56    UChar_t  GetId()  const  {return fData[4] >> 19 &  0xF;}
57             /// Return Dec
58    UChar_t  GetDec() const  {return fData[4] >> 15 &  0xF;}
59             /// Return TriggerY
60    Bool_t   GetTriggerY() const {return (fData[4] >> 14 & 0x1);}
61             /// Return Upos
62    UChar_t  GetYPos() const {return fData[4] >> 10 &  0xF;}
63             /// Get Sign of X deviation 
64    UChar_t  GetSXDev() const {return fData[4] >> 9  &  0x1;}
65             /// Get X deviation 
66    UChar_t  GetXDev() const {return fData[4] >> 5  &  0xF;}
67             /// Return TriggerX
68    Bool_t   GetTriggerX() const {return ((GetXDev() >> 4  & 0x1) && !(GetXDev() & 0xF));}
69             /// Return Xpos
70    UChar_t  GetXPos() const {return fData[4]       &  0x1F;}
71
72             /// Return LPT
73    Int_t   GetLpt() const {return (GetDec() & 0x3);}
74             /// Return HPT
75    Int_t   GetHpt() const {return (GetDec() >> 2) & 0x3;}
76
77             /// Set local data
78    void    SetData(UInt_t d, Int_t n) {fData[n] = d;}
79
80             /// Return data
81    UInt_t* GetData() {return &fData[0];}
82
83  // Scaler methods
84             /// Return local L0
85    UInt_t  GetL0()      const {return fL0;}
86             /// Return local hold (dead time)
87    UInt_t  GetHold()    const {return fHold;}
88             /// Return local clock
89    UInt_t  GetClock()   const {return fClk;}
90             /// Return switch
91    UChar_t GetSwitch()  const {return (fEOS >> 2) & 0x3FF;}
92             /// Return ComptXY
93    UChar_t GetComptXY() const {return  fEOS & 3;}
94
95             /// Return XY1
96    UShort_t GetXY1(Int_t n) const {return  (n % 2 == 0) ?
97        (fScaler[TMath::Nint(Float_t(n/2))] &  0xFFFF) : 
98        (fScaler[TMath::Nint(Float_t(n/2))] >> 16) &  0xFFFF;}
99
100             /// Return XY2
101    UShort_t GetXY2(Int_t n) const {return  (n % 2 == 0) ?
102        (fScaler[8 + TMath::Nint(Float_t(n/2))] &  0xFFFF) : 
103        (fScaler[8 + TMath::Nint(Float_t(n/2))] >> 16) &  0xFFFF;}
104
105             /// Return XY3
106    UShort_t GetXY3(Int_t n) const {return  (n % 2 == 0) ?
107        (fScaler[8*2 + TMath::Nint(Float_t(n/2))] &  0xFFFF) : 
108        (fScaler[8*2 + TMath::Nint(Float_t(n/2))] >> 16) &  0xFFFF;}
109
110             /// Return XY4
111    UShort_t GetXY4(Int_t n) const {return  (n % 2 == 0) ?
112        (fScaler[8*3 + TMath::Nint(Float_t(n/2))] &  0xFFFF) : 
113        (fScaler[8*3 + TMath::Nint(Float_t(n/2))] >> 16) &  0xFFFF;}
114
115             /// Return scalers
116    UInt_t* GetScalers()  {return &fL0;} 
117
118    // get  length
119             /// Return scaler length in word
120    Int_t  GetScalerLength()  const {return fgkScalerLength;} 
121             /// Return local info length in word
122    Int_t  GetLength()        const {return fgkLength;} 
123             /// Return end of local info word
124    UInt_t GetEndOfLocal()    const {return fgkEndOfLocal;}
125             /// Return Word for "empty" slots
126    UInt_t GetDisableWord()   const {return fgkDisableWord;}
127
128    // set random numbers to fill variable
129    void SetScalersNumbers();
130
131  private:
132   
133    // local info
134    UInt_t    fData[5];  ///< local data
135    
136    // local card scalers   
137    UInt_t     fL0;        ///< local L0
138    UInt_t     fHold;      ///< local hold (dead time)
139    UInt_t     fClk;       ///< local clock
140
141    UInt_t     fLPtNTrig;  ///< local low Pt no trigger
142    UInt_t     fHPtNTrig;  ///< local high Pt no trigger
143
144    UInt_t     fLPtRTrig;  ///< local low Pt right trigger
145    UInt_t     fHPtRTrig;  ///< local high Pt right trigger
146
147    UInt_t     fLPtLTrig;  ///< local low Pt left trigger
148    UInt_t     fHPtLTrig;  ///< local high Pt left trigger
149
150    UInt_t     fLPtSTrig;  ///< local low Pt straight trigger
151    UInt_t     fHPtSTrig;  ///< local high Pt straight trigger
152
153    UInt_t     fScaler[8*4];   ///< local data
154    UInt_t     fEOS;           ///< contains switches conf. & flag for reading X (0) or Y (1) in fScaler
155    UInt_t     fReset;         ///< reset signal
156
157    static const Int_t  fgkLength;       ///< local info length in word
158    static const Int_t  fgkScalerLength; ///< scaler length in word
159    static const UInt_t fgkEndOfLocal;   ///< end of local info word
160    static const UInt_t fgkDisableWord;  ///< Word for "empty" slots
161
162    ClassDef(AliMUONLocalStruct,3)
163 };
164 #endif