]> git.uio.no Git - u/mrichter/AliRoot.git/blame - MUON/mapping/AliMpLocalBoard.cxx
Updated RecParam calibration object
[u/mrichter/AliRoot.git] / MUON / mapping / AliMpLocalBoard.cxx
CommitLineData
4fb5ef65 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
3d1463c8 16// $Id$
4fb5ef65 17
3d1463c8 18//-----------------------------------------------------------------------------
4fb5ef65 19// Class AliMpLocalBoard
20// --------------------
21// The class defines the properties of local board
22// Author: Ch. Finck, Subatech Nantes
3d1463c8 23//-----------------------------------------------------------------------------
4fb5ef65 24
25#include "AliMpLocalBoard.h"
26#include "AliMpConstants.h"
27#include "AliMpIntPair.h"
28
29#include "AliLog.h"
30
31#include <TString.h>
32#include <Riostream.h>
33
34/// \cond CLASSIMP
35ClassImp(AliMpLocalBoard)
36/// \endcond
37
38
39//_____________________________________________________________________________
40AliMpLocalBoard::AliMpLocalBoard(Int_t id, const Char_t* name, Int_t slot)
41 : TNamed(name, "mapping trigger local board"),
42 fId(id),
43 fSlot(slot),
44 fTC(true),
45 fCrate(),
46 fSwitches(false),
47 fNotified(true),
354e70ca 48 fDEId(false),
49 fInputXfrom(0),
50 fInputXto(0),
51 fInputYfrom(0),
52 fInputYto(0)
4fb5ef65 53{
54/// Default constructor
55}
56
57//______________________________________________________________________________
58AliMpLocalBoard::AliMpLocalBoard(TRootIOCtor* /*ioCtor*/)
59 : TNamed(),
60 fId(),
61 fSlot(),
62 fTC(),
63 fCrate(),
64 fSwitches(),
65 fNotified(),
354e70ca 66 fDEId(),
67 fInputXfrom(0),
68 fInputXto(0),
69 fInputYfrom(0),
70 fInputYto(0)
4fb5ef65 71{
72/// Root IO constructor
73}
74
75
76//_____________________________________________________________________________
77AliMpLocalBoard::~AliMpLocalBoard()
78{
79/// Destructor
80
81}
82
83//_____________________________________________________________________________
84Int_t AliMpLocalBoard::GetIndex(Int_t chamberId) const
85{
86/// Return the index from chamver Id.
87/// chamberId could range from 10-13 in absolute value
88/// chamberId could also range from 0-3 in relative value
89
90 Int_t index = chamberId;
91
92 if ( chamberId >= AliMpConstants::NofTrackingChambers() &&
93 chamberId < AliMpConstants::NofChambers() )
94 {
95 index -= AliMpConstants::NofTrackingChambers();
96 }
97
98 if (index < 0 || index >= AliMpConstants::NofTriggerChambers() )
99 {
100 AliError(Form("chamber# %d not a valid trigger chamber Id, [0-3] or [10-13]", chamberId));
101 return -1;
102 }
103
104 return index;
105}
106
107
108//______________________________________________________________________________
109Bool_t AliMpLocalBoard::AddDE(Int_t detElemId)
110{
111/// Add detection element with given detElemId.
112/// Return true if the detection element was added
113
114 if ( HasDEId(detElemId) ) {
115 AliWarningStream()
116 << "Detection element Id = " << detElemId << " already present."
117 << endl;
118 return false;
119 }
120
121 fDEId.Add(detElemId);
122 return true;
123}
124
125
126//______________________________________________________________________________
127Int_t AliMpLocalBoard::GetNofDEs() const
128{
129/// Return the number of detection elements connected to this crate
130
131 return fDEId.GetSize();
132}
133
134//______________________________________________________________________________
135Int_t AliMpLocalBoard::GetDEId(Int_t index) const
136{
137/// Return the detection element by index (in loop)
138
139 return fDEId.GetValue(index);
140}
141
142//______________________________________________________________________________
143Int_t AliMpLocalBoard::GetDEIdByChamber(Int_t chamberId) const
144{
145/// Return the detection element by index (in loop)
146
147 return fDEId.GetValue(GetIndex(chamberId));
148}
149
150//______________________________________________________________________________
151Bool_t AliMpLocalBoard::HasDEId(Int_t detElemId) const
152{
153/// Return true if the detection element Id is present
154
155 return fDEId.HasValue(detElemId);
156}
157
158//______________________________________________________________________________
159Bool_t AliMpLocalBoard::AddSwitch(Int_t swit)
160{
161/// Add a swicth for the given local board
162/// Return true if switch was added
163
164 if ( swit > 1 ) {
165 AliWarningStream()
166 << "Invalid value for switch = " << swit
167 << endl;
168 return false;
169 }
170
171 fSwitches.Add(swit);
172 return true;
173}
174
175
176//______________________________________________________________________________
177Int_t AliMpLocalBoard::GetNofSwitches() const
178{
179/// Return the number switches in this local board
180
181 return fSwitches.GetSize();
182}
183
184//______________________________________________________________________________
185Int_t AliMpLocalBoard::GetSwitch(Int_t index) const
186{
187/// Return switch by index (in loop)
188
189 if (index < fSwitches.GetSize())
190 return fSwitches.GetValue(index);
191 else
192 AliWarning("Switch index too large");
193
194 return -1;
195}
196
197//______________________________________________________________________________
198AliMpIntPair AliMpLocalBoard::GetPosition() const
199{
200/// gives position of the local board in (line, col)
201
202 const Char_t* boardName = GetName();
203 Int_t iLine = boardName[4] - '0';
204 Int_t iCol = boardName[2] - '0';
4fb5ef65 205
206 return (AliMpIntPair(iLine, iCol));
4fb5ef65 207}
208