]> git.uio.no Git - u/mrichter/AliRoot.git/blob - MUON/AliMUONPainterHelper.cxx
Fixing compiler warnings
[u/mrichter/AliRoot.git] / MUON / AliMUONPainterHelper.cxx
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
18 #include <cstdlib>
19 #include "AliMUONPainterHelper.h"
20
21 #include "AliCodeTimer.h"
22 #include "AliLog.h"
23 #include "AliMUONContour.h"
24 #include "AliMUONContourMaker.h"
25 #include "AliMUONGeometryDetElement.h"
26 #include "AliMUONGeometryTransformer.h"
27 #include "AliMUONManuContourMaker.h"
28 #include "AliMUONPainterEnv.h"
29 #include "AliMUONPainterMatrix.h"
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"
45 #include "AliMpSegmentation.h"
46 #include "AliMpSlat.h"
47 #include "AliMpStationType.h"
48 #include "AliMpVPadIterator.h"
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>
56 #include <TGMsgBox.h>
57 #include <TGeoMatrix.h>
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
70 #include "AliMUONChamberPainter.h"
71
72 ///\class AliMUONPainterHelper
73 ///
74 /// Helper class for painters
75 ///
76 ///\author Laurent Aphecetche, Subatech
77
78 ///\cond CLASSIMP
79 ClassImp(AliMUONPainterHelper)
80 ///\endcond
81
82 AliMUONPainterHelper* AliMUONPainterHelper::fgInstance(0x0);
83
84 //_____________________________________________________________________________
85 AliMUONPainterHelper::AliMUONPainterHelper() : 
86 TObject(),
87 fExplodedGlobalTransformations(0x0),
88 fRealGlobalTransformations(0x0),
89 fPainterMatrices(0x0),
90 fEnv(0x0),
91 fAllContours(20000,1)
92 {
93     /// ctor
94   
95   fAllContours.SetOwnerKeyValue(kTRUE,kTRUE);
96   
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 //_____________________________________________________________________________
113 AliMUONPainterHelper::~AliMUONPainterHelper()
114 {
115   /// dtor
116   delete fExplodedGlobalTransformations;
117   delete fRealGlobalTransformations;
118   delete fPainterMatrices;
119   fEnv->Save();
120   fgInstance = 0;
121 }
122
123 //_____________________________________________________________________________
124 AliMUONContour*
125 AliMUONPainterHelper::GetContour(const char* contourName) const
126 {
127   /// Get a contour by name  
128   return static_cast<AliMUONContour*>(fAllContours.GetValue(contourName));
129 }
130
131 //_____________________________________________________________________________
132 void
133 AliMUONPainterHelper::GenerateDefaultMatrices()
134 {
135   /// Kind of bootstrap method to trigger the generation of all contours
136   
137   AliCodeTimerAuto("");
138   
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);
149
150   att.SetCathode(kFALSE,kFALSE);
151   att.SetPlane(kTRUE,kFALSE);
152   attributes.Add(new AliMUONAttPainter(att));
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));
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     {
172       AliMUONVPainter* painter = new AliMUONChamberPainter(*a,i);
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 //_____________________________________________________________________________
193 void
194 AliMUONPainterHelper::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   
201   AliCodeTimerAuto("");
202   
203   AliMUONGeometryTransformer transformer;
204   transformer.LoadGeometryData("transform.dat");
205   fExplodedGlobalTransformations = new AliMpExMap;
206   fRealGlobalTransformations = new AliMpExMap;
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 //_____________________________________________________________________________
244 AliMUONContour* 
245 AliMUONPainterHelper::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   
252   static AliMUONManuContourMaker maker(fExplodedGlobalTransformations);
253   
254   if ( viewType.IsBackView() )
255   {
256     AliError("Backview not implemented yet (and will probably never be, after all...)");
257     return 0x0;
258   }
259   
260   AliMUONContour* contour = maker.CreateManuContour(detElemId,manuId,contourName);
261   
262   if ( !contour ) return 0x0;
263   
264   AliMUONContour* pContour = new AliMUONContour(*contour);
265   
266   if (pContour) 
267   {
268     RegisterContour(pContour);
269   }
270   
271   return pContour;
272 }
273
274 //_____________________________________________________________________________
275 AliMp::CathodType
276 AliMUONPainterHelper::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
288
289 //_____________________________________________________________________________
290 AliMpMotifPosition* 
291 AliMUONPainterHelper::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 //_____________________________________________________________________________
321 AliMpPCB*
322 AliMUONPainterHelper::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 //_____________________________________________________________________________
332 AliMpPCB*
333 AliMUONPainterHelper::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 //_____________________________________________________________________________
343 AliMp::PlaneType
344 AliMUONPainterHelper::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 //_____________________________________________________________________________
356 const AliMpSlat*
357 AliMUONPainterHelper::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 //_____________________________________________________________________________
368 const AliMpSector*
369 AliMUONPainterHelper::GetSector(Int_t detElemId, AliMp::PlaneType planeType) const
370 {
371   /// Get a given sector
372   AliMp::StationType stationType = AliMpDEManager::GetStationType(detElemId);
373   if ( stationType != AliMp::kStation12 ) return 0x0;
374   
375   AliMp::CathodType cathodeType = AliMpDEManager::GetCathod(detElemId,planeType);
376   
377   return AliMpSegmentation::Instance()->GetSector(detElemId,cathodeType);
378 }
379
380 //_____________________________________________________________________________
381 const AliMpSlat*
382 AliMUONPainterHelper::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
388   return AliMpSegmentation::Instance()->GetSlat(detElemId,cathodeType);
389 }
390
391 //_____________________________________________________________________________
392 const AliMpSlat*
393 AliMUONPainterHelper::GetSlat(Int_t detElemId, Int_t manuId) const
394 {
395   /// Get a given slat
396   AliMp::StationType stationType = AliMpDEManager::GetStationType(detElemId);
397   if ( stationType != AliMp::kStation345 ) return 0x0;
398
399   return AliMpSegmentation::Instance()->GetSlatByElectronics(detElemId,manuId);
400 }
401
402 //_____________________________________________________________________________
403 AliMUONPainterHelper*
404 AliMUONPainterHelper::Instance()
405 {
406   /// Return the global and unique instance of this class
407   
408   if (fgInstance) return fgInstance;
409
410   AliCodeTimerAutoClass("");
411
412   fgInstance = new AliMUONPainterHelper;
413   fgInstance->GenerateGeometry();
414   fgInstance->GenerateDefaultMatrices();
415   fgInstance->fEnv = new AliMUONPainterEnv;
416   return fgInstance;
417 }
418
419 //_____________________________________________________________________________
420 void 
421 AliMUONPainterHelper::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 //_____________________________________________________________________________
437 void 
438 AliMUONPainterHelper::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 //_____________________________________________________________________________
454 void 
455 AliMUONPainterHelper::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 //_____________________________________________________________________________
471 void 
472 AliMUONPainterHelper::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 //_____________________________________________________________________________
488 Int_t
489 AliMUONPainterHelper::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 //_____________________________________________________________________________
508 AliMUONContour* 
509 AliMUONPainterHelper::MergeContours(const TObjArray& contours, 
510                                     const char* contourName)
511 {
512   /// Merge a set of contours (delegating to the contour maker)
513   
514   AliMUONContourMaker maker;
515   
516   AliMUONContour* contour = maker.MergeContour(contours,contourName);
517   
518   if (contour) 
519   {
520     RegisterContour(contour);
521   }
522   return contour;
523 }
524
525
526 //_____________________________________________________________________________
527 void
528 AliMUONPainterHelper::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;
537     cout << endl;
538     cout << Form("GlobalTransformations=%x",fExplodedGlobalTransformations);
539     if ( fExplodedGlobalTransformations ) cout << Form(" with %d transformations",fExplodedGlobalTransformations->GetSize());
540     cout << endl;
541     cout << Form("Contour map : collisions = %5.3f size = %d capacity = %d", 
542                  fAllContours.AverageCollisions(),
543                  fAllContours.GetSize(),
544                  fAllContours.Capacity()) << endl;
545     cout << endl;
546   }
547   
548   if ( sopt.Contains("MATRI") || sopt.Contains("FULL") )
549   {
550     fPainterMatrices->Print(opt);
551   }
552 }
553
554 //_____________________________________________________________________________
555 void
556 AliMUONPainterHelper::RegisterContour(AliMUONContour* contour)
557 {
558   /// contour is adopted by contourMaker
559   AliCodeTimerAuto("")
560   AliDebug(1,contour->GetName());
561   if ( fAllContours.GetValue(contour->GetName()) ) 
562   {
563     AliError(Form("Contour with name %s is already there",contour->GetName()));
564 //    Print("CONTOUR");
565     return;
566   }
567   fAllContours.Add(new TObjString(contour->GetName()),contour);
568 }
569
570 //_____________________________________________________________________________
571 AliMpPad 
572 AliMUONPainterHelper::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   
595   AliDebug(1,Form("dx,dy=%7.3f,%7.3f",seg->GetDimensionX(),seg->GetDimensionY()));
596   
597   return seg->PadByPosition(xl,yl);
598 }
599
600 //_____________________________________________________________________________
601 void 
602 AliMUONPainterHelper::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 //_____________________________________________________________________________
620 TString 
621 AliMUONPainterHelper::ChamberName(Int_t chamberId) const
622 {
623   /// Build a name for one chamber
624   return Form("Chamber%1d",chamberId);
625 }
626
627 //_____________________________________________________________________________
628 TString 
629 AliMUONPainterHelper::StationName(Int_t stationId) const
630 {
631   /// Build a name for one station
632   return Form("Station%1d",stationId+1);
633 }
634
635 //_____________________________________________________________________________
636 TString 
637 AliMUONPainterHelper::DEName(Int_t detElemId) const
638 {
639   /// Build a name for one detection element
640   return Form("DE%04d",detElemId);
641 }
642
643 //_____________________________________________________________________________
644 TString 
645 AliMUONPainterHelper::ManuName(Int_t manuId) const
646 {
647   /// Build a name for one manu
648   return Form("MANU%04d",manuId);
649 }
650
651 //_____________________________________________________________________________
652 TString 
653 AliMUONPainterHelper::BusPatchName(Int_t busPatchId) const
654 {
655   /// Build a name for one buspatch
656   return Form("BUSPATCH%04d",busPatchId);
657 }
658
659 //_____________________________________________________________________________
660 TString 
661 AliMUONPainterHelper::PCBName(Int_t pcbNumber) const
662 {
663   /// Build a name for one pcb
664   return Form("PCB%1d",pcbNumber);
665 }
666
667 //_____________________________________________________________________________
668 TString 
669 AliMUONPainterHelper::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 //_____________________________________________________________________________
676 TString 
677 AliMUONPainterHelper::StationPathName(Int_t stationId) const
678 {
679   /// Build a name for one station
680   return StationName(stationId);
681 }
682
683 //_____________________________________________________________________________
684 TString 
685 AliMUONPainterHelper::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 //_____________________________________________________________________________
698 TString 
699 AliMUONPainterHelper::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 //_____________________________________________________________________________
706 TString 
707 AliMUONPainterHelper::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 //_____________________________________________________________________________
716 TString 
717 AliMUONPainterHelper::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 //_____________________________________________________________________________
724 TString
725 AliMUONPainterHelper::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 }
732