Geant4 9.6.0
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G3Division Class Reference

#include <G3Division.hh>

Public Member Functions

 G3Division (G3DivType type, G3VolTableEntry *vte, G3VolTableEntry *mvte, G4int nofDivision, G4int iaxis, G4int nmed, G4double c0, G4double step)
 
 G3Division (G3VolTableEntry *vte, G3VolTableEntry *mvte, const G3Division &division)
 
virtual ~G3Division ()
 
void UpdateVTE ()
 
void CreatePVReplica ()
 

Detailed Description

Definition at line 55 of file G3Division.hh.

Constructor & Destructor Documentation

◆ G3Division() [1/2]

G3Division::G3Division ( G3DivType  type,
G3VolTableEntry vte,
G3VolTableEntry mvte,
G4int  nofDivision,
G4int  iaxis,
G4int  nmed,
G4double  c0,
G4double  step 
)

Definition at line 48 of file G3Division.cc.

51 : fType(type),
52 fVTE(vte),
53 fMVTE(mvte),
54 fNofDivisions(nofDivisions),
55 fIAxis(iaxis),
56 fNmed(nmed),
57 fC0(c0),
58 fStep(step),
59 fLowRange(0.),
60 fHighRange(0.),
61 fWidth(0.),
62 fOffset(0.),
63 fAxis(kXAxis)
64{
65 fVTE->SetHasNegPars(true);
66}
void SetHasNegPars(G4bool hasNegPars)
@ kXAxis
Definition: geomdefs.hh:54

◆ G3Division() [2/2]

G3Division::G3Division ( G3VolTableEntry vte,
G3VolTableEntry mvte,
const G3Division division 
)

Definition at line 68 of file G3Division.cc.

70 : fVTE(vte),
71 fMVTE(mvte)
72{
73 // only "input" parameters are copied from division
74 fType = division.fType;
75 fNofDivisions = division.fNofDivisions;
76 fIAxis = division.fIAxis;
77 fNmed = division.fNmed;
78 fC0 = division.fC0;
79 fStep = division.fStep;
80
81 // other parameters are set as in standard constructor
82 fLowRange = 0.;
83 fHighRange = 0.;
84 fWidth = 0.;
85 fOffset = 0.;
86 fAxis = kXAxis;
87 fVTE->SetHasNegPars(true);
88}

◆ ~G3Division()

G3Division::~G3Division ( )
virtual

Definition at line 90 of file G3Division.cc.

91{}

Member Function Documentation

◆ CreatePVReplica()

void G3Division::CreatePVReplica ( )

Definition at line 126 of file G3Division.cc.

127{
128 G4String name = fVTE->GetName();
129 G4LogicalVolume* lv = fVTE->GetLV();
130 G4LogicalVolume* mlv = fMVTE->GetLV();
131
132 G4String shape = fMVTE->GetShape();
133 if (shape == "PARA") {
134 // The para volume cannot be replicated using G4PVReplica.
135 // (Replicating a volume along a cartesian axis means "slicing" it
136 // with slices -perpendicular- to that axis.)
137
138 // position the replicated elements
139 for (G4int i=0; i<fNofDivisions; i++) {
141 position[fIAxis-1] = fLowRange + fWidth/2. + i*fWidth;
142 if (position.y()!=0.)
143 position.setX(position.y()*((G4Para*)lv->GetSolid())->GetTanAlpha());
144
145 #ifndef G3G4_NO_REFLECTION
147 ->Place(G4Translate3D(position), name, lv, mlv, 0, i);
148
149 #else
150 new G4PVPlacement(0, position, lv, name, mlv, 0, i);
151
152 #endif
153 }
154
155 // G4PVReplica cannot be created
156 return;
157 }
158
159 #ifdef G3G4DEBUG
160 G4cout << "Create G4PVReplica name " << name << " logical volume name "
161 << lv->GetName() << " mother logical volme name "
162 << mlv->GetName() << " axis " << fAxis << " ndivisions "
163 << fNofDivisions << " width " << fWidth << " Offset "
164 << fOffset << G4endl;
165 #endif
166
167 #ifndef G3G4_NO_REFLECTION
169 ->Replicate(name, lv, mlv, fAxis, fNofDivisions, fWidth, fOffset);
170
171 #else
172 new G4PVReplica(name, lv, mlv, fAxis, fNofDivisions, fWidth, fOffset);
173
174 #endif
175}
CLHEP::Hep3Vector G4ThreeVector
HepGeom::Translate3D G4Translate3D
int G4int
Definition: G4Types.hh:66
#define G4endl
Definition: G4ios.hh:52
G4DLLIMPORT std::ostream G4cout
G4LogicalVolume * GetLV()
G4VSolid * GetSolid() const
G4String GetName() const
Definition: G4Para.hh:77
static G4ReflectionFactory * Instance()
G4PhysicalVolumesPair Place(const G4Transform3D &transform3D, const G4String &name, G4LogicalVolume *LV, G4LogicalVolume *motherLV, G4bool isMany, G4int copyNo, G4bool surfCheck=false)
G4PhysicalVolumesPair Replicate(const G4String &name, G4LogicalVolume *LV, G4LogicalVolume *motherLV, EAxis axis, G4int nofReplicas, G4double width, G4double offset=0)

Referenced by G3toG4BuildPVTree().

◆ UpdateVTE()

void G3Division::UpdateVTE ( )

Definition at line 95 of file G3Division.cc.

96{
97 if (fVTE->HasNegPars() && !(fMVTE->HasNegPars())) {
98
99 // set nmed from mother
100 if (fNmed == 0) fNmed = fMVTE->GetNmed();
101 fVTE->SetNmed(fNmed);
102
103 SetRangeAndAxis();
104
105 // create envelope (if necessary)
106 // and solid
107 G3VolTableEntry* envVTE = 0;
108 if (fType == kDvn) envVTE = Dvn();
109 else if (fType == kDvn2) envVTE = Dvn2();
110 else if (fType == kDvt) envVTE = Dvt();
111 else if (fType == kDvt2) envVTE = Dvt2();
112
113 if (envVTE) {
114 // reset mother <-> daughter
115 fMVTE->ReplaceDaughter(fVTE, envVTE);
116 fVTE->ReplaceMother(fMVTE, envVTE);
117 envVTE->AddDaughter(fVTE);
118 envVTE->AddMother(fMVTE);
119
120 // replace mother with envelope
121 fMVTE = envVTE;
122 }
123 }
124}
@ kDvt
Definition: G3Division.hh:53
@ kDvt2
Definition: G3Division.hh:53
@ kDvn2
Definition: G3Division.hh:53
@ kDvn
Definition: G3Division.hh:53
void AddMother(G3VolTableEntry *aDaughter)
void SetNmed(G4int nmed)
void ReplaceDaughter(G3VolTableEntry *vteOld, G3VolTableEntry *vteNew)
void ReplaceMother(G3VolTableEntry *vteOld, G3VolTableEntry *vteNew)
void AddDaughter(G3VolTableEntry *aDaughter)

Referenced by G4CloneDaughters(), G4CreateCloneVTEWithDivision(), and G4ProcessDaughters().


The documentation for this class was generated from the following files: