AliRoot Core  v5-06-30 (35d6c57)
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
AliMpDetElement.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: AliMpDetElement.cxx,v 1.4 2006/05/24 13:58:34 ivana Exp $
18 // Category: management
19 
20 //-----------------------------------------------------------------------------
21 // Class AliMpDetElement
22 // --------------------
23 // The class defines the electronics properties of detection element
24 // Authors: Ivana Hrivnacova, IPN Orsay
25 // Laurent Aphecetche, Christian Finck, SUBATECH Nantes
26 //-----------------------------------------------------------------------------
27 
28 #include "AliMpDetElement.h"
29 
30 #include "AliMpArrayI.h"
31 #include "AliMpConstants.h"
32 #include "AliMpDEManager.h"
33 #include "AliMpDCSNamer.h"
34 #include "AliMpHVUID.h"
35 #include "AliMpManuUID.h"
36 #include "AliMpPadUID.h"
37 #include "AliMpSegmentation.h"
38 #include "AliMpVSegmentation.h"
39 
40 #include "AliCodeTimer.h"
41 #include "AliLog.h"
42 
43 #include <Riostream.h>
44 
45 using std::endl;
49 
50 const char AliMpDetElement::fgkNameSeparator = '_';
51 
52 //______________________________________________________________________________
53 AliMpDetElement::AliMpDetElement(Int_t id, const TString& name,
54  const TString& segType, AliMp::PlaneType planeType)
55  : TObject(),
56  fId(id),
57  fDdlId(-1),
58  fName(name),
59  fSegType(segType),
60  fPlaneType(planeType),
61  fBusPatchIds(false),
62  fManuList(),
63  fTrackerChannels(),
64  fHVmanus(),
65  fNofChannels(0)
66 {
68 }
69 
70 //______________________________________________________________________________
72  : TObject(),
73  fId(0),
74  fDdlId(-1),
75  fName(),
76  fSegType(),
77  fPlaneType(),
78  fBusPatchIds(),
79  fManuList(),
80  fTrackerChannels(),
81  fHVmanus(ioCtor),
82  fNofChannels()
83 {
85 }
86 
87 //______________________________________________________________________________
89 {
91 }
92 
93 
94 //
95 // public methods
96 //
97 
98 //______________________________________________________________________________
99 Bool_t AliMpDetElement::AddBusPatch(Int_t busPatchId)
100 {
103 
104  if ( HasBusPatchId(busPatchId) ) {
105  AliWarningStream()
106  << "Bus patch Id = " << busPatchId << " already present."
107  << endl;
108  return false;
109  }
110 
111  fBusPatchIds.Add(busPatchId);
112  return true;
113 }
114 
115 //______________________________________________________________________________
117 {
119 
120  return fSegType + fgkNameSeparator + PlaneTypeName(GetPlaneType(cathType));
121 }
122 
123 //______________________________________________________________________________
125 {
127 
128  if ( cath == AliMp::kCath0 ) return fPlaneType;
129  else return AliMp::OtherPlaneType(fPlaneType);
130 }
131 
132 //______________________________________________________________________________
134 {
136 
137  if ( fPlaneType == planeType ) return AliMp::kCath0;
138  else return AliMp::kCath1;
139 }
140 
141 //______________________________________________________________________________
143 {
145 
148  {
149  planeType = AliMp::kNonBendingPlane;
150  }
151  return GetCathodType(planeType);
152 }
153 
154 //______________________________________________________________________________
156 {
160 
161  Int_t chamberId = AliMpDEManager::GetChamberId(fId, false);
162  if ( ! AliMpDEManager::IsValidChamberId(chamberId, true) ) {
163  AliFatal("Cannot return AliMp::StationType value.");
164  return AliMp::kStation12;
165  }
166 
167  if ( chamberId >= 0 && chamberId <= 3 ) return AliMp::kStation12;
168  if ( chamberId >= 4 && chamberId <= 9 ) return AliMp::kStation345;
169  if ( chamberId >= 10 && chamberId <= 13 ) return AliMp::kStationTrigger;
170 
171  // Should never get to this line
172  AliFatal("Cannot return AliMp::StationType value.");
173  return AliMp::kStation12;
174 }
175 
176 //______________________________________________________________________________
178 {
182 
183  Int_t chamberId = AliMpDEManager::GetChamberId(fId, false);
184  if ( ! AliMpDEManager::IsValidChamberId(chamberId, true) ) {
185  AliFatal("Cannot return AliMp::StationType value.");
186  return AliMq::kNotSt12;
187  }
188 
189  if ( chamberId == 0 || chamberId == 1 ) return AliMq::kStation1;
190  if ( chamberId == 2 || chamberId == 3 ) return AliMq::kStation2;
191  if ( chamberId >= 4 || chamberId <= 13 ) return AliMq::kNotSt12;
192 
193  // Should never get to this line
194  AliFatal("Cannot return AliMp::StationType value.");
195  return AliMq::kNotSt12;
196 }
197 
198 //______________________________________________________________________________
200 {
202 
203  return fBusPatchIds.GetSize();
204 }
205 
206 //______________________________________________________________________________
207 Int_t AliMpDetElement::GetBusPatchId(Int_t index) const
208 {
210 
211  if ( index < 0 || index >= GetNofBusPatches() ) {
212  AliErrorStream()
213  << "In DE = " << fId << ": Index " << index << " outside limits." << endl;
214  return 0;
215  }
216 
217  return fBusPatchIds.GetValue(index);
218 }
219 
220 
221 //______________________________________________________________________________
222 Bool_t AliMpDetElement::HasBusPatchId(Int_t busPatchId) const
223 {
225 
226  return fBusPatchIds.HasValue(busPatchId);;
227 }
228 
229 //______________________________________________________________________________
230 Int_t
232 {
234 
235  Long_t uid = AliMpManuUID::BuildUniqueID(fId,manuId);
236 
237  return (Int_t)(fManuList.GetValue(uid));
238 }
239 
240 //______________________________________________________________________________
241 Bool_t
242 AliMpDetElement::IsExistingChannel(Int_t manuId, Int_t manuChannel) const
243 {
246 
247  if ( NofChannelsInManu(manuId) > 0 &&
248  manuChannel >= 0 &&
249  manuChannel < AliMpConstants::ManuNofChannels() )
250  {
251  return kTRUE;
252  }
253  else
254  {
255  return kFALSE;
256  }
257 }
258 
259 //______________________________________________________________________________
260 Bool_t
261 AliMpDetElement::IsConnectedChannel(Int_t manuId, Int_t manuChannel) const
262 {
265 
266  return ( fTrackerChannels.GetValue(AliMpPadUID::BuildUniqueID(fId,manuId,manuChannel)) > 0 );
267 }
268 
269 //______________________________________________________________________________
270 void
272 {
275 
276  if ( stationType == AliMp::kStationTrigger ) return;
277 
278  AliCodeTimerAuto("",0)
279 
280  AliDebug(1,Form("DE %4d Manu %4d",fId,manuId));
281 
282  AliCodeTimerStart(Form("%s",AliMp::StationTypeName(stationType).Data()));
283 
284  if ( fHVmanus.GetSize() == 0 )
285  {
286  fHVmanus.SetOwner(kTRUE); // to be 100% explicit
287 
288  // get the size, to avoid resizing when adding later on
289  Int_t nmanus(0);
290 
292 
293  for ( Int_t i = 0; i < 2; ++i )
294  {
295  const AliMpVSegmentation* seg =
297 
298  TArrayI manus;
299 
300  seg->GetAllElectronicCardIDs(manus);
301 
302  nmanus += manus.GetSize();
303  }
304 
305  fHVmanus.SetSize(nmanus);
306  }
307 
309 
310  Int_t n(0);
311 
312  for ( Int_t i = 0; i < AliMpConstants::ManuNofChannels(); ++i )
313  {
314  if ( seg->PadByLocation(manuId,i,kFALSE).IsValid() )
315  {
316  ++n;
317  fTrackerChannels.Add((Long_t)AliMpPadUID::BuildUniqueID(fId,manuId,i),
318  (Long_t)1);
319  }
320  }
321 
322  fManuList.Add(AliMpManuUID::BuildUniqueID(fId,manuId),(Long_t)n);
323 
324  fNofChannels += n;
325 
326  AliMpDCSNamer hvNamer("TRACKER");
327 
328  Int_t index = hvNamer.ManuId2Index(fId,manuId);
329 
330  UInt_t hvuid = AliMpHVUID::BuildUniqueID(fId,index);
331 
332  AliMpArrayI* hv = static_cast<AliMpArrayI*>(fHVmanus.GetValue(hvuid));
333 
334  if (!hv)
335  {
336  Bool_t sort(kFALSE);
337  hv = new AliMpArrayI(sort);
338  fHVmanus.Add(hvuid,hv);
339  }
340 
341  hv->Add(manuId,kFALSE);
342 
343  AliCodeTimerStop(Form("%s",AliMp::StationTypeName(stationType).Data()));
344 }
345 
346 //______________________________________________________________________________
347 const AliMpArrayI*
348 AliMpDetElement::ManusForHV(Int_t hvIndex) const
349 {
351  return static_cast<AliMpArrayI*>(fHVmanus.GetValue(AliMpHVUID::BuildUniqueID(fId,hvIndex)));
352 }
353 
354 //______________________________________________________________________________
355 Int_t
357 {
359  return fManuList.GetSize();
360 }
361 
static UInt_t BuildUniqueID(Int_t detElemId, Int_t manuId)
const AliMpVSegmentation * GetMpSegmentation(Int_t detElemId, AliMp::CathodType cath, Bool_t warn=true) const
station 1,2 (quadrants)
AliMp::PlaneType OtherPlaneType(AliMp::PlaneType planeType)
Return the other plane type.
Int_t GetSize() const
static AliMpSegmentation * Instance(Bool_t warn=true)
AliMq::Station12Type GetStation12Type() const
AliMp::StationType GetStationType() const
station 3,4,5 (slats)
Int_t NofManus() const
Bool_t HasValue(Int_t value) const
void SetSize(Int_t size)
Definition: AliMpExMap.cxx:321
Collection of methods usefull to DCS handling for MUON TRK and TRG.
Definition: AliMpDCSNamer.h:21
static UInt_t BuildUniqueID(Int_t detElemId, Int_t index)
Definition: AliMpHVUID.cxx:44
const AliMpVSegmentation * GetMpSegmentationByElectronics(Int_t detElemId, Int_t elCardID, Bool_t warn=true) const
Bool_t Add(Int_t value, Bool_t warn=kTRUE)
Definition: AliMpArrayI.cxx:97
The class defines the electronics properties of detection element.
TExMap fManuList
map of manus
TString GetSegName(AliMp::CathodType cath) const
ClassImp(TPCGenInfo)
Definition: AliTPCCmpNG.C:254
Int_t GetSize() const
Definition: AliMpExMap.cxx:339
Bool_t AddBusPatch(Int_t busPatchId)
static Int_t GetChamberId(Int_t detElemId, Bool_t warn=true)
static Int_t ManuNofChannels()
Max number of channels per manu.
TString fSegType
Segmentation type name.
TExMap fTrackerChannels
list of connected pads (tracker only)
Int_t ManuId2Index(Int_t detElemId, Int_t manuId) const
AliMpArrayI fBusPatchIds
Bus patches connected to this detection element.
TString StationTypeName(AliMp::StationType stationType)
Return name for given stationType.
non-bending plane
TString PlaneTypeName(AliMp::PlaneType planeType)
Return name for given planeType.
static AliMp::StationType GetStationType(Int_t detElemId)
virtual ~AliMpDetElement()
AliMp::PlaneType GetPlaneType(AliMp::CathodType cath) const
TObject * GetValue(Int_t keyFirst, Int_t keySecond) const
Definition: AliMpExMap.cxx:364
AliMpDetElement()
Not implemented.
void Add(Int_t keyFirst, Int_t keySecond, TObject *object)
Definition: AliMpExMap.cxx:291
Helper class for sorted integer array.
Definition: AliMpArrayI.h:21
static UInt_t BuildUniqueID(Int_t detElemId, Int_t manuId, Int_t manuChannel)
Definition: AliMpPadUID.cxx:54
Int_t NofChannelsInManu(Int_t manuId) const
void SetOwner(Bool_t owner)
Definition: AliMpExMap.cxx:331
Bool_t IsValid() const
Return validity.
Definition: AliMpPad.h:89
bending plane
value for all non sector stations
AliMpExMap fHVmanus
map of HV->manu
Int_t GetNofBusPatches() const
AliMp::CathodType GetCathodType(AliMp::PlaneType planeType) const
The abstract base class for the segmentation.
AliMp::CathodType GetCathodTypeFromManuId(Int_t manuId) const
trigger stations (slats)
Int_t GetBusPatchId(Int_t index) const
static Bool_t IsValidChamberId(Int_t chamberId, Bool_t warn=false)
AliMp::PlaneType fPlaneType
Plane type on cathod0.
const AliMpArrayI * ManusForHV(Int_t hvIndex) const
Int_t GetValue(Int_t index) const
Bool_t IsConnectedChannel(Int_t manuId, Int_t manuChannel) const
void AddManu(Int_t manuId)
virtual AliMpPad PadByLocation(Int_t manuId, Int_t manuChannel, Bool_t warning=true) const =0
Find pad by location.
Int_t fId
Identifier (unique)
Bool_t IsExistingChannel(Int_t manuId, Int_t manuChannel) const
Bool_t HasBusPatchId(Int_t busPatchId) const
Int_t fNofChannels
number of channels in this detection element
static const char fgkNameSeparator
Separator character used in DE names.
static Int_t ManuMask(AliMp::PlaneType planeType)
virtual void GetAllElectronicCardIDs(TArrayI &ecn) const =0
Fill the given array with the electronic card IDs.