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