Line data Source code
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 12 : ClassImp(AliMUONAttPainter)
44 : ///\endcond
45 :
46 : //_____________________________________________________________________________
47 : AliMUONAttPainter::AliMUONAttPainter()
48 0 : : TObject(), fName()
49 0 : {
50 : /// ctor
51 0 : SetSingle(kTRUE);
52 0 : SetValid(kTRUE);
53 0 : SetCathodeAndPlaneMutuallyExclusive(kFALSE);
54 0 : SetCathodeAndPlaneDisabled(kFALSE);
55 0 : SetName();
56 0 : }
57 :
58 : //_____________________________________________________________________________
59 : AliMUONAttPainter::~AliMUONAttPainter()
60 0 : {
61 : /// dtor
62 0 : }
63 :
64 : //_____________________________________________________________________________
65 : void AliMUONAttPainter::SetName()
66 : {
67 : /// Build our name
68 :
69 0 : fName = "Invalid";
70 :
71 0 : if ( !IsValid() ) return;
72 :
73 0 : fName = "";
74 :
75 0 : if ( CathodeName().Length() > 0 ) fName = CathodeName();
76 0 : if ( PlaneName().Length() > 0 )
77 : {
78 0 : if ( fName.Length() > 0 ) fName += "-";
79 0 : fName += PlaneName();
80 0 : }
81 :
82 : // if ( ViewPointName().Length() > 0 )
83 : // {
84 : // if ( name.Length() > 0 ) name += "-";
85 : // name += ViewPointName();
86 : // }
87 0 : }
88 :
89 : //_____________________________________________________________________________
90 : TString
91 : AliMUONAttPainter::CathodeName() const
92 : {
93 : /// Return cathode name in short form
94 :
95 0 : if ( IsCathode0() && IsCathode1() ) return "Both";
96 0 : else if ( !IsCathode0() && !IsCathode1() ) return "";
97 0 : else if ( IsCathode0() ) return "0";
98 0 : else if ( IsCathode1() ) return "1";
99 0 : return "";
100 0 : }
101 :
102 : //_____________________________________________________________________________
103 : void
104 : AliMUONAttPainter::Invert()
105 : {
106 : /// Invert our cathode/plane states
107 :
108 0 : if ( IsCathodeDefined() )
109 : {
110 0 : Bool_t cath0(IsCathode0());
111 0 : Bool_t cath1(IsCathode1());
112 0 : SetCathode(!cath0,!cath1);
113 0 : }
114 :
115 0 : if ( IsPlaneDefined() )
116 : {
117 0 : Bool_t b(IsBendingPlane());
118 0 : Bool_t nb(IsNonBendingPlane());
119 0 : SetPlane(!b,!nb);
120 0 : }
121 :
122 0 : SetName();
123 0 : }
124 :
125 : //_____________________________________________________________________________
126 : TString
127 : AliMUONAttPainter::PlaneName() const
128 : {
129 : /// Return plane name in short form
130 0 : if ( IsBendingPlane() && IsNonBendingPlane() ) return "Both";
131 0 : else if ( !IsBendingPlane() && !IsNonBendingPlane() ) return "";
132 0 : else if ( IsBendingPlane() ) return "Bending";
133 0 : else if ( IsNonBendingPlane() ) return "NonBending";
134 0 : return "";
135 0 : }
136 :
137 : //_____________________________________________________________________________
138 : TString
139 : AliMUONAttPainter::ViewPointName() const
140 : {
141 : /// Return name of view point
142 0 : if ( IsFrontView() ) return "Front";
143 0 : if ( IsBackView() ) return "Back";
144 0 : return "";
145 0 : }
146 :
147 : //_____________________________________________________________________________
148 : void
149 : AliMUONAttPainter::Print(Option_t*) const
150 : {
151 : /// Printout
152 :
153 0 : if ( !IsValid() ) cout << "INVALID : ";
154 :
155 0 : if ( IsCathodeDefined() )
156 : {
157 0 : cout << "Cathode-defined " << CathodeName() << ". ";
158 0 : }
159 0 : if ( IsPlaneDefined() )
160 : {
161 0 : cout << "Plane-defined " << PlaneName() << ". ";
162 0 : }
163 0 : if ( IsCathodeAndPlaneMutuallyExclusive() )
164 : {
165 0 : cout << "Cathode and Plane mutually exclusive. ";
166 0 : }
167 0 : cout << ViewPointName() << endl;
168 0 : }
169 :
170 : //_____________________________________________________________________________
171 : void
172 : AliMUONAttPainter::SetCathode(Bool_t cath0, Bool_t cath1)
173 : {
174 : /// Set our cathode states
175 0 : SetBit(kIsCathode0,cath0);
176 0 : SetBit(kIsCathode1,cath1);
177 0 : SetName();
178 0 : }
179 :
180 : //_____________________________________________________________________________
181 : void
182 : AliMUONAttPainter::SetPlane(Bool_t bending, Bool_t nonBending)
183 : {
184 : /// Set our plane states
185 0 : SetBit(kIsBendingPlane,bending);
186 0 : SetBit(kIsNonBendingPlane,nonBending);
187 0 : SetName();
188 0 : }
189 :
190 : //_____________________________________________________________________________
191 : void
192 : AliMUONAttPainter::SetSingle(Bool_t value)
193 : {
194 : /// Set single status
195 0 : SetBit(kIsSinglePainter,value);
196 0 : SetName();
197 0 : }
198 :
199 : //_____________________________________________________________________________
200 : void
201 : AliMUONAttPainter::SetViewPoint(Bool_t front, Bool_t back)
202 : {
203 : /// Set view point
204 0 : SetBit(kIsFrontView,front);
205 0 : SetBit(kIsBackView,back);
206 0 : SetName();
207 0 : }
208 :
209 : //_____________________________________________________________________________
210 : void
211 : AliMUONAttPainter::SetCathodeAndPlaneMutuallyExclusive(Bool_t value)
212 : {
213 : /// Set mutually exclusive flag
214 0 : SetBit(kIsCathodeAndPlaneMutuallyExclusive,value);
215 0 : SetName();
216 0 : }
217 :
218 : //_____________________________________________________________________________
219 : void
220 : AliMUONAttPainter::SetValid(Bool_t value)
221 : {
222 : /// Set valid flag
223 0 : SetBit(kIsValid,value);
224 0 : SetName();
225 0 : }
226 :
227 : //_____________________________________________________________________________
228 : void
229 : AliMUONAttPainter::SetCathodeAndPlaneDisabled(Bool_t value)
230 : {
231 : /// Set cathode & plane disable flag
232 0 : SetBit(kIsCathodeAndPlaneDisabled,value);
233 0 : SetName();
234 0 : }
|