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()
58 //_____________________________________________________________________________
59 AliMUONManuPainter::AliMUONManuPainter(const AliMUONAttPainter& att,
62 : AliMUONVPainter("MANU"),
63 fDetElemId(detElemId),
70 AliMUONPainterHelper* h = AliMUONPainterHelper::Instance();
72 SetID(detElemId,manuId);
73 SetName(h->ManuName(manuId));
74 SetPathName(h->ManuPathName(detElemId,manuId));
76 AliMpMotifPosition* mp = h->GetMotifPosition(detElemId,manuId);
80 AliFatal(Form("Could not get manuId %04d from DE %04d",manuId,detElemId));
85 AliMp::StationType stationType = AliMpDEManager::GetStationType(detElemId);
87 if ( stationType == AliMp::kStation345 )
89 const AliMpSlat* slat = AliMUONPainterHelper::Instance()->GetSlat(detElemId,manuId);
91 h->Local2Global(fDetElemId,
92 mp->Position().X() -slat->Position().X(),
93 mp->Position().Y() -slat->Position().Y(),
97 else if ( stationType != AliMp::kStationTrigger )
99 h->Local2Global(fDetElemId,
107 AliError("Hu ho. Not supposed to be used for trigger !");
112 AliMUONPainterContour* contour = h->GetContour(ContourName());
116 contour = h->GenerateManuContour(fDetElemId,
123 Add(new AliMUONManuPadPainter(*this,fDetElemId,fManuId));
126 //_____________________________________________________________________________
127 AliMUONManuPainter::AliMUONManuPainter(const AliMUONManuPainter& rhs)
128 : AliMUONVPainter(rhs), fDetElemId(-1), fManuId(-1)
134 //_____________________________________________________________________________
136 AliMUONManuPainter::operator=(const AliMUONManuPainter& rhs)
138 /// assignment operator
146 //_____________________________________________________________________________
147 AliMUONManuPainter::~AliMUONManuPainter()
152 //_____________________________________________________________________________
154 AliMUONManuPainter::ComputeDataRange(const AliMUONVTrackerData& data, Int_t dataIndex,
155 Double_t& dataMin, Double_t& dataMax) const
157 /// Compute data range spanned by this manu
158 dataMin = dataMax = data.Manu(fDetElemId, fManuId, dataIndex);
162 //_____________________________________________________________________________
164 AliMUONManuPainter::Copy(TObject& object) const
166 /// copyy this to object
167 AliMUONVPainter::Copy((AliMUONVPainter&)(object));
168 ((AliMUONManuPainter&)(object)).fDetElemId = fDetElemId;
169 ((AliMUONManuPainter&)(object)).fManuId = fManuId;
172 //_____________________________________________________________________________
174 AliMUONManuPainter::Describe(const AliMUONVTrackerData& data, Int_t dataIndex,
177 /// Describe data at this manu
179 if (!data.HasManu(fDetElemId,fManuId)) return "";
181 Double_t value = data.Manu(fDetElemId,fManuId,dataIndex);
183 return AliMUONPainterHelper::Instance()->FormatValue(data.DimensionName(dataIndex).Data(),value);
186 //_____________________________________________________________________________
188 AliMUONManuPainter::FillManuList(TObjArray& manuList) const
190 /// Append our manu to the list
191 manuList.Add(new AliMpManuUID(fDetElemId,fManuId));
194 //_____________________________________________________________________________
196 AliMUONManuPainter::PaintArea(const AliMUONVTrackerData& data, Int_t dataIndex,
197 Double_t min, Double_t max)
199 /// Paint area of this manu according to data
201 if (!data.HasManu(fDetElemId,fManuId)) return;
203 Double_t value = data.Manu(fDetElemId,fManuId,dataIndex);
205 if ( value >= AliMUONVCalibParam::InvalidFloatValue() ) return;
207 Int_t color = AliMUONPainterHelper::Instance()->ColorFromValue(value,min,max);
209 Contour()->PaintArea(color);
212 //_____________________________________________________________________________
214 AliMUONManuPainter::Validate(const AliMUONAttPainter& attributes) const
216 /// Normalize the attributes
218 /// check that cathode and plane are up-to-date, and that they are legal
220 AliMUONAttPainter norm(attributes);
222 norm.SetValid(kFALSE);
224 if ( norm.IsCathodeDefined() )
226 if ( norm.IsCathode0() != Attributes().IsCathode0() ) return norm;
229 if ( norm.IsPlaneDefined() )
231 if ( norm.IsBendingPlane() != Attributes().IsBendingPlane() ) return norm;
234 norm.SetValid(kTRUE);
236 if ( norm.IsCathodeDefined() && !norm.IsPlaneDefined() )
238 // derive plane from cathode
240 AliMp::CathodType cathode = ( norm.IsCathode0() ? AliMp::kCath0 : AliMp::kCath1 ) ;
242 AliMp::PlaneType planeType = AliMpDEManager::GetPlaneType(fDetElemId,cathode);
244 Bool_t bending = ( planeType == AliMp::kBendingPlane );
246 norm.SetPlane(bending,!bending);
248 else if ( norm.IsPlaneDefined() && !norm.IsCathodeDefined() )
250 // derive cathode from plane
252 AliMp::PlaneType planeType = ( norm.IsBendingPlane() ? AliMp::kBendingPlane : AliMp::kNonBendingPlane );
254 AliMp::CathodType cathode = AliMpDEManager::GetCathod(fDetElemId,planeType);
256 Bool_t cath0 = ( cathode == AliMp::kCath0 );
258 norm.SetCathode(cath0,!cath0);
260 else if ( norm.IsPlaneDefined() && norm.IsCathodeDefined() )
262 // check that cathode and plane matches
264 AliMp::CathodType cathode = ( norm.IsCathode0() ? AliMp::kCath0 : AliMp::kCath1 ) ;
266 AliMp::PlaneType planeType = AliMpDEManager::GetPlaneType(fDetElemId,cathode);
268 Bool_t bending = ( planeType == AliMp::kBendingPlane );
270 if ( bending != norm.IsBendingPlane() )
272 norm.SetValid(kFALSE);