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