]>
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$ | |
17 | // $MpId$ | |
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 | ||
55 | //_____________________________________________________________________________ | |
56 | AliMpTriggerSegmentation::~AliMpTriggerSegmentation() | |
57 | { | |
58 | // | |
59 | // Dtor (empty). | |
60 | // | |
61 | AliDebug(1,Form("this=%p",this)); | |
62 | } | |
63 | ||
64 | //_____________________________________________________________________________ | |
65 | AliMpVPadIterator* | |
66 | AliMpTriggerSegmentation::CreateIterator(const AliMpArea&) const | |
67 | { | |
68 | // | |
69 | // Returns an iterator to loop over the pad contained within given area. | |
70 | // Not implemented for trigger. | |
71 | ||
72 | return 0; | |
73 | } | |
74 | ||
75 | //_____________________________________________________________________________ | |
76 | const char* | |
77 | AliMpTriggerSegmentation::GetName() const | |
78 | { | |
79 | TString name("TriggerSegmentation"); | |
80 | if ( fkSlat) | |
81 | { | |
82 | name += "."; | |
83 | name += fkSlat->GetName(); | |
84 | } | |
85 | return name.Data(); | |
86 | } | |
87 | ||
88 | //_____________________________________________________________________________ | |
89 | Bool_t | |
90 | AliMpTriggerSegmentation::HasPad(const AliMpIntPair& indices) const | |
91 | { | |
92 | // | |
93 | // Test if this slat has a pad located at the position referenced | |
94 | // by the integer indices. | |
95 | // | |
96 | ||
97 | return PadByIndices(indices,kFALSE) != AliMpPad::Invalid(); | |
98 | } | |
99 | ||
100 | //_____________________________________________________________________________ | |
101 | Int_t | |
102 | AliMpTriggerSegmentation::MaxPadIndexX() | |
103 | { | |
104 | // | |
105 | // Returns the value of the largest pad index in x-direction. | |
106 | // | |
107 | ||
108 | return fkSlat->GetNofPadsX()-1; | |
109 | } | |
110 | ||
111 | //_____________________________________________________________________________ | |
112 | Int_t | |
113 | AliMpTriggerSegmentation::MaxPadIndexY() | |
114 | { | |
115 | // | |
116 | // Returns the value of the largest pad index in y-direction. | |
117 | // | |
118 | ||
119 | return fkSlat->GetMaxNofPadsY()-1; | |
120 | } | |
121 | ||
122 | //_____________________________________________________________________________ | |
123 | AliMpPad | |
124 | AliMpTriggerSegmentation::PadByLocation(const AliMpIntPair& location, | |
125 | Bool_t warning) const | |
126 | { | |
127 | // | |
128 | // Returns the pad specified by its location, where location is the | |
129 | // pair (ManuID,ManuChannel). | |
130 | // If warning=kTRUE and the pad does not exist, a warning message is | |
131 | // printed. | |
132 | // | |
133 | // AliMpPad::Invalid() is returned if there's no pad at the given location. | |
134 | // | |
135 | AliMpPad pad; | |
136 | AliMpIntPair invloc; | |
137 | ||
138 | for ( Int_t i = 0; i < fkSlat->GetSize(); ++i ) | |
139 | { | |
140 | const AliMpSlat* slat = fkSlat->GetLayer(i); | |
141 | AliMpSlatSegmentation seg(slat); | |
142 | AliMpPad p_i = seg.PadByLocation(location,kFALSE); | |
143 | if ( p_i.IsValid() ) | |
144 | { | |
145 | if ( !pad.IsValid() ) | |
146 | { | |
147 | pad = AliMpPad(invloc,p_i.GetIndices(),p_i.Position(),p_i.Dimensions()); | |
148 | pad.AddLocation(p_i.GetLocation()); | |
149 | } | |
150 | else | |
151 | { | |
152 | pad.AddLocation(p_i.GetLocation()); | |
153 | } | |
154 | } | |
155 | } | |
156 | if ( warning && !pad.IsValid() ) | |
157 | { | |
158 | AliWarning(Form("No pad found at location (%d,%d)",location.GetFirst(), | |
159 | location.GetSecond())); | |
160 | } | |
161 | return pad; | |
162 | } | |
163 | ||
164 | //_____________________________________________________________________________ | |
165 | AliMpPad | |
166 | AliMpTriggerSegmentation::PadByIndices(const AliMpIntPair& indices, | |
167 | Bool_t warning) const | |
168 | { | |
169 | // | |
170 | // Returns the pad specified by its integer indices. | |
171 | // If warning=kTRUE and the pad does not exist, a warning message is | |
172 | // printed. | |
173 | // | |
174 | // AliMpPad::Invalid() is returned if there's no pad at the given location. | |
175 | // | |
176 | // | |
177 | ||
178 | AliMpPad pad; | |
179 | AliMpIntPair invloc; | |
180 | ||
181 | for ( Int_t i = 0; i < fkSlat->GetSize(); ++i ) | |
182 | { | |
183 | const AliMpSlat* slat = fkSlat->GetLayer(i); | |
184 | AliMpSlatSegmentation seg(slat); | |
185 | AliMpPad p_i = seg.PadByIndices(indices,kFALSE); | |
186 | if ( p_i.IsValid() ) | |
187 | { | |
188 | if ( !pad.IsValid() ) | |
189 | { | |
190 | pad = AliMpPad(invloc,p_i.GetIndices(),p_i.Position(),p_i.Dimensions()); | |
191 | pad.AddLocation(p_i.GetLocation()); | |
192 | } | |
193 | else | |
194 | { | |
195 | pad.AddLocation(p_i.GetLocation()); | |
196 | } | |
197 | } | |
198 | } | |
199 | if ( warning && !pad.IsValid() ) | |
200 | { | |
201 | AliWarning(Form("No pad found at indices (%d,%d)",indices.GetFirst(), | |
202 | indices.GetSecond())); | |
203 | } | |
204 | ||
205 | return pad; | |
206 | } | |
207 | ||
208 | //_____________________________________________________________________________ | |
209 | AliMpPad | |
210 | AliMpTriggerSegmentation::PadByPosition(const TVector2& position, | |
211 | Bool_t warning) const | |
212 | { | |
213 | // | |
214 | // Returns the pad specified by its (floating point) position. | |
215 | // If warning=kTRUE and the pad does not exist, a warning message is | |
216 | // printed. | |
217 | // | |
218 | // AliMpPad::Invalid() is returned if there's no pad at the given location. | |
219 | // | |
220 | AliMpPad pad; | |
221 | AliMpIntPair invloc; | |
222 | ||
223 | for ( Int_t i = 0; i < fkSlat->GetSize(); ++i ) | |
224 | { | |
225 | const AliMpSlat* slat = fkSlat->GetLayer(i); | |
226 | AliMpSlatSegmentation seg(slat); | |
227 | AliMpPad p_i = seg.PadByPosition(position,kFALSE); | |
228 | if ( p_i.IsValid() ) | |
229 | { | |
230 | if ( !pad.IsValid() ) | |
231 | { | |
232 | pad = AliMpPad(invloc,p_i.GetIndices(),p_i.Position(),p_i.Dimensions()); | |
233 | pad.AddLocation(p_i.GetLocation()); | |
234 | } | |
235 | else | |
236 | { | |
237 | pad.AddLocation(p_i.GetLocation()); | |
238 | } | |
239 | } | |
240 | } | |
241 | if ( warning && !pad.IsValid() ) | |
242 | { | |
243 | AliWarning(Form("No pad found at position (%e,%e)",position.X(), | |
244 | position.Y())); | |
245 | } | |
246 | ||
247 | return pad; | |
248 | } | |
249 | ||
250 | //_____________________________________________________________________________ | |
251 | const AliMpTrigger* | |
252 | AliMpTriggerSegmentation::Slat() const | |
253 | { | |
254 | // | |
255 | // Returns the pointer to the referenced slat. | |
256 | // | |
257 | ||
258 | return fkSlat; | |
259 | } |