]>
Commit | Line | Data |
---|---|---|
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$ | |
13985652 | 17 | // $MpId: AliMpTriggerSegmentation.cxx,v 1.7 2006/05/24 13:58:52 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 | ||
85fec35d | 31 | /// |
32 | /// \class AliMpTriggerSegmentation | |
33 | /// | |
34 | /// Implementation of AliMpVSegmentation for trigger slats. | |
35 | /// | |
36 | /// \todo Implement CreateIterator method, if needed. | |
37 | /// | |
38 | /// \author Laurent Aphecetche | |
39 | ||
13985652 | 40 | /// \cond CLASSIMP |
ff7d3d1a | 41 | ClassImp(AliMpTriggerSegmentation) |
13985652 | 42 | /// \endcond |
ff7d3d1a | 43 | |
44 | //_____________________________________________________________________________ | |
45 | AliMpTriggerSegmentation::AliMpTriggerSegmentation() | |
46 | : AliMpVSegmentation(), | |
efb408b3 | 47 | fkSlat(0), |
48 | fNofStrips(0) | |
ff7d3d1a | 49 | { |
50 | // | |
51 | // Default ctor. Not to be used really. | |
52 | // | |
53 | AliDebug(1,Form("this=%p Empty ctor",this)); | |
54 | } | |
55 | ||
56 | //_____________________________________________________________________________ | |
57 | AliMpTriggerSegmentation::AliMpTriggerSegmentation(const AliMpTrigger* slat) | |
58 | : AliMpVSegmentation(), | |
1657f946 | 59 | fkSlat(slat), |
60 | fNofStrips(0) | |
ff7d3d1a | 61 | { |
62 | // | |
63 | // Normal ctor. | |
64 | // | |
65 | AliDebug(1,Form("this=%p Normal ctor slat=%p",this,slat)); | |
efb408b3 | 66 | |
67 | // Compute the number of strips. | |
68 | // We have to loop over all possible pads, in order to properly take | |
69 | // into account the fact that a given strip might be part of several | |
70 | // layer. Otherwise we would double count pads. | |
71 | ||
1657f946 | 72 | |
efb408b3 | 73 | for ( Int_t ix = 0; ix <= MaxPadIndexX(); ++ix ) |
74 | { | |
75 | for ( Int_t iy = 0; iy <= MaxPadIndexY(); ++iy ) | |
76 | { | |
77 | if ( HasPad(AliMpIntPair(ix,iy)) ) | |
78 | { | |
79 | ++fNofStrips; | |
80 | } | |
81 | } | |
82 | } | |
ff7d3d1a | 83 | } |
84 | ||
85 | //_____________________________________________________________________________ | |
86 | AliMpTriggerSegmentation::~AliMpTriggerSegmentation() | |
87 | { | |
88 | // | |
89 | // Dtor (empty). | |
90 | // | |
91 | AliDebug(1,Form("this=%p",this)); | |
92 | } | |
93 | ||
94 | //_____________________________________________________________________________ | |
95 | AliMpVPadIterator* | |
96 | AliMpTriggerSegmentation::CreateIterator(const AliMpArea&) const | |
97 | { | |
98 | // | |
99 | // Returns an iterator to loop over the pad contained within given area. | |
100 | // Not implemented for trigger. | |
101 | ||
102 | return 0; | |
103 | } | |
104 | ||
63bcb3c3 | 105 | //_____________________________________________________________________________ |
106 | TVector2 | |
107 | AliMpTriggerSegmentation::Dimensions() const | |
108 | { | |
109 | return Slat()->Dimensions(); | |
110 | } | |
111 | ||
112 | //_____________________________________________________________________________ | |
113 | void | |
114 | AliMpTriggerSegmentation::GetAllElectronicCardIDs(TArrayI& ecn) const | |
115 | { | |
116 | Slat()->GetAllLocalBoardNumbers(ecn); | |
117 | } | |
118 | ||
ff7d3d1a | 119 | //_____________________________________________________________________________ |
120 | const char* | |
121 | AliMpTriggerSegmentation::GetName() const | |
122 | { | |
85fec35d | 123 | // Name of that segmentation = TriggerSegmentation + slatName |
ff7d3d1a | 124 | TString name("TriggerSegmentation"); |
125 | if ( fkSlat) | |
126 | { | |
127 | name += "."; | |
128 | name += fkSlat->GetName(); | |
129 | } | |
130 | return name.Data(); | |
131 | } | |
132 | ||
133 | //_____________________________________________________________________________ | |
134 | Bool_t | |
135 | AliMpTriggerSegmentation::HasPad(const AliMpIntPair& indices) const | |
136 | { | |
137 | // | |
138 | // Test if this slat has a pad located at the position referenced | |
139 | // by the integer indices. | |
140 | // | |
141 | ||
142 | return PadByIndices(indices,kFALSE) != AliMpPad::Invalid(); | |
143 | } | |
144 | ||
145 | //_____________________________________________________________________________ | |
146 | Int_t | |
026b7442 | 147 | AliMpTriggerSegmentation::MaxPadIndexX() const |
ff7d3d1a | 148 | { |
149 | // | |
150 | // Returns the value of the largest pad index in x-direction. | |
151 | // | |
152 | ||
153 | return fkSlat->GetNofPadsX()-1; | |
154 | } | |
155 | ||
156 | //_____________________________________________________________________________ | |
157 | Int_t | |
026b7442 | 158 | AliMpTriggerSegmentation::MaxPadIndexY() const |
ff7d3d1a | 159 | { |
160 | // | |
161 | // Returns the value of the largest pad index in y-direction. | |
162 | // | |
163 | ||
164 | return fkSlat->GetMaxNofPadsY()-1; | |
165 | } | |
166 | ||
167 | //_____________________________________________________________________________ | |
168 | AliMpPad | |
169 | AliMpTriggerSegmentation::PadByLocation(const AliMpIntPair& location, | |
170 | Bool_t warning) const | |
171 | { | |
172 | // | |
173 | // Returns the pad specified by its location, where location is the | |
174 | // pair (ManuID,ManuChannel). | |
175 | // If warning=kTRUE and the pad does not exist, a warning message is | |
176 | // printed. | |
177 | // | |
178 | // AliMpPad::Invalid() is returned if there's no pad at the given location. | |
179 | // | |
180 | AliMpPad pad; | |
181 | AliMpIntPair invloc; | |
182 | ||
183 | for ( Int_t i = 0; i < fkSlat->GetSize(); ++i ) | |
184 | { | |
185 | const AliMpSlat* slat = fkSlat->GetLayer(i); | |
186 | AliMpSlatSegmentation seg(slat); | |
85fec35d | 187 | AliMpPad pi = seg.PadByLocation(location,kFALSE); |
188 | if ( pi.IsValid() ) | |
ff7d3d1a | 189 | { |
190 | if ( !pad.IsValid() ) | |
191 | { | |
85fec35d | 192 | pad = AliMpPad(invloc,pi.GetIndices(),pi.Position(),pi.Dimensions()); |
193 | pad.AddLocation(pi.GetLocation()); | |
ff7d3d1a | 194 | } |
195 | else | |
196 | { | |
85fec35d | 197 | pad.AddLocation(pi.GetLocation()); |
ff7d3d1a | 198 | } |
199 | } | |
200 | } | |
201 | if ( warning && !pad.IsValid() ) | |
202 | { | |
203 | AliWarning(Form("No pad found at location (%d,%d)",location.GetFirst(), | |
204 | location.GetSecond())); | |
205 | } | |
206 | return pad; | |
207 | } | |
208 | ||
209 | //_____________________________________________________________________________ | |
210 | AliMpPad | |
211 | AliMpTriggerSegmentation::PadByIndices(const AliMpIntPair& indices, | |
212 | Bool_t warning) const | |
213 | { | |
214 | // | |
215 | // Returns the pad specified by its integer indices. | |
216 | // If warning=kTRUE and the pad does not exist, a warning message is | |
217 | // printed. | |
218 | // | |
219 | // AliMpPad::Invalid() is returned if there's no pad at the given location. | |
220 | // | |
221 | // | |
222 | ||
223 | AliMpPad pad; | |
224 | AliMpIntPair invloc; | |
225 | ||
226 | for ( Int_t i = 0; i < fkSlat->GetSize(); ++i ) | |
227 | { | |
228 | const AliMpSlat* slat = fkSlat->GetLayer(i); | |
229 | AliMpSlatSegmentation seg(slat); | |
85fec35d | 230 | AliMpPad pi = seg.PadByIndices(indices,kFALSE); |
231 | if ( pi.IsValid() ) | |
ff7d3d1a | 232 | { |
233 | if ( !pad.IsValid() ) | |
234 | { | |
85fec35d | 235 | pad = AliMpPad(invloc,pi.GetIndices(),pi.Position(),pi.Dimensions()); |
236 | pad.AddLocation(pi.GetLocation()); | |
ff7d3d1a | 237 | } |
238 | else | |
239 | { | |
85fec35d | 240 | pad.AddLocation(pi.GetLocation()); |
ff7d3d1a | 241 | } |
242 | } | |
243 | } | |
244 | if ( warning && !pad.IsValid() ) | |
245 | { | |
246 | AliWarning(Form("No pad found at indices (%d,%d)",indices.GetFirst(), | |
247 | indices.GetSecond())); | |
248 | } | |
249 | ||
250 | return pad; | |
251 | } | |
252 | ||
253 | //_____________________________________________________________________________ | |
254 | AliMpPad | |
255 | AliMpTriggerSegmentation::PadByPosition(const TVector2& position, | |
256 | Bool_t warning) const | |
257 | { | |
258 | // | |
259 | // Returns the pad specified by its (floating point) position. | |
260 | // If warning=kTRUE and the pad does not exist, a warning message is | |
261 | // printed. | |
262 | // | |
263 | // AliMpPad::Invalid() is returned if there's no pad at the given location. | |
264 | // | |
265 | AliMpPad pad; | |
266 | AliMpIntPair invloc; | |
267 | ||
268 | for ( Int_t i = 0; i < fkSlat->GetSize(); ++i ) | |
269 | { | |
270 | const AliMpSlat* slat = fkSlat->GetLayer(i); | |
271 | AliMpSlatSegmentation seg(slat); | |
85fec35d | 272 | AliMpPad pi = seg.PadByPosition(position,kFALSE); |
273 | if ( pi.IsValid() ) | |
ff7d3d1a | 274 | { |
275 | if ( !pad.IsValid() ) | |
276 | { | |
85fec35d | 277 | pad = AliMpPad(invloc,pi.GetIndices(),pi.Position(),pi.Dimensions()); |
278 | pad.AddLocation(pi.GetLocation()); | |
ff7d3d1a | 279 | } |
280 | else | |
281 | { | |
85fec35d | 282 | pad.AddLocation(pi.GetLocation()); |
ff7d3d1a | 283 | } |
284 | } | |
285 | } | |
286 | if ( warning && !pad.IsValid() ) | |
287 | { | |
288 | AliWarning(Form("No pad found at position (%e,%e)",position.X(), | |
289 | position.Y())); | |
290 | } | |
291 | ||
292 | return pad; | |
293 | } | |
294 | ||
63bcb3c3 | 295 | //_____________________________________________________________________________ |
296 | AliMpPlaneType | |
297 | AliMpTriggerSegmentation::PlaneType() const | |
298 | { | |
299 | return Slat()->PlaneType(); | |
300 | } | |
301 | ||
ff7d3d1a | 302 | //_____________________________________________________________________________ |
303 | const AliMpTrigger* | |
304 | AliMpTriggerSegmentation::Slat() const | |
305 | { | |
306 | // | |
307 | // Returns the pointer to the referenced slat. | |
308 | // | |
309 | ||
310 | return fkSlat; | |
311 | } |