]> git.uio.no Git - u/mrichter/AliRoot.git/blob - MUON/AliMUONAttPainter.cxx
remove leg eff protection
[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 using std::cout;
41 using std::endl;
42 ///\cond CLASSIMP
43 ClassImp(AliMUONAttPainter)
44 ///\endcond
45
46 //_____________________________________________________________________________
47 AliMUONAttPainter::AliMUONAttPainter()
48 : TObject()
49 {
50   /// ctor
51   SetSingle(kTRUE);
52   SetValid(kTRUE);
53   SetCathodeAndPlaneMutuallyExclusive(kFALSE);
54   SetCathodeAndPlaneDisabled(kFALSE);
55 }
56
57 //_____________________________________________________________________________
58 AliMUONAttPainter::~AliMUONAttPainter()
59 {
60   /// dtor
61 }
62
63 //_____________________________________________________________________________
64 TString
65 AliMUONAttPainter::Name() const
66 {
67   /// Build our name
68   
69   TString name;
70   
71   if ( !IsValid() ) return "Invalid";
72   
73   if ( CathodeName().Length() > 0 ) name = CathodeName();
74   if ( PlaneName().Length() > 0 ) 
75   {
76     if ( name.Length() > 0 ) name += "-";
77     name += PlaneName();
78   }
79
80 //  if ( ViewPointName().Length() > 0 ) 
81 //  {
82 //    if ( name.Length() > 0 ) name += "-";
83 //    name += ViewPointName();
84 //  }
85   
86   return name;
87 }
88
89 //_____________________________________________________________________________
90 TString
91 AliMUONAttPainter::CathodeName() const
92 {
93   /// Return cathode name in short form
94
95   if ( IsCathode0() && IsCathode1() ) return "Both";
96   else if ( !IsCathode0() && !IsCathode1() ) return "";
97   else if ( IsCathode0() ) return "0";
98   else if ( IsCathode1() ) return "1";
99   return "";
100 }
101
102 //_____________________________________________________________________________
103 void
104 AliMUONAttPainter::Invert()
105 {
106   /// Invert our cathode/plane states
107   
108   if ( IsCathodeDefined() ) 
109   {
110     Bool_t cath0(IsCathode0());
111     Bool_t cath1(IsCathode1());
112     SetCathode(!cath0,!cath1);
113   }
114
115   if ( IsPlaneDefined() ) 
116   {
117     Bool_t b(IsBendingPlane());
118     Bool_t nb(IsNonBendingPlane());
119     
120     SetPlane(!b,!nb);
121   }
122 }
123
124 //_____________________________________________________________________________
125 TString
126 AliMUONAttPainter::PlaneName() const
127 {
128   /// Return plane name in short form
129   if ( IsBendingPlane() && IsNonBendingPlane() ) return "Both";
130   else if ( !IsBendingPlane() && !IsNonBendingPlane() ) return "";
131   else if ( IsBendingPlane() ) return "Bending";
132   else if ( IsNonBendingPlane() ) return "NonBending";
133   return "";
134 }
135
136 //_____________________________________________________________________________
137 TString
138 AliMUONAttPainter::ViewPointName() const
139 {
140   /// Return name of view point
141   if ( IsFrontView() ) return "Front";
142   if ( IsBackView() ) return "Back";
143   return "";
144 }
145
146 //_____________________________________________________________________________
147 void
148 AliMUONAttPainter::Print(Option_t*) const
149 {
150   /// Printout
151   
152   if ( !IsValid() ) cout << "INVALID : ";
153   
154   if ( IsCathodeDefined() ) 
155   {
156     cout << "Cathode-defined " << CathodeName() << ". ";
157   }
158   if ( IsPlaneDefined() ) 
159   {
160     cout << "Plane-defined " << PlaneName() << ". ";
161   }
162   if ( IsCathodeAndPlaneMutuallyExclusive() )
163   {
164     cout << "Cathode and Plane mutually exclusive. ";
165   }
166   cout << ViewPointName() << endl;
167 }