AliRoot Core  v5-06-15 (45dab64)
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
AliMUONBusPatchPainter.cxx
Go to the documentation of this file.
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 "AliMUONBusPatchPainter.h"
19 
20 #include "AliMUONManuPainter.h"
21 #include "AliMUONContour.h"
22 #include "AliMUONPainterHelper.h"
23 #include "AliMUONVCalibParam.h"
24 #include "AliMUONVTrackerData.h"
25 #include "AliMpBusPatch.h"
26 #include "AliMpConstants.h"
27 #include "AliMpDDLStore.h"
28 #include "AliMpDEManager.h"
29 #include "AliMpPlaneType.h"
30 #include "AliLog.h"
31 #include <TObjArray.h>
32 #include <TString.h>
33 #include <float.h>
34 
42 
46 
47 //_____________________________________________________________________________
49 : AliMUONVPainter(),
50 fBusPatchId(-1)
51 {
53 }
54 
55 //_____________________________________________________________________________
57 : AliMUONVPainter(ioCtor),
58 fBusPatchId(-1)
59 {
61 }
62 
63 //_____________________________________________________________________________
65  Int_t busPatchId)
66 : AliMUONVPainter("BUSPATCH"),
67 fBusPatchId(busPatchId)
68 {
74 
75  SetAttributes(Validate(att));
76 
78 
79  Int_t detElemId = AliMpDDLStore::Instance()->GetDEfromBus(busPatchId);
80 
82 
83  SetID(busPatchId,-1);
84  SetName(h->BusPatchName(busPatchId));
85  SetPathName(h->BusPatchPathName(busPatchId));
86 
88 
90 
91  AliMUONContour* bpContour = h->GetContour(ContourName());
92 
93  Double_t xmin(FLT_MAX), ymin(FLT_MAX), xmax(-FLT_MAX), ymax(-FLT_MAX);
94 
95  TObjArray contours;
96 
97  Int_t nmanus(0);
98 
99  for ( Int_t i = 0; i < busPatch->GetNofManus(); ++i )
100  {
101  Int_t manuId = busPatch->GetManuId(i);
102 
103  Bool_t correctPlane(kTRUE);
104 
105  if ( planeType == AliMp::kNonBendingPlane )
106  {
107  if ( ( manuId & mask ) == 0 ) correctPlane = kFALSE;
108  }
109  else
110  {
111  if ( ( manuId & mask ) == mask ) correctPlane = kFALSE;
112  }
113 
114  if (!correctPlane) continue;
115 
116  ++nmanus;
117 
119  busPatch->GetDEId(),
120  manuId);
121 
122  Add(painter);
123 
124  const AliMpArea& area = painter->Area();
125 
126  xmin = TMath::Min(xmin, area.LeftBorder());
127  ymin = TMath::Min(ymin,area.DownBorder());
128  xmax = TMath::Max(xmax,area.RightBorder());
129  ymax = TMath::Max(ymax,area.UpBorder());
130 
131  if (!bpContour)
132  {
133  contours.Add(painter->Contour());
134  }
135  }
136 
137  if ( !nmanus )
138  {
139  Invalidate();
140  return;
141  }
142 
143  if (!bpContour)
144  {
145  bpContour = h->MergeContours(contours,ContourName());
146  if (!bpContour)
147  {
148  AliError("Could not merge those contours");
149  StdoutToAliError(contours.Print(););
150  }
151  }
152 
153  SetContour(bpContour);
154 }
155 
156 //_____________________________________________________________________________
157 void
159  Double_t& dataMin, Double_t& dataMax) const
160 {
162  dataMin = dataMax = data.BusPatch(fBusPatchId, dataIndex);
163 }
164 
165 //_____________________________________________________________________________
167 : AliMUONVPainter(rhs), fBusPatchId(-1)
168 {
170  rhs.Copy(*this);
171 }
172 
173 //_____________________________________________________________________________
176 {
178  if ( this != &rhs )
179  {
180  rhs.Copy(*this);
181  }
182  return *this;
183 }
184 
185 //_____________________________________________________________________________
187 {
189 }
190 
191 //_____________________________________________________________________________
192 void
193 AliMUONBusPatchPainter::Copy(TObject& object) const
194 {
198 }
199 
200 //_____________________________________________________________________________
201 Bool_t
203 {
205  return ( InteractiveReadOutConfig()->BusPatch(fBusPatchId) > 0 );
206 }
207 
208 //_____________________________________________________________________________
209 TString
211  Double_t, Double_t)
212 {
214 
215  if (!data.HasBusPatch(fBusPatchId)) return "";
216 
217  Double_t value = data.BusPatch(fBusPatchId,dataIndex);
218 
219  return AliMUONPainterHelper::Instance()->FormatValue(data.DimensionName(dataIndex).Data(),value);
220 }
221 
222 //_____________________________________________________________________________
223 void
225  Double_t min, Double_t max)
226 {
228 
229  if (!data.HasBusPatch(fBusPatchId)) return;
230 
231  Double_t value = data.BusPatch(fBusPatchId,dataIndex);
232 
233  if ( value >= AliMUONVCalibParam::InvalidFloatValue() ) return;
234 
235  Int_t color = AliMUONPainterHelper::Instance()->ColorFromValue(value,min,max);
236 
237  PaintArea(color);
238 }
239 
240 //_____________________________________________________________________________
243 {
245 
246  // we invalidate the attributes, if we have no manu in the requested plane
247  // and we cross-check that both cathode and plane are up-to-date
248 
249  AliMUONAttPainter norm(attributes);
250 
251  Int_t detElemId = AliMpDDLStore::Instance()->GetDEfromBus(fBusPatchId);
252 
253  if (!norm.IsValid()) return norm;
254 
255  if ( !norm.IsCathodeDefined() )
256  {
258 
259  AliMp::CathodType cathodeType = AliMpDEManager::GetCathod(detElemId,planeType);
260 
261  Bool_t cath0 = ( cathodeType == AliMp::kCath0 );
262 
263  norm.SetCathode(cath0,!cath0);
264  }
265  else if ( !norm.IsPlaneDefined() )
266  {
267  AliMp::CathodType cathodeType = ( norm.IsCathode0() ? AliMp::kCath0 : AliMp::kCath1 );
268 
269  AliMp::PlaneType planeType = AliMpDEManager::GetPlaneType(detElemId,cathodeType);
270 
271  Bool_t bending = ( planeType == AliMp::kBendingPlane );
272 
273  norm.SetPlane(bending,!bending);
274  }
275 
277 
279 
280  Int_t nb(0);
281  Int_t b(0);
282 
283  for ( Int_t i = 0; i < busPatch->GetNofManus(); ++i )
284  {
285  Int_t manuId = busPatch->GetManuId(i);
286 
287  if ( manuId & mask ) ++nb;
288  else ++b;
289  }
290 
291  if ( norm.IsBendingPlane() && !b ) norm.SetValid(kFALSE);
292  if ( norm.IsNonBendingPlane() && !nb ) norm.SetValid(kFALSE);
293 
294  return norm;
295 }
296 
Int_t GetNofManus() const
Int_t ColorFromValue(Double_t value, Double_t min, Double_t max) const
static AliMUONPainterHelper * Instance()
Bool_t IsNonBendingPlane() const
Whether we are representing non bending plane.
void SetID(Int_t id0, Int_t id1)
Set our IDs.
static Float_t InvalidFloatValue()
Return 1E38 as invalid float value.
Int_t fBusPatchId
our identifier
Painter for one manu (not the pads, only the manu)
TString Describe(const AliMUONVTrackerData &data, Int_t dataIndex, Double_t x=FLT_MAX, Double_t y=FLT_MAX)
#define TObjArray
Double_t LeftBorder() const
Definition: AliMpArea.cxx:124
static AliMp::CathodType GetCathod(Int_t detElemId, AliMp::PlaneType planeType)
AliMUONVTrackerData * InteractiveReadOutConfig() const
A painter for one buspatch.
void ComputeDataRange(const AliMUONVTrackerData &data, Int_t dataIndex, Double_t &dataMin, Double_t &dataMax) const
Bool_t IsPlaneDefined() const
Whether we are defined by plane.
void SetContour(AliMUONContour *contour)
Set out contour.
Int_t GetDEfromBus(Int_t busPatchId) const
Bool_t IsCathodeDefined() const
Whether we are defined by cathode.
Bool_t IsBendingPlane() const
Whether we are representing bending plane.
A rectangle area positioned in plane..
Definition: AliMpArea.h:20
AliMUONBusPatchPainter & operator=(const AliMUONBusPatchPainter &rhs)
virtual TString ContourName() const
Int_t GetManuId(Int_t index) const
void SetCathode(Bool_t cath0, Bool_t cath1)
virtual TString DimensionName(Int_t dim) const =0
Get the name of a given (internal) dimension.
virtual AliMUONAttPainter Validate(const AliMUONAttPainter &attributes) const
Convert attributes so they are valid ones for us.
ClassImp(TPCGenInfo)
Definition: AliTPCCmpNG.C:254
virtual void Copy(TObject &object) const
static AliMpDDLStore * Instance(Bool_t warn=true)
const AliMUONAttPainter & Attributes() const
Get our attributes.
void SetName(const char *name)
Set our name.
Base class for a graphical object representing some part of the MUON tracking system.
void Add(AliMUONVPainter *painter)
Add a painter to our list of children. We adopt this painter (i.e. we become owner).
void Invalidate()
Mark us as not valid.
AliMUONContour * Contour() const
Return the contour representing the outline of this object.
void SetPathName(const char *pathName)
Set our path name (aka fullname)
AliMUONContour * GetContour(const char *contourName, Bool_t explodedGeometry=kTRUE) const
non-bending plane
Double_t UpBorder() const
Definition: AliMpArea.cxx:140
AliMpBusPatch * GetBusPatch(Int_t busPatchId, Bool_t warn=true) const
Utility class for the painters display.
AliMUONContour * MergeContours(const TObjArray &contours, const char *contourName, Bool_t explodedGeometry=kTRUE)
AliMpArea Area() const
Return the area containing this painter.
TString BusPatchPathName(Int_t busPatchId) const
static AliMp::PlaneType GetPlaneType(Int_t detElemId, AliMp::CathodType cath)
Double_t DownBorder() const
Definition: AliMpArea.cxx:148
bending plane
The class defines the properties of BusPatch.
Definition: AliMpBusPatch.h:21
2D contour
Bool_t IsValid() const
Whether we are valid.
Bool_t IsCathode0() const
Whether we are representing cathode 0.
virtual Double_t BusPatch(Int_t busPatchId, Int_t dim=0) const =0
Get the value for a given buspatch and given dimension.
Basic attributes shared by all painters.
TString BusPatchName(Int_t busPatchId) const
virtual Bool_t IsIncluded() const
Whether or not the part of the detector represented by this painter should be included in readout...
TString FormatValue(const char *name, Double_t value) const
virtual void Copy(TObject &object) const
void SetPlane(Bool_t bending, Bool_t nonBending)
virtual void SetAttributes(const AliMUONAttPainter &attributes)
Base class for MUON data that can be presented at different levels in the hierarchy of the MUON syste...
void SetValid(Bool_t value)
virtual Bool_t HasBusPatch(Int_t busPatchId) const =0
Whether we have data for a given buspath.
Double_t RightBorder() const
Definition: AliMpArea.cxx:132
void PaintArea(const AliMUONVTrackerData &data, Int_t dataIndex, Double_t min, Double_t max)
static Int_t ManuMask(AliMp::PlaneType planeType)