AliRoot Core  3abf5b4 (3abf5b4)
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
AliMpDDL.cxx
Go to the documentation of this file.
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: AliMpDDL.cxx,v 1.4 2006/05/24 13:58:34 ivana Exp $
18 // Category: management
19 
20 //-----------------------------------------------------------------------------
21 // Class AliMpDDL
22 // --------------------
23 // The class defines electronics properties of DDL
24 // Authors: Ivana Hrivnacova, IPN Orsay
25 // Christian Finck, SUBATECH Nantes
26 //-----------------------------------------------------------------------------
27 
28 #include "AliMpDDL.h"
29 #include "AliMpDEManager.h"
30 #include "AliMpDetElement.h"
31 
32 #include "AliLog.h"
33 
34 #include <Riostream.h>
35 
36 
37 using std::endl;
41 
42 //______________________________________________________________________________
43 AliMpDDL::AliMpDDL(Int_t id)
44  : TObject(),
45  fId(id),
46  fDEIds(),
47  fFrtIds(false),
48  fBusPatchIds(),
49  fTriggerCrateIds(false)
50 
51 {
53 }
54 
55 //______________________________________________________________________________
56 AliMpDDL::AliMpDDL(TRootIOCtor* /*ioCtor*/)
57  : TObject(),
58  fId(0),
59  fDEIds(),
60  fFrtIds(false),
61  fBusPatchIds(),
62  fTriggerCrateIds()
63 {
65 }
66 
67 //______________________________________________________________________________
69 {
71 }
72 
73 //
74 // private methods
75 //
76 
77 //______________________________________________________________________________
79 {
81 
82  for ( Int_t i=0; i<GetNofDEs(); i++ ) {
83  AliMpDetElement* detElement
85 
86  for ( Int_t j=0; j<detElement->GetNofBusPatches(); j++ )
87  fBusPatchIds.Add(detElement->GetBusPatchId(j));
88  }
89 }
90 
91 //
92 // public methods
93 //
94 
95 //______________________________________________________________________________
96 Bool_t AliMpDDL::AddDE(Int_t detElemId)
97 {
100 
101  if ( ! AliMpDEManager::IsValidDetElemId(detElemId) ) return false;
102 
103  if ( HasDEId(detElemId) ) {
104  AliWarningStream()
105  << "Detection element Id = " << detElemId << " already present."
106  << endl;
107  return false;
108  }
109 
110  AliDebugStream(3) << "Adding detElemId " << detElemId << endl;
111 
112  fDEIds.Add(detElemId);
113  return true;
114 }
115 
116 //______________________________________________________________________________
117 Bool_t AliMpDDL::AddTriggerCrate(Int_t crateId)
118 {
121 
122  if ( HasTriggerCrateId(crateId) ) {
123  AliWarningStream()
124  << "Trigger crate Id = " << crateId << " already present."
125  << endl;
126  return false;
127  }
128 
129  fTriggerCrateIds.Add(crateId);
130 
131  return true;
132 }
133 
134 //______________________________________________________________________________
135 Bool_t AliMpDDL::AddFrt(Int_t frtId)
136 {
139 
140  if ( HasFrtId(frtId) ) {
141  AliWarningStream()
142  << "FRT Id = " << frtId << " already present."
143  << endl;
144  return false;
145  }
146 
147  fFrtIds.Add(frtId);
148 
149  return true;
150 }
151 
152 
153 //______________________________________________________________________________
154 Int_t AliMpDDL::GetNofDEs() const
155 {
157 
158  return fDEIds.GetSize();
159 }
160 
161 //______________________________________________________________________________
162 Int_t AliMpDDL::GetDEId(Int_t index) const
163 {
165 
166  return fDEIds.GetValue(index);
167 }
168 
169 //______________________________________________________________________________
170 Bool_t AliMpDDL::HasDEId(Int_t detElemId) const
171 {
173 
174  return fDEIds.HasValue(detElemId);;
175 }
176 
177 //______________________________________________________________________________
178 Int_t AliMpDDL::GetNofFrts() const
179 {
181 
182  return fFrtIds.GetSize();
183 }
184 
185 //______________________________________________________________________________
186 Int_t AliMpDDL::GetFrtId(Int_t index) const
187 {
189 
190  return fFrtIds.GetValue(index);
191 }
192 
193 //______________________________________________________________________________
194 Bool_t AliMpDDL::HasFrtId(Int_t frtId) const
195 {
197 
198  return fFrtIds.HasValue(frtId);;
199 }
200 
201 
202 //______________________________________________________________________________
204 {
206 
207  return fBusPatchIds.GetSize();
208 }
209 
210 //______________________________________________________________________________
211 Int_t AliMpDDL::GetBusPatchId(Int_t index) const
212 {
214 
215  return fBusPatchIds.GetValue(index);
216 }
217 
218 //______________________________________________________________________________
219 Bool_t AliMpDDL::HasBusPatchId(Int_t busPatchId) const
220 {
222 
223  return fBusPatchIds.HasValue(busPatchId);;
224 }
225 
226 //______________________________________________________________________________
228 {
230 
231  return fTriggerCrateIds.GetSize();
232 }
233 
234 //______________________________________________________________________________
235 Int_t AliMpDDL::GetTriggerCrateId(Int_t index) const
236 {
238 
239  return fTriggerCrateIds.GetValue(index);
240 }
241 
242 //______________________________________________________________________________
243 Bool_t AliMpDDL::HasTriggerCrateId(Int_t triggerCrateId) const
244 {
246 
247  return fTriggerCrateIds.HasValue(triggerCrateId);
248 }
249 
250 //____________________________________________________________________
251 Int_t AliMpDDL::GetMaxDsp() const
252 {
254 
255  Int_t iBusPerBlk = fBusPatchIds.GetSize()/2; //per block
256 
257  Int_t iDspMax = iBusPerBlk/5; //number max of DSP per block
258  if (iBusPerBlk % 5 != 0)
259  iDspMax += 1;
260 
261  return iDspMax;
262 }
263 
264 //____________________________________________________________________
265 void AliMpDDL::GetBusPerDsp(Int_t* iBusPerDSP)
266 const
267 {
269 
270  Int_t iBusPerBlk = fBusPatchIds.GetSize()/2; //per block
271 
272  for (Int_t i = 0; i < GetMaxDsp(); i++) {
273  if ((iBusPerBlk -= 5) > 0)
274  iBusPerDSP[i] = 5;
275  else
276  iBusPerDSP[i] = iBusPerBlk + 5;
277  }
278 }
279 
Bool_t HasTriggerCrateId(Int_t crateId) const
Definition: AliMpDDL.cxx:243
void GetBusPerDsp(Int_t *iBusPerDSP) const
Definition: AliMpDDL.cxx:265
Int_t GetFrtId(Int_t index) const
Definition: AliMpDDL.cxx:186
Int_t GetSize() const
Int_t GetTriggerCrateId(Int_t index) const
Definition: AliMpDDL.cxx:235
Bool_t HasValue(Int_t value) const
Bool_t AddTriggerCrate(Int_t crateId)
Definition: AliMpDDL.cxx:117
Bool_t Add(Int_t value, Bool_t warn=kTRUE)
Definition: AliMpArrayI.cxx:97
Bool_t HasFrtId(Int_t frtId) const
Definition: AliMpDDL.cxx:194
The class defines the electronics properties of detection element.
The class defined electronics properties of DDL.
Definition: AliMpDDL.h:20
Bool_t AddFrt(Int_t frtId)
Definition: AliMpDDL.cxx:135
ClassImp(TPCGenInfo)
Definition: AliTPCCmpNG.C:254
virtual ~AliMpDDL()
Definition: AliMpDDL.cxx:68
AliMpDDL()
Not implemented.
Int_t GetNofBusPatches() const
Definition: AliMpDDL.cxx:203
void FillBusPatchIds()
Definition: AliMpDDL.cxx:78
AliMpArrayI fTriggerCrateIds
Trigger crate Ids connected to this DDL.
Definition: AliMpDDL.h:74
Int_t GetDEId(Int_t index) const
Definition: AliMpDDL.cxx:162
AliMpArrayI fBusPatchIds
Bus patch Ids connected to this DDL.
Definition: AliMpDDL.h:73
Int_t GetNofFrts() const
Definition: AliMpDDL.cxx:178
AliMpArrayI fDEIds
Detection element Ids connected to this DDL.
Definition: AliMpDDL.h:71
Bool_t HasDEId(Int_t detElemId) const
Definition: AliMpDDL.cxx:170
Int_t GetMaxDsp() const
Definition: AliMpDDL.cxx:251
Int_t GetNofBusPatches() const
Bool_t AddDE(Int_t detElemId)
Definition: AliMpDDL.cxx:96
Int_t GetBusPatchId(Int_t index) const
static AliMpDetElement * GetDetElement(Int_t detElemId, Bool_t warn=true)
Int_t GetBusPatchId(Int_t index) const
Definition: AliMpDDL.cxx:211
Int_t GetValue(Int_t index) const
AliMpArrayI fFrtIds
FRT Crocus Ids connected to this DDL.
Definition: AliMpDDL.h:72
static Bool_t IsValidDetElemId(Int_t detElemId, Bool_t warn=false)
Bool_t HasBusPatchId(Int_t busPatchId) const
Definition: AliMpDDL.cxx:219
Int_t GetNofDEs() const
Definition: AliMpDDL.cxx:154
Int_t GetNofTriggerCrates() const
Definition: AliMpDDL.cxx:227