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 #include "AliMUONManuPainter.h"
20 #include "AliMUONManuPadPainter.h"
21 #include "AliMUONPainterContour.h"
22 #include "AliMUONPainterHelper.h"
23 #include "AliMUONVCalibParam.h"
24 #include "AliMUONVDigit.h"
25 #include "AliMUONVTrackerData.h"
26 #include "AliMpDEManager.h"
27 #include "AliMpManuUID.h"
28 #include "AliMpMotifPosition.h"
29 #include "AliMpMotifType.h"
30 #include "AliMpSlat.h"
31 #include "AliMpStationType.h"
32 #include "AliMpVMotif.h"
33 #include "AliMpVPadIterator.h"
38 ///\class AliMUONManuPainter
40 /// Implementation of AliMUONVPainter for one manu (not the pads, only the manu
43 ///\author Laurent Aphecetche, Subatech
46 ClassImp(AliMUONManuPainter)
49 //_____________________________________________________________________________
50 AliMUONManuPainter::AliMUONManuPainter(TRootIOCtor* ioCtor)
51 : AliMUONVPainter(ioCtor),
58 //_____________________________________________________________________________
59 AliMUONManuPainter::AliMUONManuPainter()
67 //_____________________________________________________________________________
68 AliMUONManuPainter::AliMUONManuPainter(const AliMUONAttPainter& att,
71 : AliMUONVPainter("MANU"),
72 fDetElemId(detElemId),
79 AliMUONPainterHelper* h = AliMUONPainterHelper::Instance();
81 SetID(detElemId,manuId);
82 SetName(h->ManuName(manuId));
83 SetPathName(h->ManuPathName(detElemId,manuId));
85 AliMpMotifPosition* mp = h->GetMotifPosition(detElemId,manuId);
89 AliFatal(Form("Could not get manuId %04d from DE %04d",manuId,detElemId));
94 AliMp::StationType stationType = AliMpDEManager::GetStationType(detElemId);
96 if ( stationType == AliMp::kStation345 )
98 const AliMpSlat* slat = AliMUONPainterHelper::Instance()->GetSlat(detElemId,manuId);
100 h->Local2Global(fDetElemId,
101 mp->Position().X() -slat->Position().X(),
102 mp->Position().Y() -slat->Position().Y(),
106 else if ( stationType != AliMp::kStationTrigger )
108 h->Local2Global(fDetElemId,
116 AliError("Hu ho. Not supposed to be used for trigger !");
121 AliMUONPainterContour* contour = h->GetContour(ContourName());
125 contour = h->GenerateManuContour(fDetElemId,
132 Add(new AliMUONManuPadPainter(*this,fDetElemId,fManuId));
135 //_____________________________________________________________________________
136 AliMUONManuPainter::AliMUONManuPainter(const AliMUONManuPainter& rhs)
137 : AliMUONVPainter(rhs), fDetElemId(-1), fManuId(-1)
143 //_____________________________________________________________________________
145 AliMUONManuPainter::operator=(const AliMUONManuPainter& rhs)
147 /// assignment operator
155 //_____________________________________________________________________________
156 AliMUONManuPainter::~AliMUONManuPainter()
161 //_____________________________________________________________________________
163 AliMUONManuPainter::ComputeDataRange(const AliMUONVTrackerData& data, Int_t dataIndex,
164 Double_t& dataMin, Double_t& dataMax) const
166 /// Compute data range spanned by this manu
167 dataMin = dataMax = data.Manu(fDetElemId, fManuId, dataIndex);
171 //_____________________________________________________________________________
173 AliMUONManuPainter::Copy(TObject& object) const
175 /// copyy this to object
176 AliMUONVPainter::Copy((AliMUONVPainter&)(object));
177 ((AliMUONManuPainter&)(object)).fDetElemId = fDetElemId;
178 ((AliMUONManuPainter&)(object)).fManuId = fManuId;
181 //_____________________________________________________________________________
183 AliMUONManuPainter::Describe(const AliMUONVTrackerData& data, Int_t dataIndex,
186 /// Describe data at this manu
188 if (!data.HasManu(fDetElemId,fManuId)) return "";
190 Double_t value = data.Manu(fDetElemId,fManuId,dataIndex);
192 return AliMUONPainterHelper::Instance()->FormatValue(data.DimensionName(dataIndex).Data(),value);
195 //_____________________________________________________________________________
197 AliMUONManuPainter::FillManuList(TObjArray& manuList) const
199 /// Append our manu to the list
200 manuList.Add(new AliMpManuUID(fDetElemId,fManuId));
203 //_____________________________________________________________________________
205 AliMUONManuPainter::IsIncluded() const
207 /// whether this manu is included in the readout or not
208 return ( InteractiveReadOutConfig()->Manu(fDetElemId,fManuId) > 0 );
211 //_____________________________________________________________________________
213 AliMUONManuPainter::PaintArea(const AliMUONVTrackerData& data, Int_t dataIndex,
214 Double_t min, Double_t max)
216 /// Paint area of this manu according to data
218 if (!data.HasManu(fDetElemId,fManuId)) return;
220 Double_t value = data.Manu(fDetElemId,fManuId,dataIndex);
222 if ( value >= AliMUONVCalibParam::InvalidFloatValue() ) return;
224 Int_t color = AliMUONPainterHelper::Instance()->ColorFromValue(value,min,max);
226 Contour()->PaintArea(color);
229 //_____________________________________________________________________________
231 AliMUONManuPainter::Validate(const AliMUONAttPainter& attributes) const
233 /// Normalize the attributes
235 /// check that cathode and plane are up-to-date, and that they are legal
237 AliMUONAttPainter norm(attributes);
239 norm.SetValid(kFALSE);
241 if ( norm.IsCathodeDefined() )
243 if ( norm.IsCathode0() != Attributes().IsCathode0() ) return norm;
246 if ( norm.IsPlaneDefined() )
248 if ( norm.IsBendingPlane() != Attributes().IsBendingPlane() ) return norm;
251 norm.SetValid(kTRUE);
253 if ( norm.IsCathodeDefined() && !norm.IsPlaneDefined() )
255 // derive plane from cathode
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 norm.SetPlane(bending,!bending);
265 else if ( norm.IsPlaneDefined() && !norm.IsCathodeDefined() )
267 // derive cathode from plane
269 AliMp::PlaneType planeType = ( norm.IsBendingPlane() ? AliMp::kBendingPlane : AliMp::kNonBendingPlane );
271 AliMp::CathodType cathode = AliMpDEManager::GetCathod(fDetElemId,planeType);
273 Bool_t cath0 = ( cathode == AliMp::kCath0 );
275 norm.SetCathode(cath0,!cath0);
277 else if ( norm.IsPlaneDefined() && norm.IsCathodeDefined() )
279 // check that cathode and plane matches
281 AliMp::CathodType cathode = ( norm.IsCathode0() ? AliMp::kCath0 : AliMp::kCath1 ) ;
283 AliMp::PlaneType planeType = AliMpDEManager::GetPlaneType(fDetElemId,cathode);
285 Bool_t bending = ( planeType == AliMp::kBendingPlane );
287 if ( bending != norm.IsBendingPlane() )
289 norm.SetValid(kFALSE);