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10.5 ] [ 10.5.p1 ] [ 10.6 ] [ 10.6.p1 ] [ 10.6.p2 ] [ 10.6.p3 ] [ 10.7 ] [ 10.7.p1 ] [ 10.7.p2 ] [ 10.7.p3 ] [ 10.7.p4 ] [ 11.0 ] [ 11.0.p1 ] [ 11.0.p2 ] [ 11.0.p3, ] [ 11.0.p4 ] [ 11.1 ] [ 11.1.1 ] [ 11.1.2 ] [ 11.1.3 ] [ 11.2 ] [ 11.2.1 ] [ 11.2.2 ] [ 11.3.0 ]

  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 //  Gorad (Geant4 Open-source Radiation Analysis and Design)
 27 //
 28 //  Author : Makoto Asai (SLAC National Accelerator Laboratory)
 29 //
 30 //  Development of Gorad is funded by NASA Johnson Space Center (JSC)
 31 //  under the contract NNJ15HK11B.
 32 //
 33 // ********************************************************************
 34 //
 35 // GRDetectorConstruction.hh
 36 //   Header file of the detector construction. It reads a GDML file.
 37 //
 38 // History
 39 //   September 8th, 2020 : first implementation
 40 //
 41 // ********************************************************************
 42 
 43 #ifndef GRDetectorConstruction_H
 44 #define GRDetectorConstruction_H 1
 45 
 46 #include "G4VUserDetectorConstruction.hh"
 47 #include "globals.hh"
 48 #include "G4ThreeVector.hh"
 49 
 50 class G4GDMLParser;
 51 class GRDetectorConstructionMessenger;
 52 class GRGeomImpBiasWorld;
 53 
 54 class GRDetectorConstruction : public G4VUserDetectorConstruction
 55 {
 56   friend class GRGeomImpBiasWorld;
 57 
 58   public:
 59     GRDetectorConstruction();
 60     virtual ~GRDetectorConstruction();
 61     virtual G4VPhysicalVolume* Construct();
 62     virtual void ConstructSDAndField();
 63 
 64   private:
 65     GRDetectorConstructionMessenger* messenger;
 66     G4GDMLParser* parser;
 67     G4String gdmlFile;
 68     G4VPhysicalVolume* fWorld;
 69     G4bool initialized;
 70 
 71     static G4double worldSize;
 72 
 73   public:
 74     G4bool SetGDMLFile(G4String&);
 75     const G4String& GetGDMLFile() 
 76     { return gdmlFile; }
 77 
 78     static G4double GetWorldSize()
 79     { return worldSize; }
 80 
 81   private:
 82     void Read();
 83 
 84   public:
 85     void ListSolids(G4int);
 86     void ListLogVols(G4int);
 87     void ListPhysVols(G4int);
 88     void ListRegions(G4int);
 89     G4bool CreateRegion(G4String&,G4String&);
 90     G4bool CheckOverlap(G4String&,G4int,G4int,G4double);
 91 
 92   public:
 93     void ListAllMaterial();
 94     G4bool ListMaterial(G4String&);
 95     void DumpNistMaterials();
 96     G4bool CreateMaterial(G4String&);
 97     G4bool GetMaterial(G4String&);
 98     G4int SetMaterial(G4String&,G4String&);
 99 
100   private:
101     G4bool applyGeomImpBias = false;
102     GRGeomImpBiasWorld* geomImpBiasWorld = nullptr;
103     struct GeomImpParameters
104     {
105       G4double radius = -1.;
106       G4ThreeVector pos0;
107       G4int nLayer = 0;
108       G4double radiusT = -1.;
109       G4ThreeVector posT;
110       G4int factor = 2;
111       G4double prob = 1.;
112     } geoImpP;
113       
114   public:
115     void GeomImp(G4int n,G4double r)
116     {
117       applyGeomImpBias = true;
118       geoImpP.nLayer = n;
119       geoImpP.radius = r;
120     }
121     G4bool ApplyGeomImpBias() const
122     { return applyGeomImpBias; }
123     void GeomImpLocate(G4ThreeVector p0)
124     { geoImpP.pos0 = p0; }
125     G4double GeomImpInnerRadius(G4double rt)
126     {
127       if(rt>geoImpP.radius)
128       { return -rt; }
129       geoImpP.radiusT = rt;
130       return rt;
131     }
132     G4double GeomImpLocateTgt(G4ThreeVector pT)
133     {
134       G4ThreeVector dp = geoImpP.pos0 - pT;
135       G4double rt = geoImpP.radiusT;
136       if(rt<0.)
137       { rt = geoImpP.radius / geoImpP.nLayer; }
138       if(dp.mag() >= (geoImpP.radius - rt))
139       { return (geoImpP.radius - rt); }
140       geoImpP.posT = pT;
141       return 0.;
142     }
143     void GeomImpFactor(G4int f)
144     { geoImpP.factor = f; }
145     void GeomImpProb(G4double p)
146     { geoImpP.prob = p; }
147 };
148 
149 #endif
150