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