4 // See the class description in the header file.
6 #include "AliDetSwitch.h"
7 #include "AliGlobals.h"
9 //_____________________________________________________________________________
10 AliDetSwitch::AliDetSwitch(G4String detName, G4int nofVersions,
11 G4int defaultVersion, G4int pprVersion,
12 AliModuleType modType, G4bool isStandalone)
14 fNofVersions(nofVersions),
15 fDefaultVersion(defaultVersion),
16 fPPRVersion(pprVersion),
17 fIsStandalone(isStandalone),
24 //_____________________________________________________________________________
25 AliDetSwitch::AliDetSwitch(const AliDetSwitch& right) {
31 //_____________________________________________________________________________
32 AliDetSwitch::~AliDetSwitch(){
38 //_____________________________________________________________________________
39 AliDetSwitch& AliDetSwitch::operator=(const AliDetSwitch& right)
41 // check assignement to self
42 if (this == &right) return *this;
44 fDetName = right.fDetName;
45 fNofVersions = right.fNofVersions;
46 fDefaultVersion = right.fDefaultVersion;
47 fPPRVersion = right.fPPRVersion;
48 fSwitchedVersion = right.fSwitchedVersion;
50 fIsStandalone = right.fIsStandalone;
55 //_____________________________________________________________________________
56 G4int AliDetSwitch::operator==(const AliDetSwitch& right) const
59 G4int returnValue = 0;
60 if (fDetName == right.fDetName )
66 //_____________________________________________________________________________
67 G4int AliDetSwitch::operator!=(const AliDetSwitch& right) const
70 G4int returnValue = 1;
71 if (*this == right) returnValue = 0;
78 //_____________________________________________________________________________
79 void AliDetSwitch::SwitchOn(G4int iVersion)
81 // Switchs on the iVersion version.
84 if ((iVersion < 0) || (iVersion >= fNofVersions)) {
85 G4String text = "Wrong version number for ";
86 text = text + fDetName + ".";
87 AliGlobals::Exception(text);
90 fSwitchedVersion = iVersion;
93 //_____________________________________________________________________________
94 void AliDetSwitch::SwitchOnDefault()
96 // Switchs on the default version.
99 fSwitchedVersion = fDefaultVersion;
102 //_____________________________________________________________________________
103 void AliDetSwitch::SwitchOnPPR()
105 // Switchs on the default version.
108 fSwitchedVersion = fPPRVersion;
111 //_____________________________________________________________________________
112 void AliDetSwitch::SwitchOff()
114 // No version is switched on.
117 fSwitchedVersion = -1;