Line data Source code
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 : /// \class AliMUONPCBPainter
19 : ///
20 : /// Implementation of AliMUONVPainter for slat's PCBs
21 : ///
22 : /// \author Laurent Aphecetche, Subatech
23 :
24 : #include "AliMUONPCBPainter.h"
25 :
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"
33 : #include "AliMpPCB.h"
34 : #include "AliMpPlaneType.h"
35 : #include "AliMpSlat.h"
36 : #include "AliLog.h"
37 :
38 : /// \cond CLASSIMP
39 12 : ClassImp(AliMUONPCBPainter)
40 : /// \endcond
41 :
42 : //_____________________________________________________________________________
43 : AliMUONPCBPainter::AliMUONPCBPainter(TRootIOCtor* ioCtor)
44 0 : : AliMUONVPainter(ioCtor),
45 0 : fDetElemId(-1),
46 0 : fPCBIndex(-1)
47 0 : {
48 : /// root streaming ctor
49 0 : }
50 :
51 : //_____________________________________________________________________________
52 : AliMUONPCBPainter::AliMUONPCBPainter()
53 0 : : AliMUONVPainter(),
54 0 : fDetElemId(-1),
55 0 : fPCBIndex(-1)
56 0 : {
57 : /// empty ctor
58 0 : }
59 :
60 : //_____________________________________________________________________________
61 : AliMUONPCBPainter::AliMUONPCBPainter(const AliMUONAttPainter& att,
62 : Int_t detElemId,
63 : Int_t pcbNumber)
64 0 : : AliMUONVPainter("PCB"),
65 0 : fDetElemId(detElemId),
66 0 : fPCBIndex(pcbNumber)
67 0 : {
68 : /// Ctor
69 :
70 0 : SetAttributes(att);
71 :
72 0 : AliMUONPainterHelper* h = AliMUONPainterHelper::Instance();
73 :
74 0 : AliMp::PlaneType planeType = ( att.IsBendingPlane() ? AliMp::kBendingPlane : AliMp::kNonBendingPlane );
75 :
76 0 : const AliMpSlat* slat = AliMUONPainterHelper::Instance()->GetSlat(fDetElemId,planeType);
77 :
78 0 : SetID(detElemId,pcbNumber);
79 0 : SetName(h->PCBName(pcbNumber));
80 0 : SetPathName(h->PCBPathName(detElemId,pcbNumber));
81 :
82 0 : AliMpPCB* pcb = slat->GetPCB(fPCBIndex);
83 :
84 0 : AliMUONContour* contour = h->GetContour(ContourName());
85 0 : TObjArray contourArray;
86 :
87 0 : for ( Int_t imp = 0 ; imp < pcb->GetSize(); ++imp )
88 : {
89 0 : AliMpMotifPosition* mp = pcb->GetMotifPosition(imp);
90 0 : AliMUONVPainter* painter = new AliMUONManuPainter(Attributes(),fDetElemId,mp->GetID());
91 0 : Add(painter);
92 0 : if (!contour)
93 : {
94 0 : contourArray.Add(painter->Contour());
95 : }
96 : }
97 :
98 0 : Double_t x,y,z;
99 :
100 0 : h->Local2Global(fDetElemId,
101 0 : pcb->X()-slat->GetPositionX(),
102 0 : pcb->Y()-slat->GetPositionY(),
103 : 0.0,
104 : x,y,z);
105 :
106 0 : if (!contour)
107 : {
108 0 : contour = h->MergeContours(contourArray,ContourName());
109 0 : }
110 :
111 0 : SetContour(contour);
112 0 : }
113 :
114 : //_____________________________________________________________________________
115 0 : AliMUONPCBPainter::~AliMUONPCBPainter()
116 0 : {
117 : /// dtor
118 0 : }
119 :
120 : //_____________________________________________________________________________
121 : AliMUONPCBPainter::AliMUONPCBPainter(const AliMUONPCBPainter& rhs)
122 0 : : AliMUONVPainter(rhs),
123 0 : fDetElemId(-1),
124 0 : fPCBIndex(-1)
125 0 : {
126 : /// copy ctor
127 0 : rhs.Copy(*this);
128 0 : }
129 :
130 : //_____________________________________________________________________________
131 : AliMUONPCBPainter&
132 : AliMUONPCBPainter::operator=(const AliMUONPCBPainter& rhs)
133 : {
134 : /// assignment operator
135 0 : if ( this != &rhs )
136 : {
137 0 : rhs.Copy(*this);
138 0 : }
139 0 : return *this;
140 : }
141 :
142 : //_____________________________________________________________________________
143 : void
144 : AliMUONPCBPainter::ComputeDataRange(const AliMUONVTrackerData& data, Int_t dataIndex,
145 : Double_t& dataMin, Double_t& dataMax) const
146 : {
147 : /// Compute the min and max of this PCB data
148 0 : dataMin = dataMax = data.PCB(fDetElemId, fPCBIndex,dataIndex);
149 0 : }
150 :
151 : //_____________________________________________________________________________
152 : void
153 : AliMUONPCBPainter::Copy(TObject& object) const
154 : {
155 : /// Copy this to object
156 0 : AliMUONVPainter::Copy((AliMUONVPainter&)(object));
157 0 : ((AliMUONPCBPainter&)(object)).fDetElemId = fDetElemId;
158 0 : ((AliMUONPCBPainter&)(object)).fPCBIndex = fPCBIndex;
159 0 : }
160 :
161 : //_____________________________________________________________________________
162 : TString
163 : AliMUONPCBPainter::Describe(const AliMUONVTrackerData& data, Int_t dataIndex,
164 : Double_t, Double_t)
165 : {
166 : /// Describe data at this PCB
167 :
168 0 : if (!data.HasPCB(fDetElemId,fPCBIndex)) return "";
169 :
170 0 : Double_t value = data.PCB(fDetElemId,fPCBIndex,dataIndex);
171 :
172 0 : return AliMUONPainterHelper::Instance()->FormatValue(data.DimensionName(dataIndex).Data(),value);
173 0 : }
174 :
175 : //_____________________________________________________________________________
176 : Bool_t
177 : AliMUONPCBPainter::IsIncluded() const
178 : {
179 : /// Whether this PCB is included in the read out or not
180 0 : return ( InteractiveReadOutConfig()->PCB(fDetElemId,fPCBIndex) > 0 );
181 : }
182 :
183 : //_____________________________________________________________________________
184 : void
185 : AliMUONPCBPainter::PaintArea(const AliMUONVTrackerData& data, Int_t dataIndex,
186 : Double_t min, Double_t max)
187 : {
188 : /// Fill the contour of this PCB with a color depending of the value of the data
189 0 : if (!data.HasPCB(fDetElemId,fPCBIndex)) return;
190 :
191 0 : Double_t value = data.PCB(fDetElemId,fPCBIndex,dataIndex);
192 :
193 0 : if ( value >= AliMUONVCalibParam::InvalidFloatValue() ) return;
194 :
195 0 : Int_t color = AliMUONPainterHelper::Instance()->ColorFromValue(value,min,max);
196 :
197 0 : PaintArea(color);
198 0 : }
199 :
|