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