]> git.uio.no Git - u/mrichter/AliRoot.git/blame - MUON/mapping/AliMpTriggerSegmentation.cxx
Work around for CINT bug in root 5.10/00, with gcc4.0.2
[u/mrichter/AliRoot.git] / MUON / mapping / AliMpTriggerSegmentation.cxx
CommitLineData
ff7d3d1a 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$
026b7442 17// $MpId: AliMpTriggerSegmentation.cxx,v 1.4 2006/03/14 09:04:34 ivana Exp $
ff7d3d1a 18
19#include "AliMpTriggerSegmentation.h"
20
21#include "AliLog.h"
22#include "AliMpConnection.h"
23#include "AliMpMotif.h"
24#include "AliMpMotifPosition.h"
25#include "AliMpMotifType.h"
26#include "AliMpPCB.h"
27#include "AliMpSlat.h"
28#include "AliMpSlatSegmentation.h"
29#include "AliMpTrigger.h"
30
31ClassImp(AliMpTriggerSegmentation)
32
33//_____________________________________________________________________________
34AliMpTriggerSegmentation::AliMpTriggerSegmentation()
35: AliMpVSegmentation(),
36fkSlat(0)
37{
38 //
39 // Default ctor. Not to be used really.
40 //
41 AliDebug(1,Form("this=%p Empty ctor",this));
42}
43
44//_____________________________________________________________________________
45AliMpTriggerSegmentation::AliMpTriggerSegmentation(const AliMpTrigger* slat)
46: AliMpVSegmentation(),
47fkSlat(slat)
48{
49 //
50 // Normal ctor.
51 //
52 AliDebug(1,Form("this=%p Normal ctor slat=%p",this,slat));
53}
54
884a73f1 55//______________________________________________________________________________
56AliMpTriggerSegmentation::AliMpTriggerSegmentation(const AliMpTriggerSegmentation& right)
57 : AliMpVSegmentation(right)
58{
59/// Protected copy constructor (not implemented)
60
61 AliFatal("Copy constructor not provided.");
62}
63
ff7d3d1a 64//_____________________________________________________________________________
65AliMpTriggerSegmentation::~AliMpTriggerSegmentation()
66{
67 //
68 // Dtor (empty).
69 //
70 AliDebug(1,Form("this=%p",this));
71}
72
884a73f1 73//______________________________________________________________________________
74AliMpTriggerSegmentation&
75AliMpTriggerSegmentation::operator=(const AliMpTriggerSegmentation& right)
76{
77/// Protected assignement operator (not implemented)
78
79 // check assignement to self
80 if (this == &right) return *this;
81
82 AliFatal("Assignement operator not provided.");
83
84 return *this;
85}
86
ff7d3d1a 87//_____________________________________________________________________________
88AliMpVPadIterator*
89AliMpTriggerSegmentation::CreateIterator(const AliMpArea&) const
90{
91 //
92 // Returns an iterator to loop over the pad contained within given area.
93 // Not implemented for trigger.
94
95 return 0;
96}
97
63bcb3c3 98//_____________________________________________________________________________
99TVector2
100AliMpTriggerSegmentation::Dimensions() const
101{
102 return Slat()->Dimensions();
103}
104
105//_____________________________________________________________________________
106void
107AliMpTriggerSegmentation::GetAllElectronicCardIDs(TArrayI& ecn) const
108{
109 Slat()->GetAllLocalBoardNumbers(ecn);
110}
111
ff7d3d1a 112//_____________________________________________________________________________
113const char*
114AliMpTriggerSegmentation::GetName() const
115{
116 TString name("TriggerSegmentation");
117 if ( fkSlat)
118 {
119 name += ".";
120 name += fkSlat->GetName();
121 }
122 return name.Data();
123}
124
125//_____________________________________________________________________________
126Bool_t
127AliMpTriggerSegmentation::HasPad(const AliMpIntPair& indices) const
128{
129 //
130 // Test if this slat has a pad located at the position referenced
131 // by the integer indices.
132 //
133
134 return PadByIndices(indices,kFALSE) != AliMpPad::Invalid();
135}
136
137//_____________________________________________________________________________
138Int_t
026b7442 139AliMpTriggerSegmentation::MaxPadIndexX() const
ff7d3d1a 140{
141 //
142 // Returns the value of the largest pad index in x-direction.
143 //
144
145 return fkSlat->GetNofPadsX()-1;
146}
147
148//_____________________________________________________________________________
149Int_t
026b7442 150AliMpTriggerSegmentation::MaxPadIndexY() const
ff7d3d1a 151{
152 //
153 // Returns the value of the largest pad index in y-direction.
154 //
155
156 return fkSlat->GetMaxNofPadsY()-1;
157}
158
026b7442 159//_____________________________________________________________________________
160Int_t
161AliMpTriggerSegmentation::NofPads() const
162{
163/// Return number of pads defined in the trigger chamber
164
165 AliError("Not yet implemented");
166
167 return 0;
168}
169
ff7d3d1a 170//_____________________________________________________________________________
171AliMpPad
172AliMpTriggerSegmentation::PadByLocation(const AliMpIntPair& location,
173 Bool_t warning) const
174{
175 //
176 // Returns the pad specified by its location, where location is the
177 // pair (ManuID,ManuChannel).
178 // If warning=kTRUE and the pad does not exist, a warning message is
179 // printed.
180 //
181 // AliMpPad::Invalid() is returned if there's no pad at the given location.
182 //
183 AliMpPad pad;
184 AliMpIntPair invloc;
185
186 for ( Int_t i = 0; i < fkSlat->GetSize(); ++i )
187 {
188 const AliMpSlat* slat = fkSlat->GetLayer(i);
189 AliMpSlatSegmentation seg(slat);
190 AliMpPad p_i = seg.PadByLocation(location,kFALSE);
191 if ( p_i.IsValid() )
192 {
193 if ( !pad.IsValid() )
194 {
195 pad = AliMpPad(invloc,p_i.GetIndices(),p_i.Position(),p_i.Dimensions());
196 pad.AddLocation(p_i.GetLocation());
197 }
198 else
199 {
200 pad.AddLocation(p_i.GetLocation());
201 }
202 }
203 }
204 if ( warning && !pad.IsValid() )
205 {
206 AliWarning(Form("No pad found at location (%d,%d)",location.GetFirst(),
207 location.GetSecond()));
208 }
209 return pad;
210}
211
212//_____________________________________________________________________________
213AliMpPad
214AliMpTriggerSegmentation::PadByIndices(const AliMpIntPair& indices,
215 Bool_t warning) const
216{
217 //
218 // Returns the pad specified by its integer indices.
219 // If warning=kTRUE and the pad does not exist, a warning message is
220 // printed.
221 //
222 // AliMpPad::Invalid() is returned if there's no pad at the given location.
223 //
224 //
225
226 AliMpPad pad;
227 AliMpIntPair invloc;
228
229 for ( Int_t i = 0; i < fkSlat->GetSize(); ++i )
230 {
231 const AliMpSlat* slat = fkSlat->GetLayer(i);
232 AliMpSlatSegmentation seg(slat);
233 AliMpPad p_i = seg.PadByIndices(indices,kFALSE);
234 if ( p_i.IsValid() )
235 {
236 if ( !pad.IsValid() )
237 {
238 pad = AliMpPad(invloc,p_i.GetIndices(),p_i.Position(),p_i.Dimensions());
239 pad.AddLocation(p_i.GetLocation());
240 }
241 else
242 {
243 pad.AddLocation(p_i.GetLocation());
244 }
245 }
246 }
247 if ( warning && !pad.IsValid() )
248 {
249 AliWarning(Form("No pad found at indices (%d,%d)",indices.GetFirst(),
250 indices.GetSecond()));
251 }
252
253 return pad;
254}
255
256//_____________________________________________________________________________
257AliMpPad
258AliMpTriggerSegmentation::PadByPosition(const TVector2& position,
259 Bool_t warning) const
260{
261 //
262 // Returns the pad specified by its (floating point) position.
263 // If warning=kTRUE and the pad does not exist, a warning message is
264 // printed.
265 //
266 // AliMpPad::Invalid() is returned if there's no pad at the given location.
267 //
268 AliMpPad pad;
269 AliMpIntPair invloc;
270
271 for ( Int_t i = 0; i < fkSlat->GetSize(); ++i )
272 {
273 const AliMpSlat* slat = fkSlat->GetLayer(i);
274 AliMpSlatSegmentation seg(slat);
275 AliMpPad p_i = seg.PadByPosition(position,kFALSE);
276 if ( p_i.IsValid() )
277 {
278 if ( !pad.IsValid() )
279 {
280 pad = AliMpPad(invloc,p_i.GetIndices(),p_i.Position(),p_i.Dimensions());
281 pad.AddLocation(p_i.GetLocation());
282 }
283 else
284 {
285 pad.AddLocation(p_i.GetLocation());
286 }
287 }
288 }
289 if ( warning && !pad.IsValid() )
290 {
291 AliWarning(Form("No pad found at position (%e,%e)",position.X(),
292 position.Y()));
293 }
294
295 return pad;
296}
297
63bcb3c3 298//_____________________________________________________________________________
299AliMpPlaneType
300AliMpTriggerSegmentation::PlaneType() const
301{
302 return Slat()->PlaneType();
303}
304
ff7d3d1a 305//_____________________________________________________________________________
306const AliMpTrigger*
307AliMpTriggerSegmentation::Slat() const
308{
309 //
310 // Returns the pointer to the referenced slat.
311 //
312
313 return fkSlat;
314}