Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-02-27 09:18:30

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 //  Gorad (Geant4 Open-source Radiation Analysis and Design)
0027 //
0028 //  Author : Makoto Asai (SLAC National Accelerator Laboratory)
0029 //
0030 //  Development of Gorad is funded by NASA Johnson Space Center (JSC)
0031 //  under the contract NNJ15HK11B.
0032 //
0033 // ********************************************************************
0034 //
0035 // GRDetectorConstruction.hh
0036 //   Header file of the detector construction. It reads a GDML file.
0037 //
0038 // History
0039 //   September 8th, 2020 : first implementation
0040 //
0041 // ********************************************************************
0042 
0043 #ifndef GRDetectorConstruction_H
0044 #define GRDetectorConstruction_H 1
0045 
0046 #include "G4VUserDetectorConstruction.hh"
0047 #include "globals.hh"
0048 #include "G4ThreeVector.hh"
0049 
0050 class G4GDMLParser;
0051 class GRDetectorConstructionMessenger;
0052 class GRGeomImpBiasWorld;
0053 
0054 class GRDetectorConstruction : public G4VUserDetectorConstruction
0055 {
0056   friend class GRGeomImpBiasWorld;
0057 
0058   public:
0059     GRDetectorConstruction();
0060     virtual ~GRDetectorConstruction();
0061     virtual G4VPhysicalVolume* Construct();
0062     virtual void ConstructSDAndField();
0063 
0064   private:
0065     GRDetectorConstructionMessenger* messenger;
0066     G4GDMLParser* parser;
0067     G4String gdmlFile;
0068     G4VPhysicalVolume* fWorld;
0069     G4bool initialized;
0070 
0071     static G4double worldSize;
0072 
0073   public:
0074     G4bool SetGDMLFile(G4String&);
0075     const G4String& GetGDMLFile() 
0076     { return gdmlFile; }
0077 
0078     static G4double GetWorldSize()
0079     { return worldSize; }
0080 
0081   private:
0082     void Read();
0083 
0084   public:
0085     void ListSolids(G4int);
0086     void ListLogVols(G4int);
0087     void ListPhysVols(G4int);
0088     void ListRegions(G4int);
0089     G4bool CreateRegion(G4String&,G4String&);
0090     G4bool CheckOverlap(G4String&,G4int,G4int,G4double);
0091 
0092   public:
0093     void ListAllMaterial();
0094     G4bool ListMaterial(G4String&);
0095     void DumpNistMaterials();
0096     G4bool CreateMaterial(G4String&);
0097     G4bool GetMaterial(G4String&);
0098     G4int SetMaterial(G4String&,G4String&);
0099 
0100   private:
0101     G4bool applyGeomImpBias = false;
0102     GRGeomImpBiasWorld* geomImpBiasWorld = nullptr;
0103     struct GeomImpParameters
0104     {
0105       G4double radius = -1.;
0106       G4ThreeVector pos0;
0107       G4int nLayer = 0;
0108       G4double radiusT = -1.;
0109       G4ThreeVector posT;
0110       G4int factor = 2;
0111       G4double prob = 1.;
0112     } geoImpP;
0113       
0114   public:
0115     void GeomImp(G4int n,G4double r)
0116     {
0117       applyGeomImpBias = true;
0118       geoImpP.nLayer = n;
0119       geoImpP.radius = r;
0120     }
0121     G4bool ApplyGeomImpBias() const
0122     { return applyGeomImpBias; }
0123     void GeomImpLocate(G4ThreeVector p0)
0124     { geoImpP.pos0 = p0; }
0125     G4double GeomImpInnerRadius(G4double rt)
0126     {
0127       if(rt>geoImpP.radius)
0128       { return -rt; }
0129       geoImpP.radiusT = rt;
0130       return rt;
0131     }
0132     G4double GeomImpLocateTgt(G4ThreeVector pT)
0133     {
0134       G4ThreeVector dp = geoImpP.pos0 - pT;
0135       G4double rt = geoImpP.radiusT;
0136       if(rt<0.)
0137       { rt = geoImpP.radius / geoImpP.nLayer; }
0138       if(dp.mag() >= (geoImpP.radius - rt))
0139       { return (geoImpP.radius - rt); }
0140       geoImpP.posT = pT;
0141       return 0.;
0142     }
0143     void GeomImpFactor(G4int f)
0144     { geoImpP.factor = f; }
0145     void GeomImpProb(G4double p)
0146     { geoImpP.prob = p; }
0147 };
0148 
0149 #endif