]> git.uio.no Git - u/mrichter/AliRoot.git/blob - AliGeant4/AliDetSwitch.cxx
Add MEVSIM and TMEVSIM
[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 AliDetSwitch::AliDetSwitch(G4String detName, G4int nofVersions, 
10                  G4int defaultVersion, G4int pprVersion,
11                  AliModuleType modType, G4bool isStandalone)
12   : fDetName(detName),
13     fNofVersions(nofVersions),
14     fDefaultVersion(defaultVersion),
15     fPPRVersion(pprVersion),
16     fIsStandalone(isStandalone),
17     fType(modType),
18     fSwitchedVersion(-1)
19 {
20 //
21 }
22
23 AliDetSwitch::AliDetSwitch(const AliDetSwitch& right) {
24 //
25   fDetName = right.fDetName;
26   fNofVersions = right.fNofVersions;
27   fDefaultVersion = right.fDefaultVersion;
28   fPPRVersion = right.fPPRVersion;
29   fIsStandalone = right.fIsStandalone;
30   fType = right.fType;
31   fSwitchedVersion = right.fSwitchedVersion;
32 }
33
34 AliDetSwitch::~AliDetSwitch(){
35 //
36 }
37
38 // operators
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 G4int AliDetSwitch::operator==(const AliDetSwitch& right) const
56 {    
57 //
58   G4int returnValue = 0;
59   if (fDetName == right.fDetName )
60      returnValue = 1;
61
62   return returnValue;  
63 }
64
65 G4int AliDetSwitch::operator!=(const AliDetSwitch& right) const
66
67 //   
68   G4int returnValue = 1;
69   if (*this == right) returnValue = 0; 
70   
71   return returnValue;
72 }
73   
74 // public methods
75
76 void AliDetSwitch::SwitchOn(G4int iVersion)
77 {
78 // Switchs on the iVersion version.
79 // ---
80
81   if ((iVersion < 0) || (iVersion >= fNofVersions)) {
82     G4String text = "Wrong version number for ";
83     text = text + fDetName + ".";
84     AliGlobals::Exception(text);
85   }  
86    
87   fSwitchedVersion = iVersion;
88 }
89
90 void AliDetSwitch::SwitchOnDefault()
91 {
92 // Switchs on the default version.
93 // ---
94
95   fSwitchedVersion = fDefaultVersion;
96 }
97
98 void AliDetSwitch::SwitchOnPPR()
99 {
100 // Switchs on the default version.
101 // ---
102
103   fSwitchedVersion = fPPRVersion;
104 }
105
106 void AliDetSwitch::SwitchOff()
107 {
108 // No version is switched on.
109 // ---
110
111   fSwitchedVersion = -1;
112 }