Import Geant4 1.0.0 source tree

This commit is contained in:
Gabriele Cosmo
2016-06-08 15:28:20 +02:00
parent aaa409b6ee
commit ca1c8cb059
2995 changed files with 106830 additions and 299600 deletions
+115 -38
View File
@@ -1,43 +1,120 @@
#include "globals.hh"
// This code implementation is the intellectual property of
// the GEANT4 collaboration.
//
// By copying, distributing or modifying the Program (or any work
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G3toG4BuildTree.cc,v 1.8 1999/12/05 17:50:11 gcosmo Exp $
// GEANT4 tag $Name: geant4-01-00 $
//
// modified by I. Hrivnacova, 2.8.99
#include "G3toG4BuildTree.hh"
#include "G3RotTable.hh"
#include "G3MedTable.hh"
#include "G3VolTable.hh"
#include "VolTableEntry.hh"
#include "G3SensVolVector.hh"
#include "G3Pos.hh"
#include "G4LogicalVolume.hh"
#include "G4PVPlacement.hh"
#include "G3Pos.hh"
#include "G3RotTable.hh"
void
G3toG4BuildTree(VolTableEntry* CurVTE){
// create logical volume
G4LogicalVolume* CurLog =
new G4LogicalVolume(CurVTE->GetSolid(), // solids pointer
CurVTE->GetMaterial(),// material pointer
CurVTE->GetName());; // lv name
CurVTE->SetLV(CurLog);
for (int ICopy=0; ICopy < CurVTE->NPCopies(); ICopy++){
G3Pos* TheG3Pos = CurVTE->GetG3PosCopy(ICopy);
// pointer to mother
G4LogicalVolume* MothLV = CurVTE->GetMother()->GetLV();
// rotation matrix
G4int irot = TheG3Pos->GetIrot();
//G4cout << "Positioning PV " << TheG3Pos->GetName() << " irot " << irot
// << " inside mother " << MothLV->GetName() << " copy "
// << TheG3Pos->GetCopy() << endl;
// Position it
new G4PVPlacement((G4RotationMatrix*)
G3Rot.Get(TheG3Pos->GetIrot()), // rotation matrix
*(TheG3Pos->GetPos()), // its position
CurLog, // its LogicalVolume
TheG3Pos->GetName(), // PV name
MothLV, // Mother LV
0, // only
TheG3Pos->GetCopy()); // copy
}
// number of G3Pos daughters
G4int Ndau = CurVTE->GetNoDaughters();
for (int Idau=0; Idau<Ndau; Idau++){
G3toG4BuildTree(CurVTE->GetDaughter(Idau));
}
};
#include "globals.hh"
void G3toG4BuildTree(G3VolTableEntry* curVTE, G3VolTableEntry* motherVTE)
{
// check existence of the solid
if (curVTE->GetSolid()) {
G4LogicalVolume* curLog = curVTE->GetLV();
if (!curLog) {
// skip creating logical volume
// in case it already exists
// material
G4Material* material = 0;
G3MedTableEntry* mte = G3Med.get(curVTE->GetNmed());
if (mte) material = mte->GetMaterial();
if (!material) {
G4Exception("VTE " + curVTE->GetName() + " has not defined material!!");
}
// logical volume
curLog =
new G4LogicalVolume(curVTE->GetSolid(), material, curVTE->GetName());
curVTE->SetLV(curLog);
// insert logical volume to G3SensVol vector
// in case it is sensitive
if (mte->GetISVOL()) G3SensVol.insert(curLog);
}
// get mother logical volume
G4LogicalVolume* mothLV;
if (motherVTE) {
G4String motherName = motherVTE->GetName();
if (curVTE->FindMother(motherName)->GetName() != motherName) {
// check consistency - tbr
G4Exception("G3toG4BuildTree: Inconsistent mother <-> daughter !!");
}
mothLV = motherVTE->GetLV();
}
else {
mothLV = 0;
}
// positions in motherVTE
for (G4int i=0; i<curVTE->NPCopies(); i++){
G3Pos* theG3Pos = curVTE->GetG3PosCopy(i);
if (theG3Pos->GetMotherName() == motherVTE->GetMasterClone()->GetName()) {
// rotation matrix
G4int irot = theG3Pos->GetIrot();
G4RotationMatrix* theMatrix = 0;
if (irot>0) theMatrix = G3Rot.Get(irot);
// copy number
// (in G3 numbering starts from 1 but in G4 from 0)
G4int copyNo = theG3Pos->GetCopy() - 1;
// position it
new G4PVPlacement(theMatrix, // rotation matrix
*(theG3Pos->GetPos()), // its position
curLog, // its LogicalVolume
curVTE->GetName(), // PV name
mothLV, // Mother LV
0, // only
copyNo); // copy
// verbose
// G4cout << "PV: " << i << "th copy of " << curVTE->GetName()
// << " in " << motherVTE->GetName() << " copyNo: "
// << copyNo << " irot: " << irot << " pos: "
// << *(theG3Pos->GetPos()) << endl;
}
}
// divisions
if (curVTE->GetDivision()) {
curVTE->GetDivision()->CreatePVReplica();
// verbose
// G4cout << "PVReplica: " << curVTE->GetName()
// << " in " << motherVTE->GetName() << endl;
}
}
else {
if ( !(curVTE->GetDivision() && motherVTE->GetMasterClone() == motherVTE &&
motherVTE->GetNoClones()>1)) {
// ignore dummy vte's
// (this should be the only case when the vte is dummy but
// is present in mother <-> daughters tree
G4Exception("VTE " + curVTE->GetName() + " has not defined solid!!");
}
}
// process daughters
G4int Ndau = curVTE->GetNoDaughters();
for (int Idau=0; Idau<Ndau; Idau++){
G3toG4BuildTree(curVTE->GetDaughter(Idau), curVTE);
}
}