#include "G3VolTableEntry.hh"
Go to the source code of this file.
Defines | |
#define | G3TOG4BUILDTREE_HH 1 |
Functions | |
void | G3toG4BuildTree (G3VolTableEntry *curVTE, G3VolTableEntry *motherVTE) |
void | G3toG4BuildLVTree (G3VolTableEntry *curVTE, G3VolTableEntry *motherVTE) |
void | G3toG4BuildPVTree (G3VolTableEntry *curVTE) |
#define G3TOG4BUILDTREE_HH 1 |
Definition at line 50 of file G3toG4BuildTree.hh.
void G3toG4BuildLVTree | ( | G3VolTableEntry * | curVTE, | |
G3VolTableEntry * | motherVTE | |||
) |
Definition at line 49 of file G3toG4BuildTree.cc.
References FatalException, G3Med, G3SensVol, G3toG4BuildLVTree(), G4Exception(), G3MedTable::get(), G3VolTableEntry::GetDaughter(), G3VolTableEntry::GetDivision(), G3MedTableEntry::GetISVOL(), G3VolTableEntry::GetLV(), G3VolTableEntry::GetMasterClone(), G3MedTableEntry::GetMaterial(), G3VolTableEntry::GetName(), G3VolTableEntry::GetNmed(), G3VolTableEntry::GetNoClones(), G3VolTableEntry::GetNoDaughters(), G3VolTableEntry::GetSolid(), and G3VolTableEntry::SetLV().
Referenced by G3toG4BuildLVTree(), and G3toG4BuildTree().
00050 { 00051 // check existence of the solid 00052 if (curVTE->GetSolid()) { 00053 G4LogicalVolume* curLog = curVTE->GetLV(); 00054 if (!curLog) { 00055 // skip creating logical volume 00056 // in case it already exists 00057 00058 // material 00059 G4Material* material = 0; 00060 G3MedTableEntry* mte = G3Med.get(curVTE->GetNmed()); 00061 if (mte) material = mte->GetMaterial(); 00062 if (!material) { 00063 G4String err_message = "VTE " + curVTE->GetName() 00064 + " has not defined material!!"; 00065 G4Exception("G3toG4BuildLVTree()", "G3toG40001", 00066 FatalException, err_message); 00067 return; 00068 } 00069 00070 // logical volume 00071 curLog = 00072 new G4LogicalVolume(curVTE->GetSolid(), material, curVTE->GetName()); 00073 curVTE->SetLV(curLog); 00074 00075 // insert logical volume to G3SensVol vector 00076 // in case it is sensitive 00077 if (mte->GetISVOL()) G3SensVol.push_back(curLog); 00078 } 00079 } 00080 else { 00081 if ( !(curVTE->GetDivision() && motherVTE->GetMasterClone() == motherVTE && 00082 motherVTE->GetNoClones()>1)) { 00083 // ignore dummy vte's 00084 // (this should be the only case when the vte is dummy but 00085 // is present in mother <-> daughters tree 00086 G4String err_message = "VTE " + curVTE->GetName() 00087 + " has not defined solid!!"; 00088 G4Exception("G3toG4BuildLVTree()", "G3toG40002", 00089 FatalException, err_message); 00090 return; 00091 } 00092 } 00093 00094 // process daughters 00095 G4int Ndau = curVTE->GetNoDaughters(); 00096 for (int Idau=0; Idau<Ndau; Idau++){ 00097 G3toG4BuildLVTree(curVTE->GetDaughter(Idau), curVTE); 00098 } 00099 }
void G3toG4BuildPVTree | ( | G3VolTableEntry * | curVTE | ) |
Definition at line 101 of file G3toG4BuildTree.cc.
References G3VolTableEntry::ClearDivision(), G3VolTableEntry::ClearG3PosCopy(), G3Division::CreatePVReplica(), FatalException, G3VolTableEntry::FindMother(), G3Rot, G3toG4BuildPVTree(), G4cout, G4endl, G4Exception(), G3RotTable::Get(), G3VolTableEntry::GetDaughter(), G3VolTableEntry::GetDivision(), G3VolTableEntry::GetG3PosCopy(), G3VolTableEntry::GetLV(), G3VolTableEntry::GetMother(), G3VolTableEntry::GetName(), G3VolTableEntry::GetNoDaughters(), G3VolTableEntry::GetNoMothers(), G3VolTableEntry::GetSolid(), G4ReflectionFactory::Instance(), G3VolTableEntry::NPCopies(), and G4ReflectionFactory::Place().
Referenced by G3toG4BuildPVTree(), and G3toG4BuildTree().
00102 { 00103 // check existence of the solid 00104 if (curVTE->GetSolid()) { 00105 G4LogicalVolume* curLog = curVTE->GetLV(); 00106 00107 // positions in motherVTE 00108 for (G4int i=0; i<curVTE->NPCopies(); i++){ 00109 00110 G3Pos* theG3Pos = curVTE->GetG3PosCopy(i); 00111 if (theG3Pos) { 00112 00113 // loop over all mothers 00114 for (G4int im=0; im<curVTE->GetNoMothers(); im++) { 00115 00116 G3VolTableEntry* motherVTE = curVTE->GetMother(im); 00117 if (theG3Pos->GetMotherName() == motherVTE->GetMasterClone()->GetName()) { 00118 00119 // get mother logical volume 00120 G4LogicalVolume* mothLV=0; 00121 G4String motherName = motherVTE->GetName(); 00122 if (!curVTE->FindMother(motherName)) continue; 00123 if (curVTE->FindMother(motherName)->GetName() != motherName) { 00124 // check consistency - tbr 00125 G4String err_message = 00126 "G3toG4BuildTree: Inconsistent mother <-> daughter !!"; 00127 G4Exception("G3toG4BuildPVTree()", "G3toG40003", 00128 FatalException, err_message); 00129 return; 00130 } 00131 mothLV = motherVTE->GetLV(); 00132 00133 // copy number 00134 // (in G3 numbering starts from 1 but in G4 from 0) 00135 G4int copyNo = theG3Pos->GetCopy() - 1; 00136 00137 // position it if not top-level volume 00138 00139 if (mothLV != 0) { 00140 00141 // transformation 00142 G4int irot = theG3Pos->GetIrot(); 00143 G4RotationMatrix* theMatrix = 0; 00144 if (irot>0) theMatrix = G3Rot.Get(irot); 00145 G4Rotate3D rotation; 00146 if (theMatrix) { 00147 rotation = G4Rotate3D(*theMatrix); 00148 } 00149 00150 #ifndef G3G4_NO_REFLECTION 00151 G4Translate3D translation(*(theG3Pos->GetPos())); 00152 G4Transform3D transform3D = translation * (rotation.inverse()); 00153 00154 G4ReflectionFactory::Instance() 00155 ->Place(transform3D, // transformation 00156 curVTE->GetName(), // PV name 00157 curLog, // its logical volume 00158 mothLV, // mother logical volume 00159 false, // only 00160 copyNo); // copy 00161 #else 00162 new G4PVPlacement(theMatrix, // rotation matrix 00163 *(theG3Pos->GetPos()), // its position 00164 curLog, // its LogicalVolume 00165 curVTE->GetName(), // PV name 00166 mothLV, // Mother LV 00167 0, // only 00168 copyNo); // copy 00169 #endif 00170 00171 // verbose 00172 #ifdef G3G4DEBUG 00173 G4cout << "PV: " << i << "th copy of " << curVTE->GetName() 00174 << " in " << motherVTE->GetName() << " copyNo: " 00175 << copyNo << " irot: " << irot << " pos: " 00176 << *(theG3Pos->GetPos()) << G4endl; 00177 #endif 00178 } 00179 } 00180 } 00181 // clear this position 00182 curVTE->ClearG3PosCopy(i); 00183 i--; 00184 } 00185 } 00186 00187 // divisions 00188 if (curVTE->GetDivision()) { 00189 curVTE->GetDivision()->CreatePVReplica(); 00190 // verbose 00191 #ifdef G3G4DEBUG 00192 G4cout << "CreatePVReplica: " << curVTE->GetName() 00193 << " in " << curVTE->GetMother()->GetName() << G4endl; 00194 #endif 00195 00196 // clear this divison 00197 curVTE->ClearDivision(); 00198 } 00199 } 00200 00201 // process daughters 00202 G4int Ndau = curVTE->GetNoDaughters(); 00203 for (int Idau=0; Idau<Ndau; Idau++){ 00204 G3toG4BuildPVTree(curVTE->GetDaughter(Idau)); 00205 } 00206 }
void G3toG4BuildTree | ( | G3VolTableEntry * | curVTE, | |
G3VolTableEntry * | motherVTE | |||
) |
Definition at line 43 of file G3toG4BuildTree.cc.
References G3toG4BuildLVTree(), and G3toG4BuildPVTree().
Referenced by G4BuildGeom().
00044 { 00045 G3toG4BuildLVTree(curVTE, motherVTE); 00046 G3toG4BuildPVTree(curVTE); 00047 }