Geant4.10
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions
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::G3Division ( G3DivType  type,
G3VolTableEntry vte,
G3VolTableEntry mvte,
G4int  nofDivision,
G4int  iaxis,
G4int  nmed,
G4double  c0,
G4double  step 
)

Definition at line 50 of file G3Division.cc.

References G3VolTableEntry::SetHasNegPars().

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

Definition at line 70 of file G3Division.cc.

References kXAxis, and G3VolTableEntry::SetHasNegPars().

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

Definition at line 92 of file G3Division.cc.

93 {}

Member Function Documentation

void G3Division::CreatePVReplica ( )

Definition at line 128 of file G3Division.cc.

References G4cout, G4endl, G3VolTableEntry::GetLV(), G3VolTableEntry::GetName(), G4LogicalVolume::GetName(), G3VolTableEntry::GetShape(), G4LogicalVolume::GetSolid(), G4ReflectionFactory::Instance(), G4ReflectionFactory::Place(), G4ReflectionFactory::Replicate(), CLHEP::Hep3Vector::setX(), and CLHEP::Hep3Vector::y().

Referenced by G3toG4BuildPVTree().

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

Definition at line 97 of file G3Division.cc.

References G3VolTableEntry::AddDaughter(), G3VolTableEntry::AddMother(), G3VolTableEntry::GetNmed(), G3VolTableEntry::HasNegPars(), kDvn, kDvn2, kDvt, kDvt2, G3VolTableEntry::ReplaceDaughter(), G3VolTableEntry::ReplaceMother(), and G3VolTableEntry::SetNmed().

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

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

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