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