1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
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 **************************************************************************/
18 /// \class AliMUONPCBPainter
20 /// Implementation of AliMUONVPainter for slat's PCBs
22 /// \author Laurent Aphecetche, Subatech
24 #include "AliMUONPCBPainter.h"
26 #include "AliMUONManuPainter.h"
27 #include "AliMUONPainterContour.h"
28 #include "AliMUONPainterHelper.h"
29 #include "AliMUONVCalibParam.h"
30 #include "AliMUONVTrackerData.h"
31 #include "AliMpDEManager.h"
32 #include "AliMpMotifPosition.h"
34 #include "AliMpPlaneType.h"
35 #include "AliMpSlat.h"
39 ClassImp(AliMUONPCBPainter)
42 //_____________________________________________________________________________
43 AliMUONPCBPainter::AliMUONPCBPainter()
51 //_____________________________________________________________________________
52 AliMUONPCBPainter::AliMUONPCBPainter(const AliMUONAttPainter& att,
55 : AliMUONVPainter("PCB"),
56 fDetElemId(detElemId),
63 AliMUONPainterHelper* h = AliMUONPainterHelper::Instance();
65 AliMp::PlaneType planeType = ( att.IsBendingPlane() ? AliMp::kBendingPlane : AliMp::kNonBendingPlane );
67 const AliMpSlat* slat = AliMUONPainterHelper::Instance()->GetSlat(fDetElemId,planeType);
69 SetID(detElemId,pcbNumber);
70 SetName(h->PCBName(pcbNumber));
71 SetPathName(h->PCBPathName(detElemId,pcbNumber));
73 AliMpPCB* pcb = slat->GetPCB(fPCBIndex);
75 AliMUONPainterContour* contour = h->GetContour(ContourName());
76 TObjArray contourArray;
78 for ( Int_t imp = 0 ; imp < pcb->GetSize(); ++imp )
80 AliMpMotifPosition* mp = pcb->GetMotifPosition(imp);
81 AliDebug(1,Form("Adding manu %d to PCB %d of DE %d",
82 mp->GetID(),fPCBIndex,fDetElemId));
83 AliMUONVPainter* painter = new AliMUONManuPainter(Attributes(),fDetElemId,mp->GetID());
87 contourArray.Add(painter->Contour());
93 h->Local2Global(fDetElemId,
94 pcb->X()-slat->Position().X(),
95 pcb->Y()-slat->Position().Y(),
101 contour = h->MergeContours(contourArray,ContourName());
107 //_____________________________________________________________________________
108 AliMUONPCBPainter::~AliMUONPCBPainter()
113 //_____________________________________________________________________________
114 AliMUONPCBPainter::AliMUONPCBPainter(const AliMUONPCBPainter& rhs)
115 : AliMUONVPainter(rhs),
123 //_____________________________________________________________________________
125 AliMUONPCBPainter::operator=(const AliMUONPCBPainter& rhs)
127 /// assignment operator
135 //_____________________________________________________________________________
137 AliMUONPCBPainter::ComputeDataRange(const AliMUONVTrackerData& data, Int_t dataIndex,
138 Double_t& dataMin, Double_t& dataMax) const
140 /// Compute the min and max of this PCB data
141 dataMin = dataMax = data.PCB(fDetElemId, fPCBIndex,dataIndex);
144 //_____________________________________________________________________________
146 AliMUONPCBPainter::Copy(TObject& object) const
148 /// Copy this to object
149 AliMUONVPainter::Copy((AliMUONVPainter&)(object));
150 ((AliMUONPCBPainter&)(object)).fDetElemId = fDetElemId;
151 ((AliMUONPCBPainter&)(object)).fPCBIndex = fPCBIndex;
154 //_____________________________________________________________________________
156 AliMUONPCBPainter::Describe(const AliMUONVTrackerData& data, Int_t dataIndex,
159 /// Describe data at this PCB
161 if (!data.HasPCB(fDetElemId,fPCBIndex)) return "";
163 Double_t value = data.PCB(fDetElemId,fPCBIndex,dataIndex);
165 return AliMUONPainterHelper::Instance()->FormatValue(data.DimensionName(dataIndex).Data(),value);
168 //_____________________________________________________________________________
170 AliMUONPCBPainter::PaintArea(const AliMUONVTrackerData& data, Int_t dataIndex,
171 Double_t min, Double_t max)
173 /// Fill the contour of this PCB with a color depending of the value of the data
174 if (!data.HasPCB(fDetElemId,fPCBIndex)) return;
176 Double_t value = data.PCB(fDetElemId,fPCBIndex,dataIndex);
178 if ( value >= AliMUONVCalibParam::InvalidFloatValue() ) return;
180 Int_t color = AliMUONPainterHelper::Instance()->ColorFromValue(value,min,max);
182 Contour()->PaintArea(color);