AliRoot Core  v5-06-15 (45dab64)
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
AliMUONDEPainter.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 "AliMUONDEPainter.h"
19 
20 #include "AliMUONBusPatchPainter.h"
22 #include "AliMUONPCBPainter.h"
23 #include "AliMUONContour.h"
24 #include "AliMUONPainterHelper.h"
25 #include "AliMUONVCalibParam.h"
26 #include "AliMUONVTrackerData.h"
27 #include "AliMUONObjectPair.h"
28 #include "AliMpDDLStore.h"
29 #include "AliMpDEManager.h"
30 #include "AliMpDetElement.h"
31 #include "AliMpPCB.h"
32 #include "AliMpSector.h"
33 #include "AliMpSlat.h"
34 #include "AliLog.h"
35 #include <TMap.h>
36 #include <TObjString.h>
37 #include "AliMUONPainterGroup.h"
38 
46 
50 
51 //_____________________________________________________________________________
53 : AliMUONVPainter(),
54 fDetElemId(-1)
55 {
57 }
58 
59 //_____________________________________________________________________________
61 : AliMUONVPainter(ioCtor),
62 fDetElemId(-1)
63 {
65 }
66 
67 //_____________________________________________________________________________
69 : AliMUONVPainter("DE"),
70 fDetElemId(detElemId)
71 {
73 
74  AliMUONAttPainter deAtt(att);
75 
76  if ( att.IsCathodeDefined() )
77  {
78  AliMp::CathodType cathodType = ( att.IsCathode0() ? AliMp::kCath0 : AliMp::kCath1 ) ;
79 
80  Bool_t cath0 = ( cathodType == AliMp::kCath0 ) ;
81 
82  AliMp::PlaneType planeType = AliMpDEManager::GetPlaneType(detElemId,cathodType);
83 
84  Bool_t bending = ( planeType == AliMp::kBendingPlane );
85 
86  deAtt.SetCathode(cath0,!cath0);
87  deAtt.SetPlane(bending,!bending);
88 
89  }
90 
91  if ( att.IsPlaneDefined() )
92  {
94 
95  Bool_t bending = ( planeType == AliMp::kBendingPlane );
96 
97  Bool_t cath0 = ( AliMpDEManager::GetCathod(detElemId,planeType) == AliMp::kCath0 );
98 
99  deAtt.SetCathode(cath0,!cath0);
100  deAtt.SetPlane(bending,!bending);
101 
102  }
103 
105 
106  SetAttributes(deAtt);
107 
109 
110  SetID(detElemId,-1);
111  SetName(h->DEName(fDetElemId).Data());
112  SetPathName(h->DEPathName(fDetElemId).Data());
113 
115 
116  Double_t x,y,z;
117 
119  {
120  const AliMpSlat* slat = h->GetSlat(DetElemId(),planeType);
121 
122  for ( Int_t i = 0; i < slat->GetSize(); ++i )
123  {
125  }
126 
128  }
130  {
131  const AliMpSector* sector = h->GetSector(DetElemId(),planeType);
132 
133  Double_t xl(sector->GetDimensionX());
134  Double_t yl(sector->GetDimensionY());
135 
136  h->Local2Global(fDetElemId,xl,yl,0.0,x,y,z);
137  }
138  else
139  {
140  AliFatal("Not implemented for trigger !!!");
141  }
142 
143  AliMUONContour* contour = h->GetContour(ContourName());
144 
145  TObjArray contourArray;
146 
148 
149  for ( Int_t i = 0; i < de->GetNofBusPatches(); ++i )
150  {
152 
153  if ( !painter->IsValid() )
154  {
155  delete painter;
156  continue;
157  }
158  else
159  {
160  Add(painter);
161  }
162 
163  if ( !contour )
164  {
165  contourArray.Add(painter->Contour());
166  }
167  }
168 
169  if (!contour)
170  {
171  contour = h->MergeContours(contourArray,ContourName());
172  if (!contour)
173  {
174  AliError(Form("%s : could not merge those contours",Name().Data()));
175  StdoutToAliError(contourArray.Print(););
176  }
177  }
178 
179  SetContour(contour);
180 }
181 
182 //_____________________________________________________________________________
184 AliMUONVPainter(rhs), fDetElemId(-1)
185 {
187  rhs.Copy(*this);
188 }
189 
190 //_____________________________________________________________________________
193 {
195  if ( this != &rhs )
196  {
197  rhs.Copy(*this);
198  }
199  return *this;
200 }
201 
202 //_____________________________________________________________________________
204 {
206 }
207 
208 //_____________________________________________________________________________
209 void
211  Double_t& dataMin, Double_t& dataMax) const
212 {
214  dataMin = dataMax = data.DetectionElement(fDetElemId, dataIndex);
215 }
216 
217 //_____________________________________________________________________________
218 void
219 AliMUONDEPainter::Copy(TObject& object) const
220 {
223  ((AliMUONDEPainter&)(object)).fDetElemId = fDetElemId;
224 }
225 
226 //_____________________________________________________________________________
227 TString
228 AliMUONDEPainter::Describe(const AliMUONVTrackerData& data, Int_t dataIndex,
229  Double_t, Double_t)
230 {
232 
233  if (!data.HasDetectionElement(fDetElemId)) return "";
234 
235  Double_t value = data.DetectionElement(fDetElemId,dataIndex);
236 
237  return AliMUONPainterHelper::Instance()->FormatValue(data.DimensionName(dataIndex).Data(),value);
238 }
239 
240 //_____________________________________________________________________________
241 void
243 {
245  TIter next(Children());
246  AliMUONVPainter* p;
247 
248  while ( ( p = static_cast<AliMUONVPainter*>(next()) ) )
249  {
250  if ( p->IsA() == AliMUONBusPatchPainter::Class() )
251  {
252  // Only consider bus patch painters (and not PCB ones),
253  // in order not to double count some manus
254  p->FillManuList(manuList);
255  }
256  }
257 }
258 
259 //_____________________________________________________________________________
260 Bool_t
262 {
264  return ( InteractiveReadOutConfig()->DetectionElement(fDetElemId) > 0 );
265 }
266 
267 //_____________________________________________________________________________
268 void
270  Double_t min, Double_t max)
271 {
273 
274  if (!data.HasDetectionElement(fDetElemId)) return;
275 
276  Double_t value = data.DetectionElement(fDetElemId,dataIndex);
277 
278  if ( value >= AliMUONVCalibParam::InvalidFloatValue() ) return;
279 
280  Int_t color = AliMUONPainterHelper::Instance()->ColorFromValue(value,min,max);
281 
282  PaintArea(color);
283 }
284 
285 //_____________________________________________________________________________
288 {
290 
291  AliMUONAttPainter norm(attributes);
292 
294 
295  if ( norm.IsCathodeDefined() && !norm.IsPlaneDefined() )
296  {
297  // only cathode known : derive the plane
298 
299  AliMp::CathodType cathodType = ( norm.IsCathode0() ? AliMp::kCath0 : AliMp::kCath1 );
300 
302 
303  Bool_t bending = ( planeType == AliMp::kBendingPlane ) ;
304 
305  norm.SetPlane(bending,!bending);
306  }
307 
308  else if ( !norm.IsCathodeDefined() && norm.IsPlaneDefined() )
309  {
310  // only plane is known : derive the cathode
311 
313 
314  Bool_t cath0 = ( AliMpDEManager::GetCathod(fDetElemId,planeType) == AliMp::kCath0 );
315 
316  norm.SetCathode(cath0,!cath0);
317  }
318  else
319  {
320  // check that both information are compatible
321 
323 
325 
326  if ( (cathode == AliMp::kCath0 && norm.IsCathode1()) ||
327  (cathode == AliMp::kCath1 && norm.IsCathode0()) )
328  {
329  norm.SetValid(kFALSE);
330  }
331  }
332 
333  return norm;
334 }
335 
336 //_____________________________________________________________________________
337 void
339 {
341 
342  if (!fPainterGroups)
343  {
344  CreateGroups();
345  }
346 
347  TIter next(fPainterGroups);
348  TObjString* str;
349 
350  fResponderGroup = 0x0;
351 
352  while ( ( str = static_cast<TObjString*>(next()) ) )
353  {
354  AliMUONPainterGroup* group = static_cast<AliMUONPainterGroup*>(fPainterGroups->GetValue(str));
355  if ( str->String() == "BUSPATCH" )
356  {
357  group->SetResponder(kTRUE);
358  fResponderGroup = group;
359  break;
360  }
361  else
362  {
363  group->SetResponder(kFALSE);
364  }
365  }
366 }
367 
Int_t ColorFromValue(Double_t value, Double_t min, Double_t max) const
static AliMUONPainterHelper * Instance()
virtual Double_t DetectionElement(Int_t detElemId, Int_t dim=0) const =0
Get the value for a given DE and given dimension.
TString DEPathName(Int_t detElemId) const
A painter for one detection element.
void SetID(Int_t id0, Int_t id1)
Set our IDs.
static Float_t InvalidFloatValue()
Return 1E38 as invalid float value.
void Local2Global(Int_t detElemId, Double_t xl, Double_t yl, Double_t zl, Double_t &xg, Double_t &yg, Double_t &zg) const
AliMUONDEPainter & operator=(const AliMUONDEPainter &rhs)
Double_t GetDimensionX() const
TString Describe(const AliMUONVTrackerData &data, Int_t dataIndex, Double_t, Double_t)
#define TObjArray
static AliMp::CathodType GetCathod(Int_t detElemId, AliMp::PlaneType planeType)
AliMUONVTrackerData * InteractiveReadOutConfig() const
virtual void FillManuList(TObjArray &manuList) const
Append (i.e. don't have the right to clear the array !) our list of manus to manuList.
A painter for one buspatch.
Bool_t IsPlaneDefined() const
Whether we are defined by plane.
void SetContour(AliMUONContour *contour)
Set out contour.
virtual TString Name() const
Get our name.
station 3,4,5 (slats)
void SetResponder(Bool_t flag=kTRUE)
Set the responder flag.
Bool_t IsCathodeDefined() const
Whether we are defined by cathode.
Bool_t IsBendingPlane() const
Whether we are representing bending plane.
void Copy(TObject &object) const
const AliMpSector * GetSector(Int_t detElemId, AliMp::PlaneType planeType) const
virtual TString ContourName() const
AliMpDetElement * GetDetElement(Int_t detElemId, Bool_t warn=true) const
A slat (building block of stations 3, 4 and 5)
Definition: AliMpSlat.h:51
void SetCathode(Bool_t cath0, Bool_t cath1)
The class defines the electronics properties of detection element.
virtual TString DimensionName(Int_t dim) const =0
Get the name of a given (internal) dimension.
virtual void SetResponder(Int_t depth)
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.
virtual AliMUONAttPainter Validate(const AliMUONAttPainter &attributes) const
Convert attributes so they are valid ones for us.
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).
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
Bool_t IsCathode1() const
Whether we are representing cathode 1.
static AliMp::StationType GetStationType(Int_t detElemId)
virtual Bool_t HasDetectionElement(Int_t detElemId) const =0
Whether we have data for a given detection element.
void PaintArea(const AliMUONVTrackerData &data, Int_t dataIndex, Double_t min, Double_t max)
Utility class for the painters display.
AliMUONContour * MergeContours(const TObjArray &contours, const char *contourName, Bool_t explodedGeometry=kTRUE)
void ComputeDataRange(const AliMUONVTrackerData &data, Int_t dataIndex, Double_t &dataMin, Double_t &dataMax) const
A sector (quadrant) of the MUON chamber of stations 1 and 2.
Definition: AliMpSector.h:34
Int_t fDetElemId
our id
static AliMp::PlaneType GetPlaneType(Int_t detElemId, AliMp::CathodType cath)
Implementation of AliMUONVPainter for slat's PCBs.
virtual Bool_t IsIncluded() const
Whether or not the part of the detector represented by this painter should be included in readout...
bending plane
const AliMpSlat * GetSlat(Int_t detElemId, AliMp::PlaneType planeType) const
virtual Bool_t IsValid() const
Whether we are valid or not.
Int_t GetNofBusPatches() const
Int_t DetElemId() const
Return the ID of this detection element.
TMap * fPainterGroups
map of groups
virtual void FillManuList(TObjArray &manuList) const
Append (i.e. don't have the right to clear the array !) our list of manus to manuList.
2D contour
trigger stations (slats)
Bool_t IsCathode0() const
Whether we are representing cathode 0.
Int_t GetBusPatchId(Int_t index) const
AliMUONPainterGroup * fResponderGroup
the responder group
Basic attributes shared by all painters.
void SetCathodeAndPlaneMutuallyExclusive(Bool_t value)
TString FormatValue(const char *name, Double_t value) const
A group of AliMUONVPainter.
void SetPlane(Bool_t bending, Bool_t nonBending)
TString DEName(Int_t detElemId) const
Double_t GetDimensionY() const
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)
Int_t GetSize() const
Returns the number of PCBs of this slat.
Definition: AliMpSlat.cxx:446