Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-31 09:22:00

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 /// \file ChemGeoImporthh
0028 /// \brief Definition of the ChemGeoImport class
0029 
0030 #ifndef ChemGeoImport_HH
0031 #define ChemGeoImport_HH
0032 
0033 #include <map>
0034 #include <fstream>
0035 #include <algorithm>
0036 #include <set>
0037 
0038 #include "G4String.hh"
0039 #include "G4ThreeVector.hh"
0040 #include "G4Orb.hh"
0041 #include "G4VSolid.hh"
0042 #include "G4Box.hh"
0043 #include "G4SystemOfUnits.hh"
0044 #include "G4SubtractionSolid.hh"
0045 #include "G4LogicalVolume.hh"
0046 #include "G4PVPlacement.hh"
0047 #include "G4NistManager.hh"
0048 #include "G4VisAttributes.hh"
0049 #include "G4H2O.hh"
0050 #include "G4Electron_aq.hh"
0051 #include "G4Scheduler.hh"
0052 
0053 #include "UserMoleculeGun.hh"
0054 
0055 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0056 
0057 struct ChemMolecule
0058 {
0059     ChemMolecule(G4String name, G4int copyNumber, G4ThreeVector position,
0060                 G4int strand, G4int state, G4int electronicLevel, G4int trackId)
0061     {
0062         fName = name;
0063         fCopyNumber = copyNumber;
0064         fPosition = position;
0065         fStrand = strand;
0066         fState = state;
0067         fElectronicLevel = electronicLevel;
0068         fTrackId = trackId;
0069     }
0070 
0071     ~ChemMolecule() {}
0072 
0073     G4String fName{""};
0074 
0075     G4int fCopyNumber{-1};
0076     G4int fStrand{-1};
0077     G4int fState{-99};
0078     G4int fElectronicLevel{-99};
0079     G4int fTrackId{-1};
0080 
0081     G4ThreeVector fPosition{0};
0082 
0083     friend G4bool operator==(const ChemMolecule& lhs, const ChemMolecule& rhs)
0084     {
0085         return (lhs.fName == rhs.fName
0086                 && lhs.fCopyNumber == rhs.fCopyNumber
0087                 && lhs.fStrand == rhs.fStrand
0088                 && lhs.fState == rhs.fState
0089                 && lhs.fElectronicLevel == rhs.fElectronicLevel
0090                 && lhs.fTrackId == rhs.fTrackId);
0091     }
0092 };
0093 
0094 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0095 
0096 class ChemGeoImport
0097 {
0098 public:
0099     ChemGeoImport();
0100     ~ChemGeoImport();
0101 
0102     void SetFactor(double factor){fFactor=factor;}
0103     G4double GetFactor() const {return fFactor;}
0104 
0105     G4double GetSize() const {return fSize;}
0106 
0107     void ParseFiles(const G4String& chemInputFile);
0108 
0109     // This method will trigger the build of the geometry
0110     void InsertMoleculeInWorld();
0111 
0112     void Reset();
0113     G4String GetVoxelDefFilePath(G4String bareName);
0114     G4bool IsFileParsed() {return fIsParsed;}
0115 private:
0116     G4bool fIsParsed{false};
0117 
0118     // Factor to scale the geometry
0119     G4double fFactor{1};
0120 
0121     G4double fSize{0};
0122 
0123     G4String fGeoNameFromChemInput{""};
0124 
0125     // Vector to contain all the molecule structures listed within the imput file
0126     std::vector<ChemMolecule> fMolecules;
0127 
0128     std::vector<ChemMolecule> fToBeRemovedMol;
0129 
0130     UserMoleculeGun* fpGun{nullptr};
0131 
0132     void ParseChemInputFile(const G4String& fileName);
0133     void ParseGeoFile(const G4String& fileName);
0134     G4bool IsMoleculeInTheRemoveTable(const ChemMolecule& molecule);
0135 
0136     void GetVoxelDefFilePathList();
0137     std::set<G4String> fVoxelDefFilesList;
0138 };
0139 
0140 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0141 
0142 #endif // ChemGeoImport_HH