]> git.uio.no Git - u/mrichter/AliRoot.git/blob - MUON/AliMUONDarcHeader.h
Implemented right global output (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    UChar_t  GetGlobalOutput()       const {return (fGlobalOutput & 0xFF);}
32    UShort_t GetGlobalConfig()       const {return ((fGlobalOutput >> 16) & 0xFFFF);}
33
34    //MBZ:1, phys trig:1, type:3, ,SerialNb:4,Version:8,VME trig:1, 
35    //GlobalFlag:1, CTP trig:1, DAQ:1, Reg pattern:8;
36
37    Bool_t  GetEventType()  const {return (fWord &  0x40000000);}
38    UChar_t GetDarcType()   const {return (UChar_t)(fWord >> 27) &  0x7;}
39    UChar_t GetSerialNb()   const {return (UChar_t)(fWord >> 23) &  0xF;}
40    UChar_t GetVersion()    const {return (UChar_t)(fWord >> 15) &  0xFF;}
41    Bool_t  GetVMETrig()    const {return (fWord &  0x800);}
42    Bool_t  GetGlobalFlag() const {return (fWord &  0x400);}
43    Bool_t  GetCTPTrig()    const {return (fWord &  0x200);}
44    Bool_t  GetDAQFlag()    const {return (fWord &  0x100);}
45    UChar_t GetRegPattern() const {return (UChar_t)(fWord &  0xFF);}
46
47    void    SetWord(UInt_t w) {fWord = w;}
48    void    SetGlobalInput(Int_t in, Int_t n) {fGlobalInput[n] = in;}
49    void    SetGlobalOutput(Int_t out) {fGlobalOutput = out;}
50
51    Int_t   GetDarcHeaderLength()   const {return fgkDarcHeaderLength;}
52    Int_t   GetGlobalHeaderLength() const {return fgkGlobalHeaderLength;}
53
54    UInt_t* GetHeader() {return &fWord;}
55    Int_t*  GetGlobalInput()    {return &fGlobalInput[0];}
56
57   // DARC get methods
58    UInt_t  GetDarcL0R()     const {return fDarcL0R;}
59    UInt_t  GetDarcL1P()     const {return fDarcL1P;}
60    UInt_t  GetDarcL1S()     const {return fDarcL1S;}
61    UInt_t  GetDarcL2A()     const {return fDarcL2A;}
62    UInt_t  GetDarcL2R()     const {return fDarcL2R;}
63    UInt_t  GetDarcClock()   const {return fDarcClk;}
64    UInt_t  GetDarcHold()    const {return fDarcHold;}
65    
66    // don't use setting methods but memcpy
67    UInt_t* GetGlobalScalers()  {return &fGlobalL0;}
68    UInt_t* GetDarcScalers()    {return &fDarcL0R;} 
69
70    // global get methods
71    UInt_t  GetGlobalL0()      const {return fGlobalL0;}
72    UInt_t  GetGlobalClock()   const {return fGlobalClk;}
73    const UInt_t* GetGlobalScaler()  const {return fGlobalScaler;}
74    UInt_t  GetGlobalHold()    const {return fGlobalHold;}
75    UInt_t  GetGlobalSpare()   const {return fGlobalSpare;}
76
77    Int_t GetGlobalScalerLength() const {return fgkGlobalScalerLength;}
78    Int_t GetDarcScalerLength()   const {return fgkDarcScalerLength;} 
79
80    UInt_t GetEndOfDarc()     const {return fgkEndOfDarc;} 
81    UInt_t GetEndOfGlobal()   const {return fgkEndOfGlobal;} 
82
83    // set random numbers to fill variable
84    void SetScalersNumbers();
85
86   // get TClonesArray
87    TClonesArray*  GetRegHeaderArray()  const {return fRegHeaderArray;}
88
89    // get entries
90    Int_t GetRegHeaderEntries()  const {return fRegHeaderArray->GetEntriesFast();}
91
92    // get entry
93    AliMUONRegHeader* GetRegHeaderEntry(Int_t i) const  {
94      return (AliMUONRegHeader*)fRegHeaderArray->At(i);}
95
96    // clear
97    void Clear(Option_t* opt);
98
99  private:
100
101    UInt_t    fWord;              ///< first word
102    Int_t     fGlobalInput[4];    ///< global input
103    Int_t     fGlobalOutput;      ///< global ouput
104
105    static const Int_t fgkDarcHeaderLength;   ///< darc header length
106    static const Int_t fgkGlobalHeaderLength; ///< global header length
107
108
109  // global card scalers   
110    UInt_t     fGlobalL0;         ///< global L0
111    UInt_t     fGlobalClk;        ///< global clock
112    UInt_t     fGlobalScaler[6];  ///< global ouput
113    UInt_t     fGlobalHold;       ///< global hold (dead time)
114    UInt_t     fGlobalSpare;      ///< global spare
115    static const Int_t      fgkGlobalScalerLength;  ///< length of global scaler in word
116
117    // DARC Scalers
118    UInt_t     fDarcL0R;       ///< DARC L0 received and used
119    UInt_t     fDarcL1P;       ///< DARC L1 physics
120    UInt_t     fDarcL1S;       ///< DARC L1 software
121    UInt_t     fDarcL2A;       ///< DARC L2 accept
122    UInt_t     fDarcL2R;       ///< DARC L2 reject
123    UInt_t     fDarcClk;       ///< DARC clock
124    UInt_t     fDarcHold;      ///< DARC hold (dead time)
125    UInt_t     fDarcSpare;     ///< DARC Empty slot (for the moment)
126
127    static const Int_t      fgkDarcScalerLength;  ///< length of DARC scaler in word
128
129    static const UInt_t     fgkEndOfDarc;         ///< end of darc info word
130    static const UInt_t     fgkEndOfGlobal;       ///< end of global info word
131
132    TClonesArray* fRegHeaderArray; ///< container for regional header
133
134    ClassDef(AliMUONDarcHeader,1)  // MUON DDL Trigger
135 };
136 #endif