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, G4int pprVersion,
11 AliModuleType modType, G4bool isStandalone)
13 fNofVersions(nofVersions),
14 fDefaultVersion(defaultVersion),
15 fPPRVersion(pprVersion),
16 fIsStandalone(isStandalone),
23 AliDetSwitch::AliDetSwitch(const AliDetSwitch& right) {
25 fDetName = right.fDetName;
26 fNofVersions = right.fNofVersions;
27 fDefaultVersion = right.fDefaultVersion;
28 fPPRVersion = right.fPPRVersion;
29 fIsStandalone = right.fIsStandalone;
31 fSwitchedVersion = right.fSwitchedVersion;
34 AliDetSwitch::~AliDetSwitch(){
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 G4int AliDetSwitch::operator==(const AliDetSwitch& right) const
58 G4int returnValue = 0;
59 if (fDetName == right.fDetName )
65 G4int AliDetSwitch::operator!=(const AliDetSwitch& right) const
68 G4int returnValue = 1;
69 if (*this == right) returnValue = 0;
76 void AliDetSwitch::SwitchOn(G4int iVersion)
78 // Switchs on the iVersion version.
81 if ((iVersion < 0) || (iVersion >= fNofVersions)) {
82 G4String text = "Wrong version number for ";
83 text = text + fDetName + ".";
84 AliGlobals::Exception(text);
87 fSwitchedVersion = iVersion;
90 void AliDetSwitch::SwitchOnDefault()
92 // Switchs on the default version.
95 fSwitchedVersion = fDefaultVersion;
98 void AliDetSwitch::SwitchOnPPR()
100 // Switchs on the default version.
103 fSwitchedVersion = fPPRVersion;
106 void AliDetSwitch::SwitchOff()
108 // No version is switched on.
111 fSwitchedVersion = -1;