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 "AliMpDCSNamer.h"
23 #include "AliMUONContour.h"
24 #include "AliMUONManuContourMaker.h"
25 #include "AliMUONManuPadPainter.h"
26 #include "AliMUONPainterHelper.h"
27 #include "AliMUONVCalibParam.h"
28 #include "AliMUONVDigit.h"
29 #include "AliMUONVTrackerData.h"
30 #include "AliMpDEManager.h"
31 #include "AliMpManuUID.h"
32 #include "AliMpMotifPosition.h"
33 #include "AliMpMotifType.h"
34 #include "AliMpSlat.h"
35 #include "AliMpStationType.h"
36 #include "AliMpVMotif.h"
37 #include "AliMpVPadIterator.h"
41 ///\class AliMUONManuPainter
43 /// Implementation of AliMUONVPainter for one manu (not the pads, only the manu
46 ///\author Laurent Aphecetche, Subatech
49 ClassImp(AliMUONManuPainter)
52 //_____________________________________________________________________________
53 AliMUONManuPainter::AliMUONManuPainter(TRootIOCtor* ioCtor)
54 : AliMUONVPainter(ioCtor),
61 //_____________________________________________________________________________
62 AliMUONManuPainter::AliMUONManuPainter()
70 //_____________________________________________________________________________
71 AliMUONManuPainter::AliMUONManuPainter(const AliMUONAttPainter& att,
74 : AliMUONVPainter("MANU"),
75 fDetElemId(detElemId),
82 AliMUONPainterHelper* h = AliMUONPainterHelper::Instance();
84 SetID(detElemId,manuId);
85 SetName(h->ManuName(manuId));
86 SetPathName(h->ManuPathName(detElemId,manuId));
89 AliMp::StationType stationType = AliMpDEManager::GetStationType(detElemId);
91 if ( stationType == AliMp::kStationTrigger )
93 AliError("Hu ho. Not supposed to be used for trigger !");
98 TString name = AliMUONManuContourMaker::ManuPathName(detElemId, manuId);
100 AliMUONContour* contour = h->GetContour(name.Data());
104 AliError(Form("Could not get manuId %04d from DE %04d (name=%s)",manuId,detElemId,name.Data()));
109 Add(new AliMUONManuPadPainter(*this,fDetElemId,fManuId));
112 //_____________________________________________________________________________
113 AliMUONManuPainter::AliMUONManuPainter(const AliMUONManuPainter& rhs)
114 : AliMUONVPainter(rhs), fDetElemId(-1), fManuId(-1)
120 //_____________________________________________________________________________
122 AliMUONManuPainter::operator=(const AliMUONManuPainter& rhs)
124 /// assignment operator
132 //_____________________________________________________________________________
133 AliMUONManuPainter::~AliMUONManuPainter()
138 //_____________________________________________________________________________
140 AliMUONManuPainter::ComputeDataRange(const AliMUONVTrackerData& data, Int_t dataIndex,
141 Double_t& dataMin, Double_t& dataMax) const
143 /// Compute data range spanned by this manu
144 dataMin = dataMax = data.Manu(fDetElemId, fManuId, dataIndex);
148 //_____________________________________________________________________________
150 AliMUONManuPainter::Copy(TObject& object) const
152 /// copyy this to object
153 AliMUONVPainter::Copy((AliMUONVPainter&)(object));
154 ((AliMUONManuPainter&)(object)).fDetElemId = fDetElemId;
155 ((AliMUONManuPainter&)(object)).fManuId = fManuId;
158 //_____________________________________________________________________________
160 AliMUONManuPainter::Describe(const AliMUONVTrackerData& data, Int_t dataIndex,
163 /// Describe data at this manu
165 if (!data.HasManu(fDetElemId,fManuId)) return "";
167 Double_t value = data.Manu(fDetElemId,fManuId,dataIndex);
169 TString rv = AliMUONPainterHelper::Instance()->FormatValue(data.DimensionName(dataIndex).Data(),value);
171 if ( TString(data.GetName()).Contains("HV") )
175 AliMpDCSNamer hvNamer("TRACKER");
177 if ( AliMpDEManager::GetStationType(fDetElemId) == AliMp::kStation12 )
179 Int_t sector = hvNamer.ManuId2Sector(fDetElemId,fManuId);
181 rv += hvNamer.DCSNameFromAlias(hvNamer.DCSAliasName(fDetElemId,sector));
185 rv += hvNamer.DCSNameFromAlias(hvNamer.DCSAliasName(fDetElemId));
192 //_____________________________________________________________________________
194 AliMUONManuPainter::FillManuList(TObjArray& manuList) const
196 /// Append our manu to the list
197 manuList.Add(new AliMpManuUID(fDetElemId,fManuId));
200 //_____________________________________________________________________________
202 AliMUONManuPainter::IsIncluded() const
204 /// whether this manu is included in the readout or not
205 return ( InteractiveReadOutConfig()->Manu(fDetElemId,fManuId) > 0 );
208 //_____________________________________________________________________________
210 AliMUONManuPainter::PaintArea(const AliMUONVTrackerData& data, Int_t dataIndex,
211 Double_t min, Double_t max)
213 /// Paint area of this manu according to data
215 if (!data.HasManu(fDetElemId,fManuId)) return;
217 Double_t value = data.Manu(fDetElemId,fManuId,dataIndex);
219 if ( value >= AliMUONVCalibParam::InvalidFloatValue() ) return;
221 Int_t color = AliMUONPainterHelper::Instance()->ColorFromValue(value,min,max);
226 //_____________________________________________________________________________
228 AliMUONManuPainter::Validate(const AliMUONAttPainter& attributes) const
230 /// Normalize the attributes
232 /// check that cathode and plane are up-to-date, and that they are legal
234 AliMUONAttPainter norm(attributes);
236 norm.SetValid(kFALSE);
238 if ( norm.IsCathodeDefined() )
240 if ( norm.IsCathode0() != Attributes().IsCathode0() ) return norm;
243 if ( norm.IsPlaneDefined() )
245 if ( norm.IsBendingPlane() != Attributes().IsBendingPlane() ) return norm;
248 norm.SetValid(kTRUE);
250 if ( norm.IsCathodeDefined() && !norm.IsPlaneDefined() )
252 // derive plane from cathode
254 AliMp::CathodType cathode = ( norm.IsCathode0() ? AliMp::kCath0 : AliMp::kCath1 ) ;
256 AliMp::PlaneType planeType = AliMpDEManager::GetPlaneType(fDetElemId,cathode);
258 Bool_t bending = ( planeType == AliMp::kBendingPlane );
260 norm.SetPlane(bending,!bending);
262 else if ( norm.IsPlaneDefined() && !norm.IsCathodeDefined() )
264 // derive cathode from plane
266 AliMp::PlaneType planeType = ( norm.IsBendingPlane() ? AliMp::kBendingPlane : AliMp::kNonBendingPlane );
268 AliMp::CathodType cathode = AliMpDEManager::GetCathod(fDetElemId,planeType);
270 Bool_t cath0 = ( cathode == AliMp::kCath0 );
272 norm.SetCathode(cath0,!cath0);
274 else if ( norm.IsPlaneDefined() && norm.IsCathodeDefined() )
276 // check that cathode and plane matches
278 AliMp::CathodType cathode = ( norm.IsCathode0() ? AliMp::kCath0 : AliMp::kCath1 ) ;
280 AliMp::PlaneType planeType = AliMpDEManager::GetPlaneType(fDetElemId,cathode);
282 Bool_t bending = ( planeType == AliMp::kBendingPlane );
284 if ( bending != norm.IsBendingPlane() )
286 norm.SetValid(kFALSE);