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