2 /**************************************************************************
3 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
5 * Author: The ALICE Off-line Project. *
6 * Contributors are mentioned in the code where appropriate. *
8 * Permission to use, copy, modify and distribute this software and its *
9 * documentation strictly for non-commercial purposes is hereby granted *
10 * without fee, provided that the above copyright notice appears in all *
11 * copies and that both the copyright notice and this permission notice *
12 * appear in the supporting documentation. The authors make no claims *
13 * about the suitability of this software for any purpose. It is *
14 * provided "as is" without express or implied warranty. *
15 **************************************************************************/
19 #include "AliMUONManuPainter.h"
22 #include "AliMUONContour.h"
23 #include "AliMUONManuContourMaker.h"
24 #include "AliMUONManuPadPainter.h"
25 #include "AliMUONPainterHelper.h"
26 #include "AliMUONVCalibParam.h"
27 #include "AliMUONVDigit.h"
28 #include "AliMUONVTrackerData.h"
29 #include "AliMpDEManager.h"
30 #include "AliMpManuUID.h"
31 #include "AliMpMotifPosition.h"
32 #include "AliMpMotifType.h"
33 #include "AliMpSlat.h"
34 #include "AliMpStationType.h"
35 #include "AliMpVMotif.h"
36 #include "AliMpVPadIterator.h"
40 ///\class AliMUONManuPainter
42 /// Implementation of AliMUONVPainter for one manu (not the pads, only the manu
45 ///\author Laurent Aphecetche, Subatech
48 ClassImp(AliMUONManuPainter)
51 //_____________________________________________________________________________
52 AliMUONManuPainter::AliMUONManuPainter(TRootIOCtor* ioCtor)
53 : AliMUONVPainter(ioCtor),
60 //_____________________________________________________________________________
61 AliMUONManuPainter::AliMUONManuPainter()
69 //_____________________________________________________________________________
70 AliMUONManuPainter::AliMUONManuPainter(const AliMUONAttPainter& att,
73 : AliMUONVPainter("MANU"),
74 fDetElemId(detElemId),
81 AliMUONPainterHelper* h = AliMUONPainterHelper::Instance();
83 SetID(detElemId,manuId);
84 SetName(h->ManuName(manuId));
85 SetPathName(h->ManuPathName(detElemId,manuId));
88 AliMp::StationType stationType = AliMpDEManager::GetStationType(detElemId);
90 if ( stationType == AliMp::kStationTrigger )
92 AliError("Hu ho. Not supposed to be used for trigger !");
97 TString name = AliMUONManuContourMaker::ManuPathName(detElemId, manuId);
99 AliMUONContour* contour = h->GetContour(name.Data());
103 AliError(Form("Could not get manuId %04d from DE %04d (name=%s)",manuId,detElemId,name.Data()));
108 Add(new AliMUONManuPadPainter(*this,fDetElemId,fManuId));
111 //_____________________________________________________________________________
112 AliMUONManuPainter::AliMUONManuPainter(const AliMUONManuPainter& rhs)
113 : AliMUONVPainter(rhs), fDetElemId(-1), fManuId(-1)
119 //_____________________________________________________________________________
121 AliMUONManuPainter::operator=(const AliMUONManuPainter& rhs)
123 /// assignment operator
131 //_____________________________________________________________________________
132 AliMUONManuPainter::~AliMUONManuPainter()
137 //_____________________________________________________________________________
139 AliMUONManuPainter::ComputeDataRange(const AliMUONVTrackerData& data, Int_t dataIndex,
140 Double_t& dataMin, Double_t& dataMax) const
142 /// Compute data range spanned by this manu
143 dataMin = dataMax = data.Manu(fDetElemId, fManuId, dataIndex);
147 //_____________________________________________________________________________
149 AliMUONManuPainter::Copy(TObject& object) const
151 /// copyy this to object
152 AliMUONVPainter::Copy((AliMUONVPainter&)(object));
153 ((AliMUONManuPainter&)(object)).fDetElemId = fDetElemId;
154 ((AliMUONManuPainter&)(object)).fManuId = fManuId;
157 //_____________________________________________________________________________
159 AliMUONManuPainter::Describe(const AliMUONVTrackerData& data, Int_t dataIndex,
162 /// Describe data at this manu
164 if (!data.HasManu(fDetElemId,fManuId)) return "";
166 Double_t value = data.Manu(fDetElemId,fManuId,dataIndex);
168 return AliMUONPainterHelper::Instance()->FormatValue(data.DimensionName(dataIndex).Data(),value);
171 //_____________________________________________________________________________
173 AliMUONManuPainter::FillManuList(TObjArray& manuList) const
175 /// Append our manu to the list
176 manuList.Add(new AliMpManuUID(fDetElemId,fManuId));
179 //_____________________________________________________________________________
181 AliMUONManuPainter::IsIncluded() const
183 /// whether this manu is included in the readout or not
184 return ( InteractiveReadOutConfig()->Manu(fDetElemId,fManuId) > 0 );
187 //_____________________________________________________________________________
189 AliMUONManuPainter::PaintArea(const AliMUONVTrackerData& data, Int_t dataIndex,
190 Double_t min, Double_t max)
192 /// Paint area of this manu according to data
194 if (!data.HasManu(fDetElemId,fManuId)) return;
196 Double_t value = data.Manu(fDetElemId,fManuId,dataIndex);
198 if ( value >= AliMUONVCalibParam::InvalidFloatValue() ) return;
200 Int_t color = AliMUONPainterHelper::Instance()->ColorFromValue(value,min,max);
205 //_____________________________________________________________________________
207 AliMUONManuPainter::Validate(const AliMUONAttPainter& attributes) const
209 /// Normalize the attributes
211 /// check that cathode and plane are up-to-date, and that they are legal
213 AliMUONAttPainter norm(attributes);
215 norm.SetValid(kFALSE);
217 if ( norm.IsCathodeDefined() )
219 if ( norm.IsCathode0() != Attributes().IsCathode0() ) return norm;
222 if ( norm.IsPlaneDefined() )
224 if ( norm.IsBendingPlane() != Attributes().IsBendingPlane() ) return norm;
227 norm.SetValid(kTRUE);
229 if ( norm.IsCathodeDefined() && !norm.IsPlaneDefined() )
231 // derive plane from cathode
233 AliMp::CathodType cathode = ( norm.IsCathode0() ? AliMp::kCath0 : AliMp::kCath1 ) ;
235 AliMp::PlaneType planeType = AliMpDEManager::GetPlaneType(fDetElemId,cathode);
237 Bool_t bending = ( planeType == AliMp::kBendingPlane );
239 norm.SetPlane(bending,!bending);
241 else if ( norm.IsPlaneDefined() && !norm.IsCathodeDefined() )
243 // derive cathode from plane
245 AliMp::PlaneType planeType = ( norm.IsBendingPlane() ? AliMp::kBendingPlane : AliMp::kNonBendingPlane );
247 AliMp::CathodType cathode = AliMpDEManager::GetCathod(fDetElemId,planeType);
249 Bool_t cath0 = ( cathode == AliMp::kCath0 );
251 norm.SetCathode(cath0,!cath0);
253 else if ( norm.IsPlaneDefined() && norm.IsCathodeDefined() )
255 // check that cathode and plane matches
257 AliMp::CathodType cathode = ( norm.IsCathode0() ? AliMp::kCath0 : AliMp::kCath1 ) ;
259 AliMp::PlaneType planeType = AliMpDEManager::GetPlaneType(fDetElemId,cathode);
261 Bool_t bending = ( planeType == AliMp::kBendingPlane );
263 if ( bending != norm.IsBendingPlane() )
265 norm.SetValid(kFALSE);