]> git.uio.no Git - u/mrichter/AliRoot.git/blame - AliGeant4/AliDetSwitch.cxx
updated for changes in Config.C
[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
9AliDetSwitch::AliDetSwitch(G4String detName, G4int nofVersions,
488f10fc 10 G4int defaultVersion, G4int pprVersion,
11 AliModuleType modType, G4bool isStandalone)
676fb573 12 : fDetName(detName),
13 fNofVersions(nofVersions),
14 fDefaultVersion(defaultVersion),
488f10fc 15 fPPRVersion(pprVersion),
676fb573 16 fIsStandalone(isStandalone),
17 fType(modType),
18 fSwitchedVersion(-1)
19{
20//
21}
22
23AliDetSwitch::AliDetSwitch(const AliDetSwitch& right) {
24//
25 fDetName = right.fDetName;
26 fNofVersions = right.fNofVersions;
27 fDefaultVersion = right.fDefaultVersion;
488f10fc 28 fPPRVersion = right.fPPRVersion;
676fb573 29 fIsStandalone = right.fIsStandalone;
30 fType = right.fType;
31 fSwitchedVersion = right.fSwitchedVersion;
32}
33
34AliDetSwitch::~AliDetSwitch(){
35//
36}
37
38// operators
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
55G4int AliDetSwitch::operator==(const AliDetSwitch& right) const
56{
57//
58 G4int returnValue = 0;
59 if (fDetName == right.fDetName )
60 returnValue = 1;
61
62 return returnValue;
63}
64
65G4int AliDetSwitch::operator!=(const AliDetSwitch& right) const
66{
67//
68 G4int returnValue = 1;
69 if (*this == right) returnValue = 0;
70
71 return returnValue;
72}
73
74// public methods
75
76void AliDetSwitch::SwitchOn(G4int iVersion)
77{
78// Switchs on the iVersion version.
79// ---
80
81 if ((iVersion < 0) || (iVersion >= fNofVersions)) {
82 G4String text = "Wrong version number for ";
83 text = text + fDetName + ".";
84 AliGlobals::Exception(text);
85 }
86
87 fSwitchedVersion = iVersion;
88}
89
90void AliDetSwitch::SwitchOnDefault()
91{
92// Switchs on the default version.
93// ---
94
95 fSwitchedVersion = fDefaultVersion;
96}
97
488f10fc 98void AliDetSwitch::SwitchOnPPR()
99{
100// Switchs on the default version.
101// ---
102
103 fSwitchedVersion = fPPRVersion;
104}
105
676fb573 106void AliDetSwitch::SwitchOff()
107{
108// No version is switched on.
109// ---
110
111 fSwitchedVersion = -1;
112}