]> git.uio.no Git - u/mrichter/AliRoot.git/blob - MUON/AliMUONDarcHeader.h
Fixing bug in Darc header length (Christian)
[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    UInt_t  GetWord()               const {return fWord;}
30    Int_t   GetGlobalInput(Int_t n) const {return fGlobalInput[n];}
31    Int_t   GetGlobalOutput()       const {return fGlobalOutput;}
32
33    //DarcId:4,SerialNb:4,Version:8,EventType:4,GlobalFlag:4,MBZ:8;
34    Char_t  GetDarcId()     const {return (Char_t)(fWord >> 28) &  0xF;}
35    Char_t  GetSerialNb()   const {return (Char_t)(fWord >> 24) &  0xF;}
36    Char_t  GetVersion()    const {return (Char_t)(fWord >> 16) &  0xFF;}
37    Char_t  GetEventType()  const {return (Char_t)(fWord >> 12) &  0xF;}
38    Char_t  GetGlobalFlag() const {return (Char_t)(fWord >>  8) &  0xF;}
39
40    void    SetWord(UInt_t w) {fWord = w;}
41    void    SetGlobalInput(Int_t in, Int_t n) {fGlobalInput[n] = in;}
42    void    SetGlobalOutput(Int_t out) {fGlobalOutput = out;}
43
44    Int_t   GetDarcHeaderLength()   const {return fgkDarcHeaderLength;}
45    Int_t   GetGlobalHeaderLength() const {return fgkGlobalHeaderLength;}
46
47    UInt_t* GetHeader() {return &fWord;}
48    Int_t*  GetGlobalInput()    {return &fGlobalInput[0];}
49
50   // DARC get methods
51    UInt_t  GetDarcL0R()     const {return fDarcL0R;}
52    UInt_t  GetDarcL0U()     const {return fDarcL0U;}
53    UInt_t  GetDarcL0P()     const {return fDarcL0P;}
54    UInt_t  GetDarcL0S()     const {return fDarcL0S;}
55    UInt_t  GetDarcClock()   const {return fDarcClk;}
56    UInt_t  GetDarcHold()    const {return fDarcHold;}
57    
58    // don't use setting methods but memcpy
59    UInt_t* GetGlobalScalers()  {return &fGlobalL0;}
60    UInt_t* GetDarcScalers()    {return &fDarcL0R;} 
61
62    // global get methods
63    UInt_t  GetGlobalL0()      const {return fGlobalL0;}
64    UInt_t  GetGlobalClock()   const {return fGlobalClk;}
65    const UInt_t* GetGlobalScaler()  const {return fGlobalScaler;}
66    UInt_t  GetGlobalHold()    const {return fGlobalHold;}
67    UInt_t  GetGlobalSpare()   const {return fGlobalSpare;}
68
69    Int_t GetGlobalScalerLength() const {return fgkGlobalScalerLength;}
70    Int_t GetDarcScalerLength()   const {return fgkDarcScalerLength;} 
71
72    UInt_t GetEndOfDarc()     const {return fgkEndOfDarc;} 
73    UInt_t GetEndOfGlobal()   const {return fgkEndOfGlobal;} 
74
75    // set random numbers to fill variable
76    void SetScalersNumbers();
77
78   // get TClonesArray
79    TClonesArray*  GetRegHeaderArray()  const {return fRegHeaderArray;}
80
81    // get entries
82    Int_t GetRegHeaderEntries()  const {return fRegHeaderArray->GetEntriesFast();}
83
84    // get entry
85    AliMUONRegHeader* GetRegHeaderEntry(Int_t i) const  {
86      return (AliMUONRegHeader*)fRegHeaderArray->At(i);}
87
88    // clear
89    void Clear(Option_t* opt);
90
91  private:
92
93    UInt_t    fWord;              ///< first word
94    Int_t     fGlobalInput[4];    ///< global input
95    Int_t     fGlobalOutput;      ///< global ouput
96
97    static const Int_t fgkDarcHeaderLength;   ///< darc header length
98    static const Int_t fgkGlobalHeaderLength; ///< global header length
99
100
101  // global card scalers   
102    UInt_t     fGlobalL0;         ///< global L0
103    UInt_t     fGlobalClk;        ///< global clock
104    UInt_t     fGlobalScaler[6];  ///< global ouput
105    UInt_t     fGlobalHold;       ///< global hold (dead time)
106    UInt_t     fGlobalSpare;      ///< global spare
107    static const Int_t      fgkGlobalScalerLength;  ///< length of global scaler in word
108
109    // DARC Scalers
110    UInt_t     fDarcL0R;       ///< DARC L0 received
111    UInt_t     fDarcL0U;       ///< DARC L0 used
112    UInt_t     fDarcL0P;       ///< DARC Physical L0
113    UInt_t     fDarcL0S;       ///< DARC Software (checking) L0
114    UInt_t     fDarcClk;       ///< DARC clock
115    UInt_t     fDarcHold;      ///< DARC hold (dead time)
116    static const Int_t      fgkDarcScalerLength;  ///< length of DARC scaler in word
117
118    static const UInt_t     fgkEndOfDarc;         ///< end of darc info word
119    static const UInt_t     fgkEndOfGlobal;       ///< end of global info word
120
121    TClonesArray* fRegHeaderArray; ///< container for regional header
122
123    ClassDef(AliMUONDarcHeader,1)  // MUON DDL Trigger
124 };
125 #endif