]> git.uio.no Git - u/mrichter/AliRoot.git/blame - MUON/mapping/AliMpLocalBoard.cxx
In Print(): added an option to print area borders
[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(),
3ac706ec 46 fSwitch(0),
4fb5ef65 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(),
3ac706ec 64 fSwitch(),
4fb5ef65 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//______________________________________________________________________________
60e510d4 159void AliMpLocalBoard::SetSwitch(UInt_t swit)
4fb5ef65 160{
60e510d4 161/// set compact switch
162
163 fSwitch = swit;
164
4fb5ef65 165}
166
167//______________________________________________________________________________
168Int_t AliMpLocalBoard::GetSwitch(Int_t index) const
169{
60e510d4 170/// Return switch bit wise
4fb5ef65 171
60e510d4 172 if (index > 9) {
4fb5ef65 173 AliWarning("Switch index too large");
60e510d4 174 return -1;
175 }
176 return (fSwitch >> 9-index) & 0x1;
4fb5ef65 177}
178
179//______________________________________________________________________________
180AliMpIntPair AliMpLocalBoard::GetPosition() const
181{
182/// gives position of the local board in (line, col)
183
184 const Char_t* boardName = GetName();
185 Int_t iLine = boardName[4] - '0';
186 Int_t iCol = boardName[2] - '0';
4fb5ef65 187
188 return (AliMpIntPair(iLine, iCol));
4fb5ef65 189}
190