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) {
29 AliDetSwitch::~AliDetSwitch(){
34 AliDetSwitch& AliDetSwitch::operator=(const AliDetSwitch& right)
36 // check assignement to self
37 if (this == &right) return *this;
39 fDetName = right.fDetName;
40 fNofVersions = right.fNofVersions;
41 fDefaultVersion = right.fDefaultVersion;
42 fPPRVersion = right.fPPRVersion;
43 fSwitchedVersion = right.fSwitchedVersion;
45 fIsStandalone = right.fIsStandalone;
50 G4int AliDetSwitch::operator==(const AliDetSwitch& right) const
53 G4int returnValue = 0;
54 if (fDetName == right.fDetName )
60 G4int AliDetSwitch::operator!=(const AliDetSwitch& right) const
63 G4int returnValue = 1;
64 if (*this == right) returnValue = 0;
71 void AliDetSwitch::SwitchOn(G4int iVersion)
73 // Switchs on the iVersion version.
76 if ((iVersion < 0) || (iVersion >= fNofVersions)) {
77 G4String text = "Wrong version number for ";
78 text = text + fDetName + ".";
79 AliGlobals::Exception(text);
82 fSwitchedVersion = iVersion;
85 void AliDetSwitch::SwitchOnDefault()
87 // Switchs on the default version.
90 fSwitchedVersion = fDefaultVersion;
93 void AliDetSwitch::SwitchOnPPR()
95 // Switchs on the default version.
98 fSwitchedVersion = fPPRVersion;
101 void AliDetSwitch::SwitchOff()
103 // No version is switched on.
106 fSwitchedVersion = -1;