AliRoot Core  da88d91 (da88d91)
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
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 "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 "AliMpTrigger.h"
29 
30 //-----------------------------------------------------------------------------
38 //-----------------------------------------------------------------------------
39 
43 
44 //_____________________________________________________________________________
47  fkSlat(0),
48  fIsOwner(false),
49  fNofStrips(0)
50 {
54  AliDebug(1,Form("this=%p Empty ctor",this));
55 }
56 
57 //_____________________________________________________________________________
59  const AliMpTrigger* slat, Bool_t own)
61  fkSlat(slat),
62  fIsOwner(own),
63  fNofStrips(0)
64 {
68  AliDebug(1,Form("this=%p Normal ctor slat=%p",this,slat));
69 
70  // Compute the number of strips.
71  // We have to loop over all possible pads, in order to properly take
72  // into account the fact that a given strip might be part of several
73  // layer. Otherwise we would double count pads.
74 
75 
76  for ( Int_t ix = 0; ix <= MaxPadIndexX(); ++ix )
77  {
78  for ( Int_t iy = 0; iy <= MaxPadIndexY(); ++iy )
79  {
80  if ( HasPadByIndices(ix,iy) )
81  {
82  ++fNofStrips;
83  }
84  }
85  }
86 }
87 
88 //_____________________________________________________________________________
90 {
94 
95  if ( fIsOwner ) delete fkSlat;
96 
97  AliDebug(1,Form("this=%p",this));
98 }
99 
100 //_____________________________________________________________________________
103 {
107  AliError("Not implemented for trigger");
108  return 0;
109 }
110 
111 //_____________________________________________________________________________
114 {
118  AliError("Not implemented for trigger");
119 
120  return 0;
121 }
122 
123 //_____________________________________________________________________________
124 Int_t
126  TObjArray& /*neighbours*/,
127  Bool_t /*includeSelf*/,
128  Bool_t /*includeVoid*/) const
129 {
131  AliError("Not implemented for trigger");
132  return 0;
133 }
134 
135 //_____________________________________________________________________________
136 Double_t
138 {
140  return Slat()->GetDimensionX();
141 }
142 
143 //_____________________________________________________________________________
144 Double_t
146 {
148  return Slat()->GetDimensionY();
149 }
150 
151 //_____________________________________________________________________________
152 void
154 {
156 
158 }
159 
160 //_____________________________________________________________________________
161 const char*
163 {
165  TString name("TriggerSegmentation");
166  if ( fkSlat)
167  {
168  name += ".";
169  name += fkSlat->GetName();
170  }
171  return name.Data();
172 }
173 
174 //_____________________________________________________________________________
175 Int_t
177 {
181 
182  return fkSlat->GetNofPadsX()-1;
183 }
184 
185 //_____________________________________________________________________________
186 Int_t
188 {
192 
193  return fkSlat->GetMaxNofPadsY()-1;
194 }
195 
196 //_____________________________________________________________________________
197 AliMpPad
198 AliMpTriggerSegmentation::PadByLocation(Int_t manuId, Int_t manuChannel,
199  Bool_t warning) const
200 {
209  AliMpPad pad;
210 
211  for ( Int_t i = 0; i < fkSlat->GetSize(); ++i )
212  {
214  AliMpPad pi = seg->PadByLocation(manuId,manuChannel,kFALSE);
215  if ( pi.IsValid() )
216  {
217  if ( !pad.IsValid() )
218  {
219  // uses PadByIndices to get the complete list of locations
220  return PadByIndices(pi.GetIx(), pi.GetIy(), warning);
221  }
222  }
223  }
224  if ( warning && !pad.IsValid() )
225  {
226  AliWarning(Form("No pad found at location (%d,%d)", manuId, manuChannel));
227  }
228  return pad;
229 }
230 
231 //_____________________________________________________________________________
232 AliMpPad
234  Bool_t warning) const
235 {
244 
245  AliMpPad pad;
246 
247  for ( Int_t i = 0; i < fkSlat->GetSize(); ++i )
248  {
250  AliMpPad pi = seg->PadByIndices(ix,iy,kFALSE);
251  if ( pi.IsValid() )
252  {
253  if ( !pad.IsValid() )
254  {
255  pad = AliMpPad(0, 0,
256  pi.GetIndices(),
257  pi.GetPositionX(),pi.GetPositionY(),
258  pi.GetDimensionX(), pi.GetDimensionY());
259  pad.AddLocation(pi.GetManuId(), pi.GetManuChannel());
260  }
261  else
262  {
263  pad.AddLocation(pi.GetManuId(), pi.GetManuChannel());
264  }
265  }
266  }
267  if ( warning && !pad.IsValid() )
268  {
269  AliWarning(Form("No pad found at indices (%d,%d)",ix, iy));
270  }
271 
272  return pad;
273 }
274 
275 //_____________________________________________________________________________
276 AliMpPad
278  Bool_t warning) const
279 {
287  AliMpPad pad;
288 
289  for ( Int_t i = 0; i < fkSlat->GetSize(); ++i )
290  {
292  AliMpPad pi = seg->PadByPosition(x,y,kFALSE);
293  if ( pi.IsValid() )
294  {
295  if ( !pad.IsValid() )
296  {
297  pad = AliMpPad(0, 0,
298  pi.GetIndices(),
299  pi.GetPositionX(),pi.GetPositionY(),
300  pi.GetDimensionX(), pi.GetDimensionY());
301  pad.AddLocation(pi.GetManuId(), pi.GetManuChannel());
302  }
303  else
304  {
305  pad.AddLocation(pi.GetManuId(), pi.GetManuChannel());
306  }
307  }
308  }
309  if ( warning && !pad.IsValid() )
310  {
311  AliWarning(Form("No pad found at position (%e,%e)",x,y));
312  }
313 
314  return pad;
315 }
316 
317 //_____________________________________________________________________________
320 {
322 
323  return Slat()->PlaneType();
324 }
325 
326 //_____________________________________________________________________________
327 const AliMpTrigger*
329 {
333 
334  return fkSlat;
335 }
336 
337 //_____________________________________________________________________________
338 Int_t
340 {
342 
343  TArrayI ecn;
345  return ecn.GetSize();
346 }
347 
348 //_____________________________________________________________________________
349 Double_t
351 {
353  return Slat()->GetPositionX();
354 }
355 
356 //_____________________________________________________________________________
357 Double_t
359 {
361  return Slat()->GetPositionY();
362 }
363 
364 //_____________________________________________________________________________
367 {
369  AliError("Not implemented");
370  return 0x0;
371 }
372 
373 //_____________________________________________________________________________
374 Bool_t
376 {
379 }
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
virtual void GetAllElectronicCardIDs(TArrayI &ecn) const
Fill the given array with the electronic card IDs.
ClassImp(TPCGenInfo)
Definition: AliTPCCmpNG.C:254
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.
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.
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
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.