]> git.uio.no Git - u/mrichter/AliRoot.git/blob - MUON/mapping/AliMpGlobalCrate.cxx
2b5bbc747b6a589963c4507c228d703f98cc43ad
[u/mrichter/AliRoot.git] / MUON / mapping / AliMpGlobalCrate.cxx
1 /**************************************************************************
2  * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
3  *                                                                        *
4  * Author: The ALICE Off-line Project.                                    *
5  * Contributors are mentioned in the code where appropriate.              *
6  *                                                                        *
7  * Permission to use, copy, modify and distribute this software and its   *
8  * documentation strictly for non-commercial purposes is hereby granted   *
9  * without fee, provided that the above copyright notice appears in all   *
10  * copies and that both the copyright notice and this permission notice   *
11  * appear in the supporting documentation. The authors make no claims     *
12  * about the suitability of this software for any purpose. It is          *
13  * provided "as is" without express or implied warranty.                  *
14  **************************************************************************/
15
16 // $Id$
17 // $MpId: AliMpTrigger.cxx,v 1.4 2006/05/24 13:58:52 ivana Exp $
18
19 //-----------------------------------------------------------------------------
20 // Class AliMpGlobalCrate
21 // --------------------
22 // The class defines the properties of trigger crate
23 // Author: Ch. Finck, Subatech Nantes
24 //-----------------------------------------------------------------------------
25
26 #include "AliMpGlobalCrate.h"
27 #include "AliMpDEManager.h"
28 #include "AliMpConstants.h"
29
30 #include "AliLog.h"
31
32 #include <Riostream.h>
33
34 /// \cond CLASSIMP
35 ClassImp(AliMpGlobalCrate)
36 /// \endcond
37
38 const Char_t*  AliMpGlobalCrate::fgkJtagName       = "JtagBoard";
39 const Char_t*  AliMpGlobalCrate::fgkFirstDarcName  = "LeftDarcBoard";
40 const Char_t*  AliMpGlobalCrate::fgkSecondDarcName = "RightDarcBoard";
41 const Char_t*  AliMpGlobalCrate::fgkGlobalName     = "GlobalBoard";  
42 const Char_t*  AliMpGlobalCrate::fgkFetName        = "FetBoard"; 
43
44 const Int_t   AliMpGlobalCrate::fgkGlobalNofRegisters =  13; 
45 const Int_t   AliMpGlobalCrate::fgkFetNofRegisters    =  7; 
46 const Int_t   AliMpGlobalCrate::fgkJtagNofLines       =  4; 
47 //______________________________________________________________________________
48 AliMpGlobalCrate::AliMpGlobalCrate()
49   : TNamed("GlobalCrate", "mapping trigger global crate"),
50     fJtagVmeAddr(0x0),
51     fJtagClockDiv(0),
52     fJtagRxPhase(0),
53     fJtagRdDelay(0),
54     fEnableJtag(0),
55     fJtagCrateName(),                  
56     fFirstDarcVmeAddr(0x0),
57     fFirstDarcType(0),
58     fFirstDarcDisable(0),
59     fFirstDarcL0Delay(0),
60     fFirstDarcL1TimeOut(0),
61     fSecondDarcVmeAddr(0x0),
62     fSecondDarcType(0),
63     fSecondDarcDisable(0),
64     fSecondDarcL0Delay(0),
65     fSecondDarcL1TimeOut(0),
66     fGlobalVmeAddr(0x0),
67     fFetVmeAddr(0x0)
68 {
69
70   for (Int_t i = 0; i < fgkGlobalNofRegisters; ++i)
71     fGlobalRegisters[i] = 0;
72   
73   for (Int_t j = 0; j < fgkFetNofRegisters; ++j)
74     fFetRegisters[j] = 0;
75    
76
77  
78
79 /// Standard constructor
80 }
81
82 //______________________________________________________________________________
83 AliMpGlobalCrate::AliMpGlobalCrate(TRootIOCtor* /*ioCtor*/)
84   : TNamed("GlobalCrate", "mapping trigger global crate"),
85     fJtagVmeAddr(0x0),
86     fJtagClockDiv(0),
87     fJtagRxPhase(0),
88     fJtagRdDelay(0),
89     fEnableJtag(0),
90     fJtagCrateName(),                  
91     fFirstDarcVmeAddr(0x0),
92     fFirstDarcType(0),
93     fFirstDarcDisable(0),
94     fFirstDarcL0Delay(0),
95     fFirstDarcL1TimeOut(0),
96     fSecondDarcVmeAddr(0x0),
97     fSecondDarcType(0),
98     fSecondDarcDisable(0),
99     fSecondDarcL0Delay(0),
100     fSecondDarcL1TimeOut(0),
101     fGlobalVmeAddr(0x0),
102     fGlobalRegisters(),
103     fFetVmeAddr(0x0),
104     fFetRegisters()
105 {
106 /// Root IO constructor
107 }
108
109 //______________________________________________________________________________
110 AliMpGlobalCrate::~AliMpGlobalCrate()
111 {
112 /// Destructor
113 }
114
115 //______________________________________________________________________________
116 Bool_t AliMpGlobalCrate::GetEnableJtag(Int_t index) const 
117 {
118   /// returns enable mask for a given Jtag line
119
120   if (index > fgkJtagNofLines) {
121     AliWarning("Index size too big for Jtag line");
122     return kFALSE;
123   }
124   return ((fEnableJtag >> index) & 0x1);
125
126 }
127
128 //______________________________________________________________________________
129 void AliMpGlobalCrate::SetJtagCrateName(Int_t index, TString name) 
130 {
131   /// Get Jtag crate name for a given index 
132   if (index > AliMpConstants::LocalBoardNofChannels()) {
133     AliWarning("Index size too big for Jtag line");
134     return;
135   }                                                 
136   fJtagCrateName[index] = name;
137 }
138
139 //______________________________________________________________________________
140 TString AliMpGlobalCrate::GetJtagCrateName(Int_t jtagLine, Int_t index) const 
141
142   /// Get the crate name for a given line and a given index 
143   if (jtagLine > AliMpConstants::LocalBoardNofChannels() || index > AliMpConstants::LocalBoardNofChannels())
144     return 0x0;
145   else                                       
146     return fJtagCrateName[jtagLine*fgkJtagNofLines + index];
147 }
148
149 //______________________________________________________________________________
150 UInt_t AliMpGlobalCrate::GetGlobalRegister(Int_t index) const       
151 {
152   /// return global register for a given index
153   if (index > fgkGlobalNofRegisters) {
154     AliWarning("Index size too big for Global Register");
155     return 0;
156   } else 
157     return fGlobalRegisters[index];
158 }
159
160 //______________________________________________________________________________
161 void AliMpGlobalCrate::SetGlobalRegister(Int_t index, UInt_t reg) 
162 {
163   /// set Global register for a given index
164   if (index > fgkGlobalNofRegisters) {
165     AliWarning("Index size too big for Global Register");
166     return;
167   } 
168   fGlobalRegisters[index] = reg;
169 }
170    
171 //______________________________________________________________________________
172 UInt_t AliMpGlobalCrate::GetFetRegister(Int_t index) const       
173 {
174   /// return global register for a given index
175   if (index > fgkFetNofRegisters) {
176     AliWarning("Index size too big for Fet Register");
177     return 0;
178   } else 
179     return fFetRegisters[index];
180 }
181
182 //______________________________________________________________________________
183 void AliMpGlobalCrate::SetFetRegister(Int_t index, UInt_t reg) 
184 {
185   /// set Global register for a given index
186   if (index > fgkFetNofRegisters) {
187     AliWarning("Index size too big for Global Register");
188     return;
189   } 
190   fFetRegisters[index] = reg;
191 }