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