Geant4  10.02.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 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
547 
550 //
552  Barycenter *barycenterListTemp)
553 {
554  CheckMaterials();
555  G4VisAttributes* MyVisAtt_ZZ;
556 
557  G4VSolid* tubS1_ZZ;
558  G4LogicalVolume* tubLV1_ZZ;
559  G4VSolid* tubS2_ZZ;
560  G4LogicalVolume* tubLV2_ZZ;
561 
562  G4VSolid* AS_ZZ;
563  G4LogicalVolume* ALV_ZZ;
564  G4VSolid* BS_ZZ;
565  G4LogicalVolume* BLV_ZZ;
566  G4VSolid* CS_ZZ;
567  G4LogicalVolume* CLV_ZZ;
568 
569  int k=0;
570 
571  while (barycenterListTemp)
572  {
573  k++;
574 
575  //3 spheres to Base, Sugar, Phosphate)
576  AS_ZZ = new G4Orb("Sphere", 1.*angstrom);
577  ALV_ZZ = new G4LogicalVolume(AS_ZZ,fpWaterMaterial, "ALV_ZZ");
578  MyVisAtt_ZZ = new G4VisAttributes(G4Colour(G4Colour::Blue()));
579  MyVisAtt_ZZ->SetForceSolid(true);
580  ALV_ZZ->SetVisAttributes(MyVisAtt_ZZ);
581  new G4PVPlacement(0,
582  G4ThreeVector(barycenterListTemp->fCenterBaseX*angstrom,
583  barycenterListTemp->fCenterBaseY*angstrom,
584  barycenterListTemp->fCenterBaseZ*angstrom),
585  ALV_ZZ,
586  "AZZ",
587  worldLV,
588  false,
589  0,
591 
592  BS_ZZ = new G4Orb("Sphere", 1.*angstrom);
593  BLV_ZZ = new G4LogicalVolume(BS_ZZ,fpWaterMaterial, "BLV_ZZ");
594  MyVisAtt_ZZ = new G4VisAttributes(G4Colour(G4Colour::Red()));
595  MyVisAtt_ZZ->SetForceSolid(true);
596  BLV_ZZ->SetVisAttributes(MyVisAtt_ZZ);
597  new G4PVPlacement(0,
599  (barycenterListTemp->fCenterPhosphateX)*angstrom,
600  (barycenterListTemp->fCenterPhosphateY)*angstrom,
601  (barycenterListTemp->fCenterPhosphateZ)*angstrom),
602  BLV_ZZ,
603  "BZZ",
604  worldLV,
605  false,
606  0,
608 
609  CS_ZZ = new G4Orb("Sphere", 1.*angstrom);
610  CLV_ZZ = new G4LogicalVolume(CS_ZZ,fpWaterMaterial, "CLV_ZZ");
611  MyVisAtt_ZZ = new G4VisAttributes(G4Colour(G4Colour::Yellow()));
612  MyVisAtt_ZZ->SetForceSolid(true);
613  CLV_ZZ->SetVisAttributes(MyVisAtt_ZZ);
614  new G4PVPlacement(0,
616  barycenterListTemp->fCenterSugarX*angstrom,
617  barycenterListTemp->fCenterSugarY*angstrom,
618  barycenterListTemp->fCenterSugarZ*angstrom),
619  CLV_ZZ,
620  "CZZ",
621  worldLV,
622  false,
623  0,
625 
626  //2 cylinders (Base<=>Sugar and Sugar<=>Phosphat)
627  // Cylinder Base<=>Sugar
628  tubS1_ZZ = new G4Tubs( "Cylinder",
629  0.,
630  0.5*angstrom,
631  std::sqrt (
632  (barycenterListTemp->fCenterBaseX-barycenterListTemp->fCenterSugarX)
633  * (barycenterListTemp->fCenterBaseX-barycenterListTemp->fCenterSugarX)
634  + (barycenterListTemp->fCenterBaseY-barycenterListTemp->fCenterSugarY)
635  * (barycenterListTemp->fCenterBaseY-barycenterListTemp->fCenterSugarY)
636  + (barycenterListTemp->fCenterBaseZ-barycenterListTemp->fCenterSugarZ)
637  * (barycenterListTemp->fCenterBaseZ-barycenterListTemp->fCenterSugarZ)
638  ) /2 *angstrom,
639  0.,
640  2.*pi );
641 
642  tubLV1_ZZ = new G4LogicalVolume(tubS1_ZZ,fpWaterMaterial, "tubLV_ZZ");
643  MyVisAtt_ZZ = new G4VisAttributes(G4Colour(G4Colour::Green()));
644  MyVisAtt_ZZ->SetForceSolid(true);
645  tubLV1_ZZ->SetVisAttributes(MyVisAtt_ZZ);
646 
647  G4double Ux= barycenterListTemp->fCenterBaseX-
648  barycenterListTemp->fCenterSugarX;
649  G4double Uy= barycenterListTemp->fCenterBaseY-
650  barycenterListTemp->fCenterSugarY;
651  G4double Uz= barycenterListTemp->fCenterBaseZ-
652  barycenterListTemp->fCenterSugarZ;
653  G4double llUll=std::sqrt(Ux*Ux+Uy*Uy+Uz*Uz);
654 
655  Ux=Ux/llUll;
656  Uy=Uy/llUll;
657  Uz=Uz/llUll;
658 
659  G4ThreeVector direction = G4ThreeVector(Ux,Uy,Uz);
660  G4double theta_euler = direction.theta();
661  G4double phi_euler = direction.phi();
662  G4double psi_euler = 0;
663 
664  //Warning : clhep Euler constructor build inverse matrix !
665  G4RotationMatrix rotm1Inv = G4RotationMatrix(phi_euler+pi/2,
666  theta_euler,
667  psi_euler);
668  G4RotationMatrix rotm1 = rotm1Inv.inverse();
669  G4ThreeVector translm1 = G4ThreeVector(
670  (barycenterListTemp->fCenterBaseX+barycenterListTemp->fCenterSugarX)/2.
671  *angstrom,
672  (barycenterListTemp->fCenterBaseY+barycenterListTemp->fCenterSugarY)/2.
673  *angstrom,
674  (barycenterListTemp->fCenterBaseZ+barycenterListTemp->fCenterSugarZ)/2.
675  *angstrom);
676  G4Transform3D transform1 = G4Transform3D(rotm1,translm1);
677  new G4PVPlacement(transform1, // rotation translation
678  tubLV1_ZZ,"atomZZ",worldLV,false, 0, fCheckOverlaps);
679 
680  //Cylinder Sugar<=>Phosphat
681  tubS2_ZZ = new G4Tubs( "Cylinder2",
682  0.,
683  0.5*angstrom,
684  std::sqrt (
685  (barycenterListTemp->fCenterSugarX-barycenterListTemp->fCenterPhosphateX)
686  * (barycenterListTemp->fCenterSugarX-barycenterListTemp->fCenterPhosphateX)
687  + (barycenterListTemp->fCenterSugarY-barycenterListTemp->fCenterPhosphateY)
688  * (barycenterListTemp->fCenterSugarY-barycenterListTemp->fCenterPhosphateY)
689  + (barycenterListTemp->fCenterSugarZ-barycenterListTemp->fCenterPhosphateZ)
690  * (barycenterListTemp->fCenterSugarZ-barycenterListTemp->fCenterPhosphateZ)
691  ) /2 *angstrom,
692  0.,
693  2.*pi );
694 
695  tubLV2_ZZ = new G4LogicalVolume(tubS2_ZZ, fpWaterMaterial, "tubLV2_ZZ");
696  MyVisAtt_ZZ = new G4VisAttributes(G4Colour(1,0.5,0));
697  MyVisAtt_ZZ->SetForceSolid(true);
698  tubLV2_ZZ->SetVisAttributes(MyVisAtt_ZZ);
699 
700  Ux= barycenterListTemp->fCenterSugarX-
701  barycenterListTemp->fCenterPhosphateX;
702  Uy= barycenterListTemp->fCenterSugarY-
703  barycenterListTemp->fCenterPhosphateY;
704  Uz= barycenterListTemp->fCenterSugarZ-
705  barycenterListTemp->fCenterPhosphateZ;
706  llUll=std::sqrt(Ux*Ux+Uy*Uy+Uz*Uz);
707 
708  Ux=Ux/llUll;
709  Uy=Uy/llUll;
710  Uz=Uz/llUll;
711 
712  direction = G4ThreeVector(Ux,Uy,Uz);
713  theta_euler = direction.theta();
714  phi_euler = direction.phi();
715  psi_euler = 0;
716 
717  //Warning : clhep Euler constructor build inverse matrix !
718  rotm1Inv = G4RotationMatrix(phi_euler+pi/2,theta_euler,psi_euler);
719  rotm1 = rotm1Inv.inverse();
720  translm1 = G4ThreeVector(
721  (barycenterListTemp->fCenterSugarX+
722  barycenterListTemp->fCenterPhosphateX)/2.*angstrom,
723  (barycenterListTemp->fCenterSugarY+
724  barycenterListTemp->fCenterPhosphateY)/2.*angstrom,
725  (barycenterListTemp->fCenterSugarZ+
726  barycenterListTemp->fCenterPhosphateZ)/2.*angstrom);
727  transform1 = G4Transform3D(rotm1,translm1);
728  new G4PVPlacement(transform1, // rotation translation
729  tubLV2_ZZ,
730  "atomZZ",
731  worldLV,
732  false,
733  0,
735 
736  barycenterListTemp=barycenterListTemp->GetNext();
737  }//end of while sur moleculeListTemp
738 }
739 
740 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
741 
744 //
746  Molecule *moleculeListTemp)
747 {
748  CheckMaterials();
749 
750  double dX,dY,dZ;//Dimensions for bounding volume
751  double tX,tY,tZ;//Translation for bounding volume
752  fPDBlib.ComputeBoundingVolumeParams(moleculeListTemp,
753  dX, dY, dZ,
754  tX, tY, tZ);
755 
756  //[Geometry] Build a box :
757  G4VSolid* boundingS
758  = new G4Box("Bounding", dX*1*angstrom, dY*1*angstrom, dZ*1*angstrom);
759 
760  G4LogicalVolume* boundingLV
761  = new G4LogicalVolume(boundingS, fpWaterMaterial, "BoundingLV");
762 
763  G4RotationMatrix *pRot = new G4RotationMatrix();
764 
765  G4VisAttributes *MyVisAtt_ZZ = new G4VisAttributes(
767  boundingLV->SetVisAttributes(MyVisAtt_ZZ);
768 
769  new G4PVPlacement(pRot,
771  tX*1*angstrom,
772  tY*1*angstrom,
773  tZ*1*angstrom), // at (x,y,z)
774  boundingLV,
775  "boundingPV",
776  worldLV
777  ,false,
778  0,
780 }
781 
782 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
783 
785 {
786  G4cout<<"Load PDB file : "<<fileName<<"."<<G4endl<<G4endl;
787  fPdbFileName=fileName;
788 #ifdef G4MULTITHREADED
791  );
793 #else
796  );
797 #endif
798 }
799 
800 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
801 
803 {
804  if (fPdbFileStatus>0) //a PDB file has been loaded
805  {
806  G4cout<<"Build only world volume and bounding volume"
807  " for computation."<<G4endl<<G4endl;
808 #ifdef G4MULTITHREADED
811  );
813 #else
816  );
817 #endif
818  }
819  else G4cout<<"PDB file not found!"<<G4endl<<G4endl;
820 }
821 
822 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
823 
825 {
826  if (fPdbFileStatus>0) //a PDB file has been loaded
827  {
828 #ifdef G4MULTITHREADED
831  );
833 #else
836  );
837 #endif
838  }
839  else G4cout<<"PDB file not found!"<<G4endl<<G4endl;
840 }
841 
842 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
843 
845 {
846  if (fPdbFileStatus>0) //a PDB file has been loaded
847  {
848 #ifdef G4MULTITHREADED
851  );
853 #else
856  );
857 #endif
858  }
859  else G4cout<<"PDB file not found!"<<G4endl<<G4endl;
860 }
861 
862 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
863 
865 {
866  if (fPdbFileStatus>0) //a PDB file has been loaded
867  {
868 #ifdef G4MULTITHREADED
871  );
873 #else
876  );
877 #endif
878  }
879  else G4cout<<"PDB file not found!"<<G4endl<<G4endl;
880 }
881 
882 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
883 
885 {
886  if (fPdbFileStatus>0) //a PDB file has been loaded
887  {
888 #ifdef G4MULTITHREADED
891  );
893 #else
896  );
897 #endif
898  }
899  else G4cout<<"PDB file not found!"<<G4endl<<G4endl;
900 }
901 
902 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
903 
905 {
906  if (fPdbFileStatus>0) //a PDB file has been loaded
907  {
908 #ifdef G4MULTITHREADED
911  );
913 #else
916  );
917 #endif
918  }
919  else G4cout<<"PDB file not found!"<<G4endl<<G4endl;
920 }
921 
922 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
923 
925 {
926  if (fPdbFileStatus>0) //a PDB file has been loaded
927  {
928 #ifdef G4MULTITHREADED
931  );
933 #else
936  );
937 #endif
938  }
939  else G4cout<<"PDB file not found!"<<G4endl<<G4endl;
940 }
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:604
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:480
G4VPhysicalVolume * Construct()
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:736
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:278
Barycenter * GetNext()
Get the next Barycenter.
#define pascal
Definition: G4SIunits.hh:231
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:73
G4LogicalVolume * GetLogicalVolume() const
static const double pi
Definition: G4SIunits.hh:74
static const double g
Definition: G4SIunits.hh:180
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:667
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:283
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
G4VPhysicalVolume * DefineVolumes()
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:101
void ResiduesView(G4LogicalVolume *, Barycenter *)