AliRoot Core  v5-06-15 (45dab64)
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
AliMUONChamberPainter.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 "AliMUONChamberPainter.h"
19 
20 #include "AliMUONDEPainter.h"
21 #include "AliMUONContour.h"
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 
45 
49 
50 //_____________________________________________________________________________
52 : AliMUONVPainter(),
53 fChamberId(-1)
54 {
56 }
57 
58 //_____________________________________________________________________________
60 : AliMUONVPainter(ioCtor),
61 fChamberId(-1)
62 {
64 }
65 
66 //_____________________________________________________________________________
68  Int_t chamberId)
69 : AliMUONVPainter("Chamber"),
70 fChamberId(chamberId)
71 {
73 
74  AliMUONPainterHelper* h = AliMUONPainterHelper::Instance(); // to be sure mapping is loaded...
75 
76  AliMUONAttPainter chAtt(att);
77 
79 
80  SetAttributes(chAtt);
81 
82  SetID(chamberId,-1);
83  SetName(h->ChamberName(fChamberId).Data());
85 
86  AliMpDEIterator deIt;
87 
88  deIt.First(fChamberId);
89 
90  AliMUONContour* contour = h->GetContour(ContourName());
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 //_____________________________________________________________________________
149 : AliMUONVPainter(rhs),
150 fChamberId(rhs.fChamberId)
151 {
153  rhs.Copy(*this);
154 }
155 
156 //_____________________________________________________________________________
159 {
161  if ( this != &rhs )
162  {
163  rhs.Copy(*this);
164  }
165  return *this;
166 }
167 
168 //_____________________________________________________________________________
170 {
172 }
173 
174 //_____________________________________________________________________________
175 void
177  Double_t& dataMin, Double_t& dataMax) const
178 {
180  dataMin = dataMax = data.Chamber(fChamberId, dataIndex);
181 }
182 
183 
184 //_____________________________________________________________________________
185 void
186 AliMUONChamberPainter::Copy(TObject& object) const
187 {
191 }
192 
193 //_____________________________________________________________________________
194 TString
196  Double_t, Double_t)
197 {
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 
207 //_____________________________________________________________________________
208 Bool_t
210 {
212  return ( InteractiveReadOutConfig()->Chamber(fChamberId) > 0 );
213 }
214 
215 //_____________________________________________________________________________
216 void
218  Double_t min, Double_t max)
219 {
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 
230  PaintArea(color);
231 }
232 
233 //_____________________________________________________________________________
236 {
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 }
Int_t ColorFromValue(Double_t value, Double_t min, Double_t max) const
static AliMUONPainterHelper * Instance()
A painter for one detection element.
The iterator over detection elements.
void SetID(Int_t id0, Int_t id1)
Set our IDs.
TString Describe(const AliMUONVTrackerData &data, Int_t dataIndex, Double_t, Double_t)
static Float_t InvalidFloatValue()
Return 1E38 as invalid float value.
AliMUONAttPainter Validate(const AliMUONAttPainter &attributes) const
Convert attributes so they are valid ones for us.
#define TObjArray
Double_t LeftBorder() const
Definition: AliMpArea.cxx:124
AliMUONVTrackerData * InteractiveReadOutConfig() const
virtual Double_t Chamber(Int_t chamberId, Int_t dim=0) const =0
Get the value for a given chamber and given dimension.
Bool_t IsPlaneDefined() const
Whether we are defined by plane.
void SetContour(AliMUONContour *contour)
Set out contour.
void ComputeDataRange(const AliMUONVTrackerData &data, Int_t dataIndex, Double_t &dataMin, Double_t &dataMax) const
Bool_t IsCathodeDefined() const
Whether we are defined by cathode.
A rectangle area positioned in plane..
Definition: AliMpArea.h:20
virtual TString ContourName() 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.
ClassImp(TPCGenInfo)
Definition: AliTPCCmpNG.C:254
virtual void Copy(TObject &object) const
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 SetPathName(const char *pathName)
Set our path name (aka fullname)
AliMUONContour * GetContour(const char *contourName, Bool_t explodedGeometry=kTRUE) const
Double_t UpBorder() const
Definition: AliMpArea.cxx:140
virtual Bool_t HasChamber(Int_t chamberId) const =0
Whether we have data for a given chamber.
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.
AliMUONChamberPainter & operator=(const AliMUONChamberPainter &rhs)
void PaintArea(const AliMUONVTrackerData &data, Int_t dataIndex, Double_t min, Double_t max)
static AliMp::PlaneType GetPlaneType(Int_t detElemId, AliMp::CathodType cath)
Double_t DownBorder() const
Definition: AliMpArea.cxx:148
virtual void Copy(TObject &object) const
bending plane
2D contour
Bool_t IsCathode0() const
Whether we are representing cathode 0.
Basic attributes shared by all painters.
void SetCathodeAndPlaneMutuallyExclusive(Bool_t value)
TString ChamberPathName(Int_t chamberId) const
TString FormatValue(const char *name, Double_t value) const
TString ChamberName(Int_t chamberId) const
Int_t fChamberId
our identifier (0..n)
void SetPlane(Bool_t bending, Bool_t nonBending)
virtual TCollection * Children() const
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)
Double_t RightBorder() const
Definition: AliMpArea.cxx:132
Painter for one (plane of one) chamber.
Bool_t IsIncluded() const
Whether or not the part of the detector represented by this painter should be included in readout...