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,
18 fNofVersions(nofVersions),
19 fDefaultVersion(defaultVersion),
20 fIsStandalone(isStandalone),
27 //_____________________________________________________________________________
28 AliDetSwitch::AliDetSwitch(const AliDetSwitch& right) {
34 //_____________________________________________________________________________
35 AliDetSwitch::~AliDetSwitch(){
41 //_____________________________________________________________________________
42 AliDetSwitch& AliDetSwitch::operator=(const AliDetSwitch& right)
44 // check assignement to self
45 if (this == &right) return *this;
47 fDetName = right.fDetName;
48 fNofVersions = right.fNofVersions;
49 fDefaultVersion = right.fDefaultVersion;
50 fSwitchedVersion = right.fSwitchedVersion;
52 fIsStandalone = right.fIsStandalone;
57 //_____________________________________________________________________________
58 G4int AliDetSwitch::operator==(const AliDetSwitch& right) const
61 G4int returnValue = 0;
62 if (fDetName == right.fDetName )
68 //_____________________________________________________________________________
69 G4int AliDetSwitch::operator!=(const AliDetSwitch& right) const
72 G4int returnValue = 1;
73 if (*this == right) returnValue = 0;
80 //_____________________________________________________________________________
81 void AliDetSwitch::SwitchOn(G4int iVersion)
83 // Switchs on the iVersion version.
86 if ((iVersion < 0) || (iVersion >= fNofVersions)) {
87 G4String text = "Wrong version number for ";
88 text = text + fDetName + ".";
89 AliGlobals::Exception(text);
92 fSwitchedVersion = iVersion;
95 //_____________________________________________________________________________
96 void AliDetSwitch::SwitchOnDefault()
98 // Switchs on the default version.
101 fSwitchedVersion = fDefaultVersion;
104 //_____________________________________________________________________________
105 void AliDetSwitch::SwitchOff()
107 // No version is switched on.
110 fSwitchedVersion = -1;