Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-04-09 07:49:04

0001 #pragma once
0002 /**
0003 G4CXOpticks, Replaced G4Opticks
0004 =========================================================
0005 
0006 * KEEP THIS MINIMAL : PROVIDING TOP LEVEL INTERFACE AND COORDINARION
0007 * EVERYTHING THAT CAN BE IMPLEMENTED AT LOWER LEVELS SHOULD BE IMPLEMENTED AT LOWER LEVELS
0008 
0009   * IN THIS REGARD THE THREE PRIMARY METHODS simulate/simtrace/render ALL NEED OVERHAUL
0010     TO INSTEAD RELAY ON CSGOptiX LEVEL
0011 
0012 HMM: instanciating CSGOptiX instanciates QSim for raygenmode other than zero
0013 and that needs the upload of QSim components first ?
0014 
0015 **/
0016 
0017 struct U4Tree ;
0018 struct NPFold ;
0019 struct NP ;
0020 struct U4SensorIdentifier ;
0021 class G4VSensitiveDetector ;
0022 class G4VPhysicalVolume ;
0023 struct CSGFoundry ;
0024 struct CSGOptiX ;
0025 struct SSim ;
0026 
0027 #ifdef WITH_QS
0028 struct QSim ;
0029 #endif
0030 
0031 #include "schrono.h"
0032 #include "plog/Severity.h"
0033 #include "G4CX_API_EXPORT.hh"
0034 
0035 #include <filesystem>
0036 
0037 
0038 struct G4CX_API G4CXOpticks
0039 {
0040     static const plog::Severity LEVEL ;
0041     static U4SensorIdentifier* SensorIdentifier ;
0042     static void SetSensorIdentifier( U4SensorIdentifier* sid );
0043 
0044     static G4CXOpticks* INSTANCE ;
0045     static G4CXOpticks* Get();
0046     static const U4Tree* GetU4Tree();
0047     static G4CXOpticks* SetGeometry() ;
0048     static G4CXOpticks* SetGeometryFromGDML() ;
0049     static G4CXOpticks* SetGeometry(const G4VPhysicalVolume* world) ;
0050     static G4CXOpticks* SetGeometry_JUNO(const G4VPhysicalVolume* world, const G4VSensitiveDetector* sd, NPFold* jpmt, const NP* jlut ) ;
0051 
0052 
0053     static constexpr const char* SaveGeometry_KEY = "G4CXOpticks__SaveGeometry_DIR" ;
0054     static void SaveGeometry();
0055     static void Finalize();
0056 
0057     static bool NoGPU ;
0058     static void SetNoGPU(bool no_gpu=true) ; // exercise everything other than CSGOptiX
0059     static bool IsNoGPU() ;
0060 
0061 
0062     SSim*                    sim ;
0063     const U4Tree*            tr ;
0064     const G4VPhysicalVolume* wd ;
0065     CSGFoundry*              fd ;
0066     CSGOptiX*                cx ;
0067 
0068 #ifdef WITH_QS
0069     QSim*                    qs ;
0070 #endif
0071 
0072     schrono::TP              t0 ;
0073 
0074 
0075 private:
0076     G4CXOpticks();
0077     void init();
0078 public:
0079     virtual ~G4CXOpticks();
0080 
0081     static std::string Desc();
0082     std::string desc() const ;
0083 
0084 private:
0085     void setGeometry();
0086     void setGeometryFromGDML();
0087     void setGeometry(const char* gdmlpath);
0088     void setGeometry(const G4VPhysicalVolume* world);
0089     static const char* setGeometry_saveGeometry ;
0090     void setGeometry(CSGFoundry* fd);
0091     void setGeometry_(CSGFoundry* fd);
0092 public:
0093     std::string descSimulate() const ;
0094 
0095     void simulate( int eventID, bool reset );
0096     void reset(    int eventID );
0097     void simtrace(int eventID);
0098     void render();
0099 
0100     void saveGeometry() const ;
0101     void saveGeometry(const char* dir) const ;
0102 
0103 
0104     void SensitiveDetector_Initialize(int eventID);
0105     void SensitiveDetector_EndOfEvent(int eventID);
0106 
0107 };
0108 
0109 
0110 void from_gdml(std::filesystem::path gdml_file, std::filesystem::path out_prefix = "csg");