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