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"
21 #include "AliMUONManuPadPainter.h"
22 #include "AliMUONContour.h"
23 #include "AliMUONPainterHelper.h"
24 #include "AliMUONVCalibParam.h"
25 #include "AliMUONVDigit.h"
26 #include "AliMUONVTrackerData.h"
27 #include "AliMpDEManager.h"
28 #include "AliMpManuUID.h"
29 #include "AliMpMotifPosition.h"
30 #include "AliMpMotifType.h"
31 #include "AliMpSlat.h"
32 #include "AliMpStationType.h"
33 #include "AliMpVMotif.h"
34 #include "AliMpVPadIterator.h"
39 ///\class AliMUONManuPainter
41 /// Implementation of AliMUONVPainter for one manu (not the pads, only the manu
44 ///\author Laurent Aphecetche, Subatech
47 ClassImp(AliMUONManuPainter)
50 //_____________________________________________________________________________
51 AliMUONManuPainter::AliMUONManuPainter(TRootIOCtor* ioCtor)
52 : AliMUONVPainter(ioCtor),
59 //_____________________________________________________________________________
60 AliMUONManuPainter::AliMUONManuPainter()
68 //_____________________________________________________________________________
69 AliMUONManuPainter::AliMUONManuPainter(const AliMUONAttPainter& att,
72 : AliMUONVPainter("MANU"),
73 fDetElemId(detElemId),
80 AliMUONPainterHelper* h = AliMUONPainterHelper::Instance();
82 SetID(detElemId,manuId);
83 SetName(h->ManuName(manuId));
84 SetPathName(h->ManuPathName(detElemId,manuId));
87 AliMp::StationType stationType = AliMpDEManager::GetStationType(detElemId);
89 if ( stationType == AliMp::kStationTrigger )
91 AliError("Hu ho. Not supposed to be used for trigger !");
96 AliMUONContour* contour = h->GetContour(ContourName());
100 contour = h->GenerateManuContour(fDetElemId,
108 AliFatal(Form("Could not get manuId %04d from DE %04d",manuId,detElemId));
113 Add(new AliMUONManuPadPainter(*this,fDetElemId,fManuId));
116 //_____________________________________________________________________________
117 AliMUONManuPainter::AliMUONManuPainter(const AliMUONManuPainter& rhs)
118 : AliMUONVPainter(rhs), fDetElemId(-1), fManuId(-1)
124 //_____________________________________________________________________________
126 AliMUONManuPainter::operator=(const AliMUONManuPainter& rhs)
128 /// assignment operator
136 //_____________________________________________________________________________
137 AliMUONManuPainter::~AliMUONManuPainter()
142 //_____________________________________________________________________________
144 AliMUONManuPainter::ComputeDataRange(const AliMUONVTrackerData& data, Int_t dataIndex,
145 Double_t& dataMin, Double_t& dataMax) const
147 /// Compute data range spanned by this manu
148 dataMin = dataMax = data.Manu(fDetElemId, fManuId, dataIndex);
152 //_____________________________________________________________________________
154 AliMUONManuPainter::Copy(TObject& object) const
156 /// copyy this to object
157 AliMUONVPainter::Copy((AliMUONVPainter&)(object));
158 ((AliMUONManuPainter&)(object)).fDetElemId = fDetElemId;
159 ((AliMUONManuPainter&)(object)).fManuId = fManuId;
162 //_____________________________________________________________________________
164 AliMUONManuPainter::Describe(const AliMUONVTrackerData& data, Int_t dataIndex,
167 /// Describe data at this manu
169 if (!data.HasManu(fDetElemId,fManuId)) return "";
171 Double_t value = data.Manu(fDetElemId,fManuId,dataIndex);
173 return AliMUONPainterHelper::Instance()->FormatValue(data.DimensionName(dataIndex).Data(),value);
176 //_____________________________________________________________________________
178 AliMUONManuPainter::FillManuList(TObjArray& manuList) const
180 /// Append our manu to the list
181 manuList.Add(new AliMpManuUID(fDetElemId,fManuId));
184 //_____________________________________________________________________________
186 AliMUONManuPainter::IsIncluded() const
188 /// whether this manu is included in the readout or not
189 return ( InteractiveReadOutConfig()->Manu(fDetElemId,fManuId) > 0 );
192 //_____________________________________________________________________________
194 AliMUONManuPainter::PaintArea(const AliMUONVTrackerData& data, Int_t dataIndex,
195 Double_t min, Double_t max)
197 /// Paint area of this manu according to data
199 if (!data.HasManu(fDetElemId,fManuId)) return;
201 Double_t value = data.Manu(fDetElemId,fManuId,dataIndex);
203 if ( value >= AliMUONVCalibParam::InvalidFloatValue() ) return;
205 Int_t color = AliMUONPainterHelper::Instance()->ColorFromValue(value,min,max);
210 //_____________________________________________________________________________
212 AliMUONManuPainter::Validate(const AliMUONAttPainter& attributes) const
214 /// Normalize the attributes
216 /// check that cathode and plane are up-to-date, and that they are legal
218 AliMUONAttPainter norm(attributes);
220 norm.SetValid(kFALSE);
222 if ( norm.IsCathodeDefined() )
224 if ( norm.IsCathode0() != Attributes().IsCathode0() ) return norm;
227 if ( norm.IsPlaneDefined() )
229 if ( norm.IsBendingPlane() != Attributes().IsBendingPlane() ) return norm;
232 norm.SetValid(kTRUE);
234 if ( norm.IsCathodeDefined() && !norm.IsPlaneDefined() )
236 // derive plane from cathode
238 AliMp::CathodType cathode = ( norm.IsCathode0() ? AliMp::kCath0 : AliMp::kCath1 ) ;
240 AliMp::PlaneType planeType = AliMpDEManager::GetPlaneType(fDetElemId,cathode);
242 Bool_t bending = ( planeType == AliMp::kBendingPlane );
244 norm.SetPlane(bending,!bending);
246 else if ( norm.IsPlaneDefined() && !norm.IsCathodeDefined() )
248 // derive cathode from plane
250 AliMp::PlaneType planeType = ( norm.IsBendingPlane() ? AliMp::kBendingPlane : AliMp::kNonBendingPlane );
252 AliMp::CathodType cathode = AliMpDEManager::GetCathod(fDetElemId,planeType);
254 Bool_t cath0 = ( cathode == AliMp::kCath0 );
256 norm.SetCathode(cath0,!cath0);
258 else if ( norm.IsPlaneDefined() && norm.IsCathodeDefined() )
260 // check that cathode and plane matches
262 AliMp::CathodType cathode = ( norm.IsCathode0() ? AliMp::kCath0 : AliMp::kCath1 ) ;
264 AliMp::PlaneType planeType = AliMpDEManager::GetPlaneType(fDetElemId,cathode);
266 Bool_t bending = ( planeType == AliMp::kBendingPlane );
268 if ( bending != norm.IsBendingPlane() )
270 norm.SetValid(kFALSE);