4 // See the class description in the header file.
6 #include "AliDetSwitch.h"
7 #include "AliGlobals.h"
9 AliDetSwitch::AliDetSwitch(G4String detName, G4int nofVersions,
10 G4int defaultVersion, AliModuleType modType,
13 fNofVersions(nofVersions),
14 fDefaultVersion(defaultVersion),
15 fIsStandalone(isStandalone),
22 AliDetSwitch::AliDetSwitch(const AliDetSwitch& right) {
24 fDetName = right.fDetName;
25 fNofVersions = right.fNofVersions;
26 fDefaultVersion = right.fDefaultVersion;
27 fIsStandalone = right.fIsStandalone;
29 fSwitchedVersion = right.fSwitchedVersion;
32 AliDetSwitch::~AliDetSwitch(){
37 AliDetSwitch& AliDetSwitch::operator=(const AliDetSwitch& right)
39 // check assignement to self
40 if (this == &right) return *this;
42 fDetName = right.fDetName;
43 fNofVersions = right.fNofVersions;
44 fDefaultVersion = right.fDefaultVersion;
45 fSwitchedVersion = right.fSwitchedVersion;
47 fIsStandalone = right.fIsStandalone;
52 G4int AliDetSwitch::operator==(const AliDetSwitch& right) const
55 G4int returnValue = 0;
56 if (fDetName == right.fDetName )
62 G4int AliDetSwitch::operator!=(const AliDetSwitch& right) const
65 G4int returnValue = 1;
66 if (*this == right) returnValue = 0;
73 void AliDetSwitch::SwitchOn(G4int iVersion)
75 // Switchs on the iVersion version.
78 if ((iVersion < 0) || (iVersion >= fNofVersions)) {
79 G4String text = "Wrong version number for ";
80 text = text + fDetName + ".";
81 AliGlobals::Exception(text);
84 fSwitchedVersion = iVersion;
87 void AliDetSwitch::SwitchOnDefault()
89 // Switchs on the default version.
92 fSwitchedVersion = fDefaultVersion;
95 void AliDetSwitch::SwitchOff()
97 // No version is switched on.
100 fSwitchedVersion = -1;