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)
47 fTriggerCrateIds(false)
50 /// Standard constructor
53 //______________________________________________________________________________
54 AliMpDDL::AliMpDDL(TRootIOCtor* /*ioCtor*/)
61 /// Root IO constructor
64 //______________________________________________________________________________
74 //______________________________________________________________________________
75 void AliMpDDL::FillBusPatchIds()
77 /// Fill array with bus patch Ids
79 for ( Int_t i=0; i<GetNofDEs(); i++ ) {
80 AliMpDetElement* detElement
81 = AliMpDEManager::GetDetElement(GetDEId(i));
83 for ( Int_t j=0; j<detElement->GetNofBusPatches(); j++ )
84 fBusPatchIds.Add(detElement->GetBusPatchId(j));
92 //______________________________________________________________________________
93 Bool_t AliMpDDL::AddDE(Int_t detElemId)
95 /// Add detection element with given detElemId.
96 /// Return true if the detection element was added
98 if ( ! AliMpDEManager::IsValidDetElemId(detElemId) ) return false;
100 if ( HasDEId(detElemId) ) {
102 << "Detection element Id = " << detElemId << " already present."
107 AliDebugStream(3) << "Adding detElemId " << detElemId << endl;
109 fDEIds.Add(detElemId);
113 //______________________________________________________________________________
114 Bool_t AliMpDDL::AddTriggerCrate(Int_t crateId)
116 /// Add trigger crate with given crateId.
117 /// Return true if the trigger crate was added
119 if ( HasTriggerCrateId(crateId) ) {
121 << "Trigger crate Id = " << crateId << " already present."
126 fTriggerCrateIds.Add(crateId);
131 //______________________________________________________________________________
132 Int_t AliMpDDL::GetNofDEs() const
134 /// Return the number of detection elements connected to this DDL
136 return fDEIds.GetSize();
139 //______________________________________________________________________________
140 Int_t AliMpDDL::GetDEId(Int_t index) const
142 /// Return the detection element by index (in loop)
144 return fDEIds.GetValue(index);
147 //______________________________________________________________________________
148 Bool_t AliMpDDL::HasDEId(Int_t detElemId) const
150 /// Return true if the detection element Id is present
152 return fDEIds.HasValue(detElemId);;
155 //______________________________________________________________________________
156 Int_t AliMpDDL::GetNofBusPatches() const
158 /// Return the number of detection elements connected to this DDL
160 return fBusPatchIds.GetSize();
163 //______________________________________________________________________________
164 Int_t AliMpDDL::GetBusPatchId(Int_t index) const
166 /// Return the detection element by index (in loop)
168 return fBusPatchIds.GetValue(index);
171 //______________________________________________________________________________
172 Bool_t AliMpDDL::HasBusPatchId(Int_t busPatchId) const
174 /// Return true if the detection element Id is present
176 return fBusPatchIds.HasValue(busPatchId);;
179 //______________________________________________________________________________
180 Int_t AliMpDDL::GetNofTriggerCrates() const
182 /// Return the number of trigger crate connected to this DDL
184 return fTriggerCrateIds.GetSize();
187 //______________________________________________________________________________
188 Int_t AliMpDDL::GetTriggerCrateId(Int_t index) const
190 /// Return the trigger crate by index (in loop)
192 return fTriggerCrateIds.GetValue(index);
195 //______________________________________________________________________________
196 Bool_t AliMpDDL::HasTriggerCrateId(Int_t triggerCrateId) const
198 /// Return true if the trigger crate Id is present
200 return fTriggerCrateIds.HasValue(triggerCrateId);
203 //____________________________________________________________________
204 Int_t AliMpDDL::GetMaxDsp() const
206 /// calculates the number of DSP
208 Int_t iBusPerBlk = fBusPatchIds.GetSize()/2; //per block
210 Int_t iDspMax = iBusPerBlk/5; //number max of DSP per block
211 if (iBusPerBlk % 5 != 0)
217 //____________________________________________________________________
218 void AliMpDDL::GetBusPerDsp(Int_t* iBusPerDSP)
221 /// calculates buspatch per block
223 Int_t iBusPerBlk = fBusPatchIds.GetSize()/2; //per block
225 for (Int_t i = 0; i < GetMaxDsp(); i++) {
226 if ((iBusPerBlk -= 5) > 0)
229 iBusPerDSP[i] = iBusPerBlk + 5;