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 "AliMUONContour.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(TRootIOCtor* ioCtor)
44 : AliMUONVPainter(ioCtor),
48 /// root streaming ctor
51 //_____________________________________________________________________________
52 AliMUONPCBPainter::AliMUONPCBPainter()
60 //_____________________________________________________________________________
61 AliMUONPCBPainter::AliMUONPCBPainter(const AliMUONAttPainter& att,
64 : AliMUONVPainter("PCB"),
65 fDetElemId(detElemId),
72 AliMUONPainterHelper* h = AliMUONPainterHelper::Instance();
74 AliMp::PlaneType planeType = ( att.IsBendingPlane() ? AliMp::kBendingPlane : AliMp::kNonBendingPlane );
76 const AliMpSlat* slat = AliMUONPainterHelper::Instance()->GetSlat(fDetElemId,planeType);
78 SetID(detElemId,pcbNumber);
79 SetName(h->PCBName(pcbNumber));
80 SetPathName(h->PCBPathName(detElemId,pcbNumber));
82 AliMpPCB* pcb = slat->GetPCB(fPCBIndex);
84 AliMUONContour* contour = h->GetContour(ContourName());
85 TObjArray contourArray;
87 for ( Int_t imp = 0 ; imp < pcb->GetSize(); ++imp )
89 AliMpMotifPosition* mp = pcb->GetMotifPosition(imp);
90 AliDebug(1,Form("Adding manu %d to PCB %d of DE %d",
91 mp->GetID(),fPCBIndex,fDetElemId));
92 AliMUONVPainter* painter = new AliMUONManuPainter(Attributes(),fDetElemId,mp->GetID());
96 contourArray.Add(painter->Contour());
102 h->Local2Global(fDetElemId,
103 pcb->X()-slat->GetPositionX(),
104 pcb->Y()-slat->GetPositionY(),
110 contour = h->MergeContours(contourArray,ContourName());
116 //_____________________________________________________________________________
117 AliMUONPCBPainter::~AliMUONPCBPainter()
122 //_____________________________________________________________________________
123 AliMUONPCBPainter::AliMUONPCBPainter(const AliMUONPCBPainter& rhs)
124 : AliMUONVPainter(rhs),
132 //_____________________________________________________________________________
134 AliMUONPCBPainter::operator=(const AliMUONPCBPainter& rhs)
136 /// assignment operator
144 //_____________________________________________________________________________
146 AliMUONPCBPainter::ComputeDataRange(const AliMUONVTrackerData& data, Int_t dataIndex,
147 Double_t& dataMin, Double_t& dataMax) const
149 /// Compute the min and max of this PCB data
150 dataMin = dataMax = data.PCB(fDetElemId, fPCBIndex,dataIndex);
153 //_____________________________________________________________________________
155 AliMUONPCBPainter::Copy(TObject& object) const
157 /// Copy this to object
158 AliMUONVPainter::Copy((AliMUONVPainter&)(object));
159 ((AliMUONPCBPainter&)(object)).fDetElemId = fDetElemId;
160 ((AliMUONPCBPainter&)(object)).fPCBIndex = fPCBIndex;
163 //_____________________________________________________________________________
165 AliMUONPCBPainter::Describe(const AliMUONVTrackerData& data, Int_t dataIndex,
168 /// Describe data at this PCB
170 if (!data.HasPCB(fDetElemId,fPCBIndex)) return "";
172 Double_t value = data.PCB(fDetElemId,fPCBIndex,dataIndex);
174 return AliMUONPainterHelper::Instance()->FormatValue(data.DimensionName(dataIndex).Data(),value);
177 //_____________________________________________________________________________
179 AliMUONPCBPainter::IsIncluded() const
181 /// Whether this PCB is included in the read out or not
182 return ( InteractiveReadOutConfig()->PCB(fDetElemId,fPCBIndex) > 0 );
185 //_____________________________________________________________________________
187 AliMUONPCBPainter::PaintArea(const AliMUONVTrackerData& data, Int_t dataIndex,
188 Double_t min, Double_t max)
190 /// Fill the contour of this PCB with a color depending of the value of the data
191 if (!data.HasPCB(fDetElemId,fPCBIndex)) return;
193 Double_t value = data.PCB(fDetElemId,fPCBIndex,dataIndex);
195 if ( value >= AliMUONVCalibParam::InvalidFloatValue() ) return;
197 Int_t color = AliMUONPainterHelper::Instance()->ColorFromValue(value,min,max);