1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
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 **************************************************************************/
18 //-----------------------------------------------------------------------------
19 // Class AliMpLocalBoard
20 // --------------------
21 // The class defines the properties of local board
22 // Author: Ch. Finck, Subatech Nantes
23 //-----------------------------------------------------------------------------
25 #include "AliMpLocalBoard.h"
26 #include "AliMpConstants.h"
27 #include "AliMpIntPair.h"
32 #include <Riostream.h>
35 ClassImp(AliMpLocalBoard)
39 //_____________________________________________________________________________
40 AliMpLocalBoard::AliMpLocalBoard(Int_t id, const Char_t* name, Int_t slot)
41 : TNamed(name, "mapping trigger local board"),
54 /// Default constructor
57 //______________________________________________________________________________
58 AliMpLocalBoard::AliMpLocalBoard(TRootIOCtor* /*ioCtor*/)
72 /// Root IO constructor
76 //_____________________________________________________________________________
77 AliMpLocalBoard::~AliMpLocalBoard()
83 //_____________________________________________________________________________
84 Int_t AliMpLocalBoard::GetIndex(Int_t chamberId) const
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
90 Int_t index = chamberId;
92 if ( chamberId >= AliMpConstants::NofTrackingChambers() &&
93 chamberId < AliMpConstants::NofChambers() )
95 index -= AliMpConstants::NofTrackingChambers();
98 if (index < 0 || index >= AliMpConstants::NofTriggerChambers() )
100 AliError(Form("chamber# %d not a valid trigger chamber Id, [0-3] or [10-13]", chamberId));
108 //______________________________________________________________________________
109 Bool_t AliMpLocalBoard::AddDE(Int_t detElemId)
111 /// Add detection element with given detElemId.
112 /// Return true if the detection element was added
114 if ( HasDEId(detElemId) ) {
116 << "Detection element Id = " << detElemId << " already present."
121 fDEId.Add(detElemId);
126 //______________________________________________________________________________
127 Int_t AliMpLocalBoard::GetNofDEs() const
129 /// Return the number of detection elements connected to this crate
131 return fDEId.GetSize();
134 //______________________________________________________________________________
135 Int_t AliMpLocalBoard::GetDEId(Int_t index) const
137 /// Return the detection element by index (in loop)
139 return fDEId.GetValue(index);
142 //______________________________________________________________________________
143 Int_t AliMpLocalBoard::GetDEIdByChamber(Int_t chamberId) const
145 /// Return the detection element by index (in loop)
147 return fDEId.GetValue(GetIndex(chamberId));
150 //______________________________________________________________________________
151 Bool_t AliMpLocalBoard::HasDEId(Int_t detElemId) const
153 /// Return true if the detection element Id is present
155 return fDEId.HasValue(detElemId);
158 //______________________________________________________________________________
159 void AliMpLocalBoard::SetSwitch(UInt_t swit)
161 /// set compact switch
167 //______________________________________________________________________________
168 Int_t AliMpLocalBoard::GetSwitch(Int_t index) const
170 /// Return switch bit wise
173 AliWarning("Switch index too large");
176 return (fSwitch >> 9-index) & 0x1;
179 //______________________________________________________________________________
180 AliMpIntPair AliMpLocalBoard::GetPosition() const
182 /// gives position of the local board in (line, col)
184 const Char_t* boardName = GetName();
185 Int_t iLine = boardName[4] - '0';
186 Int_t iCol = boardName[2] - '0';
188 return (AliMpIntPair(iLine, iCol));