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>
41 //______________________________________________________________________________
42 AliMpDDL::AliMpDDL(Int_t id)
48 fTriggerCrateIds(false)
51 /// Standard constructor
54 //______________________________________________________________________________
55 AliMpDDL::AliMpDDL(TRootIOCtor* /*ioCtor*/)
63 /// Root IO constructor
66 //______________________________________________________________________________
76 //______________________________________________________________________________
77 void AliMpDDL::FillBusPatchIds()
79 /// Fill array with bus patch Ids
81 for ( Int_t i=0; i<GetNofDEs(); i++ ) {
82 AliMpDetElement* detElement
83 = AliMpDEManager::GetDetElement(GetDEId(i));
85 for ( Int_t j=0; j<detElement->GetNofBusPatches(); j++ )
86 fBusPatchIds.Add(detElement->GetBusPatchId(j));
94 //______________________________________________________________________________
95 Bool_t AliMpDDL::AddDE(Int_t detElemId)
97 /// Add detection element with given detElemId.
98 /// Return true if the detection element was added
100 if ( ! AliMpDEManager::IsValidDetElemId(detElemId) ) return false;
102 if ( HasDEId(detElemId) ) {
104 << "Detection element Id = " << detElemId << " already present."
109 AliDebugStream(3) << "Adding detElemId " << detElemId << endl;
111 fDEIds.Add(detElemId);
115 //______________________________________________________________________________
116 Bool_t AliMpDDL::AddTriggerCrate(Int_t crateId)
118 /// Add trigger crate with given crateId.
119 /// Return true if the trigger crate was added
121 if ( HasTriggerCrateId(crateId) ) {
123 << "Trigger crate Id = " << crateId << " already present."
128 fTriggerCrateIds.Add(crateId);
133 //______________________________________________________________________________
134 Bool_t AliMpDDL::AddFrt(Int_t frtId)
136 /// Add FRT with given frtId.
137 /// Return true if the FRT was added
139 if ( HasFrtId(frtId) ) {
141 << "FRT Id = " << frtId << " already present."
152 //______________________________________________________________________________
153 Int_t AliMpDDL::GetNofDEs() const
155 /// Return the number of detection elements connected to this DDL
157 return fDEIds.GetSize();
160 //______________________________________________________________________________
161 Int_t AliMpDDL::GetDEId(Int_t index) const
163 /// Return the detection element by index (in loop)
165 return fDEIds.GetValue(index);
168 //______________________________________________________________________________
169 Bool_t AliMpDDL::HasDEId(Int_t detElemId) const
171 /// Return true if the detection element Id is present
173 return fDEIds.HasValue(detElemId);;
176 //______________________________________________________________________________
177 Int_t AliMpDDL::GetNofFrts() const
179 /// Return the number of FRT connected to this DDL
181 return fFrtIds.GetSize();
184 //______________________________________________________________________________
185 Int_t AliMpDDL::GetFrtId(Int_t index) const
187 /// Return the FRT by index (in loop)
189 return fFrtIds.GetValue(index);
192 //______________________________________________________________________________
193 Bool_t AliMpDDL::HasFrtId(Int_t frtId) const
195 /// Return true if the FRT Id is present
197 return fFrtIds.HasValue(frtId);;
201 //______________________________________________________________________________
202 Int_t AliMpDDL::GetNofBusPatches() const
204 /// Return the number of detection elements connected to this DDL
206 return fBusPatchIds.GetSize();
209 //______________________________________________________________________________
210 Int_t AliMpDDL::GetBusPatchId(Int_t index) const
212 /// Return the detection element by index (in loop)
214 return fBusPatchIds.GetValue(index);
217 //______________________________________________________________________________
218 Bool_t AliMpDDL::HasBusPatchId(Int_t busPatchId) const
220 /// Return true if the detection element Id is present
222 return fBusPatchIds.HasValue(busPatchId);;
225 //______________________________________________________________________________
226 Int_t AliMpDDL::GetNofTriggerCrates() const
228 /// Return the number of trigger crate connected to this DDL
230 return fTriggerCrateIds.GetSize();
233 //______________________________________________________________________________
234 Int_t AliMpDDL::GetTriggerCrateId(Int_t index) const
236 /// Return the trigger crate by index (in loop)
238 return fTriggerCrateIds.GetValue(index);
241 //______________________________________________________________________________
242 Bool_t AliMpDDL::HasTriggerCrateId(Int_t triggerCrateId) const
244 /// Return true if the trigger crate Id is present
246 return fTriggerCrateIds.HasValue(triggerCrateId);
249 //____________________________________________________________________
250 Int_t AliMpDDL::GetMaxDsp() const
252 /// calculates the number of DSP
254 Int_t iBusPerBlk = fBusPatchIds.GetSize()/2; //per block
256 Int_t iDspMax = iBusPerBlk/5; //number max of DSP per block
257 if (iBusPerBlk % 5 != 0)
263 //____________________________________________________________________
264 void AliMpDDL::GetBusPerDsp(Int_t* iBusPerDSP)
267 /// calculates buspatch per block
269 Int_t iBusPerBlk = fBusPatchIds.GetSize()/2; //per block
271 for (Int_t i = 0; i < GetMaxDsp(); i++) {
272 if ((iBusPerBlk -= 5) > 0)
275 iBusPerDSP[i] = iBusPerBlk + 5;