]> git.uio.no Git - u/mrichter/AliRoot.git/blob - MUON/mapping/AliMpGlobalCrate.cxx
In Print(): added an option to print area borders
[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 /// Standard constructor
70
71   for (Int_t i = 0; i < fgkGlobalNofRegisters; ++i)
72     fGlobalRegisters[i] = 0;
73   
74   for (Int_t j = 0; j < fgkFetNofRegisters; ++j)
75     fFetRegisters[j] = 0;
76 }
77
78 //______________________________________________________________________________
79 AliMpGlobalCrate::AliMpGlobalCrate(TRootIOCtor* /*ioCtor*/)
80   : TNamed("GlobalCrate", "mapping trigger global crate"),
81     fJtagVmeAddr(0x0),
82     fJtagClockDiv(0),
83     fJtagRxPhase(0),
84     fJtagRdDelay(0),
85     fEnableJtag(0),
86     fJtagCrateName(),                  
87     fFirstDarcVmeAddr(0x0),
88     fFirstDarcType(0),
89     fFirstDarcDisable(0),
90     fFirstDarcL0Delay(0),
91     fFirstDarcL1TimeOut(0),
92     fSecondDarcVmeAddr(0x0),
93     fSecondDarcType(0),
94     fSecondDarcDisable(0),
95     fSecondDarcL0Delay(0),
96     fSecondDarcL1TimeOut(0),
97     fGlobalVmeAddr(0x0),
98     fGlobalRegisters(),
99     fFetVmeAddr(0x0),
100     fFetRegisters()
101 {
102 /// Root IO constructor
103 }
104
105 //______________________________________________________________________________
106 AliMpGlobalCrate::~AliMpGlobalCrate()
107 {
108 /// Destructor
109 }
110
111 //______________________________________________________________________________
112 Bool_t AliMpGlobalCrate::GetEnableJtag(Int_t index) const 
113 {
114   /// returns enable mask for a given Jtag line
115
116   if (index > fgkJtagNofLines) {
117     AliWarning("Index size too big for Jtag line");
118     return kFALSE;
119   }
120   return ((fEnableJtag >> index) & 0x1);
121
122 }
123
124 //______________________________________________________________________________
125 void AliMpGlobalCrate::SetJtagCrateName(Int_t index, TString name) 
126 {
127   /// Get Jtag crate name for a given index 
128   if (index > AliMpConstants::LocalBoardNofChannels()) {
129     AliWarning("Index size too big for Jtag line");
130     return;
131   }                                                 
132   fJtagCrateName[index] = name;
133 }
134
135 //______________________________________________________________________________
136 TString AliMpGlobalCrate::GetJtagCrateName(Int_t jtagLine, Int_t index) const 
137
138   /// Get the crate name for a given line and a given index 
139   if (jtagLine > AliMpConstants::LocalBoardNofChannels() || index > AliMpConstants::LocalBoardNofChannels())
140     return 0x0;
141   else                                       
142     return fJtagCrateName[jtagLine*fgkJtagNofLines + index];
143 }
144
145 //______________________________________________________________________________
146 UInt_t AliMpGlobalCrate::GetGlobalRegister(Int_t index) const       
147 {
148   /// return global register for a given index
149   if (index > fgkGlobalNofRegisters) {
150     AliWarning("Index size too big for Global Register");
151     return 0;
152   } else 
153     return fGlobalRegisters[index];
154 }
155
156 //______________________________________________________________________________
157 void AliMpGlobalCrate::SetGlobalRegister(Int_t index, UInt_t reg) 
158 {
159   /// set Global register for a given index
160   if (index > fgkGlobalNofRegisters) {
161     AliWarning("Index size too big for Global Register");
162     return;
163   } 
164   fGlobalRegisters[index] = reg;
165 }
166    
167 //______________________________________________________________________________
168 UInt_t AliMpGlobalCrate::GetFetRegister(Int_t index) const       
169 {
170   /// return global register for a given index
171   if (index > fgkFetNofRegisters) {
172     AliWarning("Index size too big for Fet Register");
173     return 0;
174   } else 
175     return fFetRegisters[index];
176 }
177
178 //______________________________________________________________________________
179 void AliMpGlobalCrate::SetFetRegister(Int_t index, UInt_t reg) 
180 {
181   /// set Global register for a given index
182   if (index > fgkFetNofRegisters) {
183     AliWarning("Index size too big for Global Register");
184     return;
185   } 
186   fFetRegisters[index] = reg;
187 }