]> git.uio.no Git - u/mrichter/AliRoot.git/blob - MUON/AliMUONDarcHeader.h
In AliMUONTriggerQADataMakerRec:
[u/mrichter/AliRoot.git] / MUON / AliMUONDarcHeader.h
1 #ifndef ALIMUONDARCHEADER_H
2 #define ALIMUONDARCHEADER_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 AliMUONDarcHeader
10 /// \brief MUON Darc header for Trigger
11 ///
12 //  Author Christian Finck
13
14 #include <TObject.h>
15 #include <TClonesArray.h>
16
17 class AliMUONRegHeader;
18
19 class AliMUONDarcHeader : public TObject {
20  
21 public:
22    AliMUONDarcHeader();
23    AliMUONDarcHeader(const AliMUONDarcHeader& event);
24    AliMUONDarcHeader& operator=(const AliMUONDarcHeader& event);
25
26    virtual ~AliMUONDarcHeader();
27
28
29             /// Return first word
30    UInt_t   GetWord()               const {return fWord;}
31             /// Return global input
32    UInt_t   GetGlobalInput(Int_t n) const {return fGlobalInput[n];}
33             /// Return global output
34    UChar_t  GetGlobalOutput()       const {return (fGlobalOutput & 0xFF);}
35             /// Return global config  
36    UShort_t GetGlobalConfig()       const {return ((fGlobalOutput >> 16) & 0xFFFF);}
37
38    //MBZ:1, phys trig:1, type:3, ,SerialNb:4,Version:8,VME trig:1, 
39    //GlobalFlag:1, CTP trig:1, DAQ:1, Reg pattern:8;
40
41             /// Return event type
42    //Bool_t  GetEventType()  const {return (fWord &  0x40000000);}
43    Bool_t  GetEventType() const;
44             /// Return Darc type
45    UChar_t GetDarcType()   const {return (UChar_t)(fWord >> 24) &  0x7;}
46             /// Return serial number
47    UChar_t GetSerialNb()   const {return (UChar_t)(fWord >> 20) &  0xF;}
48             /// Return version
49    UChar_t GetVersion()    const {return (UChar_t)(fWord >> 12) &  0xFF;}
50             /// Return VME trig
51    Bool_t  GetVMETrig()    const {return (fWord &  0x800);}
52             /// Return global flag
53    Bool_t  GetGlobalFlag() const {return (fWord &  0x400);}
54             /// Return CPT trigger
55    Bool_t  GetCTPTrig()    const {return (fWord &  0x200);}
56             /// Return DAQ flag
57    Bool_t  GetDAQFlag()    const {return (fWord &  0x100);}
58             /// Return reg pattern
59    UChar_t GetRegPattern() const {return (UChar_t)(fWord &  0xFF);}
60
61            /// Set first word
62    void    SetWord(UInt_t w) {fWord = w;}
63            /// Set global input
64    void    SetGlobalInput(UInt_t in, Int_t n) {fGlobalInput[n] = in;}
65            /// Set global output
66    void    SetGlobalOutput(Int_t out) {fGlobalOutput = out;}
67
68             /// Return darc header length
69    Int_t   GetDarcHeaderLength()   const {return fgkDarcHeaderLength;}
70             /// Return global header length
71    Int_t   GetGlobalHeaderLength() const {return fgkGlobalHeaderLength;}
72
73             /// Return header
74    UInt_t* GetHeader() {return &fWord;}
75             /// Return global input
76    UInt_t* GetGlobalInput()    {return &fGlobalInput[0];}
77
78   // DARC get methods
79             /// Return DARC L0 received and used
80    UInt_t  GetDarcL0R()     const {return fDarcL0R;}
81             /// Return DARC L1 physics
82    UInt_t  GetDarcL1P()     const {return fDarcL1P;}
83             /// Return DARC L1 software
84    UInt_t  GetDarcL1S()     const {return fDarcL1S;}
85             /// Return DARC L2 accept
86    UInt_t  GetDarcL2A()     const {return fDarcL2A;}
87             /// Return DARC L2 reject
88    UInt_t  GetDarcL2R()     const {return fDarcL2R;}
89             /// Return DARC clock
90    UInt_t  GetDarcClock()   const {return fDarcClk;}
91             /// Return DARC hold (dead time)
92    UInt_t  GetDarcHold()    const {return fDarcHold;}
93    
94    // don't use setting methods but memcpy
95             /// Return global L0
96    UInt_t* GetGlobalScalers()  {return &fGlobalL0;}
97             /// Return DARC L0 received and used
98    UInt_t* GetDarcScalers()    {return &fDarcL0R;} 
99
100    // global get methods
101             /// Return global L0
102    UInt_t  GetGlobalL0()      const {return fGlobalL0;}
103             /// Return global clock
104    UInt_t  GetGlobalClock()   const {return fGlobalClk;}
105             /// Return global scaler
106    const UInt_t* GetGlobalScaler()  const {return fGlobalScaler;}
107             /// Return global hold (dead time)
108    UInt_t  GetGlobalHold()    const {return fGlobalHold;}
109             /// Return global spare
110    UInt_t  GetGlobalSpare()   const {return fGlobalSpare;}
111
112             /// Return length of global scaler in word
113    Int_t GetGlobalScalerLength() const {return fgkGlobalScalerLength;}
114             /// Return length of DARC scaler in word
115    Int_t GetDarcScalerLength()   const {return fgkDarcScalerLength;} 
116
117             /// Return end of darc info word
118    UInt_t GetEndOfDarc()     const {return fgkEndOfDarc;} 
119             /// Return end of global info word
120    UInt_t GetEndOfGlobal()   const {return fgkEndOfGlobal;} 
121
122            /// Return default type for DARC def.
123    UInt_t GetDarcDefaultType()   const {return fgkDarcDefaultType;} 
124           /// Return default type for DARC def.
125    UInt_t GetDarcVadohrType()   const {return fgkDarcVadorhType;} 
126
127    // set random numbers to fill variable
128    void SetScalersNumbers();
129
130    /// get TClonesArray
131    TClonesArray*  GetRegHeaderArray()  const {return fRegHeaderArray;}
132
133    /// get entries
134    Int_t GetRegHeaderEntries()  const {return fRegHeaderArray->GetEntriesFast();}
135
136    /// get entry
137    AliMUONRegHeader* GetRegHeaderEntry(Int_t i) const  {
138      return (AliMUONRegHeader*)fRegHeaderArray->At(i);}
139
140    // clear
141    void Clear(Option_t* opt);
142
143  private:
144
145    UInt_t    fWord;              ///< first word
146    UInt_t    fGlobalInput[4];    ///< global input
147    Int_t     fGlobalOutput;      ///< global ouput
148
149    static const Int_t fgkDarcHeaderLength;   ///< darc header length
150    static const Int_t fgkGlobalHeaderLength; ///< global header length
151
152
153  // global card scalers   
154    UInt_t     fGlobalL0;         ///< global L0
155    UInt_t     fGlobalClk;        ///< global clock
156    UInt_t     fGlobalScaler[6];  ///< global ouput
157    UInt_t     fGlobalHold;       ///< global hold (dead time)
158    UInt_t     fGlobalSpare;      ///< global spare
159    static const Int_t      fgkGlobalScalerLength;  ///< length of global scaler in word
160
161    // DARC Scalers
162    UInt_t     fDarcL0R;       ///< DARC L0 received and used
163    UInt_t     fDarcL1P;       ///< DARC L1 physics
164    UInt_t     fDarcL1S;       ///< DARC L1 software
165    UInt_t     fDarcL2A;       ///< DARC L2 accept
166    UInt_t     fDarcL2R;       ///< DARC L2 reject
167    UInt_t     fDarcClk;       ///< DARC clock
168    UInt_t     fDarcHold;      ///< DARC hold (dead time)
169    UInt_t     fDarcSpare;     ///< DARC Empty slot (for the moment)
170
171    static const Int_t      fgkDarcScalerLength;  ///< length of DARC scaler in word
172
173    static const UInt_t     fgkEndOfDarc;         ///< end of darc info word
174    static const UInt_t     fgkEndOfGlobal;       ///< end of global info word
175
176    static const UInt_t     fgkDarcDefaultType;   ///< default type for DARC def.
177    static const UInt_t     fgkDarcVadorhType;    ///< default type for DARC vadorh
178
179
180    TClonesArray* fRegHeaderArray; ///< container for regional header
181
182    ClassDef(AliMUONDarcHeader,2)  // MUON DDL Trigger
183 };
184 #endif