VGM Version 5.3
Loading...
Searching...
No Matches
Medium.cxx
Go to the documentation of this file.
1// $Id$
2
3// -----------------------------------------------------------------------
4// The Geant4GM package of the Virtual Geometry Model
5// Copyright (C) 2007, Ivana Hrivnacova
6// All rights reserved.
7//
8// For the licensing terms see vgm/LICENSE.
9// Contact: ivana@ipno.in2p3.fr
10// -----------------------------------------------------------------------
11
12//
13// Class Medium
14// ---------------
15// The VGM implementation of interface to tracking medium.
16// As there is no equivalent object in Geant4, the tracking medium
17// parameters are store in data members of this class.
18//
19// Author: Ivana Hrivnacova; IPN Orsay
20
22
25
26#include "G4Material.hh"
27
28const int Geant4GM::Medium::fgkParamSize = 20;
29
30//_____________________________________________________________________________
31Geant4GM::Medium::Medium(const std::string& name, int mediumId,
32 VGM::IMaterial* material, int nofParameters, double* parameters)
33 : VGM::IMedium(),
34 BaseVGM::VMedium(material),
35 fName(name),
36 fMaterial(MaterialMap::Instance()->GetMaterial(material)),
37 fId(mediumId),
38 fParameters(new G4double[fgkParamSize])
39{
47
48 for (G4int i = 0; i < fgkParamSize; i++) {
49 if (i < nofParameters)
50 fParameters[i] = parameters[i];
51 else
52 fParameters[i] = 0;
53 }
54}
55
56//_____________________________________________________________________________
57Geant4GM::Medium::Medium() : VGM::IMedium(), BaseVGM::VMedium()
58{
60}
61
62//_____________________________________________________________________________
64 : VGM::IMedium(rhs), BaseVGM::VMedium(rhs)
65{
67}
68
69//_____________________________________________________________________________
71{
72 //
73 delete[] fParameters;
74}
75
76//
77// private functions
78//
79//_____________________________________________________________________________
80void Geant4GM::Medium::CheckIndex(int i) const
81{
82 if (i < 0 || i >= NofParameters()) {
83 std::cerr << " Geant4GM::Medium::CheckIndex: " << std::endl;
84 std::cerr << " Index of parameter outside limits." << std::endl;
85 std::cerr << "*** Error: Aborting execution ***" << std::endl;
86 exit(1);
87 }
88}
89
90//
91// public functions
92//
93
94//_____________________________________________________________________________
95std::string Geant4GM::Medium::Name() const { return fName; }
96
97//_____________________________________________________________________________
99{
100 //
101 return fId;
102}
103
104//_____________________________________________________________________________
106{
107 CheckIndex(i);
108
109 return fParameters[i];
110}
The map between VGM and Geant4 material.
Definition MaterialMap.h:36
The VGM implementation of interface to tracking medium.
Definition Medium.h:36
virtual ~Medium()
Definition Medium.cxx:70
virtual int Id() const
Return its unique identifier.
Definition Medium.cxx:98
virtual std::string Name() const
Return its name.
Definition Medium.cxx:95
virtual double Parameter(int i) const
Return the i-th parameter.
Definition Medium.cxx:105
The VGM interface to materials.
Definition IMaterial.h:44
BaseVGM utilities.
Definition utilities.h:23
VGM interfaces.
Definition VMedium.h:28