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