]>
Commit | Line | Data |
---|---|---|
676fb573 | 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, | |
488f10fc | 10 | G4int defaultVersion, G4int pprVersion, |
11 | AliModuleType modType, G4bool isStandalone) | |
676fb573 | 12 | : fDetName(detName), |
13 | fNofVersions(nofVersions), | |
14 | fDefaultVersion(defaultVersion), | |
488f10fc | 15 | fPPRVersion(pprVersion), |
676fb573 | 16 | fIsStandalone(isStandalone), |
17 | fType(modType), | |
18 | fSwitchedVersion(-1) | |
19 | { | |
20 | // | |
21 | } | |
22 | ||
23 | AliDetSwitch::AliDetSwitch(const AliDetSwitch& right) { | |
24 | // | |
58c0119e | 25 | // copy stuff |
26 | *this = right; | |
676fb573 | 27 | } |
28 | ||
29 | AliDetSwitch::~AliDetSwitch(){ | |
30 | // | |
31 | } | |
32 | ||
33 | // operators | |
34 | AliDetSwitch& AliDetSwitch::operator=(const AliDetSwitch& right) | |
35 | { | |
36 | // check assignement to self | |
37 | if (this == &right) return *this; | |
38 | ||
39 | fDetName = right.fDetName; | |
40 | fNofVersions = right.fNofVersions; | |
41 | fDefaultVersion = right.fDefaultVersion; | |
488f10fc | 42 | fPPRVersion = right.fPPRVersion; |
676fb573 | 43 | fSwitchedVersion = right.fSwitchedVersion; |
44 | fType = right.fType; | |
45 | fIsStandalone = right.fIsStandalone; | |
46 | ||
47 | return *this; | |
48 | } | |
49 | ||
50 | G4int AliDetSwitch::operator==(const AliDetSwitch& right) const | |
51 | { | |
52 | // | |
53 | G4int returnValue = 0; | |
54 | if (fDetName == right.fDetName ) | |
55 | returnValue = 1; | |
56 | ||
57 | return returnValue; | |
58 | } | |
59 | ||
60 | G4int AliDetSwitch::operator!=(const AliDetSwitch& right) const | |
61 | { | |
62 | // | |
63 | G4int returnValue = 1; | |
64 | if (*this == right) returnValue = 0; | |
65 | ||
66 | return returnValue; | |
67 | } | |
68 | ||
69 | // public methods | |
70 | ||
71 | void AliDetSwitch::SwitchOn(G4int iVersion) | |
72 | { | |
73 | // Switchs on the iVersion version. | |
74 | // --- | |
75 | ||
76 | if ((iVersion < 0) || (iVersion >= fNofVersions)) { | |
77 | G4String text = "Wrong version number for "; | |
78 | text = text + fDetName + "."; | |
79 | AliGlobals::Exception(text); | |
80 | } | |
81 | ||
82 | fSwitchedVersion = iVersion; | |
83 | } | |
84 | ||
85 | void AliDetSwitch::SwitchOnDefault() | |
86 | { | |
87 | // Switchs on the default version. | |
88 | // --- | |
89 | ||
90 | fSwitchedVersion = fDefaultVersion; | |
91 | } | |
92 | ||
488f10fc | 93 | void AliDetSwitch::SwitchOnPPR() |
94 | { | |
95 | // Switchs on the default version. | |
96 | // --- | |
97 | ||
98 | fSwitchedVersion = fPPRVersion; | |
99 | } | |
100 | ||
676fb573 | 101 | void AliDetSwitch::SwitchOff() |
102 | { | |
103 | // No version is switched on. | |
104 | // --- | |
105 | ||
106 | fSwitchedVersion = -1; | |
107 | } |