Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:16:51

0001 //
0002 // ********************************************************************
0003 // * License and Disclaimer                                           *
0004 // *                                                                  *
0005 // * The  Geant4 software  is  copyright of the Copyright Holders  of *
0006 // * the Geant4 Collaboration.  It is provided  under  the terms  and *
0007 // * conditions of the Geant4 Software License,  included in the file *
0008 // * LICENSE and available at  http://cern.ch/geant4/license .  These *
0009 // * include a list of copyright holders.                             *
0010 // *                                                                  *
0011 // * Neither the authors of this software system, nor their employing *
0012 // * institutes,nor the agencies providing financial support for this *
0013 // * work  make  any representation or  warranty, express or implied, *
0014 // * regarding  this  software system or assume any liability for its *
0015 // * use.  Please see the license in the file  LICENSE  and URL above *
0016 // * for the full disclaimer and the limitation of liability.         *
0017 // *                                                                  *
0018 // * This  code  implementation is the result of  the  scientific and *
0019 // * technical work of the GEANT4 collaboration.                      *
0020 // * By using,  copying,  modifying or  distributing the software (or *
0021 // * any work based  on the software)  you  agree  to acknowledge its *
0022 // * use  in  resulting  scientific  publications,  and indicate your *
0023 // * acceptance of all terms of the Geant4 Software license.          *
0024 // ********************************************************************
0025 //
0026 //
0027 // Code developed by:
0028 // S.Guatelli, M. Large and A. Malaroda, University of Wollongong
0029 //
0030 // Code based on the extended example DICOM
0031 //
0032 #ifndef ICRP110PhantomNestedParameterisation_HH
0033 #define ICRP110PhantomNestedParameterisation_HH
0034 
0035 #include <vector>
0036 #include <map>
0037 
0038 #include "G4Types.hh"
0039 #include "G4ThreeVector.hh"
0040 #include "G4VTouchable.hh"
0041 #include "G4VNestedParameterisation.hh" 
0042 
0043 class G4VPhysicalVolume;
0044 class G4VSolid;
0045 class G4Material;
0046 class G4VisAttributes;
0047 
0048 // CSG Entities which may be parameterised/replicated
0049 class G4Box;
0050 class G4Tubs;
0051 class G4Trd;
0052 class G4Trap;
0053 class G4Cons;
0054 class G4Sphere;
0055 class G4Ellipsoid;
0056 class G4Orb;
0057 class G4Torus;
0058 class G4Para;
0059 class G4Polycone;
0060 class G4Polyhedra;
0061 class G4Hype;
0062 
0063 /// Implements a G4VNestedParameterisation
0064 
0065 class ICRP110PhantomNestedParameterisation : public G4VNestedParameterisation
0066 {
0067 public:
0068   
0069   explicit ICRP110PhantomNestedParameterisation(const G4ThreeVector& voxelSize,
0070                                      std::vector<G4Material*>& mat,
0071                                      G4int fnX_ = 0, G4int fnY_ = 0, G4int fnZ_ = 0);
0072                                      // the total number of voxels along X, Y and Z 
0073                                      // are initialised to zero 
0074                                      
0075   ~ICRP110PhantomNestedParameterisation(); 
0076   
0077   
0078   virtual G4Material* ComputeMaterial(G4VPhysicalVolume *currentVol,
0079                               const G4int repNo, 
0080                               const G4VTouchable *parentTouch );
0081   G4int       GetNumberOfMaterials() const;
0082   G4Material* GetMaterial(G4int idx) const;
0083 
0084   G4int GetMaterialIndex( G4int copyNo) const;
0085   
0086   void SetMaterialIndices( size_t* matInd ){ fMaterialIndices = matInd;}
0087   // This method passes the information of the matID associated to each voxel
0088   // from the DetectorConstruction to the NestedParameterisation class
0089   
0090   void SetNoVoxel( G4int nx, G4int ny, G4int nz ); 
0091   // This method passes the total number of voxels along X, Y and Z from 
0092   // the DetectorConstruction to the NestedParameterisation class
0093   
0094   void ComputeTransformation(const G4int no,
0095                              G4VPhysicalVolume *currentPV) const;
0096   
0097   // Additional standard Parameterisation methods, 
0098   // which can be optionally defined, in case solid is used.
0099   void ComputeDimensions(G4Box &, const G4int,
0100                          const G4VPhysicalVolume *) const;
0101   
0102   
0103 private:  // Dummy declarations to get rid of warnings ...
0104   
0105   void ComputeDimensions (G4Trd&, const G4int,
0106                           const G4VPhysicalVolume*) const {}
0107   void ComputeDimensions (G4Trap&, const G4int,
0108                           const G4VPhysicalVolume*) const {}
0109   void ComputeDimensions (G4Cons&, const G4int,
0110                           const G4VPhysicalVolume*) const {}
0111   void ComputeDimensions (G4Sphere&, const G4int,
0112                           const G4VPhysicalVolume*) const {}
0113   void ComputeDimensions (G4Ellipsoid&, const G4int,
0114                           const G4VPhysicalVolume*) const {}
0115   void ComputeDimensions (G4Orb&, const G4int,
0116                           const G4VPhysicalVolume*) const {}
0117   void ComputeDimensions (G4Torus&, const G4int,
0118                           const G4VPhysicalVolume*) const {}
0119   void ComputeDimensions (G4Para&, const G4int,
0120                           const G4VPhysicalVolume*) const {}
0121   void ComputeDimensions (G4Hype&, const G4int,
0122                           const G4VPhysicalVolume*) const {}
0123   void ComputeDimensions (G4Tubs&, const G4int,
0124                           const G4VPhysicalVolume*) const {}
0125   void ComputeDimensions (G4Polycone&, const G4int,
0126                           const G4VPhysicalVolume*) const {}
0127   void ComputeDimensions (G4Polyhedra&, const G4int,
0128                           const G4VPhysicalVolume*) const {}
0129   
0130   void ReadColourData();
0131   
0132   using G4VNestedParameterisation::ComputeMaterial;
0133   
0134 private:
0135   
0136   G4double fdX,fdY,fdZ; // Half of the voxels along X, Y and Z 
0137   G4int fnX,fnY,fnZ;    // Number of voxels along X, Y and Z
0138   std::vector<G4Material*> fMaterials; // Vector with materials
0139   size_t* fMaterialIndices; // Index of the material associated to each voxel
0140   std::map<G4String,G4VisAttributes*> fColours;
0141 };
0142 #endif