]> git.uio.no Git - u/mrichter/AliRoot.git/blob - MUON/AliMUONAttPainter.cxx
Changing fabs into TMath::Abs
[u/mrichter/AliRoot.git] / MUON / AliMUONAttPainter.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 "AliMUONAttPainter.h"
19
20 #include <Riostream.h>
21
22 /// \class AliMUONAttPainter
23 ///
24 /// Basic attributes shared by all AliMUONVPainter objects
25 ///
26 /// One basic attribute is "what side" of the detector part we are representing.
27 /// Take the example of one full chamber. We can represent it as seen from the
28 /// interaction point, i.e. showing all the "cathode0" of all detection elements.
29 ///
30 /// Or we might want to see only the bending (or non bending) planes of all the
31 /// detection elements.
32 ///
33 /// This is governed by the SetCathode() and SetPlane() methods (and retrieved
34 /// using IsCathodeDefined() and IsPlaneDefined() methods. In the first case
35 /// above IsCathodeDefined() would be true and IsPlaneDefined() would be false.
36 /// The second case would be the contrary.
37 ///
38 /// \author Laurent Aphecetche, Subatech
39
40 ///\cond CLASSIMP
41 ClassImp(AliMUONAttPainter)
42 ///\endcond
43
44 //_____________________________________________________________________________
45 AliMUONAttPainter::AliMUONAttPainter()
46 : TObject()
47 {
48   /// ctor
49   SetSingle(kTRUE);
50   SetValid(kTRUE);
51   SetCathodeAndPlaneMutuallyExclusive(kFALSE);
52   SetCathodeAndPlaneDisabled(kFALSE);
53 }
54
55 //_____________________________________________________________________________
56 AliMUONAttPainter::~AliMUONAttPainter()
57 {
58   /// dtor
59 }
60
61 //_____________________________________________________________________________
62 TString
63 AliMUONAttPainter::Name() const
64 {
65   /// Build our name
66   
67   TString name;
68   
69   if ( !IsValid() ) return "Invalid";
70   
71   if ( CathodeName().Length() > 0 ) name = CathodeName();
72   if ( PlaneName().Length() > 0 ) 
73   {
74     if ( name.Length() > 0 ) name += "-";
75     name += PlaneName();
76   }
77   if ( ViewPointName().Length() > 0 ) 
78   {
79     if ( name.Length() > 0 ) name += "-";
80     name += ViewPointName();
81   }
82   
83   return name;
84 }
85
86 //_____________________________________________________________________________
87 TString
88 AliMUONAttPainter::CathodeName() const
89 {
90   /// Return cathode name in short form
91
92   if ( IsCathode0() && IsCathode1() ) return "Both";
93   else if ( !IsCathode0() && !IsCathode1() ) return "";
94   else if ( IsCathode0() ) return "0";
95   else if ( IsCathode1() ) return "1";
96   return "";
97 }
98
99 //_____________________________________________________________________________
100 TString
101 AliMUONAttPainter::PlaneName() const
102 {
103   /// Return plane name in short form
104   if ( IsBendingPlane() && IsNonBendingPlane() ) return "Both";
105   else if ( !IsBendingPlane() && !IsNonBendingPlane() ) return "";
106   else if ( IsBendingPlane() ) return "B";
107   else if ( IsNonBendingPlane() ) return "NB";
108   return "";
109 }
110
111 //_____________________________________________________________________________
112 TString
113 AliMUONAttPainter::ViewPointName() const
114 {
115   /// Return name of view point
116   if ( IsFrontView() ) return "Front";
117   if ( IsBackView() ) return "Back";
118   return "";
119 }
120
121 //_____________________________________________________________________________
122 void
123 AliMUONAttPainter::Print(Option_t*) const
124 {
125   /// Printout
126   
127   if ( !IsValid() ) cout << "INVALID : ";
128   
129   if ( IsCathodeDefined() ) 
130   {
131     cout << "Cathode-defined " << CathodeName() << ". ";
132   }
133   if ( IsPlaneDefined() ) 
134   {
135     cout << "Plane-defined " << PlaneName() << ". ";
136   }
137   if ( IsCathodeAndPlaneMutuallyExclusive() )
138   {
139     cout << "Cathode and Plane mutually exclusive. ";
140   }
141   cout << ViewPointName() << endl;
142 }