4 // Author: I. Hrivnacova
8 // See the class description in the header file.
10 #include "AliDetSwitch.h"
11 #include "AliGlobals.h"
13 //_____________________________________________________________________________
14 AliDetSwitch::AliDetSwitch(G4String detName, G4int nofVersions,
15 G4int defaultVersion, AliModuleType modType)
17 fNofVersions(nofVersions),
18 fDefaultVersion(defaultVersion),
25 //_____________________________________________________________________________
26 AliDetSwitch::AliDetSwitch(const AliDetSwitch& right) {
32 //_____________________________________________________________________________
33 AliDetSwitch::~AliDetSwitch(){
39 //_____________________________________________________________________________
40 AliDetSwitch& AliDetSwitch::operator=(const AliDetSwitch& right)
42 // check assignement to self
43 if (this == &right) return *this;
45 fDetName = right.fDetName;
46 fNofVersions = right.fNofVersions;
47 fDefaultVersion = right.fDefaultVersion;
48 fSwitchedVersion = right.fSwitchedVersion;
54 //_____________________________________________________________________________
55 G4int AliDetSwitch::operator==(const AliDetSwitch& right) const
58 G4int returnValue = 0;
59 if (fDetName == right.fDetName )
65 //_____________________________________________________________________________
66 G4int AliDetSwitch::operator!=(const AliDetSwitch& right) const
69 G4int returnValue = 1;
70 if (*this == right) returnValue = 0;
77 //_____________________________________________________________________________
78 void AliDetSwitch::SwitchOn(G4int iVersion)
80 // Switchs on the iVersion version.
83 if ((iVersion < 0) || (iVersion >= fNofVersions)) {
84 G4String text = "Wrong version number for ";
85 text = text + fDetName + ".";
86 AliGlobals::Exception(text);
89 fSwitchedVersion = iVersion;
92 //_____________________________________________________________________________
93 void AliDetSwitch::SwitchOnDefault()
95 // Switchs on the default version.
98 fSwitchedVersion = fDefaultVersion;
101 //_____________________________________________________________________________
102 void AliDetSwitch::SwitchOff()
104 // No version is switched on.
107 fSwitchedVersion = -1;