Adding a class to create dN/deta from FMD analysis output
[u/mrichter/AliRoot.git] / MUON / AliMUONPainterHelper.cxx
CommitLineData
0145e89a 1/**************************************************************************
2* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
3* *
4* Author: The ALICE Off-line Project. *
5* Contributors are mentioned in the code where appropriate. *
6* *
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**************************************************************************/
15
16// $Id$
17
b09247a2 18#include <cstdlib>
0145e89a 19#include "AliMUONPainterHelper.h"
20
8f0acce4 21#include "AliCodeTimer.h"
22#include "AliLog.h"
23#include "AliMUONContour.h"
24#include "AliMUONContourMaker.h"
0145e89a 25#include "AliMUONGeometryDetElement.h"
26#include "AliMUONGeometryTransformer.h"
8f0acce4 27#include "AliMUONManuContourMaker.h"
0145e89a 28#include "AliMUONPainterEnv.h"
29#include "AliMUONPainterMatrix.h"
0145e89a 30#include "AliMUONPainterRegistry.h"
31#include "AliMUONVCalibParam.h"
32#include "AliMUONVDigit.h"
33#include "AliMUONVTrackerData.h"
34#include "AliMpCDB.h"
35#include "AliMpConstants.h"
36#include "AliMpDDLStore.h"
37#include "AliMpDEIterator.h"
38#include "AliMpDEManager.h"
39#include "AliMpExMap.h"
40#include "AliMpMotifMap.h"
41#include "AliMpMotifPosition.h"
42#include "AliMpPCB.h"
43#include "AliMpPad.h"
44#include "AliMpSector.h"
0145e89a 45#include "AliMpSegmentation.h"
46#include "AliMpSlat.h"
0145e89a 47#include "AliMpStationType.h"
48#include "AliMpVPadIterator.h"
0145e89a 49#include <Riostream.h>
50#include <TArrayI.h>
51#include <TCanvas.h>
52#include <TClass.h>
53#include <TCollection.h>
54#include <TFile.h>
55#include <TGLabel.h>
0145e89a 56#include <TGMsgBox.h>
8f0acce4 57#include <TGeoMatrix.h>
0145e89a 58#include <TLine.h>
59#include <TList.h>
60#include <TMap.h>
61#include <TObjArray.h>
62#include <TObjString.h>
63#include <TStyle.h>
64#include <TSystem.h>
65#include <TVector2.h>
66#include <TVector3.h>
67#include <TVirtualPad.h>
68#include <TVirtualX.h>
69
8f0acce4 70#include "AliMUONChamberPainter.h"
71
0145e89a 72///\class AliMUONPainterHelper
73///
74/// Helper class for painters
75///
76///\author Laurent Aphecetche, Subatech
77
78///\cond CLASSIMP
79ClassImp(AliMUONPainterHelper)
80///\endcond
81
82AliMUONPainterHelper* AliMUONPainterHelper::fgInstance(0x0);
83
84//_____________________________________________________________________________
85AliMUONPainterHelper::AliMUONPainterHelper() :
8f0acce4 86TObject(),
87fExplodedGlobalTransformations(0x0),
88fRealGlobalTransformations(0x0),
89fPainterMatrices(0x0),
90fEnv(0x0),
91fAllContours(20000,1)
0145e89a 92{
93 /// ctor
8f0acce4 94
95 fAllContours.SetOwnerKeyValue(kTRUE,kTRUE);
96
0145e89a 97 fExplodeFactor[0] = 1.00;
98 fExplodeFactor[1] = 1.50;
99
100 if ( ! AliMpCDB::LoadMpSegmentation() )
101 {
102 AliFatal("Could not access mapping from OCDB !");
103 }
104
105 // Load DDL store
106 if ( ! AliMpCDB::LoadDDLStore() )
107 {
108 AliFatal("Could not access DDL Store from OCDB !");
109 }
110}
111
112//_____________________________________________________________________________
113AliMUONPainterHelper::~AliMUONPainterHelper()
114{
115 /// dtor
0145e89a 116 delete fExplodedGlobalTransformations;
117 delete fRealGlobalTransformations;
0145e89a 118 delete fPainterMatrices;
8f0acce4 119 fEnv->Save();
0145e89a 120 fgInstance = 0;
121}
122
123//_____________________________________________________________________________
8f0acce4 124AliMUONContour*
0145e89a 125AliMUONPainterHelper::GetContour(const char* contourName) const
126{
8f0acce4 127 /// Get a contour by name
128 return static_cast<AliMUONContour*>(fAllContours.GetValue(contourName));
0145e89a 129}
130
131//_____________________________________________________________________________
132void
133AliMUONPainterHelper::GenerateDefaultMatrices()
134{
135 /// Kind of bootstrap method to trigger the generation of all contours
136
8f0acce4 137 AliCodeTimerAuto("");
138
0145e89a 139 fPainterMatrices = new TObjArray;
140 fPainterMatrices->SetOwner(kFALSE);
141
142 TObjArray attributes;
143
144 AliMUONAttPainter att;
145
146 att.SetViewPoint(kTRUE,kFALSE);
147 att.SetPlane(kFALSE,kFALSE);
148 att.SetCathode(kTRUE,kFALSE);
8f0acce4 149
0145e89a 150 att.SetCathode(kFALSE,kFALSE);
151 att.SetPlane(kTRUE,kFALSE);
152 attributes.Add(new AliMUONAttPainter(att));
8f0acce4 153
154// commented the lines below, as it's now fast enough to be created on the fly,
155// only when requested by the user
156//
157// attributes.Add(new AliMUONAttPainter(att));
158// att.SetCathode(kFALSE,kTRUE);
159// attributes.Add(new AliMUONAttPainter(att));
160// att.SetPlane(kFALSE,kTRUE);
161// attributes.Add(new AliMUONAttPainter(att));
0145e89a 162
163 TIter next(&attributes);
164 AliMUONAttPainter* a;
165
166 while ( ( a = static_cast<AliMUONAttPainter*>(next()) ) )
167 {
168 AliMUONPainterMatrix* matrix = new AliMUONPainterMatrix("Tracker",5,2);
169
170 for ( Int_t i = 0; i < 10; ++i )
171 {
8f0acce4 172 AliMUONVPainter* painter = new AliMUONChamberPainter(*a,i);
0145e89a 173
174 painter->SetResponder("Chamber");
175
176 painter->SetOutlined("*",kFALSE);
177
178 painter->SetOutlined("MANU",kTRUE);
179
180 for ( Int_t j = 0; j < 3; ++j )
181 {
182 painter->SetLine(j,1,4-j);
183 }
184
185 matrix->Adopt(painter);
186 }
187 AliMUONPainterRegistry::Instance()->Register(matrix);
188 fPainterMatrices->Add(matrix);
189 }
190}
191
192//_____________________________________________________________________________
193void
194AliMUONPainterHelper::GenerateGeometry()
195{
196 /// Generate the geometry (FIXME: using transform.dat for the moment)
197 /// The geometry is not the "normal" one as we "explode" it to avoid
198 /// having overlapping detection elements as in the reality, which
199 /// would be inconvenient for a display ;-)
200
8f0acce4 201 AliCodeTimerAuto("");
0145e89a 202
203 AliMUONGeometryTransformer transformer;
204 transformer.LoadGeometryData("transform.dat");
630711ed 205 fExplodedGlobalTransformations = new AliMpExMap;
206 fRealGlobalTransformations = new AliMpExMap;
0145e89a 207 AliMpDEIterator deIt;
208 deIt.First();
209 while ( !deIt.IsDone() )
210 {
211 Int_t detElemId = deIt.CurrentDEId();
212 const AliMUONGeometryDetElement* de = transformer.GetDetElement(detElemId);
213
214 fRealGlobalTransformations->Add(detElemId,de->GetGlobalTransformation()->Clone());
215
216 TGeoHMatrix* matrix = static_cast<TGeoHMatrix*>(de->GetGlobalTransformation()->Clone());
217 Double_t* translation = matrix->GetTranslation();
218
219 AliDebug(1,Form("Initial translation for DE %04d is %7.3f, %7.3f",
220 detElemId,translation[0],translation[1]));
221
222 if ( AliMpDEManager::GetStationType(detElemId) == AliMp::kStation345 )
223 {
224 translation[0] *= fExplodeFactor[0];
225 translation[1] *= fExplodeFactor[1];
226 }
227 else
228 {
229 Double_t shift = 5; // cm
230 Double_t xshift[] = { shift, -shift, -shift, shift };
231 Double_t yshift[] = { shift, shift, -shift, -shift };
232 Int_t ishift = detElemId % 100;
233
234 translation[0] += xshift[ishift];
235 translation[1] += yshift[ishift];
236 }
237 matrix->SetTranslation(translation);
238 fExplodedGlobalTransformations->Add(detElemId,matrix);
239 deIt.Next();
240 }
241}
242
243//_____________________________________________________________________________
8f0acce4 244AliMUONContour*
0145e89a 245AliMUONPainterHelper::GenerateManuContour(Int_t detElemId,
246 Int_t manuId,
247 AliMUONAttPainter viewType,
248 const char* contourName)
249{
250 /// Generate the contour of the list of pads
251
8f0acce4 252 static AliMUONManuContourMaker maker(fExplodedGlobalTransformations);
0145e89a 253
8f0acce4 254 if ( viewType.IsBackView() )
0145e89a 255 {
8f0acce4 256 AliError("Backview not implemented yet (and will probably never be, after all...)");
257 return 0x0;
0145e89a 258 }
259
8f0acce4 260 AliMUONContour* contour = maker.CreateManuContour(detElemId,manuId,contourName);
0145e89a 261
8f0acce4 262 if ( !contour ) return 0x0;
0145e89a 263
8f0acce4 264 AliMUONContour* pContour = new AliMUONContour(*contour);
0145e89a 265
8f0acce4 266 if (pContour)
0145e89a 267 {
8f0acce4 268 RegisterContour(pContour);
0145e89a 269 }
0145e89a 270
8f0acce4 271 return pContour;
0145e89a 272}
273
274//_____________________________________________________________________________
275AliMp::CathodType
276AliMUONPainterHelper::GetCathodeType(Int_t detElemId, Int_t manuId) const
277{
278 /// Get the cathode type of a given manu
279
280 AliMp::PlaneType planeType(AliMp::kBendingPlane);
281 if ( manuId & AliMpConstants::ManuMask(AliMp::kNonBendingPlane) )
282 {
283 planeType = AliMp::kNonBendingPlane;
284 }
285 return AliMpDEManager::GetCathod(detElemId,planeType);
286}
287
0145e89a 288
289//_____________________________________________________________________________
290AliMpMotifPosition*
291AliMUONPainterHelper::GetMotifPosition(Int_t detElemId, Int_t manuId) const
292{
293 /// Get a given motif position
294 AliMp::StationType stationType = AliMpDEManager::GetStationType(detElemId);
295 if ( stationType == AliMp::kStation345 )
296 {
297 AliMp::PlaneType planeType(AliMp::kBendingPlane);
298 if ( manuId & AliMpConstants::ManuMask(AliMp::kNonBendingPlane) )
299 {
300 planeType = AliMp::kNonBendingPlane;
301 }
302 const AliMpSlat* slat = GetSlat(detElemId,planeType);
303 return slat->FindMotifPosition(manuId);
304 }
305 else if ( stationType != AliMp::kStationTrigger )
306 {
307 AliMp::PlaneType planeType(AliMp::kBendingPlane);
308 if ( manuId & AliMpConstants::ManuMask(AliMp::kNonBendingPlane) )
309 {
310 planeType = AliMp::kNonBendingPlane;
311 }
312 const AliMpSector* sector = GetSector(detElemId,planeType);
313 return sector->GetMotifMap()->FindMotifPosition(manuId);
314 }
315 AliFatalClass("Not supposed to work with trigger");
316 return 0x0;
317}
318
319
320//_____________________________________________________________________________
321AliMpPCB*
322AliMUONPainterHelper::GetPCB(Int_t detElemId, AliMp::CathodType cathodeType,
323 Int_t pcbNumber) const
324{
325 /// Get a given PCB
326 const AliMpSlat* slat = GetSlat(detElemId,cathodeType);
327 if ( slat ) return slat->GetPCB(pcbNumber);
328 return 0x0;
329}
330
331//_____________________________________________________________________________
332AliMpPCB*
333AliMUONPainterHelper::GetPCB(Int_t detElemId, AliMp::PlaneType planeType,
334 Int_t pcbNumber) const
335{
336 /// Get a given PCB
337 AliMp::CathodType cathodeType = AliMpDEManager::GetCathod(detElemId,
338 planeType);
339 return GetPCB(detElemId,cathodeType,pcbNumber);
340}
341
342//_____________________________________________________________________________
343AliMp::PlaneType
344AliMUONPainterHelper::GetPlaneType(Int_t manuId) const
345{
346 /// Get the planeType of a given manu
347
348 if ( manuId & AliMpConstants::ManuMask(AliMp::kNonBendingPlane) )
349 {
350 return AliMp::kNonBendingPlane;
351 }
352 return AliMp::kBendingPlane;
353}
354
355//_____________________________________________________________________________
356const AliMpSlat*
357AliMUONPainterHelper::GetSlat(Int_t detElemId, AliMp::PlaneType planeType) const
358{
359 /// Get a given slat
360
361 AliMp::CathodType cathodeType = AliMpDEManager::GetCathod(detElemId,
362 planeType);
363
364 return GetSlat(detElemId,cathodeType);
365}
366
367//_____________________________________________________________________________
368const AliMpSector*
369AliMUONPainterHelper::GetSector(Int_t detElemId, AliMp::PlaneType planeType) const
370{
371 /// Get a given sector
372 AliMp::StationType stationType = AliMpDEManager::GetStationType(detElemId);
4e51cfd2 373 if ( stationType != AliMp::kStation12 ) return 0x0;
0145e89a 374
375 AliMp::CathodType cathodeType = AliMpDEManager::GetCathod(detElemId,planeType);
376
f3ed9a44 377 return AliMpSegmentation::Instance()->GetSector(detElemId,cathodeType);
0145e89a 378}
379
380//_____________________________________________________________________________
381const AliMpSlat*
382AliMUONPainterHelper::GetSlat(Int_t detElemId, AliMp::CathodType cathodeType) const
383{
384 /// Get a given slat
385 AliMp::StationType stationType = AliMpDEManager::GetStationType(detElemId);
386 if ( stationType != AliMp::kStation345 ) return 0x0;
387
f3ed9a44 388 return AliMpSegmentation::Instance()->GetSlat(detElemId,cathodeType);
0145e89a 389}
390
391//_____________________________________________________________________________
392const AliMpSlat*
393AliMUONPainterHelper::GetSlat(Int_t detElemId, Int_t manuId) const
394{
395 /// Get a given slat
f3ed9a44 396 AliMp::StationType stationType = AliMpDEManager::GetStationType(detElemId);
397 if ( stationType != AliMp::kStation345 ) return 0x0;
398
399 return AliMpSegmentation::Instance()->GetSlatByElectronics(detElemId,manuId);
0145e89a 400}
401
402//_____________________________________________________________________________
403AliMUONPainterHelper*
404AliMUONPainterHelper::Instance()
405{
406 /// Return the global and unique instance of this class
407
408 if (fgInstance) return fgInstance;
0145e89a 409
8f0acce4 410 AliCodeTimerAutoClass("");
411
412 fgInstance = new AliMUONPainterHelper;
413 fgInstance->GenerateGeometry();
414 fgInstance->GenerateDefaultMatrices();
415 fgInstance->fEnv = new AliMUONPainterEnv;
0145e89a 416 return fgInstance;
417}
418
419//_____________________________________________________________________________
420void
421AliMUONPainterHelper::Global2Local(Int_t detElemId,
422 Double_t xg, Double_t yg, Double_t zg,
423 Double_t& xl, Double_t& yl, Double_t& zl) const
424{
425 /// Local to global transformation of coordinates
426
427 TGeoHMatrix* matrix = static_cast<TGeoHMatrix*>(fExplodedGlobalTransformations->GetValue(detElemId));
428 Double_t pg[3] = { xg, yg, zg };
429 Double_t pl[3] = { 0., 0., 0. };
430 matrix->MasterToLocal(pg, pl);
431 xl = pl[0];
432 yl = pl[1];
433 zl = pl[2];
434}
435
436//_____________________________________________________________________________
437void
438AliMUONPainterHelper::Global2LocalReal(Int_t detElemId,
439 Double_t xg, Double_t yg, Double_t zg,
440 Double_t& xl, Double_t& yl, Double_t& zl) const
441{
442 /// Local to global transformation of coordinates
443
444 TGeoHMatrix* matrix = static_cast<TGeoHMatrix*>(fRealGlobalTransformations->GetValue(detElemId));
445 Double_t pg[3] = { xg, yg, zg };
446 Double_t pl[3] = { 0., 0., 0. };
447 matrix->MasterToLocal(pg, pl);
448 xl = pl[0];
449 yl = pl[1];
450 zl = pl[2];
451}
452
453//_____________________________________________________________________________
454void
455AliMUONPainterHelper::Local2Global(Int_t detElemId,
456 Double_t xl, Double_t yl, Double_t zl,
457 Double_t& xg, Double_t& yg, Double_t& zg) const
458{
459 /// Local to (exploded) global transformation of coordinates
460
461 TGeoHMatrix* matrix = static_cast<TGeoHMatrix*>(fExplodedGlobalTransformations->GetValue(detElemId));
462 Double_t pl[3] = { xl, yl, zl };
463 Double_t pg[3] = { 0., 0., 0. };
464 matrix->LocalToMaster(pl, pg);
465 xg = pg[0];
466 yg = pg[1];
467 zg = pg[2];
468}
469
470//_____________________________________________________________________________
471void
472AliMUONPainterHelper::Local2GlobalReal(Int_t detElemId,
473 Double_t xl, Double_t yl, Double_t zl,
474 Double_t& xg, Double_t& yg, Double_t& zg) const
475{
476 /// Local to (real) global transformation of coordinates
477
478 TGeoHMatrix* matrix = static_cast<TGeoHMatrix*>(fRealGlobalTransformations->GetValue(detElemId));
479 Double_t pl[3] = { xl, yl, zl };
480 Double_t pg[3] = { 0., 0., 0. };
481 matrix->LocalToMaster(pl, pg);
482 xg = pg[0];
483 yg = pg[1];
484 zg = pg[2];
485}
486
487//_____________________________________________________________________________
488Int_t
489AliMUONPainterHelper::ColorFromValue(Double_t value, Double_t min, Double_t max) const
490{
491 /// Convert a value into a color, fitting within a given range
492
493 Int_t rv;
494
495 if (value > max) rv = 1;
496 else if (value <= min) rv = 0;
497 else
498 {
499 if ( max == min ) return gStyle->GetColorPalette(1);
500 Double_t range = max - min;
501 Double_t offset = value - min;
502 rv = gStyle->GetColorPalette( 1 + int( offset*(gStyle->GetNumberOfColors()-2)/range - 0.5 ) );
503 }
504 return rv;
505}
506
507//_____________________________________________________________________________
8f0acce4 508AliMUONContour*
0145e89a 509AliMUONPainterHelper::MergeContours(const TObjArray& contours,
510 const char* contourName)
511{
512 /// Merge a set of contours (delegating to the contour maker)
0145e89a 513
8f0acce4 514 AliMUONContourMaker maker;
515
516 AliMUONContour* contour = maker.MergeContour(contours,contourName);
0145e89a 517
518 if (contour)
519 {
520 RegisterContour(contour);
521 }
522 return contour;
523}
524
525
526//_____________________________________________________________________________
527void
528AliMUONPainterHelper::Print(Option_t* opt) const
529{
530 /// Printout
531 TString sopt(opt);
532 sopt.ToUpper();
533
534 if ( sopt.Length() == 0 )
535 {
536 cout << Form("ExplodeFactor=%e,%e",fExplodeFactor[0],fExplodeFactor[1]) << endl;
0145e89a 537 cout << endl;
538 cout << Form("GlobalTransformations=%x",fExplodedGlobalTransformations);
539 if ( fExplodedGlobalTransformations ) cout << Form(" with %d transformations",fExplodedGlobalTransformations->GetSize());
540 cout << endl;
8f0acce4 541 cout << Form("Contour map : collisions = %5.3f size = %d capacity = %d",
542 fAllContours.AverageCollisions(),
543 fAllContours.GetSize(),
544 fAllContours.Capacity()) << endl;
0145e89a 545 cout << endl;
0145e89a 546 }
547
548 if ( sopt.Contains("MATRI") || sopt.Contains("FULL") )
549 {
550 fPainterMatrices->Print(opt);
551 }
552}
553
554//_____________________________________________________________________________
555void
8f0acce4 556AliMUONPainterHelper::RegisterContour(AliMUONContour* contour)
0145e89a 557{
558 /// contour is adopted by contourMaker
559 AliCodeTimerAuto("")
560 AliDebug(1,contour->GetName());
8f0acce4 561 if ( fAllContours.GetValue(contour->GetName()) )
0145e89a 562 {
563 AliError(Form("Contour with name %s is already there",contour->GetName()));
564// Print("CONTOUR");
565 return;
566 }
8f0acce4 567 fAllContours.Add(new TObjString(contour->GetName()),contour);
0145e89a 568}
569
570//_____________________________________________________________________________
571AliMpPad
572AliMUONPainterHelper::PadByExplodedPosition(Int_t detElemId, Int_t manuId,
573 Double_t x, Double_t y) const
574{
575 /// Find a pad by exploded position. FIXME: not really used nor tested !
576
577 Double_t xr, yr, zr;
578
579// Local2Global(detElemId,0.0,0.0,0.0,dummy,dummy,z); // to find z
580
581 AliDebug(1,Form("DE %04d ManuID %04d x %7.3f y %7.3f",detElemId,manuId,x,y));
582
583 Exploded2Real(detElemId,x,y,0,xr,yr,zr);
584
585 AliDebug(1,Form("xr %7.3f yr %7.3f zr %7.3f",xr,yr,zr));
586
587 Double_t xl,yl,zl;
588
589 Global2LocalReal(detElemId,xr,yr,zr,xl,yl,zl);
590
591 AliDebug(1,Form("xl %7.3f yl %7.3f zl %7.3f",xl,yl,zl));
592
593 const AliMpVSegmentation* seg = AliMpSegmentation::Instance()->GetMpSegmentationByElectronics(detElemId,manuId);
594
6e97fbb8 595 AliDebug(1,Form("dx,dy=%7.3f,%7.3f",seg->GetDimensionX(),seg->GetDimensionY()));
0145e89a 596
6e97fbb8 597 return seg->PadByPosition(xl,yl);
0145e89a 598}
599
600//_____________________________________________________________________________
601void
602AliMUONPainterHelper::Exploded2Real(Int_t detElemId,
603 Double_t xe, Double_t ye, Double_t ze,
604 Double_t& xr, Double_t& yr, Double_t& zr) const
605{
606 /// Convert exploded coordinates into real ones. FIXME: not really used nor tested !
607
608 // first go back to local
609
610 Double_t xl,yl,zl;
611
612 Global2Local(detElemId,xe,ye,ze,xl,yl,zl);
613
614 // and then back to global but not exploded
615
616 Local2GlobalReal(detElemId,xl,yl,zl,xr,yr,zr);
617}
618
619//_____________________________________________________________________________
620TString
621AliMUONPainterHelper::ChamberName(Int_t chamberId) const
622{
623 /// Build a name for one chamber
624 return Form("Chamber%1d",chamberId);
625}
626
627//_____________________________________________________________________________
628TString
629AliMUONPainterHelper::StationName(Int_t stationId) const
630{
631 /// Build a name for one station
632 return Form("Station%1d",stationId+1);
633}
634
635//_____________________________________________________________________________
636TString
637AliMUONPainterHelper::DEName(Int_t detElemId) const
638{
639 /// Build a name for one detection element
640 return Form("DE%04d",detElemId);
641}
642
643//_____________________________________________________________________________
644TString
645AliMUONPainterHelper::ManuName(Int_t manuId) const
646{
647 /// Build a name for one manu
648 return Form("MANU%04d",manuId);
649}
650
651//_____________________________________________________________________________
652TString
653AliMUONPainterHelper::BusPatchName(Int_t busPatchId) const
654{
655 /// Build a name for one buspatch
656 return Form("BUSPATCH%04d",busPatchId);
657}
658
659//_____________________________________________________________________________
660TString
661AliMUONPainterHelper::PCBName(Int_t pcbNumber) const
662{
663 /// Build a name for one pcb
664 return Form("PCB%1d",pcbNumber);
665}
666
667//_____________________________________________________________________________
668TString
669AliMUONPainterHelper::ChamberPathName(Int_t chamberId) const
670{
671 /// Build a name for one chamber
672 return Form("%s/%s",StationName(chamberId/2).Data(),ChamberName(chamberId).Data());
673}
674
675//_____________________________________________________________________________
676TString
677AliMUONPainterHelper::StationPathName(Int_t stationId) const
678{
679 /// Build a name for one station
680 return StationName(stationId);
681}
682
683//_____________________________________________________________________________
684TString
685AliMUONPainterHelper::DEPathName(Int_t detElemId) const
686{
687 /// Build a name for one detection element
688
689 Int_t chamberId = AliMpDEManager::GetChamberId(detElemId);
690
691 return Form("%s/%s/%s",
692 StationName(chamberId/2).Data(),
693 ChamberName(chamberId).Data(),
694 DEName(detElemId).Data());
695}
696
697//_____________________________________________________________________________
698TString
699AliMUONPainterHelper::ManuPathName(Int_t detElemId, Int_t manuId) const
700{
701 /// Build a name for one manu
702 return Form("%s/%s",DEPathName(detElemId).Data(),ManuName(manuId).Data());
703}
704
705//_____________________________________________________________________________
706TString
707AliMUONPainterHelper::BusPatchPathName(Int_t busPatchId) const
708{
709 /// Build a name for one buspatch
710 Int_t detElemId = AliMpDDLStore::Instance()->GetDEfromBus(busPatchId);
711
712 return Form("%s/%s",DEPathName(detElemId).Data(),BusPatchName(busPatchId).Data());
713}
714
715//_____________________________________________________________________________
716TString
717AliMUONPainterHelper::PCBPathName(Int_t detElemId, Int_t pcbNumber) const
718{
719 /// Build a name for one pcb
720 return Form("%s/%s",DEPathName(detElemId).Data(),PCBName(pcbNumber).Data());
721}
722
723//_____________________________________________________________________________
724TString
725AliMUONPainterHelper::FormatValue(const char* name, Double_t value) const
726{
727 /// Format a double value to be displayed
728 /// FIXME: should insure we have the right number of significant digits here...
729
730 return Form("%s = %e",name,value);
731}
8f0acce4 732