40 #include "DetectorConstruction.hh"
42 #include "DetectorMessenger.hh"
59 #ifdef G4MULTITHREADED
99 worldPV=DefineVolumes(fPdbFileName,fChosenOption);
105 void DetectorConstruction::ConstructMaterials()
110 G4bool fromIsotopes =
false;
125 void DetectorConstruction::CheckMaterials()
127 if(!fpDefaultMaterial)
128 G4Exception(
"DetectorConstruction::CheckMaterials",
129 "DEFAULT_MATERIAL_NOT_INIT_1",
131 "Default material not initialized.");
134 G4Exception(
"DetectorConstruction::CheckMaterials",
135 "WATER_MATERIAL_NOT_INIT",
137 "Water material not initialized.");
147 if ( !fpDefaultMaterial )
149 G4Exception(
"DetectorConstruction::ConstructWorld",
150 "DEFAULT_MATERIAL_NOT_INIT_2",
152 "Default material not initialized.");
160 worldSize/2, worldSize/2, worldSize/2);
192 unsigned short int option)
203 ConstructMaterials();
208 worldPV=ConstructWorld();
213 fpBarycenterList=NULL;
217 unsigned short int isDNA;
218 fpMoleculeList = fPDBlib.
Load(filename,isDNA,verbosity);
219 if (fpMoleculeList!=NULL && isDNA==1)
226 if (fpMoleculeList!=NULL)
233 AtomisticView( worldLV,fpMoleculeList,1.0);
238 BarycenterView(worldLV,fpBarycenterList);
243 ResiduesView(worldLV,fpBarycenterList);
248 DrawBoundingVolume( worldLV,fpMoleculeList);
253 AtomisticView( worldLV,fpMoleculeList,1.0);
254 DrawBoundingVolume( worldLV,fpMoleculeList);
259 BarycenterView(worldLV,fpBarycenterList);
260 DrawBoundingVolume( worldLV,fpMoleculeList);
265 ResiduesView(worldLV,fpBarycenterList);
266 DrawBoundingVolume( worldLV,fpMoleculeList);
284 return fpBarycenterList;
291 return fpMoleculeList;
300 Molecule *moleculeListTemp,
double atomSizeFactor)
316 atomS_H, fpWaterMaterial,
"atomLV_H");
323 atomS_C, fpWaterMaterial,
"atomLV_C");
330 atomS_O, fpWaterMaterial,
"atomLV_O");
337 atomS_N, fpWaterMaterial,
"atomLV_N");
344 atomS_S, fpWaterMaterial,
"atomLV_S");
351 atomS_P, fpWaterMaterial,
"atomLV_P");
358 atomS_X, fpWaterMaterial,
"atomLV_X");
369 int nbAtomH=0, nbAtomC=0, nbAtomO=0, nbAtomN=0, nbAtomS=0, nbAtomP=0;
373 while (moleculeListTemp)
375 residueListTemp = moleculeListTemp->
GetFirst();
379 while (residueListTemp)
381 AtomTemp=residueListTemp->
GetFirst();
385 int upTo=residueListTemp->
fNbAtom;
386 for (
int i=0 ; i < (upTo + startFrom) ; i++)
389 if (AtomTemp->
fElement.compare(
"H") == 0)
394 AtomTemp->
fY*1*angstrom,
395 AtomTemp->
fZ*1*angstrom),
403 else if (AtomTemp->
fElement.compare(
"C") == 0)
408 AtomTemp->
fY*1*angstrom,
409 AtomTemp->
fZ*1*angstrom),
417 else if (AtomTemp->
fElement.compare(
"O") == 0)
422 AtomTemp->
fY*1*angstrom,
423 AtomTemp->
fZ*1*angstrom),
431 else if (AtomTemp->
fElement.compare(
"N") == 0)
436 AtomTemp->
fY*1*angstrom,
437 AtomTemp->
fZ*1*angstrom),
445 else if (AtomTemp->
fElement.compare(
"S") == 0)
450 AtomTemp->
fY*1*angstrom,
451 AtomTemp->
fZ*1*angstrom),
459 else if (AtomTemp->
fElement.compare(
"P") == 0)
464 AtomTemp->
fY*1*angstrom,
465 AtomTemp->
fZ*1*angstrom),
478 AtomTemp->
fY*1*angstrom,
479 AtomTemp->
fZ*1*angstrom),
493 residueListTemp=residueListTemp->
GetNext();
496 moleculeListTemp=moleculeListTemp->
GetNext();
499 G4cout <<
"**************** atomisticView(...) ****************" <<
G4endl;
507 G4cout <<
"Number of Phosphorus = " << nbAtomP <<
G4endl;
508 G4cout <<
"Number of undifined atoms =" << nbAtomX <<G4endl<<
G4endl;
527 while (barycenterListTemp)
531 atomS_ZZ =
new G4Orb(
"Sphere", (barycenterListTemp->
GetRadius())*angstrom);
538 barycenterListTemp->
fCenterX*1*angstrom,
539 barycenterListTemp->
fCenterY*1*angstrom,
540 barycenterListTemp->
fCenterZ*1*angstrom),
548 barycenterListTemp=barycenterListTemp->
GetNext();
577 while (barycenterListTemp)
582 AS_ZZ =
new G4Orb(
"Sphere", 1.*angstrom);
598 BS_ZZ =
new G4Orb(
"Sphere", 1.*angstrom);
615 CS_ZZ =
new G4Orb(
"Sphere", 1.*angstrom);
634 tubS1_ZZ =
new G4Tubs(
"Cylinder",
659 G4double llUll=std::sqrt(Ux*Ux+Uy*Uy+Uz*Uz);
684 tubLV1_ZZ,
"atomZZ",worldLV,
false, 0, fCheckOverlaps);
687 tubS2_ZZ =
new G4Tubs(
"Cylinder2",
701 tubLV2_ZZ =
new G4LogicalVolume(tubS2_ZZ, fpWaterMaterial,
"tubLV2_ZZ");
712 llUll=std::sqrt(Ux*Ux+Uy*Uy+Uz*Uz);
719 theta_euler = direction.
theta();
720 phi_euler = direction.
phi();
742 barycenterListTemp=barycenterListTemp->
GetNext();
751 void DetectorConstruction::DrawBoundingVolume(
G4LogicalVolume* worldLV,
764 =
new G4Box(
"Bounding", dX*1*angstrom, dY*1*angstrom, dZ*1*angstrom);
793 fPdbFileName=fileName;
794 #ifdef G4MULTITHREADED
796 DefineVolumes(fPdbFileName,fChosenOption)
801 DefineVolumes(fPdbFileName,fChosenOption)
810 if (fPdbFileStatus>0)
812 G4cout<<
"Build only world volume and bounding volume"
814 #ifdef G4MULTITHREADED
816 DefineVolumes(fPdbFileName,10)
821 DefineVolumes(fPdbFileName,10)
832 if (fPdbFileStatus>0)
834 #ifdef G4MULTITHREADED
836 DefineVolumes(fPdbFileName,1)
841 DefineVolumes(fPdbFileName,1)
852 if (fPdbFileStatus>0)
854 #ifdef G4MULTITHREADED
856 DefineVolumes(fPdbFileName,2)
861 DefineVolumes(fPdbFileName,2)
872 if (fPdbFileStatus>0)
874 #ifdef G4MULTITHREADED
876 DefineVolumes(fPdbFileName,3)
881 DefineVolumes(fPdbFileName,3)
892 if (fPdbFileStatus>0)
894 #ifdef G4MULTITHREADED
896 DefineVolumes(fPdbFileName,11)
901 DefineVolumes(fPdbFileName,11)
912 if (fPdbFileStatus>0)
914 #ifdef G4MULTITHREADED
916 DefineVolumes(fPdbFileName,12)
921 DefineVolumes(fPdbFileName,12)
932 if (fPdbFileStatus>0)
934 #ifdef G4MULTITHREADED
936 DefineVolumes(fPdbFileName,13)
941 DefineVolumes(fPdbFileName,13)
double fCenterBaseX
"X coordinate" of this Base Barycenter
double fCenterPhosphateZ
"Z coordinate" of this Phosphate Barycenter
void DrawResiduesWithBounding_()
double fCenterPhosphateX
"X coordinate" of this Phosphate Barycenter
double fCenterPhosphateY
"Y coordinate" of this Phosphate Barycenter
G4Material * FindOrBuildMaterial(const G4String &name, G4bool isotopes=true, G4bool warning=false)
Molecule * Load(const std::string &filename, unsigned short int &isDNA, unsigned short int verbose)
Load PDB file into memory.
double fCenterY
"Y coordinate" of this nucelotide Barycenter
CLHEP::Hep3Vector G4ThreeVector
CLHEP::HepRotation G4RotationMatrix
double fCenterX
"X coordinate" of this nucelotide Barycenter
double fCenterSugarX
"X coordinate" of this Sugar Barycenter
std::vector< ExP01TrackerHit * > a
static G4Material * GetMaterial(const G4String &name, G4bool warning=true)
int fNbAtom
Number of atoms into a residue (usage before vector)
int universe_mean_density
Barycenter * ComputeNucleotideBarycenters(Molecule *moleculeListTemp)
Compute nucleotide barycenter from memory.
G4VPhysicalVolume * Construct()
Residue * GetFirst()
Get the first Residue.
Residue * GetNext()
Get the next residue.
static G4Colour Magenta()
double fZ
Z orthogonal coordinates in Angstroms.
double fCenterSugarY
"Y coordinate" of this Sugar Barycenter
static G4NistManager * Instance()
double fCenterBaseZ
"Z coordinate" of this Base Barycenter
void SetForceSolid(G4bool=true)
HepRotation inverse() const
Barycenter * GetBarycenterList()
virtual void DefineWorldVolume(G4VPhysicalVolume *worldVol, G4bool topologyIsChanged=true)
static G4PhysicalVolumeStore * GetInstance()
Molecule * GetMoleculeList()
G4GLOB_DLL std::ostream G4cout
void SetVisibility(G4bool=true)
void ComputeNbNucleotidsPerStrand(Molecule *moleculeListTemp)
Compute number of nucleotide per strand.
double fCenterSugarZ
"Z coordinate" of this Sugar Barycenter
void DrawNucleotidesWithBounding_()
void BuildBoundingVolume()
static G4LogicalVolumeStore * GetInstance()
static G4SolidStore * GetInstance()
Molecule * GetNext()
information about molecule (not implemented)
static G4GeometryManager * GetInstance()
void DrawAtomsWithBounding_()
static constexpr double kelvin
void ReinitializeGeometry(G4bool destroyFirst=false, G4bool prop=true)
double GetRadius()
Get the distance between the farther atom and nucleotide barycenter.
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Barycenter * GetNext()
Get the next Barycenter.
static G4RunManager * GetRunManager()
G4LogicalVolume * GetLogicalVolume() const
Atom * GetFirst()
Get the first atom.
void ComputeBoundingVolumeParams(Molecule *moleculeListTemp, double &dX, double &dY, double &dZ, double &tX, double &tY, double &tZ)
Compute the corresponding bounding volume parameters.
double fX
X orthogonal coordinates in Angstroms.
void LoadPDBfile(G4String fileName)
double fCenterBaseY
"Y coordinate" of this Base Barycenter
Atom * GetNext()
Returns the next Atom.
static constexpr double angstrom
double fY
Y orthogonal coordinates in Angstroms.
void OpenGeometry(G4VPhysicalVolume *vol=0)
static constexpr double pi
std::string fElement
Element symbol extracted from 'atom name'.
double fCenterZ
"Z coordinate" of this nucelotide Barycenter
static constexpr double mole
void SetVisAttributes(const G4VisAttributes *pVA)