]> git.uio.no Git - u/mrichter/AliRoot.git/blob - MUON/mapping/AliMpBusPatch.cxx
New definition and implementation of bus patch class,
[u/mrichter/AliRoot.git] / MUON / mapping / AliMpBusPatch.cxx
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: AliMpBusPatch.cxx,v 1.4 2006/05/24 13:58:34 ivana Exp $
18 //
19 // --------------------
20 // Class AliMpBusPatch
21 // --------------------
22 // The class defines the properties of BusPatch
23 // Author: Ivana Hrivnacova, IPN Orsay
24
25 #include "AliMpBusPatch.h"
26
27 #include "AliLog.h"
28
29 #include <Riostream.h>
30
31 /// \cond CLASSIMP
32 ClassImp(AliMpBusPatch)
33 /// \endcond
34
35 const Int_t  AliMpBusPatch::fgkOffset = 100;
36 //
37 // static methods
38 //
39
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
52
53   return globalID - ddlID*fgkOffset;
54
55 }
56
57 //______________________________________________________________________________
58 AliMpBusPatch::AliMpBusPatch(Int_t id, Int_t detElemId, Int_t ddlId)
59   : TObject(),
60     fId(id),
61     fDEId(detElemId),
62     fDdlId(ddlId),
63     fManus()
64 {
65 /// Standard constructor
66 }
67
68 //______________________________________________________________________________
69 AliMpBusPatch::AliMpBusPatch(TRootIOCtor* /*ioCtor*/)
70   : TObject(),
71     fId(),
72     fDEId(),
73     fDdlId(),
74     fManus()
75 {
76 /// Root IO constructor
77 }
78
79 //______________________________________________________________________________
80 AliMpBusPatch::~AliMpBusPatch()
81 {
82 /// Destructor
83 }
84
85 //
86 // public methods
87 //
88
89 //______________________________________________________________________________
90 Bool_t AliMpBusPatch::AddManu(Int_t manuId)
91 {
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(); 
112 }
113
114 //______________________________________________________________________________
115 Int_t  AliMpBusPatch::GetManuId(Int_t index) const
116 {  
117 /// Return the detection element by index (in loop)
118
119   return fManus.GetValue(index); 
120 }
121
122 //______________________________________________________________________________
123 Bool_t  AliMpBusPatch::HasManu(Int_t manuId) const
124 {  
125 /// Return true if bus patch has manu with given manuId
126
127   return fManus.HasValue(manuId); 
128 }
129
130