]>
Commit | Line | Data |
---|---|---|
0145e89a | 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 | ||
18 | #include "AliMUONManuPainter.h" | |
19 | ||
20 | #include "AliMUONManuPadPainter.h" | |
21 | #include "AliMUONPainterContour.h" | |
22 | #include "AliMUONPainterHelper.h" | |
23 | #include "AliMUONVCalibParam.h" | |
24 | #include "AliMUONVDigit.h" | |
25 | #include "AliMUONVTrackerData.h" | |
26 | #include "AliMpDEManager.h" | |
10eb3d17 | 27 | #include "AliMpManuUID.h" |
0145e89a | 28 | #include "AliMpMotifPosition.h" |
29 | #include "AliMpMotifType.h" | |
30 | #include "AliMpSlat.h" | |
31 | #include "AliMpStationType.h" | |
32 | #include "AliMpVMotif.h" | |
33 | #include "AliMpVPadIterator.h" | |
34 | #include "AliLog.h" | |
35 | #include <TArrayI.h> | |
36 | #include <float.h> | |
37 | ||
38 | ///\class AliMUONManuPainter | |
39 | /// | |
40 | /// Implementation of AliMUONVPainter for one manu (not the pads, only the manu | |
41 | /// itself). | |
42 | /// | |
43 | ///\author Laurent Aphecetche, Subatech | |
44 | ||
45 | ///\cond CLASSIMP | |
46 | ClassImp(AliMUONManuPainter) | |
47 | ///\endcond | |
48 | ||
1ffbeb9d | 49 | //_____________________________________________________________________________ |
50 | AliMUONManuPainter::AliMUONManuPainter(TRootIOCtor* ioCtor) | |
51 | : AliMUONVPainter(ioCtor), | |
52 | fDetElemId(-1), | |
53 | fManuId(-1) | |
54 | { | |
55 | /// ctor | |
56 | } | |
57 | ||
0145e89a | 58 | //_____________________________________________________________________________ |
59 | AliMUONManuPainter::AliMUONManuPainter() | |
60 | : AliMUONVPainter(), | |
61 | fDetElemId(-1), | |
62 | fManuId(-1) | |
63 | { | |
64 | /// ctor | |
65 | } | |
66 | ||
67 | //_____________________________________________________________________________ | |
68 | AliMUONManuPainter::AliMUONManuPainter(const AliMUONAttPainter& att, | |
69 | Int_t detElemId, | |
70 | Int_t manuId) | |
71 | : AliMUONVPainter("MANU"), | |
72 | fDetElemId(detElemId), | |
73 | fManuId(manuId) | |
74 | { | |
75 | /// ctor | |
76 | ||
77 | SetAttributes(att); | |
78 | ||
79 | AliMUONPainterHelper* h = AliMUONPainterHelper::Instance(); | |
80 | ||
81 | SetID(detElemId,manuId); | |
82 | SetName(h->ManuName(manuId)); | |
83 | SetPathName(h->ManuPathName(detElemId,manuId)); | |
84 | ||
85 | AliMpMotifPosition* mp = h->GetMotifPosition(detElemId,manuId); | |
86 | ||
87 | if (!mp) | |
88 | { | |
89 | AliFatal(Form("Could not get manuId %04d from DE %04d",manuId,detElemId)); | |
90 | } | |
91 | ||
92 | Double_t x,y,z; | |
93 | ||
94 | AliMp::StationType stationType = AliMpDEManager::GetStationType(detElemId); | |
10eb3d17 | 95 | |
0145e89a | 96 | if ( stationType == AliMp::kStation345 ) |
97 | { | |
98 | const AliMpSlat* slat = AliMUONPainterHelper::Instance()->GetSlat(detElemId,manuId); | |
10eb3d17 | 99 | |
0145e89a | 100 | h->Local2Global(fDetElemId, |
6e97fbb8 | 101 | mp->GetPositionX() -slat->GetPositionX(), |
102 | mp->GetPositionY() -slat->GetPositionY(), | |
10eb3d17 | 103 | 0, |
104 | x,y,z); | |
0145e89a | 105 | } |
106 | else if ( stationType != AliMp::kStationTrigger ) | |
107 | { | |
108 | h->Local2Global(fDetElemId, | |
6e97fbb8 | 109 | mp->GetPositionX(), |
110 | mp->GetPositionY(), | |
10eb3d17 | 111 | 0, |
112 | x,y,z); | |
0145e89a | 113 | } |
114 | else | |
115 | { | |
116 | AliError("Hu ho. Not supposed to be used for trigger !"); | |
117 | Invalidate(); | |
118 | return; | |
119 | } | |
120 | ||
121 | AliMUONPainterContour* contour = h->GetContour(ContourName()); | |
10eb3d17 | 122 | |
0145e89a | 123 | if (!contour) |
124 | { | |
125 | contour = h->GenerateManuContour(fDetElemId, | |
10eb3d17 | 126 | fManuId, |
127 | Attributes(), | |
128 | ContourName()); | |
0145e89a | 129 | } |
130 | SetContour(contour); | |
131 | ||
132 | Add(new AliMUONManuPadPainter(*this,fDetElemId,fManuId)); | |
133 | } | |
134 | ||
135 | //_____________________________________________________________________________ | |
136 | AliMUONManuPainter::AliMUONManuPainter(const AliMUONManuPainter& rhs) | |
137 | : AliMUONVPainter(rhs), fDetElemId(-1), fManuId(-1) | |
138 | { | |
139 | /// copy ctor | |
140 | rhs.Copy(*this); | |
141 | } | |
142 | ||
143 | //_____________________________________________________________________________ | |
144 | AliMUONManuPainter& | |
145 | AliMUONManuPainter::operator=(const AliMUONManuPainter& rhs) | |
146 | { | |
147 | /// assignment operator | |
148 | if ( this != &rhs ) | |
149 | { | |
150 | rhs.Copy(*this); | |
151 | } | |
152 | return *this; | |
153 | } | |
154 | ||
155 | //_____________________________________________________________________________ | |
156 | AliMUONManuPainter::~AliMUONManuPainter() | |
157 | { | |
158 | /// dtor | |
159 | } | |
160 | ||
161 | //_____________________________________________________________________________ | |
162 | void | |
163 | AliMUONManuPainter::ComputeDataRange(const AliMUONVTrackerData& data, Int_t dataIndex, | |
164 | Double_t& dataMin, Double_t& dataMax) const | |
165 | { | |
166 | /// Compute data range spanned by this manu | |
167 | dataMin = dataMax = data.Manu(fDetElemId, fManuId, dataIndex); | |
168 | } | |
169 | ||
170 | ||
171 | //_____________________________________________________________________________ | |
172 | void | |
173 | AliMUONManuPainter::Copy(TObject& object) const | |
174 | { | |
175 | /// copyy this to object | |
176 | AliMUONVPainter::Copy((AliMUONVPainter&)(object)); | |
177 | ((AliMUONManuPainter&)(object)).fDetElemId = fDetElemId; | |
178 | ((AliMUONManuPainter&)(object)).fManuId = fManuId; | |
179 | } | |
180 | ||
181 | //_____________________________________________________________________________ | |
182 | TString | |
183 | AliMUONManuPainter::Describe(const AliMUONVTrackerData& data, Int_t dataIndex, | |
184 | Double_t, Double_t) | |
185 | { | |
186 | /// Describe data at this manu | |
187 | ||
188 | if (!data.HasManu(fDetElemId,fManuId)) return ""; | |
189 | ||
190 | Double_t value = data.Manu(fDetElemId,fManuId,dataIndex); | |
191 | ||
192 | return AliMUONPainterHelper::Instance()->FormatValue(data.DimensionName(dataIndex).Data(),value); | |
193 | } | |
194 | ||
10eb3d17 | 195 | //_____________________________________________________________________________ |
196 | void | |
197 | AliMUONManuPainter::FillManuList(TObjArray& manuList) const | |
198 | { | |
199 | /// Append our manu to the list | |
200 | manuList.Add(new AliMpManuUID(fDetElemId,fManuId)); | |
201 | } | |
202 | ||
1ffbeb9d | 203 | //_____________________________________________________________________________ |
204 | Bool_t | |
205 | AliMUONManuPainter::IsIncluded() const | |
206 | { | |
207 | /// whether this manu is included in the readout or not | |
208 | return ( InteractiveReadOutConfig()->Manu(fDetElemId,fManuId) > 0 ); | |
209 | } | |
210 | ||
0145e89a | 211 | //_____________________________________________________________________________ |
212 | void | |
213 | AliMUONManuPainter::PaintArea(const AliMUONVTrackerData& data, Int_t dataIndex, | |
214 | Double_t min, Double_t max) | |
215 | { | |
216 | /// Paint area of this manu according to data | |
217 | ||
218 | if (!data.HasManu(fDetElemId,fManuId)) return; | |
219 | ||
220 | Double_t value = data.Manu(fDetElemId,fManuId,dataIndex); | |
221 | ||
222 | if ( value >= AliMUONVCalibParam::InvalidFloatValue() ) return; | |
223 | ||
224 | Int_t color = AliMUONPainterHelper::Instance()->ColorFromValue(value,min,max); | |
225 | ||
226 | Contour()->PaintArea(color); | |
227 | } | |
228 | ||
229 | //_____________________________________________________________________________ | |
230 | AliMUONAttPainter | |
231 | AliMUONManuPainter::Validate(const AliMUONAttPainter& attributes) const | |
232 | { | |
233 | /// Normalize the attributes | |
234 | ||
235 | /// check that cathode and plane are up-to-date, and that they are legal | |
236 | ||
237 | AliMUONAttPainter norm(attributes); | |
238 | ||
239 | norm.SetValid(kFALSE); | |
240 | ||
241 | if ( norm.IsCathodeDefined() ) | |
242 | { | |
243 | if ( norm.IsCathode0() != Attributes().IsCathode0() ) return norm; | |
244 | } | |
245 | ||
246 | if ( norm.IsPlaneDefined() ) | |
247 | { | |
248 | if ( norm.IsBendingPlane() != Attributes().IsBendingPlane() ) return norm; | |
249 | } | |
250 | ||
251 | norm.SetValid(kTRUE); | |
252 | ||
253 | if ( norm.IsCathodeDefined() && !norm.IsPlaneDefined() ) | |
254 | { | |
255 | // derive plane from cathode | |
256 | ||
257 | AliMp::CathodType cathode = ( norm.IsCathode0() ? AliMp::kCath0 : AliMp::kCath1 ) ; | |
258 | ||
259 | AliMp::PlaneType planeType = AliMpDEManager::GetPlaneType(fDetElemId,cathode); | |
260 | ||
261 | Bool_t bending = ( planeType == AliMp::kBendingPlane ); | |
262 | ||
263 | norm.SetPlane(bending,!bending); | |
264 | } | |
265 | else if ( norm.IsPlaneDefined() && !norm.IsCathodeDefined() ) | |
266 | { | |
267 | // derive cathode from plane | |
268 | ||
269 | AliMp::PlaneType planeType = ( norm.IsBendingPlane() ? AliMp::kBendingPlane : AliMp::kNonBendingPlane ); | |
270 | ||
271 | AliMp::CathodType cathode = AliMpDEManager::GetCathod(fDetElemId,planeType); | |
272 | ||
273 | Bool_t cath0 = ( cathode == AliMp::kCath0 ); | |
274 | ||
275 | norm.SetCathode(cath0,!cath0); | |
276 | } | |
277 | else if ( norm.IsPlaneDefined() && norm.IsCathodeDefined() ) | |
278 | { | |
279 | // check that cathode and plane matches | |
280 | ||
281 | AliMp::CathodType cathode = ( norm.IsCathode0() ? AliMp::kCath0 : AliMp::kCath1 ) ; | |
282 | ||
283 | AliMp::PlaneType planeType = AliMpDEManager::GetPlaneType(fDetElemId,cathode); | |
284 | ||
285 | Bool_t bending = ( planeType == AliMp::kBendingPlane ); | |
286 | ||
287 | if ( bending != norm.IsBendingPlane() ) | |
288 | { | |
289 | norm.SetValid(kFALSE); | |
290 | } | |
291 | } | |
292 | ||
293 | return norm; | |
294 | } | |
295 | ||
296 |