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