AliRoot Core  3dc7879 (3dc7879)
AliMpTriggerSegmentation.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 // $MpId: AliMpTriggerSegmentation.cxx,v 1.7 2006/05/24 13:58:52 ivana Exp $
18 
20 
21 #include "TArrayI.h"
22 #include "AliLog.h"
23 #include "AliMpConnection.h"
24 #include "AliMpMotif.h"
25 #include "AliMpMotifPosition.h"
26 #include "AliMpMotifType.h"
27 #include "AliMpSlat.h"
28 #include "AliMpTrigger.h"
30 
31 //-----------------------------------------------------------------------------
39 //-----------------------------------------------------------------------------
40 
44 
45 //_____________________________________________________________________________
48  fkSlat(0),
49  fIsOwner(false),
50  fNofStrips(0)
51 {
55  AliDebug(1,Form("this=%p Empty ctor",this));
56 }
57 
58 //_____________________________________________________________________________
60  const AliMpTrigger* slat, Bool_t own)
62  fkSlat(slat),
63  fIsOwner(own),
64  fNofStrips(0)
65 {
69  AliDebug(1,Form("this=%p Normal ctor slat=%p",this,slat));
70 
71  // Compute the number of strips.
72  // We have to loop over all possible pads, in order to properly take
73  // into account the fact that a given strip might be part of several
74  // layer. Otherwise we would double count pads.
75 
76 
77  for ( Int_t ix = 0; ix <= MaxPadIndexX(); ++ix )
78  {
79  for ( Int_t iy = 0; iy <= MaxPadIndexY(); ++iy )
80  {
81  if ( HasPadByIndices(ix,iy) )
82  {
83  ++fNofStrips;
84  }
85  }
86  }
87 }
88 
89 //_____________________________________________________________________________
91 {
95 
96  if ( fIsOwner ) delete fkSlat;
97 
98  AliDebug(1,Form("this=%p",this));
99 }
100 
101 //_____________________________________________________________________________
104 {
108  AliError("Not implemented for trigger");
109  return 0;
110 }
111 
112 //_____________________________________________________________________________
115 {
118  return new AliMpTriggerPadIterator(Slat());
119 }
120 
121 //_____________________________________________________________________________
122 Int_t
124  TObjArray& /*neighbours*/,
125  Bool_t /*includeSelf*/,
126  Bool_t /*includeVoid*/) const
127 {
129  AliError("Not implemented for trigger");
130  return 0;
131 }
132 
133 //_____________________________________________________________________________
134 Double_t
136 {
138  return Slat()->GetDimensionX();
139 }
140 
141 //_____________________________________________________________________________
142 Double_t
144 {
146  return Slat()->GetDimensionY();
147 }
148 
149 //_____________________________________________________________________________
150 void
152 {
154 
156 }
157 
158 //_____________________________________________________________________________
159 const char*
161 {
163  static TString name("TriggerSegmentation");
164  if ( fkSlat)
165  {
166  name += ".";
167  name += fkSlat->GetName();
168  }
169  return name.Data();
170 }
171 
172 //_____________________________________________________________________________
173 Int_t
175 {
179 
180  return fkSlat->GetNofPadsX()-1;
181 }
182 
183 //_____________________________________________________________________________
184 Int_t
186 {
190 
191  return fkSlat->GetMaxNofPadsY()-1;
192 }
193 
194 //_____________________________________________________________________________
195 AliMpPad
196 AliMpTriggerSegmentation::PadByLocation(Int_t manuId, Int_t manuChannel,
197  Bool_t warning) const
198 {
207  AliMpPad pad;
208 
209  for ( Int_t i = 0; i < fkSlat->GetSize(); ++i )
210  {
212  AliMpPad pi = seg->PadByLocation(manuId,manuChannel,kFALSE);
213  if ( pi.IsValid() )
214  {
215  if ( !pad.IsValid() )
216  {
217  // uses PadByIndices to get the complete list of locations
218  return PadByIndices(pi.GetIx(), pi.GetIy(), warning);
219  }
220  }
221  }
222  if ( warning && !pad.IsValid() )
223  {
224  AliWarning(Form("No pad found at location (%d,%d)", manuId, manuChannel));
225  }
226  return pad;
227 }
228 
229 //_____________________________________________________________________________
230 AliMpPad
232  Bool_t warning) const
233 {
242 
243  AliMpPad pad;
244 
245  for ( Int_t i = 0; i < fkSlat->GetSize(); ++i )
246  {
248  AliMpPad pi = seg->PadByIndices(ix,iy,kFALSE);
249  if ( pi.IsValid() )
250  {
251  if ( !pad.IsValid() )
252  {
253  pad = AliMpPad(0, 0,
254  pi.GetIndices(),
255  pi.GetPositionX(),pi.GetPositionY(),
256  pi.GetDimensionX(), pi.GetDimensionY());
257  pad.AddLocation(pi.GetManuId(), pi.GetManuChannel());
258  }
259  else
260  {
261  pad.AddLocation(pi.GetManuId(), pi.GetManuChannel());
262  }
263  }
264  }
265  if ( warning && !pad.IsValid() )
266  {
267  AliWarning(Form("No pad found at indices (%d,%d)",ix, iy));
268  }
269 
270  return pad;
271 }
272 
273 //_____________________________________________________________________________
274 AliMpPad
276  Bool_t warning) const
277 {
285  AliMpPad pad;
286 
287  for ( Int_t i = 0; i < fkSlat->GetSize(); ++i )
288  {
290  AliMpPad pi = seg->PadByPosition(x,y,kFALSE);
291  if ( pi.IsValid() )
292  {
293  if ( !pad.IsValid() )
294  {
295  pad = AliMpPad(0, 0,
296  pi.GetIndices(),
297  pi.GetPositionX(),pi.GetPositionY(),
298  pi.GetDimensionX(), pi.GetDimensionY());
299  pad.AddLocation(pi.GetManuId(), pi.GetManuChannel());
300  }
301  else
302  {
303  pad.AddLocation(pi.GetManuId(), pi.GetManuChannel());
304  }
305  }
306  }
307  if ( warning && !pad.IsValid() )
308  {
309  AliWarning(Form("No pad found at position (%e,%e)",x,y));
310  }
311 
312  return pad;
313 }
314 
315 //_____________________________________________________________________________
318 {
320 
321  return Slat()->PlaneType();
322 }
323 
324 //_____________________________________________________________________________
325 const AliMpTrigger*
327 {
331 
332  return fkSlat;
333 }
334 
335 //_____________________________________________________________________________
336 Int_t
338 {
340 
341  TArrayI ecn;
343  return ecn.GetSize();
344 }
345 
346 //_____________________________________________________________________________
347 Double_t
349 {
351  return Slat()->GetPositionX();
352 }
353 
354 //_____________________________________________________________________________
355 Double_t
357 {
359  return Slat()->GetPositionY();
360 }
361 
362 //_____________________________________________________________________________
365 {
367  AliError("Not implemented");
368  return 0x0;
369 }
370 
371 //_____________________________________________________________________________
372 Bool_t
374 {
377 }
Double_t GetPositionX() const
Return x position.
Definition: AliMpTrigger.h:56
virtual AliMpPad PadByLocation(Int_t manuId, Int_t manuChannel, Bool_t warning) const
Find pad by location.
Int_t GetNofPadsX() const
virtual Double_t GetPositionY() const
Return the y position of the origin of the detection element.
Int_t MaxPadIndexX() const
Return maximum pad index in X direction.
virtual Bool_t HasMotifPosition(Int_t manuId) const =0
Whether or not we have a given manu.
#define TObjArray
Int_t GetIy() const
Definition: AliMpPad.cxx:280
void GetAllLocalBoardNumbers(TArrayI &lbn) const
Int_t GetManuId() const
Definition: AliMpPad.cxx:256
AliMpVSegmentation * GetLayerSegmentation(int layer) const
AliMp::PlaneType PlaneType() const
A rectangle area positioned in plane..
Definition: AliMpArea.h:20
const AliMpTrigger * fkSlat
Slat.
MpPair_t GetIndices() const
Return pad indices as encoded pair (ix, iy)
Definition: AliMpPad.h:74
virtual Double_t GetDimensionY() const
Return the y half-sizes of the detection element.
virtual Bool_t HasPadByIndices(Int_t ix, Int_t iy) const
virtual AliMpPad PadByIndices(Int_t ix, Int_t iy, Bool_t warning=true) const =0
Find pad by indices.
const AliMpTrigger * Slat() const
#define AliWarning(message)
Definition: AliLog.h:541
virtual void GetAllElectronicCardIDs(TArrayI &ecn) const
Fill the given array with the electronic card IDs.
virtual Double_t GetDimensionX() const
Return the x half-sizes of the detection element.
Int_t GetManuChannel() const
Definition: AliMpPad.cxx:264
Bool_t fIsOwner
Trigger slat ownership.
A trigger slat.
Definition: AliMpTrigger.h:37
const char * GetName() const
A placed motif.
Int_t GetSize() const
Returns the number of layers.
virtual AliMpVPadIterator * CreateIterator() const
Create a pad iterator over the whole area.
Implementation of AliMpVSegmentation for trigger slats.
An interface for an iterator over pads.
Double_t GetPositionY() const
Return the pad x position (in cm)
Definition: AliMpPad.h:81
virtual AliMpMotifPosition * MotifPosition(Int_t manuId) const
Return the position of a given manu (aka motifPosition)
virtual Bool_t HasMotifPosition(Int_t manuId) const
Whether or not we have a given manu.
Iterator for trigger slat pads.
Double_t GetDimensionX() const
Return the x dimension (half-sizes) of that slat (cm)
Definition: AliMpTrigger.h:75
virtual AliMpPad PadByIndices(Int_t ix, Int_t iy, Bool_t warning) const
Find pad by indices.
Int_t MaxPadIndexY() const
Return maximum pad index in Y direction.
Int_t fNofStrips
Number of strips in this slat.
Bool_t IsValid() const
Return validity.
Definition: AliMpPad.h:89
virtual AliMpPad PadByPosition(Double_t x, Double_t y, Bool_t warning=true) const =0
Find pad by position.
#define AliDebug(logLevel, message)
Definition: AliLog.h:300
Double_t GetDimensionY() const
Return the y dimension (half-sizes) of that slat (cm)
Definition: AliMpTrigger.h:77
Int_t GetIx() const
Definition: AliMpPad.cxx:272
virtual Int_t GetNeighbours(const AliMpPad &pad, TObjArray &neighbours, Bool_t includeSelf=kFALSE, Bool_t includeVoid=kFALSE) const
The abstract base class for the segmentation.
Double_t GetDimensionY() const
Return the y pad dimension - half length (in cm)
Definition: AliMpPad.h:86
Double_t GetPositionY() const
Return y position.
Definition: AliMpTrigger.h:58
Class which encapsuate all information about a pad.
Definition: AliMpPad.h:22
Double_t GetPositionX() const
Return the pad x position (in cm)
Definition: AliMpPad.h:79
#define AliError(message)
Definition: AliLog.h:591
virtual Double_t GetPositionX() const
Return the x position of the origin of the detection element.
virtual AliMpPad PadByLocation(Int_t manuId, Int_t manuChannel, Bool_t warning=true) const =0
Find pad by location.
Bool_t AddLocation(Int_t localBoardId, Int_t localBoardChannel, Bool_t warn=true)
Definition: AliMpPad.cxx:217
virtual Int_t GetNofElectronicCards() const
Get the number of electronic card IDs.
virtual AliMpPad PadByPosition(Double_t x, Double_t y, Bool_t warning) const
Find pad by position.
Double_t GetDimensionX() const
Return the x pad dimension - half length (in cm)
Definition: AliMpPad.h:84
Int_t GetMaxNofPadsY() const
virtual AliMp::PlaneType PlaneType() const
Return the plane type.