1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
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 **************************************************************************/
17 // $MpId: AliMpDDL.cxx,v 1.4 2006/05/24 13:58:34 ivana Exp $
18 // Category: management
20 //-----------------------------------------------------------------------------
22 // --------------------
23 // The class defines electronics properties of DDL
24 // Authors: Ivana Hrivnacova, IPN Orsay
25 // Christian Finck, SUBATECH Nantes
26 //-----------------------------------------------------------------------------
29 #include "AliMpDEManager.h"
30 #include "AliMpDetElement.h"
34 #include <Riostream.h>
42 //______________________________________________________________________________
43 AliMpDDL::AliMpDDL(Int_t id)
49 fTriggerCrateIds(false)
52 /// Standard constructor
55 //______________________________________________________________________________
56 AliMpDDL::AliMpDDL(TRootIOCtor* /*ioCtor*/)
64 /// Root IO constructor
67 //______________________________________________________________________________
77 //______________________________________________________________________________
78 void AliMpDDL::FillBusPatchIds()
80 /// Fill array with bus patch Ids
82 for ( Int_t i=0; i<GetNofDEs(); i++ ) {
83 AliMpDetElement* detElement
84 = AliMpDEManager::GetDetElement(GetDEId(i));
86 for ( Int_t j=0; j<detElement->GetNofBusPatches(); j++ )
87 fBusPatchIds.Add(detElement->GetBusPatchId(j));
95 //______________________________________________________________________________
96 Bool_t AliMpDDL::AddDE(Int_t detElemId)
98 /// Add detection element with given detElemId.
99 /// Return true if the detection element was added
101 if ( ! AliMpDEManager::IsValidDetElemId(detElemId) ) return false;
103 if ( HasDEId(detElemId) ) {
105 << "Detection element Id = " << detElemId << " already present."
110 AliDebugStream(3) << "Adding detElemId " << detElemId << endl;
112 fDEIds.Add(detElemId);
116 //______________________________________________________________________________
117 Bool_t AliMpDDL::AddTriggerCrate(Int_t crateId)
119 /// Add trigger crate with given crateId.
120 /// Return true if the trigger crate was added
122 if ( HasTriggerCrateId(crateId) ) {
124 << "Trigger crate Id = " << crateId << " already present."
129 fTriggerCrateIds.Add(crateId);
134 //______________________________________________________________________________
135 Bool_t AliMpDDL::AddFrt(Int_t frtId)
137 /// Add FRT with given frtId.
138 /// Return true if the FRT was added
140 if ( HasFrtId(frtId) ) {
142 << "FRT Id = " << frtId << " already present."
153 //______________________________________________________________________________
154 Int_t AliMpDDL::GetNofDEs() const
156 /// Return the number of detection elements connected to this DDL
158 return fDEIds.GetSize();
161 //______________________________________________________________________________
162 Int_t AliMpDDL::GetDEId(Int_t index) const
164 /// Return the detection element by index (in loop)
166 return fDEIds.GetValue(index);
169 //______________________________________________________________________________
170 Bool_t AliMpDDL::HasDEId(Int_t detElemId) const
172 /// Return true if the detection element Id is present
174 return fDEIds.HasValue(detElemId);;
177 //______________________________________________________________________________
178 Int_t AliMpDDL::GetNofFrts() const
180 /// Return the number of FRT connected to this DDL
182 return fFrtIds.GetSize();
185 //______________________________________________________________________________
186 Int_t AliMpDDL::GetFrtId(Int_t index) const
188 /// Return the FRT by index (in loop)
190 return fFrtIds.GetValue(index);
193 //______________________________________________________________________________
194 Bool_t AliMpDDL::HasFrtId(Int_t frtId) const
196 /// Return true if the FRT Id is present
198 return fFrtIds.HasValue(frtId);;
202 //______________________________________________________________________________
203 Int_t AliMpDDL::GetNofBusPatches() const
205 /// Return the number of detection elements connected to this DDL
207 return fBusPatchIds.GetSize();
210 //______________________________________________________________________________
211 Int_t AliMpDDL::GetBusPatchId(Int_t index) const
213 /// Return the detection element by index (in loop)
215 return fBusPatchIds.GetValue(index);
218 //______________________________________________________________________________
219 Bool_t AliMpDDL::HasBusPatchId(Int_t busPatchId) const
221 /// Return true if the detection element Id is present
223 return fBusPatchIds.HasValue(busPatchId);;
226 //______________________________________________________________________________
227 Int_t AliMpDDL::GetNofTriggerCrates() const
229 /// Return the number of trigger crate connected to this DDL
231 return fTriggerCrateIds.GetSize();
234 //______________________________________________________________________________
235 Int_t AliMpDDL::GetTriggerCrateId(Int_t index) const
237 /// Return the trigger crate by index (in loop)
239 return fTriggerCrateIds.GetValue(index);
242 //______________________________________________________________________________
243 Bool_t AliMpDDL::HasTriggerCrateId(Int_t triggerCrateId) const
245 /// Return true if the trigger crate Id is present
247 return fTriggerCrateIds.HasValue(triggerCrateId);
250 //____________________________________________________________________
251 Int_t AliMpDDL::GetMaxDsp() const
253 /// calculates the number of DSP
255 Int_t iBusPerBlk = fBusPatchIds.GetSize()/2; //per block
257 Int_t iDspMax = iBusPerBlk/5; //number max of DSP per block
258 if (iBusPerBlk % 5 != 0)
264 //____________________________________________________________________
265 void AliMpDDL::GetBusPerDsp(Int_t* iBusPerDSP)
268 /// calculates buspatch per block
270 Int_t iBusPerBlk = fBusPatchIds.GetSize()/2; //per block
272 for (Int_t i = 0; i < GetMaxDsp(); i++) {
273 if ((iBusPerBlk -= 5) > 0)
276 iBusPerDSP[i] = iBusPerBlk + 5;