Geant4  10.01.p01
DetectorConstruction.cc
Go to the documentation of this file.
1 //
2 // ********************************************************************
3 // * License and Disclaimer *
4 // * *
5 // * The Geant4 software is copyright of the Copyright Holders of *
6 // * the Geant4 Collaboration. It is provided under the terms and *
7 // * conditions of the Geant4 Software License, included in the file *
8 // * LICENSE and available at http://cern.ch/geant4/license . These *
9 // * include a list of copyright holders. *
10 // * *
11 // * Neither the authors of this software system, nor their employing *
12 // * institutes,nor the agencies providing financial support for this *
13 // * work make any representation or warranty, express or implied, *
14 // * regarding this software system or assume any liability for its *
15 // * use. Please see the license in the file LICENSE and URL above *
16 // * for the full disclaimer and the limitation of liability. *
17 // * *
18 // * This code implementation is the result of the scientific and *
19 // * technical work of the GEANT4 collaboration. *
20 // * By using, copying, modifying or distributing the software (or *
21 // * any work based on the software) you agree to acknowledge its *
22 // * use in resulting scientific publications, and indicate your *
23 // * acceptance of all terms of the Geant4 Software license. *
24 // ********************************************************************
25 //
26 // This example is provided by the Geant4-DNA collaboration
27 // Any report or published results obtained using the Geant4-DNA software
28 // shall cite the following Geant4-DNA collaboration publication:
29 // Med. Phys. 37 (2010) 4692-4708
30 // Delage et al. PDB4DNA: implementation of DNA geometry from the Protein Data
31 // Bank (PDB) description for Geant4-DNA Monte-Carlo
32 // simulations (submitted to Comput. Phys. Commun.)
33 // The Geant4-DNA web site is available at http://geant4-dna.org
34 //
35 // $Id$
36 //
39 
40 #include "DetectorConstruction.hh"
41 
42 #include "DetectorMessenger.hh"
43 #include "G4Box.hh"
44 #include "G4Colour.hh"
45 #include "G4GeometryManager.hh"
46 #include "G4LogicalVolume.hh"
47 #include "G4LogicalVolumeStore.hh"
48 #include "G4Material.hh"
49 #include "G4NistManager.hh"
50 #include "G4Orb.hh"
51 #include "G4PhysicalConstants.hh"
52 #include "G4PhysicalVolumeStore.hh"
53 #include "G4PVPlacement.hh"
54 #include "G4SolidStore.hh"
55 #include "G4SystemOfUnits.hh"
56 #include "G4Tubs.hh"
57 #include "G4VisAttributes.hh"
58 
59 #ifdef G4MULTITHREADED
60 #include "G4MTRunManager.hh"
61 #else
62 #include "G4RunManager.hh"
63 #endif
64 
65 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
66 
69  fpMessenger(0),
70  fCheckOverlaps(false)
71 {
72  //Select a PDB file name by default
73  //otherwise modified by the LoadPDBfile messenger
74  //
75  fPdbFileName=G4String("1ZBB.pdb");
77  fChosenOption=11;
78 
81  fpMessenger = new DetectorMessenger(this);
82 }
83 
84 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
85 
87 {
88 }
89 
90 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
91 
93 {
94  fChosenOption=11;//Draw atomic with bounding box (visualisation by default)
95  fPdbFileStatus=0;//There is no PDB file loaded at this stage
96 
97  //Define materials and geometry
98  G4VPhysicalVolume* worldPV;
100  return worldPV;
101 }
102 
103 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
104 
106 {
107  //[G4_WATER]
108  //
109  G4NistManager* nistManager = G4NistManager::Instance();
110  G4bool fromIsotopes = false;
111  nistManager->FindOrBuildMaterial("G4_WATER", fromIsotopes);
113 
114  //[Vacuum]
115  G4double a; // mass of a mole;
116  G4double z; // z=mean number of protons;
118  new G4Material("Galactic", z=1., a=1.01*g/mole,density= universe_mean_density,
119  kStateGas, 2.73*kelvin, 3.e-18*pascal);
121 }
122 
123 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
124 
126 {
128  {
129  G4cerr << "Cannot retrieve materials already defined. " << G4endl;
130  G4cerr << "Exiting application " << G4endl;
131  exit(1);
132  }
133 }
134 
135 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
136 
138 {
139  // Geometry parameters
140  G4double worldSize = 1000*1*angstrom;
141 
142  if ( !fpDefaultMaterial )
143  {
144  G4cerr << "Cannot retrieve materials already defined. " << G4endl;
145  G4cerr << "Exiting application " << G4endl;
146  exit(1);
147  }
148 
149  //
150  // World
151  //
152  G4VSolid* worldS
153  = new G4Box("World", // its name
154  worldSize/2, worldSize/2, worldSize/2); // its size
155 
157  worldLV
158  = new G4LogicalVolume(
159  worldS, // its solid
160  fpDefaultMaterial, // its material
161  "World"); // its name
162 
163  G4VisAttributes *MyVisAtt_ZZ = new G4VisAttributes(
165  MyVisAtt_ZZ ->SetVisibility (false);
166  worldLV->SetVisAttributes(MyVisAtt_ZZ);
167 
169  worldPV
170  = new G4PVPlacement(
171  0, // no rotation
172  G4ThreeVector(), // at (0,0,0)
173  worldLV, // its logical volume
174  "World", // its name
175  0, // its mother volume
176  false, // no boolean operation
177  0, // copy number
178  true); // checking overlaps forced to YES
179 
180  return worldPV;
181 }
182 
183 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
184 
186  unsigned short int option)
187 {
188  //Clean old geometry
189  //
194 
195  // Define Materials
196  //
198 
199  //Reconstruct world not to superimpose on geometries
200  G4VPhysicalVolume* worldPV;
201  G4LogicalVolume* worldLV;
202  worldPV=ConstructWorld();
203  worldLV=worldPV->GetLogicalVolume();
204 
205  //List of molecules inside pdb file separated by TER keyword
206  fpMoleculeList=NULL;
207  fpBarycenterList=NULL;
208 
209  //'fPDBlib.load' is currently done for each 'DefineVolumes' call.
210  int verbosity=0; //To be implemented
211  unsigned short int isDNA;
212  fpMoleculeList = fPDBlib.Load(filename,isDNA,verbosity);
213  if (fpMoleculeList!=NULL && isDNA==1)
214  {
217  G4cout<<"This PDB file is DNA."<<G4endl;
218  }
219 
220  if (fpMoleculeList!=NULL)
221  {
222  fPdbFileStatus=1;
223  }
224 
225  if (option==1)
226  {
227  AtomisticView( worldLV,fpMoleculeList,1.0);
228  }
229  else
230  if (option==2)
231  {
233  }
234  else
235  if (option==3)
236  {
238  }
239  else
240  if (option==10)
241  {
243  }
244  else
245  if (option==11)
246  {
247  AtomisticView( worldLV,fpMoleculeList,1.0);
249  }
250  else
251  if (option==12)
252  {
255  }
256  else
257  if (option==13)
258  {
261  }
262  // Always return the physical World
263  //
264  return worldPV;
265 }
266 
267 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
268 
270 {
271  return fPDBlib;
272 }
273 
274 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
275 
277 {
278  return fpBarycenterList;
279 }
280 
281 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
282 
284 {
285  return fpMoleculeList;
286 }
287 
288 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
289 
292 //
294  Molecule *moleculeListTemp, double atomSizeFactor)
295 {
296  CheckMaterials();
297 
298  // All solids are defined for different color attributes :
299  G4double sphereSize = atomSizeFactor*1*angstrom;
300  G4VSolid* atomS_H = new G4Orb("Sphere", sphereSize*1.2);
301  G4VSolid* atomS_C = new G4Orb("Sphere", sphereSize*1.7);
302  G4VSolid* atomS_O = new G4Orb("Sphere", sphereSize*1.52);
303  G4VSolid* atomS_N = new G4Orb("Sphere", sphereSize*1.55);
304  G4VSolid* atomS_S = new G4Orb("Sphere", sphereSize*1.8);
305  G4VSolid* atomS_P = new G4Orb("Sphere", sphereSize*1.8);
306  G4VSolid* atomS_X = new G4Orb("Sphere", sphereSize); //Undefined
307 
308  //Logical volumes and color table for atoms :
309  G4LogicalVolume* atomLV_H = new G4LogicalVolume(
310  atomS_H, fpWaterMaterial, "atomLV_H"); // its solid, material, name
311  G4VisAttributes * MyVisAtt_H = new G4VisAttributes(
313  MyVisAtt_H->SetForceSolid(true);
314  atomLV_H->SetVisAttributes(MyVisAtt_H);
315 
316  G4LogicalVolume* atomLV_C = new G4LogicalVolume(
317  atomS_C, fpWaterMaterial, "atomLV_C"); // its solid, material, name
318  G4VisAttributes * MyVisAtt_C = new G4VisAttributes(
319  G4Colour(G4Colour::Gray()));//Black in CPK, but bad rendering
320  MyVisAtt_C->SetForceSolid(true);
321  atomLV_C->SetVisAttributes(MyVisAtt_C);
322 
323  G4LogicalVolume* atomLV_O = new G4LogicalVolume(
324  atomS_O, fpWaterMaterial, "atomLV_O"); // its solid, material, name
325  G4VisAttributes * MyVisAtt_O = new G4VisAttributes(
327  MyVisAtt_O->SetForceSolid(true);
328  atomLV_O->SetVisAttributes(MyVisAtt_O);
329 
330  G4LogicalVolume* atomLV_N = new G4LogicalVolume(
331  atomS_N, fpWaterMaterial, "atomLV_N"); // its solid, material, name
332  G4VisAttributes * MyVisAtt_N = new G4VisAttributes(
333  G4Colour(G4Colour(0.,0.,0.5)));//Dark blue
334  MyVisAtt_N->SetForceSolid(true);
335  atomLV_N->SetVisAttributes(MyVisAtt_N);
336 
337  G4LogicalVolume* atomLV_S = new G4LogicalVolume(
338  atomS_S, fpWaterMaterial, "atomLV_S"); // its solid, material, name
339  G4VisAttributes * MyVisAtt_S = new G4VisAttributes(G4Colour(
340  G4Colour::Yellow()));
341  MyVisAtt_S->SetForceSolid(true);
342  atomLV_S->SetVisAttributes(MyVisAtt_S);
343 
344  G4LogicalVolume* atomLV_P = new G4LogicalVolume(
345  atomS_P, fpWaterMaterial, "atomLV_P"); // its solid, material, name
346  G4VisAttributes * MyVisAtt_P = new G4VisAttributes(
347  G4Colour(G4Colour(1.0,0.5,0.)));//Orange
348  MyVisAtt_P->SetForceSolid(true);
349  atomLV_P->SetVisAttributes(MyVisAtt_P);
350 
351  G4LogicalVolume* atomLV_X = new G4LogicalVolume(
352  atomS_X, fpWaterMaterial, "atomLV_X"); // its solid, material, name
353  G4VisAttributes * MyVisAtt_X = new G4VisAttributes(
354  G4Colour(G4Colour(1.0,0.75,0.8)));//Pink, other elements in CKP
355  MyVisAtt_X->SetForceSolid(true);
356  atomLV_X->SetVisAttributes(MyVisAtt_X);
357 
358  //Placement and physical volume construction from memory
359  Residue *residueListTemp;
360  Atom *AtomTemp;
361 
362  int nbAtomTot=0; //Number total of atoms
363  int nbAtomH=0, nbAtomC=0, nbAtomO=0, nbAtomN=0, nbAtomS=0, nbAtomP=0;
364  int nbAtomX=0;
365  int k=0;
366 
367  while (moleculeListTemp)
368  {
369  residueListTemp = moleculeListTemp->GetFirst();
370 
371  k++;
372  int j=0;
373  while (residueListTemp)
374  {
375  AtomTemp=residueListTemp->GetFirst();
376  j++;
377 
378  int startFrom=0;
379  int upTo=residueListTemp->fNbAtom; //case Base+sugar+phosphat (all atoms)
380  for (int i=0 ; i < (upTo + startFrom) ; i++) //Phosphat or Sugar or Base
381  {
382 
383  if (AtomTemp->fElement.compare("H") == 0)
384  {
385  nbAtomH++;
386  new G4PVPlacement(0,
387  G4ThreeVector(AtomTemp->fX*1*angstrom,
388  AtomTemp->fY*1*angstrom,
389  AtomTemp->fZ*1*angstrom),
390  atomLV_H,
391  "atomP",
392  worldLV,
393  false,
394  0,
396  }
397  else if (AtomTemp->fElement.compare("C") == 0)
398  {
399  nbAtomC++;
400  new G4PVPlacement(0,
401  G4ThreeVector(AtomTemp->fX*1*angstrom,
402  AtomTemp->fY*1*angstrom,
403  AtomTemp->fZ*1*angstrom),
404  atomLV_C,
405  "atomP",
406  worldLV,
407  false,
408  0,
410  }
411  else if (AtomTemp->fElement.compare("O") == 0)
412  {
413  nbAtomO++;
414  new G4PVPlacement(0,
415  G4ThreeVector(AtomTemp->fX*1*angstrom,
416  AtomTemp->fY*1*angstrom,
417  AtomTemp->fZ*1*angstrom),
418  atomLV_O,
419  "atomP",
420  worldLV,
421  false,
422  0,
424  }
425  else if (AtomTemp->fElement.compare("N") == 0)
426  {
427  nbAtomN++;
428  new G4PVPlacement(0,
429  G4ThreeVector(AtomTemp->fX*1*angstrom,
430  AtomTemp->fY*1*angstrom,
431  AtomTemp->fZ*1*angstrom),
432  atomLV_N,
433  "atomP",
434  worldLV,
435  false,
436  0,
438  }
439  else if (AtomTemp->fElement.compare("S") == 0)
440  {
441  nbAtomS++;
442  new G4PVPlacement(0,
443  G4ThreeVector(AtomTemp->fX*1*angstrom,
444  AtomTemp->fY*1*angstrom,
445  AtomTemp->fZ*1*angstrom),
446  atomLV_S,
447  "atomP",
448  worldLV,
449  false,
450  0,
452  }
453  else if (AtomTemp->fElement.compare("P") == 0)
454  {
455  nbAtomP++;
456  new G4PVPlacement(0,
457  G4ThreeVector(AtomTemp->fX*1*angstrom,
458  AtomTemp->fY*1*angstrom,
459  AtomTemp->fZ*1*angstrom),
460  atomLV_P,
461  "atomP",
462  worldLV,
463  false,
464  0,
466  }
467  else
468  {
469  nbAtomX++;
470  new G4PVPlacement(0,
471  G4ThreeVector(AtomTemp->fX*1*angstrom,
472  AtomTemp->fY*1*angstrom,
473  AtomTemp->fZ*1*angstrom),
474  atomLV_X,
475  "atomP",
476  worldLV,
477  false,
478  0,
480  }
481 
482  nbAtomTot++;
483  //}//End if (i>=startFrom)
484  AtomTemp=AtomTemp->GetNext();
485  }//end of for ( i=0 ; i < residueListTemp->nbAtom ; i++)
486 
487  residueListTemp=residueListTemp->GetNext();
488  }//end of while (residueListTemp)
489 
490  moleculeListTemp=moleculeListTemp->GetNext();
491  }//end of while (moleculeListTemp)
492 
493  G4cout << "**************** atomisticView(...) ****************" <<G4endl;
494  G4cout << "Number of loaded chains = " << k <<G4endl;
495  G4cout << "Number of Atoms = " << nbAtomTot <<G4endl;
496  G4cout << "Number of Hydrogens = " << nbAtomH <<G4endl;
497  G4cout << "Number of Carbons = " << nbAtomC <<G4endl;
498  G4cout << "Number of Oxygens = " << nbAtomO <<G4endl;
499  G4cout << "Number of Nitrogens = " << nbAtomN <<G4endl;
500  G4cout << "Number of Sulfurs = " << nbAtomS <<G4endl;
501  G4cout << "Number of Phosphorus = " << nbAtomP <<G4endl;
502  G4cout << "Number of undifined atoms =" << nbAtomX <<G4endl<<G4endl;
503 }
504 
505 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
506 
509 //
511  Barycenter *barycenterListTemp)
512 {
513  CheckMaterials();
514 
515  G4VSolid* atomS_ZZ;
516  G4LogicalVolume* atomLV_ZZ;
517  G4VisAttributes* MyVisAtt_ZZ;
518 
519  int k=0;
520 
521  while (barycenterListTemp)
522  {
523  k++;
524 
525  atomS_ZZ = new G4Orb("Sphere", (barycenterListTemp->GetRadius())*angstrom);
526  atomLV_ZZ = new G4LogicalVolume(atomS_ZZ,fpWaterMaterial,"atomLV_ZZ");
527  MyVisAtt_ZZ = new G4VisAttributes(G4Colour(G4Colour::Magenta()));
528  MyVisAtt_ZZ->SetForceSolid(true);
529  atomLV_ZZ->SetVisAttributes(MyVisAtt_ZZ);
530 
532  barycenterListTemp->fCenterX*1*angstrom,
533  barycenterListTemp->fCenterY*1*angstrom,
534  barycenterListTemp->fCenterZ*1*angstrom),
535  atomLV_ZZ,
536  "atomZZ",
537  worldLV,
538  false,
539  0,
541 
542  barycenterListTemp=barycenterListTemp->GetNext();
543  }//end of while (moleculeListTemp)
544 }
545 
546 
547 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
548 
551 //
553  Barycenter *barycenterListTemp)
554 {
555  CheckMaterials();
556  G4VisAttributes* MyVisAtt_ZZ;
557 
558  G4VSolid* tubS1_ZZ;
559  G4LogicalVolume* tubLV1_ZZ;
560  G4VSolid* tubS2_ZZ;
561  G4LogicalVolume* tubLV2_ZZ;
562 
563  G4VSolid* AS_ZZ;
564  G4LogicalVolume* ALV_ZZ;
565  G4VSolid* BS_ZZ;
566  G4LogicalVolume* BLV_ZZ;
567  G4VSolid* CS_ZZ;
568  G4LogicalVolume* CLV_ZZ;
569 
570  int k=0;
571 
572  while (barycenterListTemp)
573  {
574  k++;
575 
576  //3 spheres to Base, Sugar, Phosphate)
577  AS_ZZ = new G4Orb("Sphere", 1.*angstrom);
578  ALV_ZZ = new G4LogicalVolume(AS_ZZ,fpWaterMaterial, "ALV_ZZ");
579  MyVisAtt_ZZ = new G4VisAttributes(G4Colour(G4Colour::Blue()));
580  MyVisAtt_ZZ->SetForceSolid(true);
581  ALV_ZZ->SetVisAttributes(MyVisAtt_ZZ);
582  new G4PVPlacement(0,
583  G4ThreeVector(barycenterListTemp->fCenterBaseX*angstrom,
584  barycenterListTemp->fCenterBaseY*angstrom,
585  barycenterListTemp->fCenterBaseZ*angstrom),
586  ALV_ZZ,
587  "AZZ",
588  worldLV,
589  false,
590  0,
592 
593  BS_ZZ = new G4Orb("Sphere", 1.*angstrom);
594  BLV_ZZ = new G4LogicalVolume(BS_ZZ,fpWaterMaterial, "BLV_ZZ");
595  MyVisAtt_ZZ = new G4VisAttributes(G4Colour(G4Colour::Red()));
596  MyVisAtt_ZZ->SetForceSolid(true);
597  BLV_ZZ->SetVisAttributes(MyVisAtt_ZZ);
598  new G4PVPlacement(0,
600  (barycenterListTemp->fCenterPhosphateX)*angstrom,
601  (barycenterListTemp->fCenterPhosphateY)*angstrom,
602  (barycenterListTemp->fCenterPhosphateZ)*angstrom),
603  BLV_ZZ,
604  "BZZ",
605  worldLV,
606  false,
607  0,
609 
610  CS_ZZ = new G4Orb("Sphere", 1.*angstrom);
611  CLV_ZZ = new G4LogicalVolume(CS_ZZ,fpWaterMaterial, "CLV_ZZ");
612  MyVisAtt_ZZ = new G4VisAttributes(G4Colour(G4Colour::Yellow()));
613  MyVisAtt_ZZ->SetForceSolid(true);
614  CLV_ZZ->SetVisAttributes(MyVisAtt_ZZ);
615  new G4PVPlacement(0,
617  barycenterListTemp->fCenterSugarX*angstrom,
618  barycenterListTemp->fCenterSugarY*angstrom,
619  barycenterListTemp->fCenterSugarZ*angstrom),
620  CLV_ZZ,
621  "CZZ",
622  worldLV,
623  false,
624  0,
626 
627  //2 cylinders (Base<=>Sugar and Sugar<=>Phosphat)
628  // Cylinder Base<=>Sugar
629  tubS1_ZZ = new G4Tubs( "Cylinder",
630  0.,
631  0.5*angstrom,
632  std::sqrt (
633  (barycenterListTemp->fCenterBaseX-barycenterListTemp->fCenterSugarX)
634  * (barycenterListTemp->fCenterBaseX-barycenterListTemp->fCenterSugarX)
635  + (barycenterListTemp->fCenterBaseY-barycenterListTemp->fCenterSugarY)
636  * (barycenterListTemp->fCenterBaseY-barycenterListTemp->fCenterSugarY)
637  + (barycenterListTemp->fCenterBaseZ-barycenterListTemp->fCenterSugarZ)
638  * (barycenterListTemp->fCenterBaseZ-barycenterListTemp->fCenterSugarZ)
639  ) /2 *angstrom,
640  0.,
641  2.*pi );
642 
643  tubLV1_ZZ = new G4LogicalVolume(tubS1_ZZ,fpWaterMaterial, "tubLV_ZZ");
644  MyVisAtt_ZZ = new G4VisAttributes(G4Colour(G4Colour::Green()));
645  MyVisAtt_ZZ->SetForceSolid(true);
646  tubLV1_ZZ->SetVisAttributes(MyVisAtt_ZZ);
647 
648  G4double Ux= barycenterListTemp->fCenterBaseX-
649  barycenterListTemp->fCenterSugarX;
650  G4double Uy= barycenterListTemp->fCenterBaseY-
651  barycenterListTemp->fCenterSugarY;
652  G4double Uz= barycenterListTemp->fCenterBaseZ-
653  barycenterListTemp->fCenterSugarZ;
654  G4double llUll=std::sqrt(Ux*Ux+Uy*Uy+Uz*Uz);
655 
656  Ux=Ux/llUll;
657  Uy=Uy/llUll;
658  Uz=Uz/llUll;
659 
660  G4ThreeVector direction = G4ThreeVector(Ux,Uy,Uz);
661  G4double theta_euler = direction.theta();
662  G4double phi_euler = direction.phi();
663  G4double psi_euler = 0;
664 
665  //Warning : clhep Euler constructor build inverse matrix !
666  G4RotationMatrix rotm1Inv = G4RotationMatrix(phi_euler+pi/2,
667  theta_euler,
668  psi_euler);
669  G4RotationMatrix rotm1 = rotm1Inv.inverse();
670  G4ThreeVector translm1 = G4ThreeVector(
671  (barycenterListTemp->fCenterBaseX+barycenterListTemp->fCenterSugarX)/2.
672  *angstrom,
673  (barycenterListTemp->fCenterBaseY+barycenterListTemp->fCenterSugarY)/2.
674  *angstrom,
675  (barycenterListTemp->fCenterBaseZ+barycenterListTemp->fCenterSugarZ)/2.
676  *angstrom);
677  G4Transform3D transform1 = G4Transform3D(rotm1,translm1);
678  new G4PVPlacement(transform1, // rotation translation
679  tubLV1_ZZ,"atomZZ",worldLV,false, 0, fCheckOverlaps);
680 
681  //Cylinder Sugar<=>Phosphat
682  tubS2_ZZ = new G4Tubs( "Cylinder2",
683  0.,
684  0.5*angstrom,
685  std::sqrt (
686  (barycenterListTemp->fCenterSugarX-barycenterListTemp->fCenterPhosphateX)
687  * (barycenterListTemp->fCenterSugarX-barycenterListTemp->fCenterPhosphateX)
688  + (barycenterListTemp->fCenterSugarY-barycenterListTemp->fCenterPhosphateY)
689  * (barycenterListTemp->fCenterSugarY-barycenterListTemp->fCenterPhosphateY)
690  + (barycenterListTemp->fCenterSugarZ-barycenterListTemp->fCenterPhosphateZ)
691  * (barycenterListTemp->fCenterSugarZ-barycenterListTemp->fCenterPhosphateZ)
692  ) /2 *angstrom,
693  0.,
694  2.*pi );
695 
696  tubLV2_ZZ = new G4LogicalVolume(tubS2_ZZ, fpWaterMaterial, "tubLV2_ZZ");
697  MyVisAtt_ZZ = new G4VisAttributes(G4Colour(1,0.5,0));
698  MyVisAtt_ZZ->SetForceSolid(true);
699  tubLV2_ZZ->SetVisAttributes(MyVisAtt_ZZ);
700 
701  Ux= barycenterListTemp->fCenterSugarX-
702  barycenterListTemp->fCenterPhosphateX;
703  Uy= barycenterListTemp->fCenterSugarY-
704  barycenterListTemp->fCenterPhosphateY;
705  Uz= barycenterListTemp->fCenterSugarZ-
706  barycenterListTemp->fCenterPhosphateZ;
707  llUll=std::sqrt(Ux*Ux+Uy*Uy+Uz*Uz);
708 
709  Ux=Ux/llUll;
710  Uy=Uy/llUll;
711  Uz=Uz/llUll;
712 
713  direction = G4ThreeVector(Ux,Uy,Uz);
714  theta_euler = direction.theta();
715  phi_euler = direction.phi();
716  psi_euler = 0;
717 
718  //Warning : clhep Euler constructor build inverse matrix !
719  rotm1Inv = G4RotationMatrix(phi_euler+pi/2,theta_euler,psi_euler);
720  rotm1 = rotm1Inv.inverse();
721  translm1 = G4ThreeVector(
722  (barycenterListTemp->fCenterSugarX+
723  barycenterListTemp->fCenterPhosphateX)/2.*angstrom,
724  (barycenterListTemp->fCenterSugarY+
725  barycenterListTemp->fCenterPhosphateY)/2.*angstrom,
726  (barycenterListTemp->fCenterSugarZ+
727  barycenterListTemp->fCenterPhosphateZ)/2.*angstrom);
728  transform1 = G4Transform3D(rotm1,translm1);
729  new G4PVPlacement(transform1, // rotation translation
730  tubLV2_ZZ,
731  "atomZZ",
732  worldLV,
733  false,
734  0,
736 
737  barycenterListTemp=barycenterListTemp->GetNext();
738  }//end of while sur moleculeListTemp
739 }
740 
741 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
742 
745 //
747  Molecule *moleculeListTemp)
748 {
749  CheckMaterials();
750 
751  double dX,dY,dZ;//Dimensions for bounding volume
752  double tX,tY,tZ;//Translation for bounding volume
753  fPDBlib.ComputeBoundingVolumeParams(moleculeListTemp,
754  dX, dY, dZ,
755  tX, tY, tZ);
756 
757  //[Geometry] Build a box :
758  G4VSolid* boundingS
759  = new G4Box("Bounding", dX*1*angstrom, dY*1*angstrom, dZ*1*angstrom);
760 
761  G4LogicalVolume* boundingLV
762  = new G4LogicalVolume(boundingS, fpWaterMaterial, "BoundingLV");
763 
764  G4RotationMatrix *pRot = new G4RotationMatrix();
765 
766  G4VisAttributes *MyVisAtt_ZZ = new G4VisAttributes(
768  boundingLV->SetVisAttributes(MyVisAtt_ZZ);
769 
770  new G4PVPlacement(pRot,
772  tX*1*angstrom,
773  tY*1*angstrom,
774  tZ*1*angstrom), // at (x,y,z)
775  boundingLV,
776  "boundingPV",
777  worldLV
778  ,false,
779  0,
781 }
782 
783 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
784 
786 {
787  G4cout<<"Load PDB file : "<<fileName<<"."<<G4endl<<G4endl;
788  fPdbFileName=fileName;
789 #ifdef G4MULTITHREADED
792  );
794 #else
797  );
798 #endif
799 }
800 
801 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
802 
804 {
805  if (fPdbFileStatus>0) //a PDB file has been loaded
806  {
807  G4cout<<"Build only world volume and bounding volume"
808  " for computation."<<G4endl<<G4endl;
809 #ifdef G4MULTITHREADED
812  );
814 #else
817  );
818 #endif
819  }
820  else G4cout<<"PDB file not found!"<<G4endl<<G4endl;
821 }
822 
823 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
824 
826 {
827  if (fPdbFileStatus>0) //a PDB file has been loaded
828  {
829 #ifdef G4MULTITHREADED
832  );
834 #else
837  );
838 #endif
839  }
840  else G4cout<<"PDB file not found!"<<G4endl<<G4endl;
841 }
842 
843 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
844 
846 {
847  if (fPdbFileStatus>0) //a PDB file has been loaded
848  {
849 #ifdef G4MULTITHREADED
852  );
854 #else
857  );
858 #endif
859  }
860  else G4cout<<"PDB file not found!"<<G4endl<<G4endl;
861 }
862 
863 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
864 
866 {
867  if (fPdbFileStatus>0) //a PDB file has been loaded
868  {
869 #ifdef G4MULTITHREADED
872  );
874 #else
877  );
878 #endif
879  }
880  else G4cout<<"PDB file not found!"<<G4endl<<G4endl;
881 }
882 
883 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
884 
886 {
887  if (fPdbFileStatus>0) //a PDB file has been loaded
888  {
889 #ifdef G4MULTITHREADED
892  );
894 #else
897  );
898 #endif
899  }
900  else G4cout<<"PDB file not found!"<<G4endl<<G4endl;
901 }
902 
903 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
904 
906 {
907  if (fPdbFileStatus>0) //a PDB file has been loaded
908  {
909 #ifdef G4MULTITHREADED
912  );
914 #else
917  );
918 #endif
919  }
920  else G4cout<<"PDB file not found!"<<G4endl<<G4endl;
921 }
922 
923 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
924 
926 {
927  if (fPdbFileStatus>0) //a PDB file has been loaded
928  {
929 #ifdef G4MULTITHREADED
932  );
934 #else
937  );
938 #endif
939  }
940  else G4cout<<"PDB file not found!"<<G4endl<<G4endl;
941 }
942 
double fCenterBaseX
"X coordinate" of this Base Barycenter
static G4Colour Gray()
Definition: G4Colour.hh:144
double fCenterPhosphateZ
"Z coordinate" of this Phosphate Barycenter
Molecule Class.
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)
PDBlib Class.
Definition: PDBlib.hh:58
Molecule Class.
Definition: PDBmolecule.hh:62
double fCenterY
"Y coordinate" of this nucelotide Barycenter
CLHEP::Hep3Vector G4ThreeVector
CLHEP::HepRotation G4RotationMatrix
static G4Colour Green()
Definition: G4Colour.hh:149
double fCenterX
"X coordinate" of this nucelotide Barycenter
double fCenterSugarX
"X coordinate" of this Sugar Barycenter
static G4Material * GetMaterial(const G4String &name, G4bool warning=true)
Definition: G4Material.cc:603
int fNbAtom
Number of atoms into a residue (usage before vector)
Definition: PDBresidue.hh:88
G4double z
Definition: TRTMaterials.hh:39
Definition: G4Box.hh:64
Barycenter * ComputeNucleotideBarycenters(Molecule *moleculeListTemp)
Compute nucleotide barycenter from memory.
Definition: PDBlib.cc:481
G4VPhysicalVolume * Construct()
const G4double pi
void SetVisibility(G4bool)
Definition: G4Tubs.hh:85
Residue * GetFirst()
Get the first Residue.
Definition: PDBmolecule.cc:82
Residue * GetNext()
Get the next residue.
Definition: PDBresidue.cc:67
static G4Colour Magenta()
Definition: G4Colour.hh:152
static void Clean()
Definition: G4SolidStore.cc:79
double fZ
Z orthogonal coordinates in Angstroms.
Definition: PDBatom.hh:96
G4double a
Definition: TRTMaterials.hh:39
Residue Class.
Definition: PDBresidue.hh:58
double fCenterSugarY
"Y coordinate" of this Sugar Barycenter
void SetForceSolid(G4bool)
static G4NistManager * Instance()
void BarycenterView(G4LogicalVolume *, Barycenter *)
double fCenterBaseZ
"Z coordinate" of this Base Barycenter
Barycenter * GetBarycenterList()
virtual void DefineWorldVolume(G4VPhysicalVolume *worldVol, G4bool topologyIsChanged=true)
static G4PhysicalVolumeStore * GetInstance()
G4double density
Definition: TRTMaterials.hh:39
DetectorMessenger * fpMessenger
G4GLOB_DLL std::ostream G4cout
unsigned short int fPdbFileStatus
Check if PDB file loaded.
Atom Class.
Definition: PDBatom.hh:57
string fElement
Element symbol extracted from 'atom name'.
Definition: PDBatom.hh:99
bool G4bool
Definition: G4Types.hh:79
void ComputeNbNucleotidsPerStrand(Molecule *moleculeListTemp)
Compute number of nucleotide per strand.
Definition: PDBlib.cc:739
double fCenterSugarZ
"Z coordinate" of this Sugar Barycenter
void AtomisticView(G4LogicalVolume *, Molecule *, double atomSizeFactor)
static G4LogicalVolumeStore * GetInstance()
static G4SolidStore * GetInstance()
HepGeom::Transform3D G4Transform3D
static G4Colour Blue()
Definition: G4Colour.hh:150
Molecule * GetNext()
information about molecule (not implemented)
Definition: PDBmolecule.cc:75
static G4GeometryManager * GetInstance()
unsigned short int fChosenOption
Option for the visualisation.
Definition: G4Orb.hh:61
void ReinitializeGeometry(G4bool destroyFirst=false, G4bool prop=true)
double GetRadius()
Get the distance between the farther atom and nucleotide barycenter.
static const double kelvin
Definition: G4SIunits.hh:260
Barycenter * GetNext()
Get the next Barycenter.
#define pascal
Definition: G4SIunits.hh:213
G4String fPdbFileName
PDB filename.
static G4RunManager * GetRunManager()
Definition: G4RunManager.cc:79
Molecule * Load(const string &filename, unsigned short int &isDNA, unsigned short int verbose)
Load PDB file into memory.
Definition: PDBlib.cc:74
G4LogicalVolume * GetLogicalVolume() const
G4VPhysicalVolume * DefineVolumes(G4String filename, unsigned short int option)
static const double g
Definition: G4SIunits.hh:162
Atom * GetFirst()
Get the first atom.
Definition: PDBresidue.cc:74
void ComputeBoundingVolumeParams(Molecule *moleculeListTemp, double &dX, double &dY, double &dZ, double &tX, double &tY, double &tZ)
Compute the corresponding bounding volume parameters.
Definition: PDBlib.cc:669
double fX
X orthogonal coordinates in Angstroms.
Definition: PDBatom.hh:94
void DrawBoundingVolume(G4LogicalVolume *, Molecule *)
void LoadPDBfile(G4String fileName)
double fCenterBaseY
"Y coordinate" of this Base Barycenter
static const double mole
Definition: G4SIunits.hh:265
Atom * GetNext()
Returns the next Atom.
Definition: PDBatom.cc:66
#define G4endl
Definition: G4ios.hh:61
double fY
Y orthogonal coordinates in Angstroms.
Definition: PDBatom.hh:95
void OpenGeometry(G4VPhysicalVolume *vol=0)
static G4Colour Red()
Definition: G4Colour.hh:148
double fCenterZ
"Z coordinate" of this nucelotide Barycenter
G4VPhysicalVolume * ConstructWorld()
double G4double
Definition: G4Types.hh:76
static G4Colour Yellow()
Definition: G4Colour.hh:153
Messenger class that defines commands for DetectorConstruction.
void SetVisAttributes(const G4VisAttributes *pVA)
G4GLOB_DLL std::ostream G4cerr
static G4Colour White()
Definition: G4Colour.hh:143
static const double angstrom
Definition: G4SIunits.hh:92
void ResiduesView(G4LogicalVolume *, Barycenter *)