]>
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 "AliMUONChamberPainter.h" | |
19 | ||
20 | #include "AliMUONDEPainter.h" | |
8f0acce4 | 21 | #include "AliMUONContour.h" |
0145e89a | 22 | #include "AliMUONPainterHelper.h" |
23 | #include "AliMUONVCalibParam.h" | |
24 | #include "AliMUONVTrackerData.h" | |
25 | #include "AliMpConstants.h" | |
26 | #include "AliMpDEIterator.h" | |
27 | #include "AliMpDEManager.h" | |
28 | #include "AliMpPlaneType.h" | |
29 | #include "AliMpSegmentation.h" | |
30 | #include "AliMpStationType.h" | |
31 | #include "AliMpVSegmentation.h" | |
32 | #include "AliMUONObjectPair.h" | |
33 | #include "AliLog.h" | |
34 | #include <Riostream.h> | |
35 | #include <TObjString.h> | |
36 | #include <TArrayI.h> | |
37 | #include <cassert> | |
38 | #include <float.h> | |
39 | ||
40 | /// \class AliMUONChamberPainter | |
41 | /// | |
42 | /// Painter for one plane/cathode of one chamber | |
43 | /// | |
44 | /// \author Laurent Aphecetche, Subatech | |
45 | ||
46 | ///\cond CLASSIMP | |
47 | ClassImp(AliMUONChamberPainter) | |
48 | ///\endcond | |
49 | ||
50 | //_____________________________________________________________________________ | |
51 | AliMUONChamberPainter::AliMUONChamberPainter() | |
52 | : AliMUONVPainter(), | |
53 | fChamberId(-1) | |
54 | { | |
55 | /// ctor | |
56 | } | |
57 | ||
1ffbeb9d | 58 | //_____________________________________________________________________________ |
59 | AliMUONChamberPainter::AliMUONChamberPainter(TRootIOCtor* ioCtor) | |
60 | : AliMUONVPainter(ioCtor), | |
61 | fChamberId(-1) | |
62 | { | |
63 | /// ctor | |
64 | } | |
65 | ||
0145e89a | 66 | //_____________________________________________________________________________ |
67 | AliMUONChamberPainter::AliMUONChamberPainter(const AliMUONAttPainter& att, | |
68 | Int_t chamberId) | |
69 | : AliMUONVPainter("Chamber"), | |
70 | fChamberId(chamberId) | |
71 | { | |
72 | /// ctor | |
73 | ||
74 | AliMUONPainterHelper* h = AliMUONPainterHelper::Instance(); // to be sure mapping is loaded... | |
75 | ||
76 | AliMUONAttPainter chAtt(att); | |
77 | ||
78 | chAtt.SetCathodeAndPlaneMutuallyExclusive(kTRUE); | |
79 | ||
80 | SetAttributes(chAtt); | |
81 | ||
82 | SetID(chamberId,-1); | |
83 | SetName(h->ChamberName(fChamberId).Data()); | |
84 | SetPathName(h->ChamberPathName(fChamberId).Data()); | |
85 | ||
86 | AliMpDEIterator deIt; | |
87 | ||
88 | deIt.First(fChamberId); | |
89 | ||
8f0acce4 | 90 | AliMUONContour* contour = h->GetContour(ContourName()); |
0145e89a | 91 | TObjArray contourArray; |
92 | ||
93 | while (!deIt.IsDone()) | |
94 | { | |
95 | Int_t detElemId = deIt.CurrentDEId(); | |
96 | ||
97 | AliMUONAttPainter deAtt(att); | |
98 | ||
99 | if ( att.IsCathodeDefined() ) | |
100 | { | |
101 | deAtt.SetCathode(kFALSE,kFALSE); | |
102 | AliMp::PlaneType planeType; | |
103 | ||
104 | if ( att.IsCathode0() ) planeType = AliMpDEManager::GetPlaneType(detElemId,AliMp::kCath0); | |
105 | else planeType = AliMpDEManager::GetPlaneType(detElemId,AliMp::kCath1); | |
106 | ||
107 | Bool_t bending = ( planeType == AliMp::kBendingPlane ); | |
108 | ||
109 | deAtt.SetPlane(bending,!bending); | |
110 | } | |
111 | ||
112 | assert(deAtt.IsPlaneDefined()); | |
113 | ||
114 | AliMUONVPainter* painter = new AliMUONDEPainter(deAtt,detElemId); | |
115 | ||
116 | Add(painter); | |
117 | ||
118 | if (!contour) | |
119 | { | |
120 | contourArray.Add(painter->Contour()); | |
121 | } | |
122 | ||
123 | deIt.Next(); | |
124 | } | |
125 | ||
126 | Double_t xmin(1E9), xmax(-1E9), ymin(1E9), ymax(-1E9); | |
127 | TIter next(Children()); | |
128 | AliMUONVPainter* painter; | |
129 | ||
130 | while ( ( painter = static_cast<AliMUONVPainter*>(next()) ) ) | |
131 | { | |
132 | const AliMpArea& area = painter->Area(); | |
133 | xmin = TMath::Min(xmin,area.LeftBorder()); | |
134 | xmax = TMath::Max(xmax,area.RightBorder()); | |
135 | ymin = TMath::Min(ymin,area.DownBorder()); | |
136 | ymax = TMath::Max(ymax,area.UpBorder()); | |
137 | } | |
138 | ||
139 | if ( contourArray.GetLast() >= 0 ) | |
140 | { | |
141 | contour = h->MergeContours(contourArray,ContourName()); | |
142 | } | |
143 | ||
144 | SetContour(contour); | |
145 | } | |
146 | ||
147 | //_____________________________________________________________________________ | |
148 | AliMUONChamberPainter::AliMUONChamberPainter(const AliMUONChamberPainter& rhs) | |
149 | : AliMUONVPainter(rhs), | |
150 | fChamberId(rhs.fChamberId) | |
151 | { | |
152 | /// copy ctor | |
153 | rhs.Copy(*this); | |
154 | } | |
155 | ||
156 | //_____________________________________________________________________________ | |
157 | AliMUONChamberPainter& | |
158 | AliMUONChamberPainter::operator=(const AliMUONChamberPainter& rhs) | |
159 | { | |
160 | /// assignment operator | |
161 | if ( this != &rhs ) | |
162 | { | |
163 | rhs.Copy(*this); | |
164 | } | |
165 | return *this; | |
166 | } | |
167 | ||
168 | //_____________________________________________________________________________ | |
169 | AliMUONChamberPainter::~AliMUONChamberPainter() | |
170 | { | |
171 | /// dtor | |
172 | } | |
173 | ||
174 | //_____________________________________________________________________________ | |
175 | void | |
176 | AliMUONChamberPainter::ComputeDataRange(const AliMUONVTrackerData& data, Int_t dataIndex, | |
177 | Double_t& dataMin, Double_t& dataMax) const | |
178 | { | |
179 | /// Compute data range spanned by this (plane of that) chamber | |
180 | dataMin = dataMax = data.Chamber(fChamberId, dataIndex); | |
181 | } | |
182 | ||
183 | ||
184 | //_____________________________________________________________________________ | |
185 | void | |
186 | AliMUONChamberPainter::Copy(TObject& object) const | |
187 | { | |
188 | /// Copy this to object | |
189 | AliMUONVPainter::Copy((AliMUONVPainter&)(object)); | |
190 | ((AliMUONChamberPainter&)(object)).fChamberId = fChamberId; | |
191 | } | |
192 | ||
193 | //_____________________________________________________________________________ | |
194 | TString | |
195 | AliMUONChamberPainter::Describe(const AliMUONVTrackerData& data, Int_t dataIndex, | |
196 | Double_t, Double_t) | |
197 | { | |
198 | /// Describe data at this chamber | |
199 | ||
200 | if (!data.HasChamber(fChamberId)) return ""; | |
201 | ||
202 | Double_t value = data.Chamber(fChamberId,dataIndex); | |
203 | ||
204 | return AliMUONPainterHelper::Instance()->FormatValue(data.DimensionName(dataIndex).Data(),value); | |
205 | } | |
206 | ||
1ffbeb9d | 207 | //_____________________________________________________________________________ |
208 | Bool_t | |
209 | AliMUONChamberPainter::IsIncluded() const | |
210 | { | |
211 | /// whether this chamber is included in the readout or not | |
212 | return ( InteractiveReadOutConfig()->Chamber(fChamberId) > 0 ); | |
213 | } | |
214 | ||
0145e89a | 215 | //_____________________________________________________________________________ |
216 | void | |
217 | AliMUONChamberPainter::PaintArea(const AliMUONVTrackerData& data, Int_t dataIndex, | |
218 | Double_t min, Double_t max) | |
219 | { | |
220 | /// Paint area of this chamber according to data | |
221 | ||
222 | if (!data.HasChamber(fChamberId)) return; | |
223 | ||
224 | Double_t value = data.Chamber(fChamberId,dataIndex); | |
225 | ||
226 | if ( value >= AliMUONVCalibParam::InvalidFloatValue() ) return; | |
227 | ||
228 | Int_t color = AliMUONPainterHelper::Instance()->ColorFromValue(value,min,max); | |
229 | ||
8f0acce4 | 230 | PaintArea(color); |
0145e89a | 231 | } |
232 | ||
233 | //_____________________________________________________________________________ | |
234 | AliMUONAttPainter | |
235 | AliMUONChamberPainter::Validate(const AliMUONAttPainter& attributes) const | |
236 | { | |
237 | /// Normalize attributes | |
238 | ||
239 | AliMUONAttPainter norm(attributes); | |
240 | ||
241 | // A chamber painter must be either cathode defined or plane defined | |
242 | ||
243 | if ( norm.IsCathodeDefined() && norm.IsPlaneDefined() ) | |
244 | { | |
245 | norm.SetValid(kFALSE); | |
246 | } | |
247 | ||
248 | if ( !norm.IsCathodeDefined() && !norm.IsPlaneDefined() ) | |
249 | { | |
250 | norm.SetValid(kFALSE); | |
251 | } | |
252 | ||
253 | return norm; | |
254 | } |