Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-02-23 09:22:43

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 /// \file runAndEvent/RE02/include/RE02NestedPhantomParameterisation.hh
0027 /// \brief Definition of the RE02NestedPhantomParameterisation class
0028 //
0029 //
0030 //
0031 #ifndef RE02NESTEDPARAMETERISATION_HH
0032 #define RE02NESTEDPARAMETERISATION_HH
0033 
0034 #include "G4ThreeVector.hh"
0035 #include "G4Types.hh"
0036 #include "G4VNestedParameterisation.hh"
0037 #include "G4VTouchable.hh"
0038 
0039 #include <vector>
0040 
0041 class G4VPhysicalVolume;
0042 class G4VSolid;
0043 class G4Material;
0044 
0045 // CSG Entities which may be parameterised/replicated
0046 //
0047 class G4Box;
0048 class G4Tubs;
0049 class G4Trd;
0050 class G4Trap;
0051 class G4Cons;
0052 class G4Sphere;
0053 class G4Orb;
0054 class G4Ellipsoid;
0055 class G4Torus;
0056 class G4Para;
0057 class G4Polycone;
0058 class G4Polyhedra;
0059 class G4Hype;
0060 
0061 //
0062 /// A nested parameterisation class for a phantom
0063 ///
0064 ///  (Description)
0065 ///     This parameterisation handles material and transfomation of voxles.
0066 ///
0067 /// - G4Material* ComputeMaterial(G4VPhysicalVolume *currentVol,
0068 ///                               const G4int repNo,
0069 ///                               const G4VTouchable *parentTouch=0)
0070 ///     returns material.
0071 ///       if ix%2==0 && iy%2==0 && iz%2==0 then fMat[0]
0072 ///       else fMat[1]
0073 ///
0074 /// - G4int GetNumberOfMaterials() const
0075 ///     returns the number of material defined in fMat
0076 ///
0077 /// - G4Material* GetMaterial(G4int idx) const
0078 ///     returns the i-th material of fMat
0079 ///
0080 /// - void ComputeTransformation(const G4int no,
0081 ///                              G4VPhysicalVolume *currentPV) const
0082 ///     returns a transformation with the physical volume of the 2nd argument
0083 ///     according to copyNo
0084 ///     Its position is defined as G4ThreeVector(0.,0.,fpZ[copyNo]).
0085 ///
0086 /// - void ComputeDimensions(G4Box &, const G4int,
0087 ///                          const G4VPhysicalVolume *) const
0088 ///     returns dimensions of this parameterized volume with the physical
0089 ///     volume of the 3rd argument.
0090 ///
0091 //
0092 class RE02NestedPhantomParameterisation : public G4VNestedParameterisation
0093 {
0094   public:  // with description
0095     RE02NestedPhantomParameterisation(const G4ThreeVector& voxelSize, G4int nz,
0096                                       std::vector<G4Material*>& mat);
0097     ~RE02NestedPhantomParameterisation();
0098 
0099     // Methods required in derived classes
0100     // -----------------------------------
0101     G4Material* ComputeMaterial(G4VPhysicalVolume* currentVol, const G4int repNo,
0102                                 const G4VTouchable* parentTouch = 0);
0103     // Required method, as it is the reason for this class.
0104     //   Must cope with parentTouch=0 for navigator's SetupHierarchy
0105 
0106     G4int GetNumberOfMaterials() const;
0107     G4Material* GetMaterial(G4int idx) const;
0108     // Needed to define materials for instances of Nested Parameterisation
0109     //   Current convention: each call should return the materials
0110     //   of all instances with the same mother/ancestor volume.
0111 
0112     void ComputeTransformation(const G4int no, G4VPhysicalVolume* currentPV) const;
0113 
0114     // Methods optional in derived classes
0115     // -----------------------------------
0116 
0117     // Additional standard Parameterisation methods,
0118     //   which can be optionally defined, in case solid is used.
0119 
0120     void ComputeDimensions(G4Box&, const G4int, const G4VPhysicalVolume*) const;
0121 
0122   private:  // Dummy declarations to get rid of warnings ...
0123     void ComputeDimensions(G4Trd&, const G4int, const G4VPhysicalVolume*) const {}
0124     void ComputeDimensions(G4Trap&, const G4int, const G4VPhysicalVolume*) const {}
0125     void ComputeDimensions(G4Cons&, const G4int, const G4VPhysicalVolume*) const {}
0126     void ComputeDimensions(G4Sphere&, const G4int, const G4VPhysicalVolume*) const {}
0127     void ComputeDimensions(G4Orb&, const G4int, const G4VPhysicalVolume*) const {}
0128     void ComputeDimensions(G4Ellipsoid&, const G4int, const G4VPhysicalVolume*) const {}
0129     void ComputeDimensions(G4Torus&, const G4int, const G4VPhysicalVolume*) const {}
0130     void ComputeDimensions(G4Para&, const G4int, const G4VPhysicalVolume*) const {}
0131     void ComputeDimensions(G4Hype&, const G4int, const G4VPhysicalVolume*) const {}
0132     void ComputeDimensions(G4Tubs&, const G4int, const G4VPhysicalVolume*) const {}
0133     void ComputeDimensions(G4Polycone&, const G4int, const G4VPhysicalVolume*) const {}
0134     void ComputeDimensions(G4Polyhedra&, const G4int, const G4VPhysicalVolume*) const {}
0135     //  G4Material* ComputeMaterial(const G4int repNo,
0136     //                              G4VPhysicalVolume* currentVol,
0137     //                              const G4VTouchable* parentTouch)
0138     //  { return ComputeMaterial( currentVol, repNo, parentTouch ); }
0139     using G4VNestedParameterisation::ComputeMaterial;
0140 
0141   private:
0142     G4double fdX, fdY, fdZ;
0143     G4int fNz;
0144     //
0145     std::vector<G4double> fpZ;
0146     std::vector<G4Material*> fMat;
0147 };
0148 
0149 #endif