]> git.uio.no Git - u/mrichter/AliRoot.git/blob - MUON/AliMUONLocalStruct.h
Adding CVS Id
[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    UInt_t  GetData(Int_t n) const {return fData[n];}
29
30    UShort_t GetX2() const {return (fData[0]     >> 16) &  0xFFFF;}
31    UShort_t GetX1() const {return (fData[0])           &  0xFFFF;}
32    UShort_t GetX4() const {return (fData[1] >> 16) &  0xFFFF;}
33    UShort_t GetX3() const {return (fData[1])       &  0xFFFF;}
34
35    UShort_t GetY2() const {return (fData[2] >> 16) &  0xFFFF;}
36    UShort_t GetY1() const {return (fData[2])       &  0xFFFF;}
37    UShort_t GetY4() const {return (fData[3] >> 16) &  0xFFFF;}
38    UShort_t GetY3() const {return (fData[3])       &  0xFFFF;}
39
40    UChar_t  GetId()  const  {return fData[4] >> 19 &  0xF;}
41    UChar_t  GetDec() const  {return fData[4] >> 15 &  0xF;}
42    Bool_t   GetTriggerY() const {return (fData[4] >> 14 & 0x1);}
43    UChar_t  GetYPos() const {return fData[4] >> 10 &  0xF;}
44    UChar_t  GetXDev() const {return fData[4] >> 5  &  0x1F;}
45    Bool_t   GetTriggerX() const {return ((GetXDev() >> 4  & 0x1) && !(GetXDev() & 0xF));}
46    UChar_t  GetXPos() const {return fData[4]       &  0x1F;}
47
48    Int_t   GetLpt() const {return (GetDec() & 0x3);}
49    Int_t   GetHpt() const {return (GetDec() >> 2) & 0x3;}
50
51    void    SetData(UInt_t d, Int_t n) {fData[n] = d;}
52
53    UInt_t* GetData() {return &fData[0];}
54
55  // Scaler methods
56    UInt_t  GetL0()      const {return fL0;}
57    UInt_t  GetHold()    const {return fHold;}
58    UInt_t  GetClock()   const {return fClk;}
59    UChar_t GetSwitch()  const {return (fEOS >> 2) & 0x3FF;}
60    UChar_t GetComptXY() const {return  fEOS & 3;}
61
62    UShort_t GetXY1(Int_t n) const {return  (n % 2 == 0) ?
63        (fScaler[TMath::Nint(Float_t(n/2))] &  0xFFFF) : 
64        (fScaler[TMath::Nint(Float_t(n/2))] >> 16) &  0xFFFF;}
65
66    UShort_t GetXY2(Int_t n) const {return  (n % 2 == 0) ?
67        (fScaler[8 + TMath::Nint(Float_t(n/2))] &  0xFFFF) : 
68        (fScaler[8 + TMath::Nint(Float_t(n/2))] >> 16) &  0xFFFF;}
69
70    UShort_t GetXY3(Int_t n) const {return  (n % 2 == 0) ?
71        (fScaler[8*2 + TMath::Nint(Float_t(n/2))] &  0xFFFF) : 
72        (fScaler[8*2 + TMath::Nint(Float_t(n/2))] >> 16) &  0xFFFF;}
73
74    UShort_t GetXY4(Int_t n) const {return  (n % 2 == 0) ?
75        (fScaler[8*3 + TMath::Nint(Float_t(n/2))] &  0xFFFF) : 
76        (fScaler[8*3 + TMath::Nint(Float_t(n/2))] >> 16) &  0xFFFF;}
77
78    UInt_t* GetScalers()  {return &fL0;} 
79
80    // get  length
81    Int_t  GetScalerLength()  const {return fgkScalerLength;} 
82    Int_t  GetLength()        const {return fgkLength;} 
83    UInt_t GetEndOfLocal()    const {return fgkEndOfLocal;}
84    UInt_t GetDisableWord()   const {return fgkDisableWord;}
85
86   // set random numbers to fill variable
87    void SetScalersNumbers();
88
89  private:
90   
91    // local info
92    UInt_t    fData[5];  ///< local data
93    
94    // local card scalers   
95    UInt_t     fL0;        ///< local L0
96    UInt_t     fHold;      ///< local hold (dead time)
97    UInt_t     fClk;       ///< local clock
98
99    UInt_t     fLPtNTrig;  ///< local low Pt no trigger
100    UInt_t     fHPtNTrig;  ///< local high Pt no trigger
101
102    UInt_t     fLPtRTrig;  ///< local low Pt right trigger
103    UInt_t     fHPtRTrig;  ///< local high Pt right trigger
104
105    UInt_t     fLPtLTrig;  ///< local low Pt left trigger
106    UInt_t     fHPtLTrig;  ///< local high Pt left trigger
107
108    UInt_t     fLPtSTrig;  ///< local low Pt straight trigger
109    UInt_t     fHPtSTrig;  ///< local high Pt straight trigger
110
111    UInt_t     fScaler[8*4];   ///< local data
112    UInt_t     fEOS;           ///< contains switches conf. & flag for reading X (0) or Y (1) in fScaler
113    UInt_t     fReset;         ///< reset signal
114
115    static const Int_t  fgkLength;       ///< local info length in word
116    static const Int_t  fgkScalerLength; ///< scaler length in word
117    static const UInt_t fgkEndOfLocal;   ///< end of local info word
118    static const UInt_t fgkDisableWord;  ///< Word for "empty" slots
119
120    ClassDef(AliMUONLocalStruct,3)
121 };
122 #endif