AliRoot Core  v5-06-15 (45dab64)
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
AliMpLocalBoard.cxx
Go to the documentation of this file.
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 
18 //-----------------------------------------------------------------------------
19 // Class AliMpLocalBoard
20 // --------------------
21 // The class defines the properties of local board
22 // Author: Ch. Finck, Subatech Nantes
23 //-----------------------------------------------------------------------------
24 
25 #include "AliMpLocalBoard.h"
26 #include "AliMpConstants.h"
27 #include "AliMpEncodePair.h"
28 
29 #include "AliLog.h"
30 
31 #include <TString.h>
32 #include <Riostream.h>
33 
34 using std::endl;
38 
39 
40 //_____________________________________________________________________________
41 AliMpLocalBoard::AliMpLocalBoard(Int_t id, const Char_t* name, Int_t slot)
42  : TNamed(name, "mapping trigger local board"),
43  fId(id),
44  fSlot(slot),
45  fTC(true),
46  fCrate(),
47  fSwitch(0),
48  fNotified(true),
49  fDEId(false),
50  fInputXfrom(0),
51  fInputXto(0),
52  fInputYfrom(0),
53  fInputYto(0)
54 {
56 }
57 
58 //______________________________________________________________________________
59 AliMpLocalBoard::AliMpLocalBoard(TRootIOCtor* /*ioCtor*/)
60  : TNamed(),
61  fId(),
62  fSlot(),
63  fTC(),
64  fCrate(),
65  fSwitch(),
66  fNotified(),
67  fDEId(),
68  fInputXfrom(0),
69  fInputXto(0),
70  fInputYfrom(0),
71  fInputYto(0)
72 {
74 }
75 
76 
77 //_____________________________________________________________________________
79 {
81 
82 }
83 
84 //_____________________________________________________________________________
85 Int_t AliMpLocalBoard::GetIndex(Int_t chamberId) const
86 {
90 
91  Int_t index = chamberId;
92 
93  if ( chamberId >= AliMpConstants::NofTrackingChambers() &&
94  chamberId < AliMpConstants::NofChambers() )
95  {
97  }
98 
99  if (index < 0 || index >= AliMpConstants::NofTriggerChambers() )
100  {
101  AliError(Form("chamber# %d not a valid trigger chamber Id, [0-3] or [10-13]", chamberId));
102  return -1;
103  }
104 
105  return index;
106 }
107 
108 
109 //______________________________________________________________________________
110 Bool_t AliMpLocalBoard::AddDE(Int_t detElemId)
111 {
114 
115  if ( HasDEId(detElemId) ) {
116  AliWarningStream()
117  << "Detection element Id = " << detElemId << " already present."
118  << endl;
119  return false;
120  }
121 
122  fDEId.Add(detElemId);
123  return true;
124 }
125 
126 
127 //______________________________________________________________________________
129 {
131 
132  return fDEId.GetSize();
133 }
134 
135 //______________________________________________________________________________
136 Int_t AliMpLocalBoard::GetDEId(Int_t index) const
137 {
139 
140  return fDEId.GetValue(index);
141 }
142 
143 //______________________________________________________________________________
144 Int_t AliMpLocalBoard::GetDEIdByChamber(Int_t chamberId) const
145 {
147 
148  return fDEId.GetValue(GetIndex(chamberId));
149 }
150 
151 //______________________________________________________________________________
152 Bool_t AliMpLocalBoard::HasDEId(Int_t detElemId) const
153 {
155 
156  return fDEId.HasValue(detElemId);
157 }
158 
159 //______________________________________________________________________________
160 void AliMpLocalBoard::SetSwitch(UInt_t swit)
161 {
163 
164  fSwitch = swit;
165 
166 }
167 
168 //______________________________________________________________________________
169 Int_t AliMpLocalBoard::GetSwitch(Int_t index) const
170 {
172 
173  if (index > 9) {
174  AliWarning("Switch index too large");
175  return -1;
176  }
177  return (fSwitch >> (9-index)) & 0x1;
178 }
179 
180 //______________________________________________________________________________
182 {
184 
185  const Char_t* boardName = GetName();
186  Int_t iLine = boardName[4] - '0';
187  Int_t iCol = boardName[2] - '0';
188 
189  return AliMp::Pair(iLine, iCol);
190 }
191 
static Int_t NofChambers()
Return number of chambers.
Bool_t AddDE(Int_t detElemId)
Int_t GetIndex(Int_t chamberId) const
Int_t GetSize() const
UInt_t fSwitch
switches in compact way
Bool_t HasDEId(Int_t detElemId) const
Bool_t HasValue(Int_t value) const
MpPair_t Pair(Int_t first, Int_t second)
Encode the pair of integers to another integer.
Bool_t Add(Int_t value, Bool_t warn=kTRUE)
Definition: AliMpArrayI.cxx:97
Int_t GetNofDEs() const
Class that manages the properties of the local board.
Int_t GetDEId(Int_t index) const
ClassImp(TPCGenInfo)
Definition: AliTPCCmpNG.C:254
AliMpArrayI fDEId
list of Detection element to which this local board is connected
MpPair_t GetPosition() const
given position (line, col)
Int_t GetDEIdByChamber(Int_t chamberId) const
void SetSwitch(UInt_t swit)
Set switch in a compact way.
AliMpLocalBoard()
Not implemented.
UInt_t GetSwitch() const
Get switch in a compact way.
Int_t MpPair_t
Int_t GetValue(Int_t index) const
static Int_t NofTrackingChambers()
Return number of tracking chambers.
virtual ~AliMpLocalBoard()
static Int_t NofTriggerChambers()