]> git.uio.no Git - u/mrichter/AliRoot.git/blame - AliGeant4/AliDetSwitch.cxx
Initial version
[u/mrichter/AliRoot.git] / AliGeant4 / AliDetSwitch.cxx
CommitLineData
676fb573 1// $Id$
2// Category: geometry
3//
4// See the class description in the header file.
5
6#include "AliDetSwitch.h"
7#include "AliGlobals.h"
8
78ca1e9c 9//_____________________________________________________________________________
676fb573 10AliDetSwitch::AliDetSwitch(G4String detName, G4int nofVersions,
488f10fc 11 G4int defaultVersion, G4int pprVersion,
12 AliModuleType modType, G4bool isStandalone)
676fb573 13 : fDetName(detName),
14 fNofVersions(nofVersions),
15 fDefaultVersion(defaultVersion),
488f10fc 16 fPPRVersion(pprVersion),
676fb573 17 fIsStandalone(isStandalone),
18 fType(modType),
19 fSwitchedVersion(-1)
20{
21//
22}
23
78ca1e9c 24//_____________________________________________________________________________
676fb573 25AliDetSwitch::AliDetSwitch(const AliDetSwitch& right) {
26//
58c0119e 27 // copy stuff
28 *this = right;
676fb573 29}
30
78ca1e9c 31//_____________________________________________________________________________
676fb573 32AliDetSwitch::~AliDetSwitch(){
33//
34}
35
36// operators
78ca1e9c 37
38//_____________________________________________________________________________
676fb573 39AliDetSwitch& AliDetSwitch::operator=(const AliDetSwitch& right)
40{
41 // check assignement to self
42 if (this == &right) return *this;
43
44 fDetName = right.fDetName;
45 fNofVersions = right.fNofVersions;
46 fDefaultVersion = right.fDefaultVersion;
488f10fc 47 fPPRVersion = right.fPPRVersion;
676fb573 48 fSwitchedVersion = right.fSwitchedVersion;
49 fType = right.fType;
50 fIsStandalone = right.fIsStandalone;
51
52 return *this;
53}
54
78ca1e9c 55//_____________________________________________________________________________
676fb573 56G4int AliDetSwitch::operator==(const AliDetSwitch& right) const
57{
58//
59 G4int returnValue = 0;
60 if (fDetName == right.fDetName )
61 returnValue = 1;
62
63 return returnValue;
64}
65
78ca1e9c 66//_____________________________________________________________________________
676fb573 67G4int AliDetSwitch::operator!=(const AliDetSwitch& right) const
68{
69//
70 G4int returnValue = 1;
71 if (*this == right) returnValue = 0;
72
73 return returnValue;
74}
75
76// public methods
77
78ca1e9c 78//_____________________________________________________________________________
676fb573 79void AliDetSwitch::SwitchOn(G4int iVersion)
80{
81// Switchs on the iVersion version.
82// ---
83
84 if ((iVersion < 0) || (iVersion >= fNofVersions)) {
85 G4String text = "Wrong version number for ";
86 text = text + fDetName + ".";
87 AliGlobals::Exception(text);
88 }
89
90 fSwitchedVersion = iVersion;
91}
92
78ca1e9c 93//_____________________________________________________________________________
676fb573 94void AliDetSwitch::SwitchOnDefault()
95{
96// Switchs on the default version.
97// ---
98
99 fSwitchedVersion = fDefaultVersion;
100}
101
78ca1e9c 102//_____________________________________________________________________________
488f10fc 103void AliDetSwitch::SwitchOnPPR()
104{
105// Switchs on the default version.
106// ---
107
108 fSwitchedVersion = fPPRVersion;
109}
110
78ca1e9c 111//_____________________________________________________________________________
676fb573 112void AliDetSwitch::SwitchOff()
113{
114// No version is switched on.
115// ---
116
117 fSwitchedVersion = -1;
118}