]> git.uio.no Git - u/mrichter/AliRoot.git/blob - AliGeant4/AliDetSwitch.h
updated commands description
[u/mrichter/AliRoot.git] / AliGeant4 / AliDetSwitch.h
1 // $Id$
2 // Category: geometry
3 //
4 // Author: I. Hrivnacova
5 //
6 // Class AliDetSwitch
7 // ------------------
8 // See the class description in the header file.
9
10 #include "AliDetSwitch.h"
11 #include "AliGlobals.h"
12
13 //_____________________________________________________________________________
14 AliDetSwitch::AliDetSwitch(G4String detName, G4int nofVersions, 
15                  G4int defaultVersion, AliModuleType modType, 
16                  G4bool isStandalone)
17   : fDetName(detName),
18     fNofVersions(nofVersions),
19     fDefaultVersion(defaultVersion),
20     fIsStandalone(isStandalone),
21     fType(modType),
22     fSwitchedVersion(-1)
23 {
24 //
25 }
26
27 //_____________________________________________________________________________
28 AliDetSwitch::AliDetSwitch(const AliDetSwitch& right) {
29 //
30   // copy stuff
31   *this = right;
32 }
33
34 //_____________________________________________________________________________
35 AliDetSwitch::~AliDetSwitch(){
36 //
37 }
38
39 // operators
40
41 //_____________________________________________________________________________
42 AliDetSwitch& AliDetSwitch::operator=(const AliDetSwitch& right)
43 {    
44   // check assignement to self
45   if (this == &right) return *this;
46
47   fDetName = right.fDetName;
48   fNofVersions = right.fNofVersions;
49   fDefaultVersion = right.fDefaultVersion;
50   fSwitchedVersion = right.fSwitchedVersion;
51   fType = right.fType;
52   fIsStandalone = right.fIsStandalone;
53   
54   return *this;
55 }
56
57 //_____________________________________________________________________________
58 G4int AliDetSwitch::operator==(const AliDetSwitch& right) const
59 {    
60 //
61   G4int returnValue = 0;
62   if (fDetName == right.fDetName )
63      returnValue = 1;
64
65   return returnValue;  
66 }
67
68 //_____________________________________________________________________________
69 G4int AliDetSwitch::operator!=(const AliDetSwitch& right) const
70
71 //   
72   G4int returnValue = 1;
73   if (*this == right) returnValue = 0; 
74   
75   return returnValue;
76 }
77   
78 // public methods
79
80 //_____________________________________________________________________________
81 void AliDetSwitch::SwitchOn(G4int iVersion)
82 {
83 // Switchs on the iVersion version.
84 // ---
85
86   if ((iVersion < 0) || (iVersion >= fNofVersions)) {
87     G4String text = "Wrong version number for ";
88     text = text + fDetName + ".";
89     AliGlobals::Exception(text);
90   }  
91    
92   fSwitchedVersion = iVersion;
93 }
94
95 //_____________________________________________________________________________
96 void AliDetSwitch::SwitchOnDefault()
97 {
98 // Switchs on the default version.
99 // ---
100
101   fSwitchedVersion = fDefaultVersion;
102 }
103
104 //_____________________________________________________________________________
105 void AliDetSwitch::SwitchOff()
106 {
107 // No version is switched on.
108 // ---
109
110   fSwitchedVersion = -1;
111 }