Ignore:
Timestamp:
Jan 8, 2010, 3:02:48 PM (14 years ago)
Author:
garnier
Message:

update to geant4.9.3

Location:
trunk/examples/extended/medical/DICOM
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • trunk/examples/extended/medical/DICOM/dicom.cc

    r807 r1230  
    5656#include "DicomPrimaryGeneratorAction.hh"
    5757#include "DicomEventAction.hh"
     58#include "DicomRunAction.hh"
    5859#include "DicomHandler.hh"
    5960
     
    7778  runManager->SetUserInitialization(theGeometry);
    7879  runManager->SetUserAction(new DicomPrimaryGeneratorAction());
    79   //  runManager->SetUserAction(new DicomEventAction);
     80  runManager->SetUserAction(new DicomRunAction);
     81  runManager->SetUserAction(new DicomEventAction);
    8082
    8183  runManager->Initialize();
  • trunk/examples/extended/medical/DICOM/include/DicomDetectorConstruction.hh

    r807 r1230  
    7979  // construct the patient volumes. This method should be implemented for each of the derived classes
    8080
     81  void SetScorer(G4LogicalVolume* voxel_logic);
     82
    8183protected:
    8284  G4Material* air;
  • trunk/examples/extended/medical/DICOM/include/DicomNestedPhantomParameterisation.hh

    r807 r1230  
    2424// ********************************************************************
    2525//
    26 #ifndef RE02NESTEDPARAMETERISATION_HH
    27 #define RE02NESTEDPARAMETERISATION_HH
     26// $Id: DicomNestedPhantomParameterisation.hh,v 1.3 2009/01/27 10:44:58 gcosmo Exp $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
     28//
     29// --------------------------------------------------------------------
     30#ifndef DICOMNESTEDPARAMETERISATION_HH
     31#define DICOMNESTEDPARAMETERISATION_HH
     32
     33#include <vector>
    2834
    2935#include "G4Types.hh"
     36#include "G4ThreeVector.hh"
    3037#include "G4VNestedParameterisation.hh"
    31 #include "G4ThreeVector.hh"
    32 #include <vector>
    3338
    3439class G4VPhysicalVolume;
     
    5257class G4Hype;
    5358
    54 class DicomNestedPhantomParameterisation: public G4VNestedParameterisation
     59class DicomNestedPhantomParameterisation : public G4VNestedParameterisation
    5560{
    56   public:  // with description
     61  public:
    5762
    5863    DicomNestedPhantomParameterisation(const G4ThreeVector& voxelSize,
    59                                       std::vector<G4Material*>& mat);
     64                                       std::vector<G4Material*>& mat);
    6065    virtual ~DicomNestedPhantomParameterisation();
    6166
    62     // Methods required in derived classes
    63     // -----------------------------------
    64     virtual G4Material* ComputeMaterial(G4VPhysicalVolume *currentVol,
    65                                         const G4int repNo,
    66                                         const G4VTouchable *parentTouch=0
    67                                         );
    68   // Required method, as it is the reason for this class.
    69   //   Must cope with parentTouch=0 for navigator's SetupHierarchy
     67    G4Material* ComputeMaterial(G4VPhysicalVolume *currentVol,
     68                                const G4int repNo,
     69                                const G4VTouchable *parentTouch );
     70      // Must cope with parentTouch for navigator's SetupHierarchy
    7071
    71     virtual G4int       GetNumberOfMaterials() const;
    72     virtual G4Material* GetMaterial(G4int idx) const;
     72    G4int       GetNumberOfMaterials() const;
     73    G4Material* GetMaterial(G4int idx) const;
    7374      // Needed to define materials for instances of Nested Parameterisation
    74       //   Current convention: each call should return the materials
    75       //   of all instances with the same mother/ancestor volume.
     75      // Current convention: each call should return the materials
     76      // of all instances with the same mother/ancestor volume
     77
    7678    size_t GetMaterialIndex( size_t nx, size_t ny, size_t nz) const;
    7779    size_t GetMaterialIndex( size_t copyNo) const;
    78     void SetMaterialIndices( size_t* matInd ){
    79       fMaterialIndices = matInd; }
     80    void SetMaterialIndices( size_t* matInd ) { fMaterialIndices = matInd; }
    8081    void SetNoVoxel( size_t nx, size_t ny, size_t nz );
    8182
    82     virtual void ComputeTransformation(const G4int no,
    83                                        G4VPhysicalVolume *currentPV) const;
    84 
    85     // Methods optional in derived classes
    86     // -----------------------------------
     83    void ComputeTransformation(const G4int no,
     84                                     G4VPhysicalVolume *currentPV) const;
    8785
    8886    // Additional standard Parameterisation methods,
    89     //   which can be optionally defined, in case solid is used.
     87    // which can be optionally defined, in case solid is used.
    9088
    91     virtual void ComputeDimensions(G4Box &,
    92                                    const G4int,
    93                                    const G4VPhysicalVolume *) const;
     89    void ComputeDimensions(G4Box &, const G4int,
     90                                    const G4VPhysicalVolume *) const;
    9491
    95 private:  // Dummy declarations to get rid of warnings ...
    96   void ComputeDimensions (G4Trd&,const G4int,const G4VPhysicalVolume*)
    97     const {}
    98   void ComputeDimensions (G4Trap&,const G4int,const G4VPhysicalVolume*)
    99     const {}
    100   void ComputeDimensions (G4Cons&,const G4int,const G4VPhysicalVolume*)
    101     const {}
    102   void ComputeDimensions (G4Sphere&,const G4int,const G4VPhysicalVolume*)
    103     const {}
    104   void ComputeDimensions (G4Orb&,const G4int,const G4VPhysicalVolume*)
    105     const {}
    106   void ComputeDimensions (G4Torus&,const G4int,const G4VPhysicalVolume*)
    107     const {}
    108   void ComputeDimensions (G4Para&,const G4int,const G4VPhysicalVolume*)
    109     const {}
    110   void ComputeDimensions (G4Hype&,const G4int,const G4VPhysicalVolume*)
    111     const {}
    112   void ComputeDimensions (G4Tubs&,const G4int,const G4VPhysicalVolume*)
    113     const {}
    114   void ComputeDimensions (G4Polycone&,const G4int,const G4VPhysicalVolume*)
    115     const {}
    116   void ComputeDimensions (G4Polyhedra&,const G4int,const G4VPhysicalVolume*)
    117     const {}
     92  private:  // Dummy declarations to get rid of warnings ...
    11893
    119 private:
    120   G4double fdX,fdY,fdZ;
    121   G4int fnX,fnY,fnZ;
    122  
    123   //
    124   std::vector<G4Material*> fMaterials;
     94    void ComputeDimensions (G4Trd&, const G4int,
     95                            const G4VPhysicalVolume*) const {}
     96    void ComputeDimensions (G4Trap&, const G4int,
     97                            const G4VPhysicalVolume*) const {}
     98    void ComputeDimensions (G4Cons&, const G4int,
     99                            const G4VPhysicalVolume*) const {}
     100    void ComputeDimensions (G4Sphere&, const G4int,
     101                            const G4VPhysicalVolume*) const {}
     102    void ComputeDimensions (G4Orb&, const G4int,
     103                            const G4VPhysicalVolume*) const {}
     104    void ComputeDimensions (G4Torus&, const G4int,
     105                            const G4VPhysicalVolume*) const {}
     106    void ComputeDimensions (G4Para&, const G4int,
     107                            const G4VPhysicalVolume*) const {}
     108    void ComputeDimensions (G4Hype&, const G4int,
     109                            const G4VPhysicalVolume*) const {}
     110    void ComputeDimensions (G4Tubs&, const G4int,
     111                            const G4VPhysicalVolume*) const {}
     112    void ComputeDimensions (G4Polycone&, const G4int,
     113                            const G4VPhysicalVolume*) const {}
     114    void ComputeDimensions (G4Polyhedra&, const G4int,
     115                            const G4VPhysicalVolume*) const {}
    125116
    126   size_t* fMaterialIndices;
    127       // Index in fMaterials that correspond to each voxel.
     117  private:
     118
     119    G4double fdX,fdY,fdZ;
     120    G4int fnX,fnY,fnZ;
     121    std::vector<G4Material*> fMaterials;
     122    size_t* fMaterialIndices; // Index in materials corresponding to each voxel
    128123};
    129124
  • trunk/examples/extended/medical/DICOM/src/DicomDetectorConstruction.cc

    r807 r1230  
    451451}
    452452
     453
     454#include "G4SDManager.hh"
     455#include "G4MultiFunctionalDetector.hh"
     456#include "G4PSDoseDeposit_RegNav.hh"
     457
     458//-------------------------------------------------------------
     459void DicomDetectorConstruction::SetScorer(G4LogicalVolume* voxel_logic)
     460{
     461
     462  G4SDManager* SDman = G4SDManager::GetSDMpointer();
     463  //
     464  // Sensitive Detector Name
     465  G4String concreteSDname = "PatientSD";
     466
     467  //------------------------
     468  // MultiFunctionalDetector
     469  //------------------------
     470  //
     471  // Define MultiFunctionalDetector with name.
     472  G4MultiFunctionalDetector* MFDet = new G4MultiFunctionalDetector(concreteSDname);
     473  SDman->AddNewDetector( MFDet );                 // Register SD to SDManager
     474
     475  voxel_logic->SetSensitiveDetector(MFDet);
     476
     477  G4PSDoseDeposit_RegNav*   scorer = new G4PSDoseDeposit_RegNav("DoseDeposit"); 
     478  MFDet->RegisterPrimitive(scorer);
     479
     480}
     481
  • trunk/examples/extended/medical/DICOM/src/DicomNestedPhantomParameterisation.cc

    r807 r1230  
    2424// ********************************************************************
    2525//
    26 ///////////////////////////////////////////////////////////////////////////////
     26// $Id: DicomNestedPhantomParameterisation.cc,v 1.5 2009/01/27 10:44:58 gcosmo Exp $
     27// GEANT4 tag $Name: geant4-09-03-cand-01 $
     28//
     29// --------------------------------------------------------------------
    2730#include "DicomNestedPhantomParameterisation.hh"
    2831
     
    3437#include "G4Material.hh"
    3538
    36 DicomNestedPhantomParameterisation::DicomNestedPhantomParameterisation(
    37                                                      const G4ThreeVector& voxelSize,
    38                                                      std::vector<G4Material*>& mat):
    39   G4VNestedParameterisation(),fdX(voxelSize.x()),fdY(voxelSize.y()),fdZ(voxelSize.z()),fMaterials(mat)
     39DicomNestedPhantomParameterisation::
     40DicomNestedPhantomParameterisation(const G4ThreeVector& voxelSize,
     41                                         std::vector<G4Material*>& mat):
     42  G4VNestedParameterisation(), fdX(voxelSize.x()),
     43  fdY(voxelSize.y()), fdZ(voxelSize.z()), fMaterials(mat)
    4044{
    4145  // Position of voxels.
    42   // x and y positions are already defined in DetectorConstruction
    43   // by using replicated volume. Here only we need to define is z positions of voxes.
     46  // x and y positions are already defined in DetectorConstruction by using
     47  // replicated volume. Here only we need to define is z positions of voxels.
    4448}
    4549
     
    4852}
    4953
    50 void DicomNestedPhantomParameterisation::SetNoVoxel( size_t nx, size_t ny, size_t nz )
     54void DicomNestedPhantomParameterisation::
     55SetNoVoxel( size_t nx, size_t ny, size_t nz )
    5156{
    5257  fnX = nx;
     
    5863// Material assignment to geometry.
    5964//
    60 G4Material* DicomNestedPhantomParameterisation::ComputeMaterial(G4VPhysicalVolume* ,
    61                                                         const G4int copyNoZ,
    62                                                         const G4VTouchable* parentTouch)
     65G4Material* DicomNestedPhantomParameterisation::
     66ComputeMaterial(G4VPhysicalVolume*, const G4int copyNoZ,
     67                                    const G4VTouchable* parentTouch)
    6368{
    64   if(parentTouch==0) return fMaterials[0]; // protection for initialization and vis at idle state
     69  // protection for initialization and vis at idle state
     70  //
     71  if(parentTouch==0) return fMaterials[0];
     72
    6573  // Copy number of voxels.
    6674  // Copy number of X and Y are obtained from replication number.
     
    7078  G4int iz = copyNoZ;
    7179
    72   G4int copyNo = ix + fnZ*iy + fnX*fnY*iz;
     80  G4int copyNo = ix + fnX*iy + fnX*fnY*iz;
    7381
    7482  size_t matIndex = GetMaterialIndex(copyNo);
    7583
    7684  return fMaterials[ matIndex ];
    77 
    7885}
    7986
     
    8693
    8794//
    88 //  Number of Materials
    89 //  Material scanner is required for preparing physics tables and so on before
    90 //  stating simulation, so that G4 has to know number of materials.
    91 G4int       DicomNestedPhantomParameterisation::GetNumberOfMaterials() const{
     95// Number of Materials
     96// Material scanner is required for preparing physics tables and so on before
     97// starting simulation, so that G4 has to know number of materials.
     98//
     99G4int DicomNestedPhantomParameterisation::GetNumberOfMaterials() const
     100{
    92101  return fMaterials.size();
    93102}
     
    97106//  This is needed for material scanner and realizing geometry.
    98107//
    99 G4Material* DicomNestedPhantomParameterisation::GetMaterial(G4int i) const{
     108G4Material* DicomNestedPhantomParameterisation::GetMaterial(G4int i) const
     109{
    100110  return fMaterials[i];
    101111}
     
    104114// Transformation of voxels.
    105115//
    106 void DicomNestedPhantomParameterisation::ComputeTransformation(const G4int copyNo,
    107                                                   G4VPhysicalVolume* physVol)const{
     116void DicomNestedPhantomParameterisation::
     117ComputeTransformation(const G4int copyNo, G4VPhysicalVolume* physVol) const
     118{
    108119  G4ThreeVector position(0.,0.,(2*copyNo+1)*fdZ - fdZ*fnZ);
    109 
    110120  physVol->SetTranslation(position);
    111121}
     
    114124// Dimensions are always same in this RE02 example.
    115125//
    116 void DicomNestedPhantomParameterisation::ComputeDimensions(G4Box& box,
    117                                                const G4int ,
    118                                                const G4VPhysicalVolume* ) const{
     126void DicomNestedPhantomParameterisation::
     127ComputeDimensions( G4Box& box, const G4int, const G4VPhysicalVolume* ) const
     128{
    119129  box.SetXHalfLength(fdX);
    120130  box.SetYHalfLength(fdY);
  • trunk/examples/extended/medical/DICOM/src/DicomPhysicsList.cc

    r807 r1230  
    5454DicomPhysicsList::DicomPhysicsList():  G4VUserPhysicsList()
    5555{
    56   defaultCutValue = 1.e-3*mm;
    57   cutForGamma     = 1.e-3*mm;
     56  defaultCutValue = 1.*mm;
     57  cutForGamma     = 1.*mm;
    5858  cutForElectron  = defaultCutValue;
    5959  cutForPositron  = defaultCutValue;
  • trunk/examples/extended/medical/DICOM/src/DicomPrimaryGeneratorAction.cc

    r807 r1230  
    6565  G4String particleName;
    6666  G4ParticleDefinition* particle
    67     = particleTable->FindParticle(particleName="gamma");
     67    = particleTable->FindParticle(particleName="e-");
    6868  particleGun->SetParticleDefinition(particle);
    69   G4ThreeVector dir(2.*CLHEP::RandFlat::shoot()-1.,2.*CLHEP::RandFlat::shoot()-1.,2.*CLHEP::RandFlat::shoot()-1);
     69  // put the e- in the x direction of the patient (z in the accelerator axs) to hit patient in the central slice of the phantom
     70  G4ThreeVector dir(0,1,0);
     71  //G4ThreeVector dir(2.*CLHEP::RandFlat::shoot()-1.,2.*CLHEP::RandFlat::shoot()-1.,-CLHEP::RandFlat::shoot());
    7072  dir /= dir.mag();
    7173  particleGun->SetParticleMomentumDirection(dir);       
    7274  particleGun->SetParticleEnergy(5.*MeV);
    73   particleGun->SetParticlePosition(G4ThreeVector(0.,0.,-20.)); // put it close to the patient voxels
     75  //put it at SAD = 1 m on xy plane of central slice
     76  particleGun->SetParticlePosition(G4ThreeVector(0.,-99.9*cm,-27.));
     77  //particleGun->SetParticlePosition(G4ThreeVector(0.,0.,-22.));
    7478  particleGun->GeneratePrimaryVertex(anEvent);
    7579}
  • trunk/examples/extended/medical/DICOM/src/RegularDicomDetectorConstruction.cc

    r807 r1230  
    9595  //----- Set this physical volume as having a regular structure of type 1, so that G4RegularNavigation is used
    9696  patient_phys->SetRegularStructureId(1); // if not set, G4VoxelNavigation will be used instead
     97
     98  SetScorer(voxel_logic);
    9799}
    98100
  • trunk/examples/extended/medical/DICOM/vis.mac

    r850 r1230  
    33#visualisation
    44/vis/scene/create
    5 /vis/open OGLSQT
     5/vis/open OGLIX
     6#/vis/open DAWNFILE
     7/vis/open VRML2FILE
    68/vis/viewer/update
    79/vis/viewer/zoom 5
     
    1012/tracking/verbose 1
    1113/run/beamOn 10
     14/vis/viewer/update
    1215
Note: See TracChangeset for help on using the changeset viewer.