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