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
21 // --------------------
22 // The class defines electronics properties of DDL
23 // Authors: Ivana Hrivnacova, IPN Orsay
24 // Christian Finck, SUBATECH Nantes
27 #include "AliMpDEManager.h"
28 #include "AliMpDetElement.h"
32 #include <Riostream.h>
39 //______________________________________________________________________________
40 AliMpDDL::AliMpDDL(Int_t id)
46 /// Standard constructor
49 //______________________________________________________________________________
50 AliMpDDL::AliMpDDL(TRootIOCtor* /*ioCtor*/)
56 /// Root IO constructor
59 //______________________________________________________________________________
69 //______________________________________________________________________________
70 void AliMpDDL::FillBusPatchIds()
72 /// Fill array with bus patch Ids
74 for ( Int_t i=0; i<GetNofDEs(); i++ ) {
75 AliMpDetElement* detElement
76 = AliMpDEManager::GetDetElement(GetDEId(i));
78 for ( Int_t j=0; j<detElement->GetNofBusPatches(); j++ )
79 fBusPatchIds.Add(detElement->GetBusPatchId(j));
87 //______________________________________________________________________________
88 Bool_t AliMpDDL::AddDE(Int_t detElemId)
90 /// Add detection element with given detElemId.
91 /// Return true if the detection element was added
93 if ( ! AliMpDEManager::IsValidDetElemId(detElemId) ) return false;
95 if ( HasDEId(detElemId) ) {
97 << "Detection element Id = " << detElemId << " already present."
102 AliDebugStream(3) << "Adding detElemId " << detElemId << endl;
104 fDEIds.Add(detElemId);
108 //______________________________________________________________________________
109 Int_t AliMpDDL::GetNofDEs() const
111 /// Return the number of detection elements connected to this DDL
113 return fDEIds.GetSize();
116 //______________________________________________________________________________
117 Int_t AliMpDDL::GetDEId(Int_t index) const
119 /// Return the detection element by index (in loop)
121 return fDEIds.GetValue(index);
124 //______________________________________________________________________________
125 Bool_t AliMpDDL::HasDEId(Int_t detElemId) const
127 /// Return true if the detection element Id is present
129 return fDEIds.HasValue(detElemId);;
132 //______________________________________________________________________________
133 Int_t AliMpDDL::GetNofBusPatches() const
135 /// Return the number of detection elements connected to this DDL
137 return fBusPatchIds.GetSize();
140 //______________________________________________________________________________
141 Int_t AliMpDDL::GetBusPatchId(Int_t index) const
143 /// Return the detection element by index (in loop)
145 return fBusPatchIds.GetValue(index);
148 //______________________________________________________________________________
149 Bool_t AliMpDDL::HasBusPatchId(Int_t busPatchId) const
151 /// Return true if the detection element Id is present
153 return fBusPatchIds.HasValue(busPatchId);;
156 //____________________________________________________________________
157 Int_t AliMpDDL::GetMaxDsp() const
159 /// calculates the number of DSP
161 Int_t iBusPerBlk = fBusPatchIds.GetSize()/2; //per block
163 Int_t iDspMax = iBusPerBlk/5; //number max of DSP per block
164 if (iBusPerBlk % 5 != 0)
170 //____________________________________________________________________
171 void AliMpDDL::GetBusPerDsp(Int_t* iBusPerDSP)
174 /// calculates buspatch per block
176 Int_t iBusPerBlk = fBusPatchIds.GetSize()/2; //per block
178 for (Int_t i = 0; i < GetMaxDsp(); i++) {
179 if ((iBusPerBlk -= 5) > 0)
182 iBusPerDSP[i] = iBusPerBlk + 5;