]>
Commit | Line | Data |
---|---|---|
1e738c3c | 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$ | |
b4daf0b2 | 17 | // $MpId: AliMpBusPatch.cxx,v 1.4 2006/05/24 13:58:34 ivana Exp $ |
1e738c3c | 18 | // |
b4daf0b2 | 19 | // -------------------- |
20 | // Class AliMpBusPatch | |
21 | // -------------------- | |
22 | // The class defines the properties of BusPatch | |
23 | // Author: Ivana Hrivnacova, IPN Orsay | |
1e738c3c | 24 | |
25 | #include "AliMpBusPatch.h" | |
b4daf0b2 | 26 | |
1e738c3c | 27 | #include "AliLog.h" |
b4daf0b2 | 28 | |
29 | #include <Riostream.h> | |
1e738c3c | 30 | |
13985652 | 31 | /// \cond CLASSIMP |
1e738c3c | 32 | ClassImp(AliMpBusPatch) |
13985652 | 33 | /// \endcond |
1e738c3c | 34 | |
d2892ef5 | 35 | const Int_t AliMpBusPatch::fgkOffset = 100; |
b4daf0b2 | 36 | // |
37 | // static methods | |
38 | // | |
d2892ef5 | 39 | |
d2892ef5 | 40 | //____________________________________________________________________ |
41 | Int_t AliMpBusPatch::GetGlobalBusID(Int_t localID, Int_t ddlID) | |
42 | { | |
43 | /// return global bus id from local bus and ddl id | |
44 | ||
45 | return ddlID*fgkOffset + localID; | |
46 | ||
47 | } | |
48 | //____________________________________________________________________ | |
49 | Int_t AliMpBusPatch::GetLocalBusID(Int_t globalID, Int_t ddlID) | |
50 | { | |
51 | /// return local bus id from local bus id | |
1e738c3c | 52 | |
d2892ef5 | 53 | return globalID - ddlID*fgkOffset; |
54 | ||
55 | } | |
1e738c3c | 56 | |
b4daf0b2 | 57 | //______________________________________________________________________________ |
58 | AliMpBusPatch::AliMpBusPatch(Int_t id, Int_t detElemId, Int_t ddlId) | |
59 | : TObject(), | |
60 | fId(id), | |
61 | fDEId(detElemId), | |
62 | fDdlId(ddlId), | |
fd31e0db | 63 | fManus(false) |
1e738c3c | 64 | { |
b4daf0b2 | 65 | /// Standard constructor |
1e738c3c | 66 | } |
67 | ||
b4daf0b2 | 68 | //______________________________________________________________________________ |
69 | AliMpBusPatch::AliMpBusPatch(TRootIOCtor* /*ioCtor*/) | |
70 | : TObject(), | |
71 | fId(), | |
72 | fDEId(), | |
73 | fDdlId(), | |
74 | fManus() | |
1e738c3c | 75 | { |
b4daf0b2 | 76 | /// Root IO constructor |
1e738c3c | 77 | } |
1e738c3c | 78 | |
b4daf0b2 | 79 | //______________________________________________________________________________ |
80 | AliMpBusPatch::~AliMpBusPatch() | |
5826f1df | 81 | { |
b4daf0b2 | 82 | /// Destructor |
5826f1df | 83 | } |
84 | ||
b4daf0b2 | 85 | // |
86 | // public methods | |
87 | // | |
5826f1df | 88 | |
b4daf0b2 | 89 | //______________________________________________________________________________ |
90 | Bool_t AliMpBusPatch::AddManu(Int_t manuId) | |
5826f1df | 91 | { |
b4daf0b2 | 92 | /// Add detection element with given detElemId. |
93 | /// Return true if the detection element was added | |
94 | ||
95 | if ( HasManu(manuId) ) { | |
96 | AliWarningStream() | |
97 | << "Manu with manuId=" << manuId << " already present." | |
98 | << endl; | |
99 | return false; | |
100 | } | |
101 | ||
102 | fManus.Add(manuId); | |
103 | return true; | |
104 | } | |
105 | ||
106 | //______________________________________________________________________________ | |
107 | Int_t AliMpBusPatch::GetNofManus() const | |
108 | { | |
109 | /// Return the number of detection elements connected to this DDL | |
110 | ||
111 | return fManus.GetSize(); | |
5826f1df | 112 | } |
113 | ||
b4daf0b2 | 114 | //______________________________________________________________________________ |
115 | Int_t AliMpBusPatch::GetManuId(Int_t index) const | |
116 | { | |
117 | /// Return the detection element by index (in loop) | |
528df1a6 | 118 | |
b4daf0b2 | 119 | return fManus.GetValue(index); |
5826f1df | 120 | } |
121 | ||
b4daf0b2 | 122 | //______________________________________________________________________________ |
123 | Bool_t AliMpBusPatch::HasManu(Int_t manuId) const | |
124 | { | |
125 | /// Return true if bus patch has manu with given manuId | |
5826f1df | 126 | |
b4daf0b2 | 127 | return fManus.HasValue(manuId); |
5826f1df | 128 | } |
129 | ||
5826f1df | 130 |