AliRoot Core  edcc906 (edcc906)
AliMpPadRow.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: AliMpPadRow.cxx,v 1.8 2006/05/24 13:58:46 ivana Exp $
18 // Category: sector
19 
20 //-----------------------------------------------------------------------------
21 // Class AliMpPadRow
22 // ------------------
23 // Class describing a pad row composed of the pad row segments.
24 // Included in AliRoot: 2003/05/02
25 // Authors: David Guez, Ivana Hrivnacova; IPN Orsay
26 //-----------------------------------------------------------------------------
27 
28 #include "AliMpPadRow.h"
29 #include "AliMpPadRowLSegment.h"
30 #include "AliMpPadRowRSegment.h"
31 
32 #include "AliLog.h"
33 
34 #include <Riostream.h>
35 
36 using std::endl;
38 ClassImp(AliMpPadRow)
40 
41 //_____________________________________________________________________________
43  : TObject(),
44  fDirection(direction),
45  fID(0),
46  fOffsetX(0),
47  fSegments()
48 {
50 }
51 
52 //_____________________________________________________________________________
54  : TObject(),
55  fDirection(AliMp::kLeft),
56  fID(0),
57  fOffsetX(0),
58  fSegments()
59 {
61 }
62 
63 //_____________________________________________________________________________
65 {
67 
68  for (Int_t i=0; i<GetNofPadRowSegments() ; i++)
69  delete fSegments[i];
70 }
71 
72 //
73 // private methods
74 //
75 
76 //_____________________________________________________________________________
78 {
81 
82  if (GetNofPadRowSegments() == 0)
83  return fOffsetX;
84  else
85  if (fDirection == AliMp::kLeft)
87  else
89 }
90 
91 //
92 // public methods
93 //
94 
95 //_____________________________________________________________________________
97 AliMpPadRow::AddPadRowSegment(AliMpMotif* motif, Int_t motifPositionId,
98  Int_t nofPads)
99 {
101 
102  AliMpVPadRowSegment* padRowSegment = 0;
103 
104  if (fDirection == AliMp::kLeft) {
105  padRowSegment
106  = new AliMpPadRowLSegment(this, motif, motifPositionId, nofPads);
107  }
108  else {
109  padRowSegment
110  = new AliMpPadRowRSegment(this, motif, motifPositionId, nofPads);
111  }
112 
113  // Set pad row segment offset
114  padRowSegment->SetOffsetX(CurrentBorderX());
115 
116  // Adds the pad row segment
117  fSegments.Add(padRowSegment);
118 
119  return padRowSegment;
120 }
121 
122 //_____________________________________________________________________________
124 {
127 
128  for (Int_t i=0; i<GetNofPadRowSegments(); i++) {
130  if (x >= rs->LeftBorderX() && x <= rs->RightBorderX())
131  return rs;
132  }
133 
134  return 0;
135 }
136 
137 //_____________________________________________________________________________
138 Double_t AliMpPadRow::HalfSizeY() const
139 {
141 
142  return GetPadRowSegment(0)->HalfSizeY();
143 }
144 
145 //_____________________________________________________________________________
146 void AliMpPadRow::SetID(Int_t id)
147 {
149 
150  fID = id;
151 }
152 
153 //_____________________________________________________________________________
154 void AliMpPadRow::SetOffsetX(Double_t offsetX)
155 {
157 
158  fOffsetX = offsetX;
159 }
160 
161 //_____________________________________________________________________________
162 Int_t AliMpPadRow::GetID() const
163 {
165 
166  return fID;
167 }
168 
169 //_____________________________________________________________________________
171 {
173 
174  return fSegments.GetEntriesFast();
175 }
176 
177 //_____________________________________________________________________________
179 {
181 
182  if (i<0 || i>=GetNofPadRowSegments()) {
183  AliWarningStream() << "Index outside range" << endl;
184  return 0;
185  }
186 
187  return (AliMpVPadRowSegment*)fSegments[i];
188 }
189 
190 //_____________________________________________________________________________
192 {
194 
195  Int_t nofPads=0;
196  for (Int_t i=0; i<GetNofPadRowSegments(); i++)
197  nofPads += GetPadRowSegment(i)->GetNofPads();
198 
199  return nofPads;
200 }
201 
A pad row composed of the pad row segments.
Definition: AliMpPadRow.h:25
virtual Double_t RightBorderX() const =0
virtual Double_t LeftBorderX() const =0
void SetOffsetX(Double_t offsetX)
AliMpVPadRowSegment * GetPadRowSegment(Int_t i) const
void SetID(Int_t id)
A right pad row segment composed of the identic pads.
A left pad row segment composed of the identic pads.
void SetOffsetX(Double_t offsetX)
Double_t HalfSizeY() const
virtual ~AliMpPadRow()
Definition: AliMpPadRow.cxx:64
Int_t GetNofPadRowSegments() const
Int_t GetNofPads() const
Double_t fOffsetX
the x position of the border
Definition: AliMpPadRow.h:56
Int_t GetID() const
Int_t fID
the pad row ID
Definition: AliMpPadRow.h:55
AliMpVPadRowSegment * FindPadRowSegment(Double_t x) const
Double_t CurrentBorderX() const
Definition: AliMpPadRow.cxx:77
Int_t GetNofPads() const
Return number of pads.
#define AliWarningStream()
Definition: AliLog.h:581
AliMp::XDirection fDirection
the pad row x direction
Definition: AliMpPadRow.h:54
A motif with its unique ID and the motif type.
Definition: AliMpMotif.h:23
AliMpVPadRowSegment * AddPadRowSegment(AliMpMotif *motif, Int_t motifPositionId, Int_t nofPads)
Definition: AliMpPadRow.cxx:97
TObjArray fSegments
the pad row segments
Definition: AliMpPadRow.h:57
The namespace for mapping enums and related functions.
virtual Double_t HalfSizeY() const
The abstract base class for a pad row segment composed of the the identic pads.
special row segments built from right to left