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