├── .clang-format ├── .github └── workflows │ ├── tests.yml │ └── wheels.yml ├── .gitignore ├── .gitmodules ├── CMakeLists.txt ├── DESIGN.md ├── LICENSE ├── MANIFEST.in ├── README.md ├── examples ├── B1 │ ├── README │ ├── exampleB1.in │ ├── exampleB1.out │ ├── exampleB1.py │ ├── exampleB1MT.py │ ├── init_vis.mac │ ├── run1.mac │ ├── run2.mac │ └── vis.mac ├── B2 │ ├── README │ ├── exampleB2.in │ ├── exampleB2a.out │ ├── exampleB2a.py │ ├── exampleB2b.out │ ├── exampleB2b.py │ ├── gui.mac │ ├── init_vis.mac │ ├── run1.mac │ ├── run2.mac │ ├── startup.mac │ └── vis.mac ├── B3 │ ├── README │ ├── debug.mac │ ├── exampleB3.in │ ├── exampleB3a.out │ ├── exampleB3a.py │ ├── exampleB3b.out │ ├── exampleB3b.py │ ├── init_vis.mac │ ├── run1.mac │ ├── run2.mac │ └── vis.mac ├── B4 │ ├── README │ ├── exampleB4.in │ ├── exampleB4a.out │ ├── exampleB4a.py │ ├── exampleB4b.out │ ├── exampleB4b.py │ ├── exampleB4c.out │ ├── exampleB4c.py │ ├── exampleB4d.out │ ├── exampleB4d.py │ ├── gui.mac │ ├── init_vis.mac │ ├── run1.mac │ ├── run2.mac │ └── vis.mac ├── B5 │ ├── README │ ├── exampleB5.in │ ├── exampleB5.out │ ├── exampleB5.py │ ├── gui.mac │ ├── icons.mac │ ├── init.mac │ ├── init_vis.mac │ ├── run.png │ ├── run1.mac │ ├── run2.mac │ └── vis.mac └── gdml │ ├── README │ ├── auxiliary.gdml │ ├── g04.mac │ ├── g04.py │ └── vis.mac ├── pyproject.toml ├── setup.py ├── source ├── CMakeLists.txt ├── analysis │ ├── accumulables │ │ ├── pyG4Accumulable.cc │ │ ├── pyG4AccumulableManager.cc │ │ ├── pyG4MergeMode.cc │ │ └── pyG4VAccumulable.cc │ ├── pyG4AnalysisManager.cc │ ├── pyG4TScoreNtupleWriter.cc │ ├── pyG4VAnalysisManager.cc │ ├── pyhisto.cc │ └── pymodG4analysis.cc ├── datainit.py ├── digits_hits │ ├── pyG4HCofThisEvent.cc │ ├── pyG4MultiFunctionalDetector.cc │ ├── pyG4MultiSensitiveDetector.cc │ ├── pyG4SDFilter.cc │ ├── pyG4SDManager.cc │ ├── pyG4Scorer.cc │ ├── pyG4VHit.cc │ ├── pyG4VHitsCollection.cc │ ├── pyG4VPrimitivePlotter.cc │ ├── pyG4VPrimitiveScorer.cc │ ├── pyG4VSDFilter.cc │ ├── pyG4VSensitiveDetector.cc │ └── pymodG4digits_hits.cc ├── event │ ├── pyG4AdjointPosOnPhysVolGenerator.cc │ ├── pyG4AdjointPrimaryGenerator.cc │ ├── pyG4AdjointStackingAction.cc │ ├── pyG4ClassificationOfNewTrack.cc │ ├── pyG4EvManMessenger.cc │ ├── pyG4Event.cc │ ├── pyG4EventManager.cc │ ├── pyG4GeneralParticleSource.cc │ ├── pyG4GeneralParticleSourceData.cc │ ├── pyG4GeneralParticleSourceMessenger.cc │ ├── pyG4HEPEvtInterface.cc │ ├── pyG4HEPEvtParticle.cc │ ├── pyG4MultiEventAction.cc │ ├── pyG4ParticleGun.cc │ ├── pyG4ParticleGunMessenger.cc │ ├── pyG4PrimaryTransformer.cc │ ├── pyG4RayShooter.cc │ ├── pyG4SPSAngDistribution.cc │ ├── pyG4SPSEneDistribution.cc │ ├── pyG4SPSPosDistribution.cc │ ├── pyG4SPSRandomGenerator.cc │ ├── pyG4SingleParticleSource.cc │ ├── pyG4SmartTrackStack.cc │ ├── pyG4StackChecker.cc │ ├── pyG4StackManager.cc │ ├── pyG4StackedTrack.cc │ ├── pyG4StackingMessenger.cc │ ├── pyG4TrackStack.cc │ ├── pyG4TrajectoryContainer.cc │ ├── pyG4UserEventAction.cc │ ├── pyG4UserStackingAction.cc │ ├── pyG4VPrimaryGenerator.cc │ ├── pyG4VUserEventInformation.cc │ └── pymodG4event.cc ├── geant4_pybind.cc ├── geometry │ ├── biasing │ │ ├── pyG4GeometryCell.cc │ │ ├── pyG4GeometryCellComp.cc │ │ ├── pyG4GeometryCellStep.cc │ │ ├── pyG4IStore.cc │ │ ├── pyG4ImportanceAlgorithm.cc │ │ ├── pyG4VGCellFinder.cc │ │ ├── pyG4VIStore.cc │ │ ├── pyG4VImportanceAlgorithm.cc │ │ ├── pyG4VImportanceSplitExaminer.cc │ │ ├── pyG4VWeightWindowAlgorithm.cc │ │ ├── pyG4VWeightWindowStore.cc │ │ ├── pyG4WeightWindowAlgorithm.cc │ │ └── pyG4WeightWindowStore.cc │ ├── divisions │ │ ├── pyG4PVDivision.cc │ │ ├── pyG4PVDivisionFactory.cc │ │ ├── pyG4ParameterisationBox.cc │ │ ├── pyG4ParameterisationCons.cc │ │ ├── pyG4ParameterisationPara.cc │ │ ├── pyG4ParameterisationPolycone.cc │ │ ├── pyG4ParameterisationPolyhedra.cc │ │ ├── pyG4ParameterisationTrd.cc │ │ ├── pyG4ParameterisationTubs.cc │ │ ├── pyG4ReplicatedSlice.cc │ │ └── pyG4VDivisionParameterisation.cc │ ├── magneticfield │ │ ├── pyG4BFieldIntegrationDriver.cc │ │ ├── pyG4BogackiShampine23.cc │ │ ├── pyG4BogackiShampine45.cc │ │ ├── pyG4BulirschStoer.cc │ │ ├── pyG4CachedMagneticField.cc │ │ ├── pyG4CashKarpRKF45.cc │ │ ├── pyG4ChargeState.cc │ │ ├── pyG4ChordFinder.cc │ │ ├── pyG4ClassicalRK4.cc │ │ ├── pyG4ConstRK4.cc │ │ ├── pyG4DELPHIMagField.cc │ │ ├── pyG4DoLoMcPriRK34.cc │ │ ├── pyG4DormandPrince745.cc │ │ ├── pyG4DormandPrinceRK56.cc │ │ ├── pyG4DormandPrinceRK78.cc │ │ ├── pyG4DriverReporter.cc │ │ ├── pyG4ElectricField.cc │ │ ├── pyG4ElectroMagneticField.cc │ │ ├── pyG4EqEMFieldWithEDM.cc │ │ ├── pyG4EqEMFieldWithSpin.cc │ │ ├── pyG4EqGravityField.cc │ │ ├── pyG4EqMagElectricField.cc │ │ ├── pyG4EquationOfMotion.cc │ │ ├── pyG4ErrorMag_UsualEqRhs.cc │ │ ├── pyG4ExactHelixStepper.cc │ │ ├── pyG4ExplicitEuler.cc │ │ ├── pyG4FSALBogackiShampine45.cc │ │ ├── pyG4FSALDormandPrince745.cc │ │ ├── pyG4Field.cc │ │ ├── pyG4FieldManager.cc │ │ ├── pyG4FieldManagerStore.cc │ │ ├── pyG4FieldTrack.cc │ │ ├── pyG4FieldUtils.cc │ │ ├── pyG4HarmonicPolMagField.cc │ │ ├── pyG4HelixExplicitEuler.cc │ │ ├── pyG4HelixHeum.cc │ │ ├── pyG4HelixImplicitEuler.cc │ │ ├── pyG4HelixMixedStepper.cc │ │ ├── pyG4HelixSimpleRunge.cc │ │ ├── pyG4ImplicitEuler.cc │ │ ├── pyG4LineCurrentMagField.cc │ │ ├── pyG4LineSection.cc │ │ ├── pyG4MagErrorStepper.cc │ │ ├── pyG4MagHelicalStepper.cc │ │ ├── pyG4MagIntegratorDriver.cc │ │ ├── pyG4MagIntegratorStepper.cc │ │ ├── pyG4Mag_EqRhs.cc │ │ ├── pyG4Mag_SpinEqRhs.cc │ │ ├── pyG4Mag_UsualEqRhs.cc │ │ ├── pyG4MagneticField.cc │ │ ├── pyG4ModifiedMidpoint.cc │ │ ├── pyG4MonopoleEq.cc │ │ ├── pyG4NystromRK4.cc │ │ ├── pyG4OldMagIntDriver.cc │ │ ├── pyG4QuadrupoleMagField.cc │ │ ├── pyG4RK547FEq1.cc │ │ ├── pyG4RK547FEq2.cc │ │ ├── pyG4RK547FEq3.cc │ │ ├── pyG4RKG3_Stepper.cc │ │ ├── pyG4RepleteEofM.cc │ │ ├── pyG4SextupoleMagField.cc │ │ ├── pyG4SimpleHeum.cc │ │ ├── pyG4SimpleRunge.cc │ │ ├── pyG4TQuadrupoleMagField.cc │ │ ├── pyG4TrialsCounter.cc │ │ ├── pyG4TsitourasRK45.cc │ │ ├── pyG4UniformElectricField.cc │ │ ├── pyG4UniformGravityField.cc │ │ ├── pyG4UniformMagField.cc │ │ ├── pyG4VFSALIntegrationStepper.cc │ │ └── pyG4VIntegrationDriver.cc │ ├── management │ │ ├── pyG4AffineTransform.cc │ │ ├── pyG4BlockingList.cc │ │ ├── pyG4BoundingEnvelope.cc │ │ ├── pyG4ErrorCylSurfaceTarget.cc │ │ ├── pyG4ErrorPlaneSurfaceTarget.cc │ │ ├── pyG4ErrorSurfaceTarget.cc │ │ ├── pyG4ErrorTanPlaneTarget.cc │ │ ├── pyG4ErrorTarget.cc │ │ ├── pyG4GeomTools.cc │ │ ├── pyG4GeometryManager.cc │ │ ├── pyG4IdentityTrajectoryFilter.cc │ │ ├── pyG4LogicalCrystalVolume.cc │ │ ├── pyG4LogicalSurface.cc │ │ ├── pyG4LogicalVolume.cc │ │ ├── pyG4LogicalVolumeStore.cc │ │ ├── pyG4PhysicalVolumeStore.cc │ │ ├── pyG4ReflectedSolid.cc │ │ ├── pyG4Region.cc │ │ ├── pyG4RegionStore.cc │ │ ├── pyG4SmartVoxelHeader.cc │ │ ├── pyG4SmartVoxelNode.cc │ │ ├── pyG4SmartVoxelProxy.cc │ │ ├── pyG4SmartVoxelStat.cc │ │ ├── pyG4SolidStore.cc │ │ ├── pyG4VCurvedTrajectoryFilter.cc │ │ ├── pyG4VNestedParameterisation.cc │ │ ├── pyG4VPVDivisionFactory.cc │ │ ├── pyG4VPVParameterisation.cc │ │ ├── pyG4VPhysicalVolume.cc │ │ ├── pyG4VPhysicalVolume.hh │ │ ├── pyG4VSolid.cc │ │ ├── pyG4VTouchable.cc │ │ ├── pyG4VUserRegionInformation.cc │ │ ├── pyG4VVolumeMaterialScanner.cc │ │ └── pyG4VoxelLimits.cc │ ├── navigation │ │ ├── pyG4AuxiliaryNavServices.cc │ │ ├── pyG4BrentLocator.cc │ │ ├── pyG4DrawVoxels.cc │ │ ├── pyG4ErrorPropagationNavigator.cc │ │ ├── pyG4GeomTestVolume.cc │ │ ├── pyG4GeometryMessenger.cc │ │ ├── pyG4GlobalMagFieldMessenger.cc │ │ ├── pyG4LocatorChangeLogger.cc │ │ ├── pyG4LocatorChangeRecord.cc │ │ ├── pyG4MultiLevelLocator.cc │ │ ├── pyG4MultiNavigator.cc │ │ ├── pyG4NavigationLogger.cc │ │ ├── pyG4Navigator.cc │ │ ├── pyG4NormalNavigation.cc │ │ ├── pyG4ParameterisedNavigation.cc │ │ ├── pyG4PartialPhantomParameterisation.cc │ │ ├── pyG4PathFinder.cc │ │ ├── pyG4PhantomParameterisation.cc │ │ ├── pyG4PropagatorInField.cc │ │ ├── pyG4RegularNavigation.cc │ │ ├── pyG4RegularNavigationHelper.cc │ │ ├── pyG4ReplicaNavigation.cc │ │ ├── pyG4SafetyHelper.cc │ │ ├── pyG4SimpleLocator.cc │ │ ├── pyG4TransportationManager.cc │ │ ├── pyG4VExternalNavigation.cc │ │ ├── pyG4VIntersectionLocator.cc │ │ ├── pyG4VoxelNavigation.cc │ │ └── pyG4VoxelSafety.cc │ ├── pymodG4geometry.cc │ ├── solids │ │ ├── Boolean │ │ │ ├── pyG4BooleanSolid.cc │ │ │ ├── pyG4DisplacedSolid.cc │ │ │ ├── pyG4IntersectionSolid.cc │ │ │ ├── pyG4MultiUnion.cc │ │ │ ├── pyG4ScaledSolid.cc │ │ │ ├── pyG4SubtractionSolid.cc │ │ │ └── pyG4UnionSolid.cc │ │ ├── CSG │ │ │ ├── pyG4Box.cc │ │ │ ├── pyG4CSGSolid.cc │ │ │ ├── pyG4Cons.cc │ │ │ ├── pyG4CutTubs.cc │ │ │ ├── pyG4Orb.cc │ │ │ ├── pyG4Para.cc │ │ │ ├── pyG4Sphere.cc │ │ │ ├── pyG4Torus.cc │ │ │ ├── pyG4Trap.cc │ │ │ ├── pyG4Trd.cc │ │ │ └── pyG4Tubs.cc │ │ └── specific │ │ │ ├── pyG4ClippablePolygon.cc │ │ │ ├── pyG4Ellipsoid.cc │ │ │ ├── pyG4EllipticalCone.cc │ │ │ ├── pyG4EllipticalTube.cc │ │ │ ├── pyG4EnclosingCylinder.cc │ │ │ ├── pyG4ExtrudedSolid.cc │ │ │ ├── pyG4GenericPolycone.cc │ │ │ ├── pyG4GenericTrap.cc │ │ │ ├── pyG4Hype.cc │ │ │ ├── pyG4IntersectingCone.cc │ │ │ ├── pyG4Paraboloid.cc │ │ │ ├── pyG4PolyPhiFace.cc │ │ │ ├── pyG4Polycone.cc │ │ │ ├── pyG4PolyconeHistorical.cc │ │ │ ├── pyG4PolyconeSide.cc │ │ │ ├── pyG4Polyhedra.cc │ │ │ ├── pyG4PolyhedraHistorical.cc │ │ │ ├── pyG4PolyhedraSide.cc │ │ │ ├── pyG4QuadrangularFacet.cc │ │ │ ├── pyG4ReduciblePolygon.cc │ │ │ ├── pyG4SolidExtentList.cc │ │ │ ├── pyG4SolidsWorkspace.cc │ │ │ ├── pyG4SurfBits.cc │ │ │ ├── pyG4TessellatedGeometryAlgorithms.cc │ │ │ ├── pyG4TessellatedSolid.cc │ │ │ ├── pyG4Tet.cc │ │ │ ├── pyG4TriangularFacet.cc │ │ │ ├── pyG4TwistBoxSide.cc │ │ │ ├── pyG4TwistTrapAlphaSide.cc │ │ │ ├── pyG4TwistTrapFlatSide.cc │ │ │ ├── pyG4TwistTrapParallelSide.cc │ │ │ ├── pyG4TwistTubsFlatSide.cc │ │ │ ├── pyG4TwistTubsHypeSide.cc │ │ │ ├── pyG4TwistTubsSide.cc │ │ │ ├── pyG4TwistedBox.cc │ │ │ ├── pyG4TwistedTrap.cc │ │ │ ├── pyG4TwistedTrd.cc │ │ │ ├── pyG4TwistedTubs.cc │ │ │ ├── pyG4VCSGface.cc │ │ │ ├── pyG4VCSGfaceted.cc │ │ │ ├── pyG4VFacet.cc │ │ │ ├── pyG4VTwistSurface.cc │ │ │ ├── pyG4VTwistedFaceted.cc │ │ │ └── pyG4Voxelizer.cc │ └── volumes │ │ ├── pyG4AssemblyStore.cc │ │ ├── pyG4AssemblyTriplet.cc │ │ ├── pyG4AssemblyVolume.cc │ │ ├── pyG4GeometryWorkspace.cc │ │ ├── pyG4LogicalBorderSurface.cc │ │ ├── pyG4LogicalSkinSurface.cc │ │ ├── pyG4NavigationHistory.cc │ │ ├── pyG4NavigationHistoryPool.cc │ │ ├── pyG4NavigationLevel.cc │ │ ├── pyG4NavigationLevelRep.cc │ │ ├── pyG4PVParameterised.cc │ │ ├── pyG4PVPlacement.cc │ │ ├── pyG4PVReplica.cc │ │ ├── pyG4ReflectionFactory.cc │ │ ├── pyG4TouchableHistory.cc │ │ └── pyG4VExternalPhysicalVolume.cc ├── global │ ├── pyG4ApplicationState.cc │ ├── pyG4Exception.cc │ ├── pyG4ExceptionHandler.cc │ ├── pyG4ExceptionSeverity.cc │ ├── pyG4GeometryTolerance.cc │ ├── pyG4PhysicalConstants.cc │ ├── pyG4PhysicsFreeVector.cc │ ├── pyG4PhysicsVector.cc │ ├── pyG4RandomDirection.cc │ ├── pyG4RotationMatrix.cc │ ├── pyG4StatAnalysis.cc │ ├── pyG4StateManager.cc │ ├── pyG4SystemOfUnits.cc │ ├── pyG4ThreeVector.cc │ ├── pyG4Timer.cc │ ├── pyG4Transform3D.cc │ ├── pyG4TwoVector.cc │ ├── pyG4UnitsTable.cc │ ├── pyG4UserLimits.cc │ ├── pyG4Version.cc │ ├── pyRandomEngines.cc │ ├── pyRandomize.cc │ ├── pygeomdefs.cc │ ├── pyglobals.cc │ └── pymodG4global.cc ├── graphics_reps │ ├── pyG4AttDef.cc │ ├── pyG4AttDefStore.cc │ ├── pyG4AttValue.cc │ ├── pyG4Circle.cc │ ├── pyG4Colour.cc │ ├── pyG4Square.cc │ ├── pyG4Text.cc │ ├── pyG4TypeKey.cc │ ├── pyG4VMarker.cc │ ├── pyG4VVisManager.cc │ ├── pyG4VisAttributes.cc │ ├── pyG4Visible.cc │ └── pymodG4graphics_reps.cc ├── intercoms │ ├── pyG4GenericMessenger.cc │ ├── pyG4UIcmdWith3Vector.cc │ ├── pyG4UIcmdWith3VectorAndUnit.cc │ ├── pyG4UIcmdWithABool.cc │ ├── pyG4UIcmdWithADouble.cc │ ├── pyG4UIcmdWithADoubleAndUnit.cc │ ├── pyG4UIcmdWithALongInt.cc │ ├── pyG4UIcmdWithAString.cc │ ├── pyG4UIcmdWithAnInteger.cc │ ├── pyG4UIcmdWithoutParameter.cc │ ├── pyG4UIcommand.cc │ ├── pyG4UIcommandStatus.cc │ ├── pyG4UIcommandTree.cc │ ├── pyG4UIdirectory.cc │ ├── pyG4UImanager.cc │ ├── pyG4UImessenger.cc │ ├── pyG4UIparameter.cc │ └── pymodG4intercoms.cc ├── interface │ ├── pyG4UIExecutive.cc │ ├── pyG4VUIshell.cc │ └── pymodG4interface.cc ├── materials │ ├── pyG4AtomicBond.cc │ ├── pyG4AtomicFormFactor.cc │ ├── pyG4AtomicShells.cc │ ├── pyG4AtomicShells_XDB_EADL.cc │ ├── pyG4CrystalAtomBase.cc │ ├── pyG4CrystalExtension.cc │ ├── pyG4CrystalUnitCell.cc │ ├── pyG4DensityEffectCalculator.cc │ ├── pyG4DensityEffectData.cc │ ├── pyG4Element.cc │ ├── pyG4ElementData.cc │ ├── pyG4ElementTable.cc │ ├── pyG4ExtDEDXTable.cc │ ├── pyG4ExtendedMaterial.cc │ ├── pyG4ICRU90StoppingData.cc │ ├── pyG4IonStoppingData.cc │ ├── pyG4IonisParamElm.cc │ ├── pyG4IonisParamMat.cc │ ├── pyG4Isotope.cc │ ├── pyG4LatticeLogical.cc │ ├── pyG4LatticePhysical.cc │ ├── pyG4Material.cc │ ├── pyG4MaterialPropertiesIndex.cc │ ├── pyG4MaterialPropertiesTable.cc │ ├── pyG4MaterialPropertyVector.cc │ ├── pyG4MaterialTable.cc │ ├── pyG4MicroElecMaterialStructure.cc │ ├── pyG4MicroElecSiStructure.cc │ ├── pyG4NistElementBuilder.cc │ ├── pyG4NistManager.cc │ ├── pyG4NistMaterialBuilder.cc │ ├── pyG4NistMessenger.cc │ ├── pyG4OpticalMaterialProperties.cc │ ├── pyG4OpticalSurface.cc │ ├── pyG4SandiaTable.cc │ ├── pyG4SurfaceProperty.cc │ ├── pyG4UCNMaterialPropertiesTable.cc │ ├── pyG4UCNMicroRoughnessHelper.cc │ ├── pyG4VIonDEDXTable.cc │ ├── pyG4VMaterialExtension.cc │ └── pymodG4materials.cc ├── opaques.hh ├── particles │ ├── pyG4Adjoint.cc │ ├── pyG4Barions.cc │ ├── pyG4Bosons.cc │ ├── pyG4DecayTable.cc │ ├── pyG4DynamicParticle.cc │ ├── pyG4IonTable.cc │ ├── pyG4Ions.cc │ ├── pyG4Leptons.cc │ ├── pyG4Mesons.cc │ ├── pyG4ParticleDefinition.cc │ ├── pyG4ParticleList.cc │ ├── pyG4ParticleTable.cc │ ├── pyG4PrimaryParticle.cc │ ├── pyG4PrimaryVertex.cc │ └── pymodG4particles.cc ├── persistency │ ├── pyG4GDMLAuxStructType.cc │ ├── pyG4GDMLParser.cc │ └── pymodG4persistency.cc ├── physics_lists │ ├── pyG4DecayPhysics.cc │ ├── pyG4EmPhysics.cc │ ├── pyG4FastSimulationPhysics.cc │ ├── pyG4GammaLeptoNuclearPhysics.cc │ ├── pyG4GenericBiasingPhysics.cc │ ├── pyG4HadronElasticPhysics.cc │ ├── pyG4HadronInelasticPhysics.cc │ ├── pyG4ImportanceBiasing.cc │ ├── pyG4IonPhysics.cc │ ├── pyG4NeutronTrackingCut.cc │ ├── pyG4ParallelWorldPhysics.cc │ ├── pyG4StepLimiterPhysics.cc │ ├── pyG4StoppingPhysics.cc │ ├── pyG4WeightWindowBiasing.cc │ ├── pyPhysListFactory.cc │ ├── pyPhysicsLists.cc │ └── pymodG4physicslists.cc ├── processes │ ├── electromagnetic │ │ └── pyG4EmParameters.cc │ ├── hadronic │ │ └── pyG4HadronicParameters.cc │ ├── pyG4CrossSectionHandler.cc │ ├── pyG4EmCalculator.cc │ ├── pyG4ProcVector.cc │ ├── pyG4ProcessManager.cc │ ├── pyG4ProcessTable.cc │ ├── pyG4ProcessType.cc │ ├── pyG4ProductionCutsTable.cc │ ├── pyG4VCrossSectionHandler.cc │ ├── pyG4VProcess.cc │ └── pymodG4processes.cc ├── run │ ├── pyG4MTRunManager.cc │ ├── pyG4Run.cc │ ├── pyG4RunManager.cc │ ├── pyG4RunManagerKernel.cc │ ├── pyG4UserRunAction.cc │ ├── pyG4VModularPhysicsList.cc │ ├── pyG4VPhysicsConstructor.cc │ ├── pyG4VUserActionInitialization.cc │ ├── pyG4VUserDetectorConstruction.cc │ ├── pyG4VUserParallelWorld.cc │ ├── pyG4VUserPhysicsList.cc │ ├── pyG4VUserPrimaryGeneratorAction.cc │ └── pymodG4run.cc ├── tasking │ ├── pyG4RunManagerFactory.cc │ ├── pyG4TaskRunManager.cc │ ├── pyG4VUserTaskQueue.cc │ └── pymodG4tasking.cc ├── track │ ├── pyG4Step.cc │ ├── pyG4StepPoint.cc │ ├── pyG4StepStatus.cc │ ├── pyG4Track.cc │ ├── pyG4TrackStatus.cc │ └── pymodG4track.cc ├── tracking │ ├── pyG4SteppingVerbose.cc │ ├── pyG4TrackingManager.cc │ ├── pyG4Trajectory.cc │ ├── pyG4TrajectoryPoint.cc │ ├── pyG4UserSteppingAction.cc │ ├── pyG4UserTrackingAction.cc │ ├── pyG4VSteppingVerbose.cc │ ├── pyG4VTrajectory.cc │ ├── pyG4VTrajectoryPoint.cc │ └── pymodG4tracking.cc ├── typecast.hh └── visualization │ ├── pyG4ASCIITree.cc │ ├── pyG4DAWNFILE.cc │ ├── pyG4HepRepFile.cc │ ├── pyG4OpenGLImmediateQt.cc │ ├── pyG4OpenGLImmediateWin32.cc │ ├── pyG4OpenGLImmediateX.cc │ ├── pyG4OpenGLImmediateXm.cc │ ├── pyG4OpenGLStoredX.cc │ ├── pyG4OpenGLStoredXm.cc │ ├── pyG4RayTracer.cc │ ├── pyG4RayTracerX.cc │ ├── pyG4VGraphicsSystem.cc │ ├── pyG4VRML2File.cc │ ├── pyG4VisExecutive.cc │ ├── pyG4VisManager.cc │ └── pymodG4visualization.cc └── tests ├── CMakeLists.txt ├── test_B1.py ├── test_destruction.py └── test_examples.py /.gitignore: -------------------------------------------------------------------------------- 1 | build/ 2 | dist/ 3 | _build/ 4 | _generate/ 5 | *.so 6 | *.py[cod] 7 | *.egg-info 8 | /*env* 9 | .vscode/ 10 | 11 | # Generated files 12 | examples/**/*.macro 13 | examples/**/*.root 14 | examples/**/*.csv 15 | examples/**/*.xml 16 | 17 | tests/*.macro 18 | tests/*.root 19 | tests/*.csv 20 | tests/*.xml 21 | 22 | # Generated 3rd party LICENSE file 23 | LICENSE-3RD-PARTY 24 | EXTRA_LICENSES 25 | MANIFEST.in 26 | -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "pybind11"] 2 | path = pybind11 3 | url = https://github.com/HaarigerHarald/pybind11 4 | branch = smart_holder 5 | -------------------------------------------------------------------------------- /CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.16) 2 | project(geant4_pybind) 3 | 4 | set(CMAKE_CXX_STANDARD 17) 5 | set(CMAKE_CXX_STANDARD_REQUIRED ON) 6 | set(CMAKE_CXX_VISIBILITY_PRESET hidden) 7 | 8 | if(MSVC) 9 | if(CMAKE_CXX_FLAGS MATCHES "/W[0-4]") 10 | string(REGEX REPLACE "/W[0-4]" "/W3" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}") 11 | else() 12 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /W3") 13 | endif() 14 | elseif(CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX) 15 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wno-long-long") 16 | endif() 17 | 18 | find_package(Geant4 11.0 REQUIRED) 19 | find_package(Geant4 OPTIONAL_COMPONENTS gdml ui_tcsh motif vis_raytracer_x11 vis_opengl_x11 vis_opengl_win32 qt) 20 | 21 | set(PYBIND11_PYTHON_VERSION 3.5) 22 | add_subdirectory(pybind11) 23 | 24 | add_subdirectory(source) 25 | 26 | include(CTest) 27 | if(BUILD_TESTING) 28 | add_subdirectory(tests) 29 | endif() 30 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | This is free and unencumbered software released into the public domain. 2 | 3 | Anyone is free to copy, modify, publish, use, compile, sell, or 4 | distribute this software, either in source code form or as a compiled 5 | binary, for any purpose, commercial or non-commercial, and by any 6 | means. 7 | 8 | In jurisdictions that recognize copyright laws, the author or authors 9 | of this software dedicate any and all copyright interest in the 10 | software to the public domain. We make this dedication for the benefit 11 | of the public at large and to the detriment of our heirs and 12 | successors. We intend this dedication to be an overt act of 13 | relinquishment in perpetuity of all present and future rights to this 14 | software under copyright law. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 18 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 19 | IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR 20 | OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 21 | ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 22 | OTHER DEALINGS IN THE SOFTWARE. 23 | 24 | For more information, please refer to 25 | -------------------------------------------------------------------------------- /MANIFEST.in: -------------------------------------------------------------------------------- 1 | include README.md DESIGN.md LICENSE pybind11/LICENSE doc/*.py 2 | exclude LICENSE-3RD-PARTY EXTRA_LICENSES 3 | graft pybind11/include 4 | graft pybind11/tools 5 | recursive-include source * 6 | global-include CMakeLists.txt *.cmake 7 | -------------------------------------------------------------------------------- /examples/B1/exampleB1.in: -------------------------------------------------------------------------------- 1 | # Macro file for example B1 test 2 | 3 | /run/initialize 4 | 5 | # gamma 6 MeV 6 | /gun/particle gamma 7 | /gun/energy 6 MeV 8 | # 9 | /run/printProgress 100 10 | /run/beamOn 1000 11 | # 12 | # proton 210 MeV 13 | /gun/particle proton 14 | /gun/energy 210 MeV 15 | # 16 | /run/beamOn 1000 17 | -------------------------------------------------------------------------------- /examples/B1/init_vis.mac: -------------------------------------------------------------------------------- 1 | # Macro file for the initialization of example B1 2 | # in interactive session 3 | # 4 | # Set some default verbose 5 | /control/verbose 2 6 | /control/saveHistory 7 | /run/verbose 2 8 | # 9 | # Change the default number of threads (in multi-threaded mode) 10 | #/run/numberOfThreads 4 11 | # 12 | # Initialize kernel 13 | /run/initialize 14 | # 15 | # Visualization setting 16 | /control/execute vis.mac 17 | -------------------------------------------------------------------------------- /examples/B1/run1.mac: -------------------------------------------------------------------------------- 1 | # Macro file for example B1 2 | # 3 | # Can be run in batch, without graphic 4 | # or interactively: Idle> /control/execute run1.mac 5 | # 6 | # Change the default number of workers (in multi-threading mode) 7 | #/run/numberOfThreads 4 8 | # 9 | # Initialize kernel 10 | /run/initialize 11 | # 12 | /control/verbose 2 13 | /run/verbose 2 14 | /event/verbose 0 15 | /tracking/verbose 1 16 | # 17 | # gamma 6 MeV to the direction (0.,0.,1.) 18 | # 19 | #/gun/particle gamma 20 | #/gun/energy 6 MeV 21 | # 22 | /run/beamOn 5 23 | # 24 | # proton 210 MeV to the direction (0.,0.,1.) 25 | # 26 | /gun/particle proton 27 | /gun/energy 210 MeV 28 | /tracking/verbose 2 29 | # 30 | /run/beamOn 1 31 | -------------------------------------------------------------------------------- /examples/B1/run2.mac: -------------------------------------------------------------------------------- 1 | # Macro file for example B1 2 | # 3 | # To be run preferably in batch, without graphics: 4 | # % exampleB1 run2.mac 5 | # 6 | #/run/numberOfThreads 4 7 | /run/initialize 8 | # 9 | /control/verbose 2 10 | /run/verbose 2 11 | # 12 | # gamma 6 MeV to the direction (0.,0.,1.) 13 | # 10000 events 14 | # 15 | /gun/particle gamma 16 | /gun/energy 6 MeV 17 | # 18 | /run/printProgress 100 19 | /run/beamOn 1000 20 | # 21 | # proton 210 MeV to the direction (0.,0.,1.) 22 | # 1000 events 23 | # 24 | /gun/particle proton 25 | /gun/energy 210 MeV 26 | # 27 | /run/beamOn 1000 28 | -------------------------------------------------------------------------------- /examples/B2/exampleB2.in: -------------------------------------------------------------------------------- 1 | # Macro file for example B2 test 2 | 3 | /run/initialize 4 | 5 | /tracking/verbose 0 6 | 7 | # e+ 200MeV 8 | /gun/energy 200 MeV 9 | /gun/particle e+ 10 | /run/beamOn 100 11 | 12 | # mu+ 1TeV 13 | /gun/energy 1 TeV 14 | /gun/particle mu+ 15 | /run/beamOn 100 16 | 17 | /tracking/verbose 1 18 | 19 | # geantino 20 | /gun/particle geantino 21 | /run/beamOn 1 22 | -------------------------------------------------------------------------------- /examples/B2/init_vis.mac: -------------------------------------------------------------------------------- 1 | # Macro file for the initialization of example B2 2 | # in interactive session 3 | # 4 | # Set some default verbose 5 | /control/verbose 2 6 | /control/saveHistory 7 | /run/verbose 2 8 | # 9 | # Change the default number of threads (in multi-threaded mode) 10 | #/run/numberOfThreads 4 11 | # 12 | # Initialize kernel 13 | /run/initialize 14 | # 15 | # Visualization setting 16 | /control/execute vis.mac 17 | -------------------------------------------------------------------------------- /examples/B2/run1.mac: -------------------------------------------------------------------------------- 1 | # Macro file for example B2 2 | # 3 | # Can be run in batch, without graphic 4 | # or interactively: Idle> /control/execute run1.mac 5 | # 6 | # Change the default number of workers (in multi-threading mode) 7 | #/run/numberOfThreads 4 8 | # 9 | # Initialize kernel 10 | /run/initialize 11 | # 12 | # Default kinematics: 13 | # proton 3 GeV in direction (0.,0.,1.) 14 | # 1 event with tracking/verbose 15 | # 16 | /tracking/verbose 1 17 | /run/beamOn 1 18 | # 19 | # 1 event with printing hits 20 | # 21 | /tracking/verbose 0 22 | /hits/verbose 2 23 | /run/beamOn 1 24 | # 25 | # set target and chamber material 26 | # 27 | /B2/det/setTargetMaterial G4_WATER 28 | /B2/det/setChamberMaterial G4_Ar 29 | /run/beamOn 3 30 | # 31 | # set a magnetic field and max allowed step length 32 | # 3 event with printing hits 33 | # 34 | /globalField/verbose 1 35 | /globalField/setValue 0.2 0 0 tesla 36 | /B2/det/stepMax 1.0 mm 37 | /gun/energy 0.3 GeV 38 | /run/beamOn 3 39 | # 40 | # muon 300 MeV in the direction (0.,0.,1.) 41 | # 3 event with detailed printing 42 | # 43 | /gun/particle mu- 44 | /gun/energy 300 MeV 45 | /run/beamOn 3 46 | -------------------------------------------------------------------------------- /examples/B2/run2.mac: -------------------------------------------------------------------------------- 1 | # Macro file for example B2 2 | # 3 | # To be run preferably in batch, without graphics: 4 | # % exampleB2[a,b] run2.mac 5 | # 6 | #/run/numberOfThreads 4 7 | /run/initialize 8 | /run/beamOn 500 9 | -------------------------------------------------------------------------------- /examples/B2/startup.mac: -------------------------------------------------------------------------------- 1 | # Macro file for the pre-initialization phase of example B2 2 | # 3 | # Set some default verbose 4 | /control/verbose 2 5 | /control/saveHistory 6 | /run/verbose 2 7 | # 8 | # Change the default number of threads (in multi-threaded mode) 9 | #/run/numberOfThreads 4 10 | # 11 | # Initialize kernel 12 | /run/initialize 13 | -------------------------------------------------------------------------------- /examples/B3/debug.mac: -------------------------------------------------------------------------------- 1 | # 2 | # Macro file for "exampleB3.cc" 3 | # 4 | # can be run in batch, without graphic 5 | # or interactively: Idle> /control/execute debug.mac 6 | # 7 | /run/initialize 8 | # 9 | /tracking/verbose 1 10 | # 11 | /gun/particle geantino 12 | /run/beamOn 1 13 | -------------------------------------------------------------------------------- /examples/B3/exampleB3.in: -------------------------------------------------------------------------------- 1 | # 2 | # Macro file for example B3 test 3 | # 4 | /run/initialize 5 | # 6 | /control/verbose 2 7 | # 8 | /run/printProgress 1000 9 | /run/beamOn 10000 10 | -------------------------------------------------------------------------------- /examples/B3/init_vis.mac: -------------------------------------------------------------------------------- 1 | # Macro file for the initialization of example B3 2 | # in interactive session 3 | # 4 | # Set some default verbose 5 | # 6 | /control/verbose 2 7 | /control/saveHistory 8 | /run/verbose 2 9 | # 10 | # Change the default number of threads (in multi-threaded mode) 11 | #/run/numberOfThreads 4 12 | # 13 | # Initialize kernel 14 | /run/initialize 15 | # 16 | # Visualization setting 17 | /control/execute vis.mac 18 | -------------------------------------------------------------------------------- /examples/B3/run1.mac: -------------------------------------------------------------------------------- 1 | # 2 | # Macro file of "exampleB3.cc" 3 | # 4 | # Change the default number of workers (in multi-threading mode) 5 | #/run/numberOfThreads 4 6 | # 7 | # Initialize kernel 8 | /run/initialize 9 | # 10 | /control/verbose 2 11 | /tracking/verbose 2 12 | # 13 | /run/beamOn 1 14 | # 15 | /tracking/verbose 0 16 | /run/beamOn 20 17 | -------------------------------------------------------------------------------- /examples/B3/run2.mac: -------------------------------------------------------------------------------- 1 | # 2 | # Macro file of "exampleB3.cc" 3 | # To be run preferably in batch, without graphics: 4 | # % exampleB3 run3.mac 5 | # 6 | #/run/numberOfThreads 4 7 | /run/initialize 8 | # 9 | /control/verbose 2 10 | # 11 | /run/beamOn 40000 12 | # 13 | # change beta source 14 | # 15 | /gun/particle ion 16 | /gun/ion 6 11 17 | # 18 | /run/printProgress 10000 19 | /run/beamOn 40000 20 | -------------------------------------------------------------------------------- /examples/B4/exampleB4.in: -------------------------------------------------------------------------------- 1 | # Macro file for example B4 test 2 | 3 | /run/initialize 4 | 5 | # e+ 300MeV 6 | /gun/particle e+ 7 | /gun/energy 300 MeV 8 | /run/beamOn 1 9 | # 10 | # list the existing physics processes 11 | /process/list 12 | # 13 | # switch off MultipleScattering 14 | /process/inactivate msc 15 | /run/beamOn 1 16 | # 17 | # switch on MultipleScattering 18 | /process/activate msc 19 | # 20 | # change detector parameter 21 | /gun/particle gamma 22 | /gun/energy 500 MeV 23 | /run/beamOn 1 24 | -------------------------------------------------------------------------------- /examples/B4/gui.mac: -------------------------------------------------------------------------------- 1 | # 2 | # This file permits to customize, with commands, 3 | # the menu bar of the G4UIXm, G4UIQt, G4UIWin32 sessions. 4 | # It has no effect with G4UIterminal. 5 | # 6 | # File menu : 7 | /gui/addMenu file File 8 | /gui/addButton file Quit exit 9 | # 10 | # Run menu : 11 | /gui/addMenu run Run 12 | /gui/addButton run "beamOn 1" "/run/beamOn 1" 13 | /gui/addButton run run1 "/control/execute run1.mac" 14 | # 15 | # Gun menu : 16 | /gui/addMenu gun Gun 17 | /gui/addButton gun "50 MeV" "/gun/energy 50 MeV" 18 | /gui/addButton gun "1 GeV" "/gun/energy 1 GeV" 19 | /gui/addButton gun "10 GeV" "/gun/energy 10 GeV" 20 | /gui/addButton gun "e-" "/gun/particle e-" 21 | /gui/addButton gun "pi0" "/gun/particle pi0" 22 | /gui/addButton gun "pi+" "/gun/particle pi+" 23 | /gui/addButton gun "neutron" "/gun/particle neutron" 24 | /gui/addButton gun "proton" "/gun/particle proton" 25 | # 26 | # Viewer menu : 27 | /gui/addMenu viewer Viewer 28 | /gui/addButton viewer "Set style surface" "/vis/viewer/set/style surface" 29 | /gui/addButton viewer "Set style wireframe" "/vis/viewer/set/style wireframe" 30 | /gui/addButton viewer "Refresh viewer" "/vis/viewer/refresh" 31 | /gui/addButton viewer "Update viewer (interaction or end-of-file)" "/vis/viewer/update" 32 | /gui/addButton viewer "Flush viewer (= refresh + update)" "/vis/viewer/flush" 33 | /gui/addButton viewer "Update scene" "/vis/scene/notifyHandlers" 34 | # 35 | # To limit the output flow in the "dump" widget : 36 | /run/printProgress 100 37 | # 38 | -------------------------------------------------------------------------------- /examples/B4/init_vis.mac: -------------------------------------------------------------------------------- 1 | # Macro file for the initialization of example B4 2 | # in interactive session 3 | # 4 | # Set some default verbose 5 | # 6 | /control/verbose 2 7 | /control/saveHistory 8 | /run/verbose 2 9 | # 10 | # Change the default number of threads (in multi-threaded mode) 11 | #/run/numberOfThreads 4 12 | # 13 | # Initialize kernel 14 | /run/initialize 15 | # 16 | # Visualization setting 17 | /control/execute vis.mac 18 | -------------------------------------------------------------------------------- /examples/B4/run1.mac: -------------------------------------------------------------------------------- 1 | # Macro file for example B4 2 | # 3 | # Can be run in batch, without graphic 4 | # or interactively: Idle> /control/execute run1.mac 5 | # 6 | # Change the default number of workers (in multi-threading mode) 7 | #/run/numberOfThreads 4 8 | # 9 | # Initialize kernel 10 | /run/initialize 11 | # 12 | # Default kinematics: 13 | # electron 50 MeV in direction (0.,0.,1.) 14 | # 1 event with tracking/verbose 15 | # 16 | /tracking/verbose 1 17 | /run/beamOn 1 18 | # 19 | # 20 | # muon 300 MeV in direction (0.,0.,1.) 21 | # 3 events 22 | # 23 | /gun/particle mu+ 24 | /gun/energy 3 MeV 25 | /run/beamOn 3 26 | # 27 | # 20 events 28 | # 29 | /tracking/verbose 0 30 | /run/printProgress 5 31 | /run/beamOn 20 32 | # 33 | # Magnetic field 34 | # 35 | /globalField/setValue 0.2 0 0 tesla 36 | /run/beamOn 3 37 | # 38 | # Activate/inactivate physics processes 39 | # 40 | /process/list 41 | /process/inactivate eBrem 42 | # 43 | /run/beamOn 20 44 | # 45 | -------------------------------------------------------------------------------- /examples/B4/run2.mac: -------------------------------------------------------------------------------- 1 | # Macro file for example B4 2 | # 3 | # To be run preferably in batch, without graphics: 4 | # % exampleB4[a,b,c,d] run2.mac 5 | # 6 | #/run/numberOfThreads 4 7 | #/control/cout/ignoreThreadsExcept 0 8 | # 9 | /run/initialize 10 | # 11 | # Default kinemtics: 12 | # electron 50 MeV in direction (0.,0.,1.) 13 | # 1000 events 14 | # 15 | /run/printProgress 100 16 | /run/beamOn 1000 17 | 18 | -------------------------------------------------------------------------------- /examples/B5/exampleB5.in: -------------------------------------------------------------------------------- 1 | # 2 | # Test macro file for exampleB5 3 | # 4 | 5 | /run/initialize 6 | 7 | # Turn off randomization 8 | /B5/generator/randomizePrimary false 9 | /B5/generator/sigmaMomentum 0. 10 | /B5/generator/sigmaAngle 0. 11 | /run/printProgress 5 12 | # 13 | /analysis/ntuple/setFileName 0 B5ntuple 14 | # 15 | /B5/detector/armAngle 30. deg 16 | /gun/particle proton 17 | /B5/generator/momentum 100. GeV 18 | /B5/field/value 100. tesla 19 | /run/beamOn 5 20 | # 21 | /B5/detector/armAngle 60. deg 22 | /gun/particle pi+ 23 | /B5/generator/momentum 100. GeV 24 | /B5/field/value 200. tesla 25 | /run/beamOn 5 26 | # 27 | /gun/particle e+ 28 | /B5/detector/armAngle 30. deg 29 | /B5/generator/momentum 100. GeV 30 | /B5/field/value 100. tesla 31 | /run/beamOn 5 32 | # 33 | /B5/detector/armAngle 30. deg 34 | /gun/particle proton 35 | /B5/generator/momentum 10. GeV 36 | /B5/field/value 10. tesla 37 | /run/beamOn 5 38 | # 39 | /B5/detector/armAngle 60. deg 40 | /gun/particle pi+ 41 | /B5/generator/momentum 10. GeV 42 | /B5/field/value 20. tesla 43 | /run/beamOn 5 44 | # 45 | /gun/particle e+ 46 | /B5/detector/armAngle 30. deg 47 | /B5/generator/momentum 10. GeV 48 | /B5/field/value 10. tesla 49 | /run/beamOn 5 50 | # 51 | # 52 | /B5/detector/armAngle 30. deg 53 | /gun/particle proton 54 | /B5/generator/momentum 1. GeV 55 | /B5/field/value 1. tesla 56 | /run/beamOn 5 57 | # 58 | /B5/detector/armAngle 60. deg 59 | /gun/particle pi+ 60 | /B5/generator/momentum 1. GeV 61 | /B5/field/value 2. tesla 62 | /run/beamOn 5 63 | # 64 | /gun/particle e+ 65 | /B5/detector/armAngle 30. deg 66 | /B5/generator/momentum 1. GeV 67 | /B5/field/value 1. tesla 68 | /run/beamOn 5 69 | -------------------------------------------------------------------------------- /examples/B5/icons.mac: -------------------------------------------------------------------------------- 1 | # 2 | # This file permits to customize, with commands, 3 | # the icon menu bar of the G4UIQt sessions not yet implemented other UI drivers (geant4-09-05-ref-09) 4 | # It has no effect with G4UIterminal. 5 | 6 | # disable default icons 7 | /gui/defaultIcons false 8 | 9 | # open/save icons 10 | /gui/addIcon "Open macro file" open /control/execute 11 | /gui/addIcon "Save viewer state" save /vis/viewer/save 12 | 13 | # Cursors style icons 14 | /gui/addIcon "Move" move 15 | /gui/addIcon "Pick" pick 16 | /gui/addIcon "Zoom out" zoom_out 17 | /gui/addIcon "Zoom in" zoom_in 18 | /gui/addIcon "Rotate" rotate 19 | 20 | # Surface Style icons 21 | # Surface Style icons 22 | /gui/addIcon "Hidden line removal" hidden_line_removal 23 | /gui/addIcon "Hidden line and hidden surface removal" hidden_line_and_surface_removal 24 | /gui/addIcon "Surfaces" solid 25 | /gui/addIcon "Wireframe" wireframe 26 | 27 | # Perspective/Ortho icons 28 | /gui/addIcon "Perspective" perspective 29 | /gui/addIcon "Orthographic" ortho 30 | -------------------------------------------------------------------------------- /examples/B5/init.mac: -------------------------------------------------------------------------------- 1 | # Macro file for the initialization of example B1 2 | # when running in interactive mode without visualization 3 | # 4 | # Set some default verbose 5 | /control/verbose 2 6 | /control/saveHistory 7 | /run/verbose 2 8 | # 9 | # Change the default number of threads (in multi-threaded mode) 10 | #/run/numberOfThreads 4 11 | # 12 | # Initialize kernel 13 | /run/initialize 14 | -------------------------------------------------------------------------------- /examples/B5/init_vis.mac: -------------------------------------------------------------------------------- 1 | # Macro file for the initialization phase of example B5 2 | # when running in interactive mode with visualization 3 | # 4 | # Set some default verbose 5 | # 6 | /control/verbose 2 7 | /control/saveHistory 8 | /run/verbose 2 9 | # 10 | # Change the default number of threads (in multi-threaded mode) 11 | #/run/numberOfThreads 4 12 | # 13 | # Initialize kernel 14 | /run/initialize 15 | # 16 | # Visualization setting 17 | /control/execute vis.mac 18 | -------------------------------------------------------------------------------- /examples/B5/run.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HaarigerHarald/geant4_pybind/1e6181b4a83ac15797140d28c356a2877d7a2592/examples/B5/run.png -------------------------------------------------------------------------------- /examples/B5/run1.mac: -------------------------------------------------------------------------------- 1 | # Macro file for example B5 2 | # 3 | # Can be run in batch, without graphic 4 | # or interactively: Idle> /control/execute run1.mac 5 | # 6 | # Change the default number of workers (in multi-threading mode) 7 | #/run/numberOfThreads 4 8 | # 9 | # Initialize kernel 10 | /run/initialize 11 | # 12 | # Defaults: 13 | # armAngle 30. deg 14 | # field value: 1.0*tesla 15 | /run/beamOn 3 16 | # 17 | /B5/detector/armAngle 0. deg 18 | /B5/field/value 0. tesla 19 | /run/beamOn 3 20 | # 21 | /B5/detector/armAngle 60. deg 22 | /B5/field/value 2. tesla 23 | /run/beamOn 3 24 | # 25 | /B5/detector/armAngle 30. deg 26 | /B5/field/value 1. tesla 27 | /B5/generator/momentum 2. GeV 28 | /B5/generator/sigmaMomentum 0. 29 | /B5/generator/sigmaAngle 0. 30 | /B5/generator/sigmaAngle 2. deg 31 | /run/beamOn 3 32 | 33 | -------------------------------------------------------------------------------- /examples/B5/run2.mac: -------------------------------------------------------------------------------- 1 | # Macro file for example B5 2 | # 3 | # To be run preferably in batch, without graphics: 4 | # % exampleB5 run2.mac 5 | # 6 | #/run/numberOfThreads 4 7 | /control/cout/ignoreThreadsExcept 0 8 | # 9 | /run/initialize 10 | # 11 | # turn off randomization 12 | # 13 | /B5/generator/randomizePrimary FALSE 14 | /B5/generator/sigmaMomentum 0. 15 | /B5/generator/sigmaAngle 0. 16 | /run/verbose 1 17 | /run/printProgress 0 18 | # 19 | /B5/detector/armAngle 30. deg 20 | /gun/particle proton 21 | /B5/generator/momentum 100. GeV 22 | /B5/field/value 100. tesla 23 | /analysis/setFileName B5_proton 24 | /analysis/ntuple/setFileName 0 B5ntuple_proton 25 | /run/beamOn 30 26 | # 27 | /B5/detector/armAngle 60. deg 28 | /gun/particle pi+ 29 | /B5/generator/momentum 100. GeV 30 | /B5/field/value 200. tesla 31 | /analysis/setFileName B5_pi+ 32 | /analysis/ntuple/setFileName 0 B5ntuple_pi+ 33 | /run/beamOn 30 34 | # 35 | /gun/particle e+ 36 | /B5/detector/armAngle 30. deg 37 | /B5/generator/momentum 100. GeV 38 | /B5/field/value 100. tesla 39 | /analysis/setFileName B5_e+ 40 | /analysis/ntuple/setFileName 0 B5ntuple_e+ 41 | /run/beamOn 30 42 | 43 | -------------------------------------------------------------------------------- /examples/gdml/README: -------------------------------------------------------------------------------- 1 | ------------------------------------------------------------------- 2 | 3 | ========================================================= 4 | Geant4 - an Object-Oriented Toolkit for Simulation in HEP 5 | ========================================================= 6 | 7 | GDML detector sensitivity 8 | ------------------------- 9 | 10 | This example demonstrates the usage of the GDML auxiliary information for 11 | associating a sensitive detector to a volume. 12 | 13 | The detector construction consists of a call to GDMLProcessor which parses a 14 | GDML file and returns the pointer to the world volume. The user can also write 15 | her/his own GDML file and use it as the primary input format for her/his Geant4 16 | application. 17 | 18 | A simple GDML files is provided: 19 | - auxiliary.gdml, showing association of a volume with the auxiliary 20 | information, related to the sensitive detector. 21 | 22 | HOW TO BUILD THE EXAMPLE ? 23 | 24 | - You need to have built the persistency/gdml module by having 25 | set the -DGEANT4_USE_GDML=ON flag during the CMAKE configuration step, 26 | as well as the -DXERCESC_ROOT_DIR= flag pointing to 27 | the path where the XercesC XML parser package is installed in your system. 28 | 29 | - Execute the application. 30 | o For parsing interactively the GDML file: 31 | % python3 g04.py auxiliary.gdml 32 | -------------------------------------------------------------------------------- /examples/gdml/g04.mac: -------------------------------------------------------------------------------- 1 | ################################################### 2 | # Batch running of events 3 | ################################################### 4 | 5 | # verbosity 6 | /tracking/verbose 1 7 | /control/verbose 1 8 | /run/verbose 2 9 | 10 | # Shoot along Z direction 11 | /run/beamOn 20 12 | /gun/direction 0 0 -1 13 | /run/beamOn 20 14 | 15 | # Shoot along various directions 16 | /tracking/verbose 0 17 | /gun/direction 0.3 0.2 1 18 | /run/beamOn 20 19 | /gun/direction 0.3 -0.2 1 20 | /run/beamOn 20 21 | /gun/direction -0.3 0.2 0.6 22 | /run/beamOn 20 23 | 24 | exit 25 | -------------------------------------------------------------------------------- /examples/gdml/vis.mac: -------------------------------------------------------------------------------- 1 | ################################################### 2 | # Visualization of detector geometry and events 3 | ################################################### 4 | 5 | # create empty scene 6 | /vis/scene/create 7 | 8 | # Create a scene handler for a specific graphics system 9 | /vis/open OGL 10 | 11 | # draw scene 12 | /vis/viewer/zoom 1.4 13 | /vis/viewer/flush 14 | 15 | # (if you prefer not refreshing each event, uncomment next line) 16 | # /vis/scene/endOfEventAction accumulate 17 | -------------------------------------------------------------------------------- /pyproject.toml: -------------------------------------------------------------------------------- 1 | [build-system] 2 | requires = [ 3 | "setuptools>=42", 4 | "wheel", 5 | "cmake>=3.16", 6 | "ninja; sys_platform != 'win32'", 7 | "pybind11-stubgen~=2.5", 8 | ] 9 | build-backend = "setuptools.build_meta" 10 | -------------------------------------------------------------------------------- /source/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | 2 | file(GLOB_RECURSE SOURCE CONFIGURE_DEPENDS 3 | analysis/*.cc 4 | digits_hits/*.cc 5 | event/*.cc 6 | geometry/*.cc 7 | global/*.cc 8 | graphics_reps/*.cc 9 | intercoms/*.cc 10 | interface/*.cc 11 | materials/*.cc 12 | particles/*.cc 13 | persistency/*.cc 14 | physics_lists/*.cc 15 | processes/*.cc 16 | run/*.cc 17 | tasking/*.cc 18 | track/*.cc 19 | tracking/*.cc 20 | visualization/*.cc 21 | ) 22 | 23 | pybind11_add_module(geant4_pybind 24 | ${SOURCE} 25 | geant4_pybind.cc 26 | ) 27 | 28 | target_include_directories(geant4_pybind PRIVATE "${CMAKE_CURRENT_LIST_DIR}") 29 | 30 | target_compile_definitions(geant4_pybind 31 | PRIVATE 32 | PYBIND11_USE_SMART_HOLDER_AS_DEFAULT 33 | $<$:G4_HAS_GDML> 34 | $<$:G4_HAS_TCSH> 35 | $<$:G4_HAS_OPENGLX> 36 | $<$:G4_HAS_RAYTRACERX> 37 | $<$:G4_HAS_OPENGLXM> 38 | $<$:G4_HAS_OPENGLWIN> 39 | $<$:G4_HAS_QT> 40 | ) 41 | 42 | target_link_libraries(geant4_pybind PRIVATE ${Geant4_LIBRARIES}) 43 | -------------------------------------------------------------------------------- /source/analysis/accumulables/pyG4MergeMode.cc: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #include 5 | 6 | #include "typecast.hh" 7 | #include "opaques.hh" 8 | 9 | namespace py = pybind11; 10 | 11 | void export_G4MergeMode(py::module &m) 12 | { 13 | py::enum_(m, "G4MergeMode") 14 | .value("kAddition", G4MergeMode::kAddition) 15 | .value("kMultiplication", G4MergeMode::kMultiplication) 16 | .value("kMaximum", G4MergeMode::kMaximum) 17 | .value("kMinimum", G4MergeMode::kMinimum); 18 | 19 | struct ScopedG4Accumulables {}; 20 | 21 | py::class_(m, "G4Accumulables") 22 | .def_static("GetMergeMode", &G4Accumulables::GetMergeMode, py::arg("mergeModeName")); 23 | } 24 | -------------------------------------------------------------------------------- /source/analysis/accumulables/pyG4VAccumulable.cc: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #include 5 | #include 6 | 7 | #include "typecast.hh" 8 | #include "opaques.hh" 9 | 10 | namespace py = pybind11; 11 | 12 | class PyG4VAccumulable : public G4VAccumulable, public py::trampoline_self_life_support { 13 | public: 14 | using G4VAccumulable::G4VAccumulable; 15 | 16 | void Merge(const G4VAccumulable &other) override { PYBIND11_OVERRIDE_PURE(void, G4VAccumulable, Merge, other); } 17 | 18 | void Reset() override { PYBIND11_OVERRIDE_PURE(void, G4VAccumulable, Reset, ); } 19 | }; 20 | 21 | void export_G4VAccumulable(py::module &m) 22 | { 23 | py::class_(m, "G4VAccumulable") 24 | 25 | .def(py::init(), py::arg("name") = "") 26 | .def("__copy__", [](const PyG4VAccumulable &self) { return new PyG4VAccumulable(self); }) 27 | .def("__deepcopy__", [](const PyG4VAccumulable &self, py::dict) { return new PyG4VAccumulable(self); }) 28 | .def("GetName", &G4VAccumulable::GetName) 29 | .def("Merge", &G4VAccumulable::Merge, py::arg("other")) 30 | .def("Reset", &G4VAccumulable::Reset); 31 | } 32 | -------------------------------------------------------------------------------- /source/analysis/pymodG4analysis.cc: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #include "typecast.hh" 5 | #include "opaques.hh" 6 | 7 | namespace py = pybind11; 8 | 9 | void export_histo(py::module &); 10 | void export_G4VAnalysisManager(py::module &); 11 | void export_G4AnalysisManager(py::module &); 12 | void export_G4TScoreNtupleWriter(py::module &); 13 | void export_G4MergeMode(py::module &m); 14 | void export_G4VAccumulable(py::module &m); 15 | void export_G4Accumulable(py::module &m); 16 | void export_G4AccumulableManager(py::module &m); 17 | 18 | void export_modG4analysis(py::module &m) 19 | { 20 | export_histo(m); 21 | export_G4VAnalysisManager(m); 22 | export_G4AnalysisManager(m); 23 | export_G4TScoreNtupleWriter(m); 24 | export_G4MergeMode(m); 25 | export_G4VAccumulable(m); 26 | export_G4Accumulable(m); 27 | export_G4AccumulableManager(m); 28 | } 29 | -------------------------------------------------------------------------------- /source/digits_hits/pyG4HCofThisEvent.cc: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #include 5 | 6 | #include "typecast.hh" 7 | #include "opaques.hh" 8 | 9 | namespace py = pybind11; 10 | 11 | void export_G4HCofThisEvent(py::module &m) 12 | { 13 | py::class_(m, "G4HCofThisEvent") 14 | .def(py::init<>()) 15 | .def(py::init()) 16 | .def(py::init()) 17 | .def("AddHitsCollection", [](G4HCofThisEvent &self, G4int HCID, 18 | py::disown_ptr aHC) { self.AddHitsCollection(HCID, aHC); }) 19 | 20 | .def("GetHC", &G4HCofThisEvent::GetHC, py::return_value_policy::reference_internal) 21 | .def("GetNumberOfCollections", &G4HCofThisEvent::GetNumberOfCollections) 22 | .def("GetCapacity", &G4HCofThisEvent::GetCapacity); 23 | } 24 | -------------------------------------------------------------------------------- /source/digits_hits/pyG4VSDFilter.cc: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #include 5 | #include 6 | 7 | #include "typecast.hh" 8 | #include "opaques.hh" 9 | 10 | namespace py = pybind11; 11 | 12 | class PyG4VSDFilter : public G4VSDFilter, public py::trampoline_self_life_support { 13 | public: 14 | using G4VSDFilter::G4VSDFilter; 15 | 16 | G4bool Accept(const G4Step *step) const override { PYBIND11_OVERRIDE_PURE(G4bool, G4VSDFilter, Accept, step); } 17 | }; 18 | 19 | void export_G4VSDFilter(py::module &m) 20 | { 21 | // TODO 22 | py::class_(m, "G4VSDFilter") 23 | 24 | .def(py::init(), py::arg("name")) 25 | .def("Accept", &G4VSDFilter::Accept) 26 | .def("GetName", &G4VSDFilter::GetName); 27 | } 28 | -------------------------------------------------------------------------------- /source/digits_hits/pymodG4digits_hits.cc: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #include "typecast.hh" 5 | #include "opaques.hh" 6 | 7 | namespace py = pybind11; 8 | 9 | void export_G4VSensitiveDetector(py::module &); 10 | void export_G4VHit(py::module &); 11 | void export_G4SDManager(py::module &); 12 | void export_G4VHitsCollection(py::module &); 13 | void export_G4HCofThisEvent(py::module &); 14 | void export_G4MultiFunctionalDetector(py::module &); 15 | void export_G4MultiSensitiveDetector(py::module &); 16 | void export_G4VSDFilter(py::module &); 17 | void export_G4SDFilter(py::module &); 18 | void export_G4VPrimitiveScorer(py::module &); 19 | void export_G4VPrimitivePlotter(py::module &); 20 | void export_G4Scorer(py::module &); 21 | 22 | void export_modG4digit_hits(py::module &m) 23 | { 24 | export_G4VSensitiveDetector(m); 25 | export_G4VHit(m); 26 | export_G4SDManager(m); 27 | export_G4VHitsCollection(m); 28 | export_G4HCofThisEvent(m); 29 | export_G4MultiFunctionalDetector(m); 30 | export_G4MultiSensitiveDetector(m); 31 | export_G4VSDFilter(m); 32 | export_G4SDFilter(m); 33 | export_G4VPrimitiveScorer(m); 34 | export_G4VPrimitivePlotter(m); 35 | export_G4Scorer(m); 36 | } 37 | -------------------------------------------------------------------------------- /source/event/pyG4ClassificationOfNewTrack.cc: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #include 5 | 6 | #include "typecast.hh" 7 | #include "opaques.hh" 8 | 9 | namespace py = pybind11; 10 | 11 | void export_G4ClassificationOfNewTrack(py::module &m) 12 | { 13 | py::enum_(m, "G4ClassificationOfNewTrack") 14 | .value("fUrgent", fUrgent) 15 | .value("fWaiting", fWaiting) 16 | .value("fPostpone", fPostpone) 17 | .value("fKill", fKill) 18 | .value("fWaiting_1", fWaiting_1) 19 | .value("fWaiting_2", fWaiting_2) 20 | .value("fWaiting_3", fWaiting_3) 21 | .value("fWaiting_4", fWaiting_4) 22 | .value("fWaiting_5", fWaiting_5) 23 | .value("fWaiting_6", fWaiting_6) 24 | .value("fWaiting_7", fWaiting_7) 25 | .value("fWaiting_8", fWaiting_8) 26 | .value("fWaiting_9", fWaiting_9) 27 | .value("fWaiting_10", fWaiting_10) 28 | .export_values(); 29 | } 30 | -------------------------------------------------------------------------------- /source/event/pyG4HEPEvtInterface.cc: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | 10 | #include "typecast.hh" 11 | #include "opaques.hh" 12 | 13 | namespace py = pybind11; 14 | 15 | class PyG4HEPEvtInterface : public G4HEPEvtInterface, public py::trampoline_self_life_support { 16 | public: 17 | using G4HEPEvtInterface::G4HEPEvtInterface; 18 | 19 | void GeneratePrimaryVertex(G4Event *evt) override 20 | { 21 | PYBIND11_OVERRIDE(void, G4HEPEvtInterface, GeneratePrimaryVertex, evt); 22 | } 23 | }; 24 | 25 | void export_G4HEPEvtInterface(py::module &m) 26 | { 27 | py::class_(m, "G4HEPEvtInterface") 28 | 29 | .def(py::init(), py::arg("evfile"), py::arg("vl") = 0) 30 | .def("GeneratePrimaryVertex", &G4HEPEvtInterface::GeneratePrimaryVertex, py::arg("evt")); 31 | } 32 | -------------------------------------------------------------------------------- /source/event/pyG4HEPEvtParticle.cc: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | #include 6 | #include 7 | #include 8 | 9 | #include "typecast.hh" 10 | #include "opaques.hh" 11 | 12 | namespace py = pybind11; 13 | 14 | void export_G4HEPEvtParticle(py::module &m) 15 | { 16 | py::class_(m, "G4HEPEvtParticle") 17 | 18 | .def("__copy__", [](const G4HEPEvtParticle &self) { return new G4HEPEvtParticle(self); }) 19 | .def("__deepcopy__", [](const G4HEPEvtParticle &self, py::dict) { return new G4HEPEvtParticle(self); }) 20 | .def(py::init<>()) 21 | .def(py::init(), py::arg("pp"), py::arg("isthep"), py::arg("jdahep1"), 22 | py::arg("jdahep2")) 23 | 24 | .def("Done", &G4HEPEvtParticle::Done) 25 | .def("GetISTHEP", &G4HEPEvtParticle::GetISTHEP) 26 | .def("GetJDAHEP1", &G4HEPEvtParticle::GetJDAHEP1) 27 | .def("GetJDAHEP2", &G4HEPEvtParticle::GetJDAHEP2) 28 | .def("GetTheParticle", &G4HEPEvtParticle::GetTheParticle, py::return_value_policy::reference) 29 | .def(py::self != py::self) 30 | .def(py::self == py::self); 31 | } 32 | -------------------------------------------------------------------------------- /source/event/pyG4MultiEventAction.cc: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #include 5 | #include 6 | #include 7 | 8 | #include "typecast.hh" 9 | #include "opaques.hh" 10 | 11 | namespace py = pybind11; 12 | 13 | class PyG4MultiEventAction : public G4MultiEventAction, public py::trampoline_self_life_support { 14 | public: 15 | using G4MultiEventAction::G4MultiEventAction; 16 | 17 | void BeginOfEventAction(const G4Event *arg0) override 18 | { 19 | PYBIND11_OVERRIDE(void, G4MultiEventAction, BeginOfEventAction, arg0); 20 | } 21 | 22 | void EndOfEventAction(const G4Event *arg0) override 23 | { 24 | PYBIND11_OVERRIDE(void, G4MultiEventAction, EndOfEventAction, arg0); 25 | } 26 | 27 | void SetEventManager(G4EventManager *arg0) override 28 | { 29 | PYBIND11_OVERRIDE(void, G4MultiEventAction, SetEventManager, arg0); 30 | } 31 | }; 32 | 33 | void export_G4MultiEventAction(py::module &m) 34 | { 35 | py::class_(m, "G4MultiEventAction", 36 | py::multiple_inheritance()) 37 | 38 | .def(py::init<>()) 39 | .def("BeginOfEventAction", &G4MultiEventAction::BeginOfEventAction) 40 | .def("EndOfEventAction", &G4MultiEventAction::EndOfEventAction) 41 | .def("SetEventManager", &G4MultiEventAction::SetEventManager); 42 | } 43 | -------------------------------------------------------------------------------- /source/event/pyG4RayShooter.cc: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | 14 | #include "typecast.hh" 15 | #include "opaques.hh" 16 | 17 | namespace py = pybind11; 18 | 19 | void export_G4RayShooter(py::module &m) 20 | { 21 | py::class_(m, "G4RayShooter") 22 | 23 | .def("__copy__", [](const G4RayShooter &self) { return new G4RayShooter(self); }) 24 | .def("__deepcopy__", [](const G4RayShooter &self, py::dict) { return new G4RayShooter(self); }) 25 | .def(py::init<>()) 26 | .def("Shoot", &G4RayShooter::Shoot, py::arg("evt"), py::arg("vtx"), py::arg("direc")); 27 | } 28 | -------------------------------------------------------------------------------- /source/event/pyG4SmartTrackStack.cc: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #include 5 | #include 6 | #include 7 | 8 | #include "typecast.hh" 9 | #include "opaques.hh" 10 | 11 | namespace py = pybind11; 12 | 13 | void export_G4SmartTrackStack(py::module &m) 14 | { 15 | py::class_(m, "G4SmartTrackStack") 16 | 17 | .def("__copy__", [](const G4SmartTrackStack &self) { return new G4SmartTrackStack(self); }) 18 | .def("__deepcopy__", [](const G4SmartTrackStack &self, py::dict) { return new G4SmartTrackStack(self); }) 19 | .def(py::init<>()) 20 | .def("GetMaxNTrack", &G4SmartTrackStack::GetMaxNTrack) 21 | .def("GetNTrack", &G4SmartTrackStack::GetNTrack) 22 | .def("PopFromStack", &G4SmartTrackStack::PopFromStack) 23 | .def("PushToStack", &G4SmartTrackStack::PushToStack, py::arg("aStackedTrack")) 24 | .def("TransferTo", &G4SmartTrackStack::TransferTo, py::arg("aStack")) 25 | .def("clear", &G4SmartTrackStack::clear) 26 | .def("clearAndDestroy", &G4SmartTrackStack::clearAndDestroy) 27 | .def("dumpStatistics", &G4SmartTrackStack::dumpStatistics); 28 | //.def("getEnergyOfStack", &G4SmartTrackStack::getEnergyOfStack, py::arg("aTrackStack")); 29 | } 30 | -------------------------------------------------------------------------------- /source/event/pyG4StackedTrack.cc: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #include 5 | #include 6 | #include 7 | 8 | #include "typecast.hh" 9 | #include "opaques.hh" 10 | 11 | namespace py = pybind11; 12 | 13 | void export_G4StackedTrack(py::module &m) 14 | { 15 | py::class_(m, "G4StackedTrack") 16 | 17 | .def(py::init<>()) 18 | .def(py::init(), py::arg("aTrack"), 19 | py::arg("aTraj") = static_cast(nullptr)) 20 | 21 | .def("__copy__", [](const G4StackedTrack &self) { return new G4StackedTrack(self); }) 22 | .def("__deepcopy__", [](const G4StackedTrack &self, py::dict) { return new G4StackedTrack(self); }) 23 | .def("GetTrack", &G4StackedTrack::GetTrack, py::return_value_policy::reference) 24 | .def("GetTrajectory", &G4StackedTrack::GetTrajectory, py::return_value_policy::reference); 25 | } 26 | -------------------------------------------------------------------------------- /source/event/pyG4TrackStack.cc: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | #include 6 | #include 7 | #include 8 | #include 9 | 10 | #include "typecast.hh" 11 | #include "opaques.hh" 12 | 13 | namespace py = pybind11; 14 | 15 | void export_G4TrackStack(py::module &m) 16 | { 17 | py::bind_vector(m, "G4TrackStack") 18 | 19 | .def("__copy__", [](const G4TrackStack &self) { return new G4TrackStack(self); }) 20 | .def("__deepcopy__", [](const G4TrackStack &self, py::dict) { return new G4TrackStack(self); }) 21 | .def(py::init<>()) 22 | .def(py::init(), py::arg("n")) 23 | .def("GetMaxNTrack", &G4TrackStack::GetMaxNTrack) 24 | .def("GetNStick", &G4TrackStack::GetNStick) 25 | .def("GetNTrack", &G4TrackStack::GetNTrack) 26 | .def("GetSafetyValue1", &G4TrackStack::GetSafetyValue1) 27 | .def("GetSafetyValue2", &G4TrackStack::GetSafetyValue2) 28 | .def("PopFromStack", &G4TrackStack::PopFromStack) 29 | .def("PushToStack", &G4TrackStack::PushToStack, py::arg("aStackedTrack")) 30 | .def("SetSafetyValue2", &G4TrackStack::SetSafetyValue2, py::arg("x")) 31 | .def("TransferTo", py::overload_cast(&G4TrackStack::TransferTo), py::arg("aStack")) 32 | .def("TransferTo", py::overload_cast(&G4TrackStack::TransferTo), py::arg("aStack")) 33 | .def("clearAndDestroy", &G4TrackStack::clearAndDestroy) 34 | .def("getTotalEnergy", &G4TrackStack::getTotalEnergy); 35 | } 36 | -------------------------------------------------------------------------------- /source/event/pyG4TrajectoryContainer.cc: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | 6 | #include 7 | 8 | #include "typecast.hh" 9 | #include "opaques.hh" 10 | 11 | namespace py = pybind11; 12 | 13 | void export_G4TrajectoryContainer(py::module &m) 14 | { 15 | py::bind_vector(m, "TrajectoryVector"); 16 | 17 | py::class_(m, "G4TrajectoryContainer") 18 | 19 | .def(py::init<>()) 20 | .def(py::self == py::self) 21 | .def(py::self != py::self) 22 | .def("size", &G4TrajectoryContainer::size) 23 | .def( 24 | "push_back", [](G4TrajectoryContainer &self, py::disown_ptr p) { self.push_back(p); }, 25 | py::arg("p")) 26 | 27 | .def("entries", &G4TrajectoryContainer::entries) 28 | .def( 29 | "insert", [](G4TrajectoryContainer &self, py::disown_ptr p) { return self.insert(p); }, 30 | py::arg("p")) 31 | 32 | .def("clearAndDestroy", &G4TrajectoryContainer::clearAndDestroy) 33 | .def("__getitem__", &G4TrajectoryContainer::operator[], py::is_operator(), 34 | py::return_value_policy::reference_internal) 35 | 36 | .def("GetVector", &G4TrajectoryContainer::GetVector, py::return_value_policy::reference_internal); 37 | } 38 | -------------------------------------------------------------------------------- /source/event/pyG4VPrimaryGenerator.cc: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #include 5 | #include 6 | 7 | #include "typecast.hh" 8 | #include "opaques.hh" 9 | 10 | namespace py = pybind11; 11 | 12 | class PyG4VPrimaryGenerator : public G4VPrimaryGenerator, public py::trampoline_self_life_support { 13 | public: 14 | using G4VPrimaryGenerator::G4VPrimaryGenerator; 15 | 16 | void GeneratePrimaryVertex(G4Event *evt) override 17 | { 18 | PYBIND11_OVERRIDE_PURE(void, G4VPrimaryGenerator, GeneratePrimaryVertex, evt); 19 | } 20 | }; 21 | 22 | void export_G4VPrimaryGenerator(py::module &m) 23 | { 24 | py::class_(m, "G4VPrimaryGenerator") 25 | 26 | .def("__copy__", [](const PyG4VPrimaryGenerator &self) { return new PyG4VPrimaryGenerator(self); }) 27 | .def("__deepcopy__", [](const PyG4VPrimaryGenerator &self, py::dict) { return new PyG4VPrimaryGenerator(self); }) 28 | .def(py::init<>()) 29 | .def_static("CheckVertexInsideWorld", &G4VPrimaryGenerator::CheckVertexInsideWorld, py::arg("pos")) 30 | .def("GeneratePrimaryVertex", &G4VPrimaryGenerator::GeneratePrimaryVertex, py::arg("evt")) 31 | .def("GetParticlePosition", &G4VPrimaryGenerator::GetParticlePosition) 32 | .def("GetParticleTime", &G4VPrimaryGenerator::GetParticleTime) 33 | .def("SetParticlePosition", &G4VPrimaryGenerator::SetParticlePosition, py::arg("aPosition")) 34 | .def("SetParticleTime", &G4VPrimaryGenerator::SetParticleTime, py::arg("aTime")); 35 | } 36 | -------------------------------------------------------------------------------- /source/event/pyG4VUserEventInformation.cc: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #include 5 | 6 | #include "typecast.hh" 7 | #include "opaques.hh" 8 | 9 | namespace py = pybind11; 10 | 11 | class PyG4VUserEventInformation : public G4VUserEventInformation, public py::trampoline_self_life_support { 12 | public: 13 | using G4VUserEventInformation::G4VUserEventInformation; 14 | 15 | void Print() const override { PYBIND11_OVERRIDE_PURE(void, G4VUserEventInformation, Print, ); } 16 | }; 17 | 18 | void export_G4VUserEventInformation(py::module &m) 19 | { 20 | py::class_(m, "G4VUserEventInformation") 21 | 22 | .def(py::init<>()) 23 | .def("__copy__", [](const PyG4VUserEventInformation &self) { return new PyG4VUserEventInformation(self); }) 24 | .def("__deepcopy__", 25 | [](const PyG4VUserEventInformation &self, py::dict) { return new PyG4VUserEventInformation(self); }) 26 | 27 | .def("Print", &G4VUserEventInformation::Print); 28 | } 29 | -------------------------------------------------------------------------------- /source/geometry/biasing/pyG4GeometryCell.cc: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #include 5 | #include 6 | 7 | #include "typecast.hh" 8 | #include "opaques.hh" 9 | 10 | namespace py = pybind11; 11 | 12 | void export_G4GeometryCell(py::module &m) 13 | { 14 | py::class_(m, "G4GeometryCell") 15 | 16 | .def(py::init(), py::arg("aVolume"), py::arg("RepNum")) 17 | .def("__copy__", [](const G4GeometryCell &self) { return G4GeometryCell(self); }) 18 | .def("__deepcopy__", [](const G4GeometryCell &self, py::dict) { return G4GeometryCell(self); }) 19 | .def("GetPhysicalVolume", &G4GeometryCell::GetPhysicalVolume) 20 | .def("GetReplicaNumber", &G4GeometryCell::GetReplicaNumber); 21 | } 22 | -------------------------------------------------------------------------------- /source/geometry/biasing/pyG4GeometryCellComp.cc: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | #include 6 | #include 7 | 8 | #include "typecast.hh" 9 | #include "opaques.hh" 10 | 11 | namespace py = pybind11; 12 | 13 | void export_G4GeometryCellComp(py::module &m) 14 | { 15 | py::class_(m, "G4GeometryCellComp") 16 | 17 | .def(py::init<>()) 18 | .def("__copy__", [](const G4GeometryCellComp &self) { return G4GeometryCellComp(self); }) 19 | .def("__deepcopy__", [](const G4GeometryCellComp &self, py::dict) { return G4GeometryCellComp(self); }) 20 | .def("__call__", &G4GeometryCellComp::operator(), py::arg("g1"), py::arg("g2"), py::is_operator()); 21 | } 22 | -------------------------------------------------------------------------------- /source/geometry/biasing/pyG4GeometryCellStep.cc: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #include 5 | #include 6 | 7 | #include "typecast.hh" 8 | #include "opaques.hh" 9 | 10 | namespace py = pybind11; 11 | 12 | void export_G4GeometryCellStep(py::module &m) 13 | { 14 | py::class_(m, "G4GeometryCellStep") 15 | 16 | .def(py::init(), py::arg("preCell"), py::arg("postCell")) 17 | .def("__copy__", [](const G4GeometryCellStep &self) { return G4GeometryCellStep(self); }) 18 | .def("__deepcopy__", [](const G4GeometryCellStep &self, py::dict) { return G4GeometryCellStep(self); }) 19 | .def("GetPreGeometryCell", &G4GeometryCellStep::GetPreGeometryCell) 20 | .def("GetPostGeometryCell", &G4GeometryCellStep::GetPostGeometryCell) 21 | .def("GetCrossBoundary", &G4GeometryCellStep::GetCrossBoundary) 22 | .def("SetPreGeometryCell", &G4GeometryCellStep::SetPreGeometryCell, py::arg("preCell")) 23 | .def("SetPostGeometryCell", &G4GeometryCellStep::SetPostGeometryCell, py::arg("postCell")) 24 | .def("SetCrossBoundary", &G4GeometryCellStep::SetCrossBoundary, py::arg("b")); 25 | } 26 | -------------------------------------------------------------------------------- /source/geometry/biasing/pyG4ImportanceAlgorithm.cc: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #include 5 | 6 | #include "typecast.hh" 7 | #include "opaques.hh" 8 | 9 | namespace py = pybind11; 10 | 11 | class PyG4ImportanceAlgorithm : public G4ImportanceAlgorithm, public py::trampoline_self_life_support { 12 | public: 13 | using G4ImportanceAlgorithm::G4ImportanceAlgorithm; 14 | 15 | G4Nsplit_Weight Calculate(G4double ipre, G4double ipost, G4double init_w) const override 16 | { 17 | PYBIND11_OVERRIDE(G4Nsplit_Weight, G4ImportanceAlgorithm, Calculate, ipre, ipost, init_w); 18 | } 19 | }; 20 | 21 | void export_G4ImportanceAlgorithm(py::module &m) 22 | { 23 | py::class_(m, "G4ImportanceAlgorithm") 24 | 25 | .def(py::init<>()) 26 | .def("__copy__", [](const PyG4ImportanceAlgorithm &self) { return PyG4ImportanceAlgorithm(self); }) 27 | .def("__deepcopy__", [](const PyG4ImportanceAlgorithm &self, py::dict) { return PyG4ImportanceAlgorithm(self); }) 28 | .def("Calculate", &G4ImportanceAlgorithm::Calculate, py::arg("ipre"), py::arg("ipost"), py::arg("init_w")); 29 | } 30 | -------------------------------------------------------------------------------- /source/geometry/biasing/pyG4VGCellFinder.cc: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #include 5 | #include 6 | #include 7 | 8 | #include "typecast.hh" 9 | #include "opaques.hh" 10 | 11 | namespace py = pybind11; 12 | 13 | class PyG4VGCellFinder : public G4VGCellFinder, public py::trampoline_self_life_support { 14 | public: 15 | using G4VGCellFinder::G4VGCellFinder; 16 | 17 | G4GeometryCell GetPreGeometryCell(const G4Step &aStep) const override 18 | { 19 | PYBIND11_OVERRIDE_PURE(G4GeometryCell, G4VGCellFinder, GetPreGeometryCell, aStep); 20 | } 21 | 22 | G4GeometryCell GetPostGeometryCell(const G4Step &aStep) const override 23 | { 24 | PYBIND11_OVERRIDE_PURE(G4GeometryCell, G4VGCellFinder, GetPostGeometryCell, aStep); 25 | } 26 | }; 27 | 28 | void export_G4VGCellFinder(py::module &m) 29 | { 30 | py::class_(m, "G4VGCellFinder") 31 | 32 | .def(py::init<>()) 33 | .def("__copy__", [](const PyG4VGCellFinder &self) { return PyG4VGCellFinder(self); }) 34 | .def("__deepcopy__", [](const PyG4VGCellFinder &self, py::dict) { return PyG4VGCellFinder(self); }) 35 | .def("GetPreGeometryCell", &G4VGCellFinder::GetPreGeometryCell, py::arg("aStep")) 36 | .def("GetPostGeometryCell", &G4VGCellFinder::GetPostGeometryCell, py::arg("aStep")); 37 | } 38 | -------------------------------------------------------------------------------- /source/geometry/biasing/pyG4VIStore.cc: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #include 5 | #include 6 | #include 7 | 8 | #include "typecast.hh" 9 | #include "opaques.hh" 10 | 11 | namespace py = pybind11; 12 | 13 | class PyG4VIStore : public G4VIStore, public py::trampoline_self_life_support { 14 | public: 15 | using G4VIStore::G4VIStore; 16 | 17 | G4double GetImportance(const G4GeometryCell &gCell) const override 18 | { 19 | PYBIND11_OVERRIDE_PURE(G4double, G4VIStore, GetImportance, gCell); 20 | } 21 | 22 | G4bool IsKnown(const G4GeometryCell &gCell) const override 23 | { 24 | PYBIND11_OVERRIDE_PURE(G4bool, G4VIStore, IsKnown, gCell); 25 | } 26 | 27 | const G4VPhysicalVolume &GetWorldVolume() const override 28 | { 29 | PYBIND11_OVERRIDE_PURE(const G4VPhysicalVolume &, G4VIStore, GetWorldVolume, ); 30 | } 31 | }; 32 | 33 | void export_G4VIStore(py::module &m) 34 | { 35 | py::class_(m, "G4VIStore") 36 | 37 | .def(py::init<>()) 38 | .def("__copy__", [](const PyG4VIStore &self) { return PyG4VIStore(self); }) 39 | .def("__deepcopy__", [](const PyG4VIStore &self, py::dict) { return PyG4VIStore(self); }) 40 | .def("GetImportance", &G4VIStore::GetImportance, py::arg("gCell")) 41 | .def("IsKnown", &G4VIStore::IsKnown, py::arg("gCell")) 42 | .def("GetWorldVolume", &G4VIStore::GetWorldVolume); 43 | } 44 | -------------------------------------------------------------------------------- /source/geometry/biasing/pyG4VImportanceAlgorithm.cc: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #include 5 | 6 | #include "typecast.hh" 7 | #include "opaques.hh" 8 | 9 | namespace py = pybind11; 10 | 11 | class PyG4VImportanceAlgorithm : public G4VImportanceAlgorithm, public py::trampoline_self_life_support { 12 | public: 13 | using G4VImportanceAlgorithm::G4VImportanceAlgorithm; 14 | 15 | G4Nsplit_Weight Calculate(G4double ipre, G4double ipost, G4double init_w) const override 16 | { 17 | PYBIND11_OVERRIDE_PURE(G4Nsplit_Weight, G4VImportanceAlgorithm, Calculate, ipre, ipost, init_w); 18 | } 19 | }; 20 | 21 | void export_G4VImportanceAlgorithm(py::module &m) 22 | { 23 | py::class_(m, "G4VImportanceAlgorithm") 24 | 25 | .def(py::init<>()) 26 | .def("__copy__", [](const PyG4VImportanceAlgorithm &self) { return PyG4VImportanceAlgorithm(self); }) 27 | .def("__deepcopy__", 28 | [](const PyG4VImportanceAlgorithm &self, py::dict) { return PyG4VImportanceAlgorithm(self); }) 29 | 30 | .def("Calculate", &G4VImportanceAlgorithm::Calculate, py::arg("ipre"), py::arg("ipost"), py::arg("init_w")); 31 | } 32 | -------------------------------------------------------------------------------- /source/geometry/biasing/pyG4VImportanceSplitExaminer.cc: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #include 5 | 6 | #include "typecast.hh" 7 | #include "opaques.hh" 8 | 9 | namespace py = pybind11; 10 | 11 | class PyG4VImportanceSplitExaminer : public G4VImportanceSplitExaminer, public py::trampoline_self_life_support { 12 | public: 13 | using G4VImportanceSplitExaminer::G4VImportanceSplitExaminer; 14 | 15 | G4Nsplit_Weight Examine(G4double w) const override 16 | { 17 | PYBIND11_OVERRIDE_PURE(G4Nsplit_Weight, G4VImportanceSplitExaminer, Examine, w); 18 | } 19 | }; 20 | 21 | void export_G4VImportanceSplitExaminer(py::module &m) 22 | { 23 | py::class_(m, "G4VImportanceSplitExaminer") 24 | 25 | .def(py::init<>()) 26 | .def("__copy__", [](const PyG4VImportanceSplitExaminer &self) { return PyG4VImportanceSplitExaminer(self); }) 27 | .def("__deepcopy__", 28 | [](const PyG4VImportanceSplitExaminer &self, py::dict) { return PyG4VImportanceSplitExaminer(self); }) 29 | 30 | .def("Examine", &G4VImportanceSplitExaminer::Examine, py::arg("w")); 31 | } 32 | -------------------------------------------------------------------------------- /source/geometry/biasing/pyG4VWeightWindowAlgorithm.cc: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #include 5 | 6 | #include "typecast.hh" 7 | #include "opaques.hh" 8 | 9 | namespace py = pybind11; 10 | 11 | class PyG4VWeightWindowAlgorithm : public G4VWeightWindowAlgorithm, public py::trampoline_self_life_support { 12 | public: 13 | using G4VWeightWindowAlgorithm::G4VWeightWindowAlgorithm; 14 | 15 | G4Nsplit_Weight Calculate(G4double init_w, G4double lowerWeightBound) const override 16 | { 17 | PYBIND11_OVERRIDE_PURE(G4Nsplit_Weight, G4VWeightWindowAlgorithm, Calculate, init_w, lowerWeightBound); 18 | } 19 | }; 20 | 21 | void export_G4VWeightWindowAlgorithm(py::module &m) 22 | { 23 | py::class_(m, "G4VWeightWindowAlgorithm") 24 | 25 | .def(py::init<>()) 26 | .def("__copy__", [](const PyG4VWeightWindowAlgorithm &self) { return PyG4VWeightWindowAlgorithm(self); }) 27 | .def("__deepcopy__", 28 | [](const PyG4VWeightWindowAlgorithm &self, py::dict) { return PyG4VWeightWindowAlgorithm(self); }) 29 | 30 | .def("Calculate", &G4VWeightWindowAlgorithm::Calculate, py::arg("init_w"), py::arg("lowerWeightBound")); 31 | } 32 | -------------------------------------------------------------------------------- /source/geometry/biasing/pyG4WeightWindowAlgorithm.cc: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #include 5 | 6 | #include "typecast.hh" 7 | #include "opaques.hh" 8 | 9 | namespace py = pybind11; 10 | 11 | class PyG4WeightWindowAlgorithm : public G4WeightWindowAlgorithm, public py::trampoline_self_life_support { 12 | public: 13 | using G4WeightWindowAlgorithm::G4WeightWindowAlgorithm; 14 | 15 | G4Nsplit_Weight Calculate(G4double init_w, G4double lowerWeightBound) const override 16 | { 17 | PYBIND11_OVERRIDE(G4Nsplit_Weight, G4WeightWindowAlgorithm, Calculate, init_w, lowerWeightBound); 18 | } 19 | }; 20 | 21 | void export_G4WeightWindowAlgorithm(py::module &m) 22 | { 23 | py::class_(m, 24 | "G4WeightWindowAlgorithm") 25 | 26 | .def(py::init(), py::arg("upperLimitFactor") = 5, py::arg("survivalFactor") = 3, 27 | py::arg("maxNumberOfSplits") = 5) 28 | 29 | .def("__copy__", [](const PyG4WeightWindowAlgorithm &self) { return PyG4WeightWindowAlgorithm(self); }) 30 | .def("__deepcopy__", 31 | [](const PyG4WeightWindowAlgorithm &self, py::dict) { return PyG4WeightWindowAlgorithm(self); }) 32 | 33 | .def("Calculate", &G4WeightWindowAlgorithm::Calculate, py::arg("init_w"), py::arg("lowerWeightBound")); 34 | } 35 | -------------------------------------------------------------------------------- /source/geometry/magneticfield/pyG4CashKarpRKF45.cc: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #include 5 | 6 | #include "typecast.hh" 7 | #include "opaques.hh" 8 | 9 | namespace py = pybind11; 10 | 11 | class PyG4CashKarpRKF45 : public G4CashKarpRKF45, public py::trampoline_self_life_support { 12 | public: 13 | using G4CashKarpRKF45::G4CashKarpRKF45; 14 | 15 | void Stepper(const G4double *y, const G4double *dydx, G4double h, G4double *yout, G4double *yerr) override 16 | { 17 | PYBIND11_OVERRIDE(void, G4CashKarpRKF45, Stepper, y, dydx, h, yout, yerr); 18 | } 19 | 20 | G4double DistChord() const override { PYBIND11_OVERRIDE(G4double, G4CashKarpRKF45, DistChord, ); } 21 | 22 | G4int IntegratorOrder() const override { PYBIND11_OVERRIDE(G4int, G4CashKarpRKF45, IntegratorOrder, ); } 23 | }; 24 | 25 | void export_G4CashKarpRKF45(py::module &m) 26 | { 27 | py::class_(m, "G4CashKarpRKF45") 28 | 29 | .def(py::init(), py::arg("EqRhs"), py::arg("numberOfVariables") = 6, 30 | py::arg("primary") = true) 31 | 32 | .def("Stepper", &G4CashKarpRKF45::Stepper, py::arg("y"), py::arg("dydx"), py::arg("h"), py::arg("yout"), 33 | py::arg("yerr")) 34 | 35 | .def("DistChord", &G4CashKarpRKF45::DistChord) 36 | .def("IntegratorOrder", &G4CashKarpRKF45::IntegratorOrder); 37 | } 38 | -------------------------------------------------------------------------------- /source/geometry/magneticfield/pyG4ClassicalRK4.cc: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #include 5 | #include 6 | 7 | #include "typecast.hh" 8 | #include "opaques.hh" 9 | 10 | namespace py = pybind11; 11 | 12 | class PyG4ClassicalRK4 : public G4ClassicalRK4, public py::trampoline_self_life_support { 13 | public: 14 | using G4ClassicalRK4::G4ClassicalRK4; 15 | 16 | void DumbStepper(const G4double *yIn, const G4double *dydx, G4double h, G4double *yOut) override 17 | { 18 | PYBIND11_OVERRIDE(void, G4ClassicalRK4, DumbStepper, yIn, dydx, h, yOut); 19 | } 20 | 21 | G4int IntegratorOrder() const override { PYBIND11_OVERRIDE(G4int, G4ClassicalRK4, IntegratorOrder, ); } 22 | 23 | void Stepper(const G4double *y, const G4double *dydx, G4double h, G4double *yout, G4double *yerr) override 24 | { 25 | PYBIND11_OVERRIDE(void, G4ClassicalRK4, Stepper, y, dydx, h, yout, yerr); 26 | } 27 | 28 | G4double DistChord() const override { PYBIND11_OVERRIDE(G4double, G4ClassicalRK4, DistChord, ); } 29 | }; 30 | 31 | void export_G4ClassicalRK4(py::module &m) 32 | { 33 | py::class_(m, "G4ClassicalRK4") 34 | 35 | .def(py::init(), py::arg("EquationMotion"), py::arg("numberOfVariables") = 6) 36 | .def("DumbStepper", &G4ClassicalRK4::DumbStepper, py::arg("yIn"), py::arg("dydx"), py::arg("h"), py::arg("yOut")) 37 | .def("IntegratorOrder", &G4ClassicalRK4::IntegratorOrder); 38 | } 39 | -------------------------------------------------------------------------------- /source/geometry/magneticfield/pyG4DormandPrinceRK78.cc: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #include 5 | 6 | #include "typecast.hh" 7 | #include "opaques.hh" 8 | 9 | namespace py = pybind11; 10 | 11 | class PyG4DormandPrinceRK78 : public G4DormandPrinceRK78, public py::trampoline_self_life_support { 12 | public: 13 | using G4DormandPrinceRK78::G4DormandPrinceRK78; 14 | 15 | void Stepper(const G4double *y, const G4double *dydx, G4double h, G4double *yout, G4double *yerr) override 16 | { 17 | PYBIND11_OVERRIDE(void, G4DormandPrinceRK78, Stepper, y, dydx, h, yout, yerr); 18 | } 19 | 20 | G4double DistChord() const override { PYBIND11_OVERRIDE(G4double, G4DormandPrinceRK78, DistChord, ); } 21 | 22 | G4int IntegratorOrder() const override { PYBIND11_OVERRIDE(G4int, G4DormandPrinceRK78, IntegratorOrder, ); } 23 | }; 24 | 25 | void export_G4DormandPrinceRK78(py::module &m) 26 | { 27 | py::class_(m, "G4DormandPrinceRK78") 28 | 29 | .def(py::init(), py::arg("EqRhs"), py::arg("numberOfVariables") = 6, 30 | py::arg("primary") = true) 31 | 32 | .def("Stepper", &G4DormandPrinceRK78::Stepper, py::arg("y"), py::arg("dydx"), py::arg("h"), py::arg("yout"), 33 | py::arg("yerr")) 34 | 35 | .def("DistChord", &G4DormandPrinceRK78::DistChord) 36 | .def("IntegratorOrder", &G4DormandPrinceRK78::IntegratorOrder); 37 | } 38 | -------------------------------------------------------------------------------- /source/geometry/magneticfield/pyG4DriverReporter.cc: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #include 5 | 6 | #include "typecast.hh" 7 | #include "opaques.hh" 8 | 9 | namespace py = pybind11; 10 | 11 | void export_G4DriverReporter(py::module &m) 12 | { 13 | py::class_(m, "G4DriverReporter") 14 | 15 | .def(py::init<>()) 16 | .def("__copy__", [](const G4DriverReporter &self) { return G4DriverReporter(self); }) 17 | .def("__deepcopy__", [](const G4DriverReporter &self, py::dict) { return G4DriverReporter(self); }) 18 | 19 | .def_static("PrintStatus", 20 | py::overload_cast(&G4DriverReporter::PrintStatus), 22 | py::arg("StartArr"), py::arg("xstart"), py::arg("CurrentArr"), py::arg("xcurrent"), 23 | py::arg("requestStep"), py::arg("subStepNo"), py::arg("noIntegrationVariables")) 24 | 25 | .def_static("PrintStatus", 26 | py::overload_cast( 27 | &G4DriverReporter::PrintStatus), 28 | py::arg("StartFT"), py::arg("CurrentFT"), py::arg("requestStep"), py::arg("subStepNo")) 29 | 30 | .def_static("PrintStat_Aux", &G4DriverReporter::PrintStat_Aux, py::arg("aFieldTrack"), py::arg("requestStep"), 31 | py::arg("actualStep"), py::arg("subStepNo"), py::arg("subStepSize"), py::arg("dotVelocities")); 32 | } 33 | -------------------------------------------------------------------------------- /source/geometry/magneticfield/pyG4EqGravityField.cc: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #include 5 | 6 | #include "typecast.hh" 7 | #include "opaques.hh" 8 | 9 | namespace py = pybind11; 10 | 11 | class PyG4EqGravityField : public G4EqGravityField, public py::trampoline_self_life_support { 12 | public: 13 | using G4EqGravityField::G4EqGravityField; 14 | 15 | void SetChargeMomentumMass(G4ChargeState particleCharge, G4double MomentumXc, G4double mass) override 16 | { 17 | PYBIND11_OVERRIDE(void, G4EqGravityField, SetChargeMomentumMass, particleCharge, MomentumXc, mass); 18 | } 19 | 20 | void EvaluateRhsGivenB(const G4double *y, const G4double *Field, G4double *dydx) const override 21 | { 22 | PYBIND11_OVERRIDE(void, G4EqGravityField, EvaluateRhsGivenB, y, Field, dydx); 23 | } 24 | }; 25 | 26 | void export_G4EqGravityField(py::module &m) 27 | { 28 | py::class_(m, "G4EqGravityField") 29 | 30 | .def(py::init(), py::arg("gField")) 31 | .def("__copy__", [](const PyG4EqGravityField &self) { return PyG4EqGravityField(self); }) 32 | .def("__deepcopy__", [](const PyG4EqGravityField &self, py::dict) { return PyG4EqGravityField(self); }) 33 | .def("SetChargeMomentumMass", &G4EqGravityField::SetChargeMomentumMass, py::arg("particleCharge"), 34 | py::arg("MomentumXc"), py::arg("mass")) 35 | 36 | .def("EvaluateRhsGivenB", &G4EqGravityField::EvaluateRhsGivenB, py::arg("y"), py::arg("Field"), py::arg("dydx")); 37 | } 38 | -------------------------------------------------------------------------------- /source/geometry/magneticfield/pyG4ErrorMag_UsualEqRhs.cc: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #include 5 | 6 | #include "typecast.hh" 7 | #include "opaques.hh" 8 | 9 | namespace py = pybind11; 10 | 11 | class PyG4ErrorMag_UsualEqRhs : public G4ErrorMag_UsualEqRhs, public py::trampoline_self_life_support { 12 | public: 13 | using G4ErrorMag_UsualEqRhs::G4ErrorMag_UsualEqRhs; 14 | 15 | void EvaluateRhsGivenB(const G4double *y, const G4double *B, G4double *dydx) const override 16 | { 17 | PYBIND11_OVERRIDE(void, G4ErrorMag_UsualEqRhs, EvaluateRhsGivenB, y, B, dydx); 18 | } 19 | 20 | void SetChargeMomentumMass(G4ChargeState particleCharge, G4double MomentumXc, G4double mass) override 21 | { 22 | PYBIND11_OVERRIDE(void, G4ErrorMag_UsualEqRhs, SetChargeMomentumMass, particleCharge, MomentumXc, mass); 23 | } 24 | }; 25 | 26 | void export_G4ErrorMag_UsualEqRhs(py::module &m) 27 | { 28 | py::class_(m, "G4ErrorMag_UsualEqRhs") 29 | 30 | .def(py::init(), py::arg("MagField")) 31 | .def("__copy__", [](const PyG4ErrorMag_UsualEqRhs &self) { return PyG4ErrorMag_UsualEqRhs(self); }) 32 | .def("__deepcopy__", [](const PyG4ErrorMag_UsualEqRhs &self, py::dict) { return PyG4ErrorMag_UsualEqRhs(self); }) 33 | .def("EvaluateRhsGivenB", &G4ErrorMag_UsualEqRhs::EvaluateRhsGivenB, py::arg("y"), py::arg("B"), py::arg("dydx")); 34 | } 35 | -------------------------------------------------------------------------------- /source/geometry/magneticfield/pyG4ExplicitEuler.cc: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #include 5 | #include 6 | 7 | #include "typecast.hh" 8 | #include "opaques.hh" 9 | 10 | namespace py = pybind11; 11 | 12 | class PyG4ExplicitEuler : public G4ExplicitEuler, public py::trampoline_self_life_support { 13 | public: 14 | using G4ExplicitEuler::G4ExplicitEuler; 15 | 16 | void DumbStepper(const G4double *y, const G4double *dydx, G4double h, G4double *yout) override 17 | { 18 | PYBIND11_OVERRIDE(void, G4ExplicitEuler, DumbStepper, y, dydx, h, yout); 19 | } 20 | 21 | G4int IntegratorOrder() const override { PYBIND11_OVERRIDE(G4int, G4ExplicitEuler, IntegratorOrder, ); } 22 | 23 | void Stepper(const G4double *y, const G4double *dydx, G4double h, G4double *yout, G4double *yerr) override 24 | { 25 | PYBIND11_OVERRIDE(void, G4ExplicitEuler, Stepper, y, dydx, h, yout, yerr); 26 | } 27 | 28 | G4double DistChord() const override { PYBIND11_OVERRIDE(G4double, G4ExplicitEuler, DistChord, ); } 29 | }; 30 | 31 | void export_G4ExplicitEuler(py::module &m) 32 | { 33 | py::class_(m, "G4ExplicitEuler") 34 | 35 | .def(py::init(), py::arg("EqRhs"), py::arg("numberOfVariables") = 6) 36 | .def("DumbStepper", &G4ExplicitEuler::DumbStepper, py::arg("y"), py::arg("dydx"), py::arg("h"), py::arg("yout")) 37 | .def("IntegratorOrder", &G4ExplicitEuler::IntegratorOrder); 38 | } 39 | -------------------------------------------------------------------------------- /source/geometry/magneticfield/pyG4FieldManagerStore.cc: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | 10 | #include "typecast.hh" 11 | #include "opaques.hh" 12 | 13 | namespace py = pybind11; 14 | 15 | void export_G4FieldManagerStore(py::module &m) 16 | { 17 | py::class_(m, "G4FieldManagerStore") 18 | 19 | .def("__copy__", [](const G4FieldManagerStore &self) { return G4FieldManagerStore(self); }) 20 | .def("__deepcopy__", [](const G4FieldManagerStore &self, py::dict) { return G4FieldManagerStore(self); }) 21 | .def_static("Register", &G4FieldManagerStore::Register, py::arg("pVolume")) 22 | .def_static("DeRegister", &G4FieldManagerStore::DeRegister, py::arg("pVolume")) 23 | .def_static("GetInstance", &G4FieldManagerStore::GetInstance, py::return_value_policy::reference) 24 | .def_static("GetInstanceIfExist", &G4FieldManagerStore::GetInstanceIfExist, py::return_value_policy::reference) 25 | .def_static("Clean", &G4FieldManagerStore::Clean) 26 | .def("ClearAllChordFindersState", &G4FieldManagerStore::ClearAllChordFindersState); 27 | } 28 | -------------------------------------------------------------------------------- /source/geometry/magneticfield/pyG4HelixHeum.cc: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #include 5 | #include 6 | 7 | #include "typecast.hh" 8 | #include "opaques.hh" 9 | 10 | namespace py = pybind11; 11 | 12 | class PyG4HelixHeum : public G4HelixHeum, public py::trampoline_self_life_support { 13 | public: 14 | using G4HelixHeum::G4HelixHeum; 15 | 16 | void DumbStepper(const G4double *y, G4ThreeVector Bfld, G4double h, G4double *yout) override 17 | { 18 | PYBIND11_OVERRIDE(void, G4HelixHeum, DumbStepper, y, Bfld, h, yout); 19 | } 20 | 21 | G4int IntegratorOrder() const override { PYBIND11_OVERRIDE(G4int, G4HelixHeum, IntegratorOrder, ); } 22 | 23 | void Stepper(const G4double *y, const G4double *dydx, G4double h, G4double *yout, G4double *yerr) override 24 | { 25 | PYBIND11_OVERRIDE(void, G4HelixHeum, Stepper, y, dydx, h, yout, yerr); 26 | } 27 | 28 | G4double DistChord() const override { PYBIND11_OVERRIDE(G4double, G4HelixHeum, DistChord, ); } 29 | }; 30 | 31 | void export_G4HelixHeum(py::module &m) 32 | { 33 | py::class_(m, "G4HelixHeum") 34 | 35 | .def(py::init(), py::arg("EqRhs")) 36 | .def("DumbStepper", &G4HelixHeum::DumbStepper, py::arg("y"), py::arg("Bfld"), py::arg("h"), py::arg("yout")) 37 | .def("IntegratorOrder", &G4HelixHeum::IntegratorOrder); 38 | } 39 | -------------------------------------------------------------------------------- /source/geometry/magneticfield/pyG4HelixImplicitEuler.cc: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #include 5 | #include 6 | 7 | #include "typecast.hh" 8 | #include "opaques.hh" 9 | 10 | namespace py = pybind11; 11 | 12 | class PyG4HelixImplicitEuler : public G4HelixImplicitEuler, public py::trampoline_self_life_support { 13 | public: 14 | using G4HelixImplicitEuler::G4HelixImplicitEuler; 15 | 16 | void DumbStepper(const G4double *y, G4ThreeVector Bfld, G4double h, G4double *yout) override 17 | { 18 | PYBIND11_OVERRIDE(void, G4HelixImplicitEuler, DumbStepper, y, Bfld, h, yout); 19 | } 20 | 21 | G4int IntegratorOrder() const override { PYBIND11_OVERRIDE(G4int, G4HelixImplicitEuler, IntegratorOrder, ); } 22 | 23 | void Stepper(const G4double *y, const G4double *dydx, G4double h, G4double *yout, G4double *yerr) override 24 | { 25 | PYBIND11_OVERRIDE(void, G4HelixImplicitEuler, Stepper, y, dydx, h, yout, yerr); 26 | } 27 | 28 | G4double DistChord() const override { PYBIND11_OVERRIDE(G4double, G4HelixImplicitEuler, DistChord, ); } 29 | }; 30 | 31 | void export_G4HelixImplicitEuler(py::module &m) 32 | { 33 | py::class_(m, "G4HelixImplicitEuler") 34 | 35 | .def(py::init(), py::arg("EqRhs")) 36 | .def("DumbStepper", &G4HelixImplicitEuler::DumbStepper, py::arg("y"), py::arg("Bfld"), py::arg("h"), 37 | py::arg("yout")) 38 | 39 | .def("IntegratorOrder", &G4HelixImplicitEuler::IntegratorOrder); 40 | } 41 | -------------------------------------------------------------------------------- /source/geometry/magneticfield/pyG4HelixSimpleRunge.cc: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #include 5 | #include 6 | 7 | #include "typecast.hh" 8 | #include "opaques.hh" 9 | 10 | namespace py = pybind11; 11 | 12 | class PyG4HelixSimpleRunge : public G4HelixSimpleRunge, public py::trampoline_self_life_support { 13 | public: 14 | using G4HelixSimpleRunge::G4HelixSimpleRunge; 15 | 16 | void DumbStepper(const G4double *y, G4ThreeVector Bfld, G4double h, G4double *yout) override 17 | { 18 | PYBIND11_OVERRIDE(void, G4HelixSimpleRunge, DumbStepper, y, Bfld, h, yout); 19 | } 20 | 21 | G4int IntegratorOrder() const override { PYBIND11_OVERRIDE(G4int, G4HelixSimpleRunge, IntegratorOrder, ); } 22 | 23 | void Stepper(const G4double *y, const G4double *dydx, G4double h, G4double *yout, G4double *yerr) override 24 | { 25 | PYBIND11_OVERRIDE(void, G4HelixSimpleRunge, Stepper, y, dydx, h, yout, yerr); 26 | } 27 | 28 | G4double DistChord() const override { PYBIND11_OVERRIDE(G4double, G4HelixSimpleRunge, DistChord, ); } 29 | }; 30 | 31 | void export_G4HelixSimpleRunge(py::module &m) 32 | { 33 | py::class_(m, "G4HelixSimpleRunge") 34 | 35 | .def(py::init(), py::arg("EqRhs")) 36 | .def("DumbStepper", &G4HelixSimpleRunge::DumbStepper, py::arg("y"), py::arg("Bfld"), py::arg("h"), 37 | py::arg("yout")) 38 | 39 | .def("IntegratorOrder", &G4HelixSimpleRunge::IntegratorOrder); 40 | } 41 | -------------------------------------------------------------------------------- /source/geometry/magneticfield/pyG4ImplicitEuler.cc: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #include 5 | #include 6 | 7 | #include "typecast.hh" 8 | #include "opaques.hh" 9 | 10 | namespace py = pybind11; 11 | 12 | class PyG4ImplicitEuler : public G4ImplicitEuler, public py::trampoline_self_life_support { 13 | public: 14 | using G4ImplicitEuler::G4ImplicitEuler; 15 | 16 | void DumbStepper(const G4double *y, const G4double *dydx, G4double h, G4double *yout) override 17 | { 18 | PYBIND11_OVERRIDE(void, G4ImplicitEuler, DumbStepper, y, dydx, h, yout); 19 | } 20 | 21 | G4int IntegratorOrder() const override { PYBIND11_OVERRIDE(G4int, G4ImplicitEuler, IntegratorOrder, ); } 22 | 23 | void Stepper(const G4double *y, const G4double *dydx, G4double h, G4double *yout, G4double *yerr) override 24 | { 25 | PYBIND11_OVERRIDE(void, G4ImplicitEuler, Stepper, y, dydx, h, yout, yerr); 26 | } 27 | 28 | G4double DistChord() const override { PYBIND11_OVERRIDE(G4double, G4ImplicitEuler, DistChord, ); } 29 | }; 30 | 31 | void export_G4ImplicitEuler(py::module &m) 32 | { 33 | py::class_(m, "G4ImplicitEuler") 34 | 35 | .def(py::init(), py::arg("EqRhs"), py::arg("numberOfVariables") = 6) 36 | .def("DumbStepper", &G4ImplicitEuler::DumbStepper, py::arg("y"), py::arg("dydx"), py::arg("h"), py::arg("yout")) 37 | .def("IntegratorOrder", &G4ImplicitEuler::IntegratorOrder); 38 | } 39 | -------------------------------------------------------------------------------- /source/geometry/magneticfield/pyG4LineSection.cc: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #include 5 | 6 | #include "typecast.hh" 7 | #include "opaques.hh" 8 | 9 | namespace py = pybind11; 10 | 11 | void export_G4LineSection(py::module &m) 12 | { 13 | py::class_(m, "G4LineSection") 14 | 15 | .def(py::init(), py::arg("PntA"), py::arg("PntB")) 16 | .def("__copy__", [](const G4LineSection &self) { return G4LineSection(self); }) 17 | .def("__deepcopy__", [](const G4LineSection &self, py::dict) { return G4LineSection(self); }) 18 | .def("Dist", &G4LineSection::Dist, py::arg("OtherPnt")) 19 | .def("GetABdistanceSq", &G4LineSection::GetABdistanceSq) 20 | .def_static("Distline", &G4LineSection::Distline, py::arg("OtherPnt"), py::arg("LinePntA"), py::arg("LinePntB")); 21 | } 22 | -------------------------------------------------------------------------------- /source/geometry/magneticfield/pyG4Mag_EqRhs.cc: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #include 5 | #include 6 | 7 | #include "typecast.hh" 8 | #include "opaques.hh" 9 | 10 | namespace py = pybind11; 11 | 12 | class PyG4Mag_EqRhs : public G4Mag_EqRhs, public py::trampoline_self_life_support { 13 | public: 14 | using G4Mag_EqRhs::G4Mag_EqRhs; 15 | 16 | void EvaluateRhsGivenB(const G4double *y, const G4double *B, G4double *dydx) const override 17 | { 18 | PYBIND11_OVERRIDE_PURE(void, G4Mag_EqRhs, EvaluateRhsGivenB, y, B, dydx); 19 | } 20 | 21 | void SetChargeMomentumMass(G4ChargeState particleCharge, G4double MomentumXc, G4double mass) override 22 | { 23 | PYBIND11_OVERRIDE(void, G4Mag_EqRhs, SetChargeMomentumMass, particleCharge, MomentumXc, mass); 24 | } 25 | }; 26 | 27 | void export_G4Mag_EqRhs(py::module &m) 28 | { 29 | py::class_(m, "G4Mag_EqRhs") 30 | 31 | .def(py::init(), py::arg("magField")) 32 | .def("__copy__", [](const PyG4Mag_EqRhs &self) { return PyG4Mag_EqRhs(self); }) 33 | .def("__deepcopy__", [](const PyG4Mag_EqRhs &self, py::dict) { return PyG4Mag_EqRhs(self); }) 34 | .def("EvaluateRhsGivenB", &G4Mag_EqRhs::EvaluateRhsGivenB, py::arg("y"), py::arg("B"), py::arg("dydx")) 35 | .def("FCof", &G4Mag_EqRhs::FCof) 36 | .def("SetChargeMomentumMass", &G4Mag_EqRhs::SetChargeMomentumMass, py::arg("particleCharge"), 37 | py::arg("MomentumXc"), py::arg("mass")); 38 | } 39 | -------------------------------------------------------------------------------- /source/geometry/magneticfield/pyG4Mag_UsualEqRhs.cc: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #include 5 | #include 6 | 7 | #include "typecast.hh" 8 | #include "opaques.hh" 9 | 10 | namespace py = pybind11; 11 | 12 | class PyG4Mag_UsualEqRhs : public G4Mag_UsualEqRhs, public py::trampoline_self_life_support { 13 | public: 14 | using G4Mag_UsualEqRhs::G4Mag_UsualEqRhs; 15 | 16 | void EvaluateRhsGivenB(const G4double *y, const G4double *B, G4double *dydx) const override 17 | { 18 | PYBIND11_OVERRIDE(void, G4Mag_UsualEqRhs, EvaluateRhsGivenB, y, B, dydx); 19 | } 20 | 21 | void SetChargeMomentumMass(G4ChargeState particleCharge, G4double MomentumXc, G4double mass) override 22 | { 23 | PYBIND11_OVERRIDE(void, G4Mag_UsualEqRhs, SetChargeMomentumMass, particleCharge, MomentumXc, mass); 24 | } 25 | }; 26 | 27 | void export_G4Mag_UsualEqRhs(py::module &m) 28 | { 29 | py::class_(m, "G4Mag_UsualEqRhs") 30 | 31 | .def(py::init(), py::arg("MagField")) 32 | .def("__copy__", [](const PyG4Mag_UsualEqRhs &self) { return PyG4Mag_UsualEqRhs(self); }) 33 | .def("__deepcopy__", [](const PyG4Mag_UsualEqRhs &self, py::dict) { return PyG4Mag_UsualEqRhs(self); }) 34 | .def("EvaluateRhsGivenB", &G4Mag_UsualEqRhs::EvaluateRhsGivenB, py::arg("y"), py::arg("B"), py::arg("dydx")) 35 | .def("SetChargeMomentumMass", &G4Mag_UsualEqRhs::SetChargeMomentumMass, py::arg("particleCharge"), 36 | py::arg("MomentumXc"), py::arg("mass")); 37 | } 38 | -------------------------------------------------------------------------------- /source/geometry/magneticfield/pyG4MonopoleEq.cc: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #include 5 | 6 | #include "typecast.hh" 7 | #include "opaques.hh" 8 | 9 | namespace py = pybind11; 10 | 11 | class PyG4MonopoleEq : public G4MonopoleEq, public py::trampoline_self_life_support { 12 | public: 13 | using G4MonopoleEq::G4MonopoleEq; 14 | 15 | void SetChargeMomentumMass(G4ChargeState particleCharge, G4double MomentumXc, G4double mass) override 16 | { 17 | PYBIND11_OVERRIDE(void, G4MonopoleEq, SetChargeMomentumMass, particleCharge, MomentumXc, mass); 18 | } 19 | 20 | void EvaluateRhsGivenB(const G4double *y, const G4double *Field, G4double *dydx) const override 21 | { 22 | PYBIND11_OVERRIDE(void, G4MonopoleEq, EvaluateRhsGivenB, y, Field, dydx); 23 | } 24 | }; 25 | 26 | void export_G4MonopoleEq(py::module &m) 27 | { 28 | py::class_(m, "G4MonopoleEq") 29 | 30 | .def(py::init(), py::arg("emField")) 31 | .def("__copy__", [](const PyG4MonopoleEq &self) { return PyG4MonopoleEq(self); }) 32 | .def("__deepcopy__", [](const PyG4MonopoleEq &self, py::dict) { return PyG4MonopoleEq(self); }) 33 | .def("SetChargeMomentumMass", &G4MonopoleEq::SetChargeMomentumMass, py::arg("particleCharge"), 34 | py::arg("MomentumXc"), py::arg("mass")) 35 | 36 | .def("EvaluateRhsGivenB", &G4MonopoleEq::EvaluateRhsGivenB, py::arg("y"), py::arg("Field"), py::arg("dydx")); 37 | } 38 | -------------------------------------------------------------------------------- /source/geometry/magneticfield/pyG4NystromRK4.cc: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #include 5 | 6 | #include "typecast.hh" 7 | #include "opaques.hh" 8 | 9 | namespace py = pybind11; 10 | 11 | class PyG4NystromRK4 : public G4NystromRK4, public py::trampoline_self_life_support { 12 | public: 13 | using G4NystromRK4::G4NystromRK4; 14 | 15 | void Stepper(const G4double *y, const G4double *dydx, G4double hstep, G4double *yOut, G4double *yError) override 16 | { 17 | PYBIND11_OVERRIDE(void, G4NystromRK4, Stepper, y, dydx, hstep, yOut, yError); 18 | } 19 | 20 | G4int IntegratorOrder() const override { PYBIND11_OVERRIDE(G4int, G4NystromRK4, IntegratorOrder, ); } 21 | 22 | G4double DistChord() const override { PYBIND11_OVERRIDE(G4double, G4NystromRK4, DistChord, ); } 23 | }; 24 | 25 | void export_G4NystromRK4(py::module &m) 26 | { 27 | py::class_(m, "G4NystromRK4") 28 | 29 | .def(py::init(), py::arg("EquationMotion"), py::arg("distanceConstField") = 0.) 30 | .def("Stepper", &G4NystromRK4::Stepper, py::arg("y"), py::arg("dydx"), py::arg("hstep"), py::arg("yOut"), 31 | py::arg("yError")) 32 | 33 | .def("SetDistanceForConstantField", &G4NystromRK4::SetDistanceForConstantField, py::arg("length")) 34 | .def("GetDistanceForConstantField", &G4NystromRK4::GetDistanceForConstantField) 35 | .def("IntegratorOrder", &G4NystromRK4::IntegratorOrder) 36 | .def("DistChord", &G4NystromRK4::DistChord); 37 | } 38 | -------------------------------------------------------------------------------- /source/geometry/magneticfield/pyG4SimpleHeum.cc: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #include 5 | #include 6 | 7 | #include "typecast.hh" 8 | #include "opaques.hh" 9 | 10 | namespace py = pybind11; 11 | 12 | class PyG4SimpleHeum : public G4SimpleHeum, public py::trampoline_self_life_support { 13 | public: 14 | using G4SimpleHeum::G4SimpleHeum; 15 | 16 | void DumbStepper(const G4double *y, const G4double *dydx, G4double h, G4double *yout) override 17 | { 18 | PYBIND11_OVERRIDE(void, G4SimpleHeum, DumbStepper, y, dydx, h, yout); 19 | } 20 | 21 | G4int IntegratorOrder() const override { PYBIND11_OVERRIDE(G4int, G4SimpleHeum, IntegratorOrder, ); } 22 | 23 | void Stepper(const G4double *y, const G4double *dydx, G4double h, G4double *yout, G4double *yerr) override 24 | { 25 | PYBIND11_OVERRIDE(void, G4SimpleHeum, Stepper, y, dydx, h, yout, yerr); 26 | } 27 | 28 | G4double DistChord() const override { PYBIND11_OVERRIDE(G4double, G4SimpleHeum, DistChord, ); } 29 | }; 30 | 31 | void export_G4SimpleHeum(py::module &m) 32 | { 33 | py::class_(m, "G4SimpleHeum") 34 | 35 | .def(py::init(), py::arg("EqRhs"), py::arg("num_variables") = 6) 36 | .def("DumbStepper", &G4SimpleHeum::DumbStepper, py::arg("y"), py::arg("dydx"), py::arg("h"), py::arg("yout")) 37 | .def("IntegratorOrder", &G4SimpleHeum::IntegratorOrder); 38 | } 39 | -------------------------------------------------------------------------------- /source/geometry/magneticfield/pyG4SimpleRunge.cc: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #include 5 | #include 6 | 7 | #include "typecast.hh" 8 | #include "opaques.hh" 9 | 10 | namespace py = pybind11; 11 | 12 | class PyG4SimpleRunge : public G4SimpleRunge, public py::trampoline_self_life_support { 13 | public: 14 | using G4SimpleRunge::G4SimpleRunge; 15 | 16 | void DumbStepper(const G4double *y, const G4double *dydx, G4double h, G4double *yout) override 17 | { 18 | PYBIND11_OVERRIDE(void, G4SimpleRunge, DumbStepper, y, dydx, h, yout); 19 | } 20 | 21 | G4int IntegratorOrder() const override { PYBIND11_OVERRIDE(G4int, G4SimpleRunge, IntegratorOrder, ); } 22 | 23 | void Stepper(const G4double *y, const G4double *dydx, G4double h, G4double *yout, G4double *yerr) override 24 | { 25 | PYBIND11_OVERRIDE(void, G4SimpleRunge, Stepper, y, dydx, h, yout, yerr); 26 | } 27 | 28 | G4double DistChord() const override { PYBIND11_OVERRIDE(G4double, G4SimpleRunge, DistChord, ); } 29 | }; 30 | 31 | void export_G4SimpleRunge(py::module &m) 32 | { 33 | py::class_(m, "G4SimpleRunge") 34 | 35 | .def(py::init(), py::arg("EquationRhs"), py::arg("numberOfVariables") = 6) 36 | .def("DumbStepper", &G4SimpleRunge::DumbStepper, py::arg("y"), py::arg("dydx"), py::arg("h"), py::arg("yout")) 37 | .def("IntegratorOrder", &G4SimpleRunge::IntegratorOrder); 38 | } 39 | -------------------------------------------------------------------------------- /source/geometry/magneticfield/pyG4TrialsCounter.cc: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #include 5 | 6 | #include "typecast.hh" 7 | #include "opaques.hh" 8 | 9 | namespace py = pybind11; 10 | 11 | void export_G4TrialsCounter(py::module &m) 12 | { 13 | py::class_(m, "G4TrialsCounter") 14 | 15 | .def(py::init(), py::arg("nameStats"), py::arg("description"), 16 | py::arg("printOnExit") = false) 17 | 18 | .def("__copy__", [](const G4TrialsCounter &self) { return G4TrialsCounter(self); }) 19 | .def("__deepcopy__", [](const G4TrialsCounter &self, py::dict) { return G4TrialsCounter(self); }) 20 | .def("AccumulateCounts", &G4TrialsCounter::AccumulateCounts, py::arg("noTrials")) 21 | .def("ClearCounts", &G4TrialsCounter::ClearCounts) 22 | .def("ReturnTotals", &G4TrialsCounter::ReturnTotals, py::arg("calls"), py::arg("maxTrials"), py::arg("numMaxT")) 23 | .def("PrintStatistics", &G4TrialsCounter::PrintStatistics); 24 | } 25 | -------------------------------------------------------------------------------- /source/geometry/management/pyG4BlockingList.cc: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #include 5 | 6 | #include "typecast.hh" 7 | #include "opaques.hh" 8 | 9 | namespace py = pybind11; 10 | 11 | void export_G4BlockingList(py::module &m) 12 | { 13 | py::class_(m, "G4BlockingList") 14 | 15 | .def(py::init(), py::arg("maxDefault") = kBlockingListMaxDefault, 16 | py::arg("stride") = kBlockingListStride) 17 | 18 | .def("__copy__", [](const G4BlockingList &self) { return G4BlockingList(self); }) 19 | .def("__deepcopy__", [](const G4BlockingList &self, py::dict) { return G4BlockingList(self); }) 20 | .def("Reset", &G4BlockingList::Reset) 21 | .def("FullyReset", &G4BlockingList::FullyReset) 22 | .def("Enlarge", &G4BlockingList::Enlarge, py::arg("nv")) 23 | .def("Length", &G4BlockingList::Length) 24 | .def("BlockVolume", &G4BlockingList::BlockVolume, py::arg("v")) 25 | .def("IsBlocked", &G4BlockingList::IsBlocked, py::arg("v")); 26 | } 27 | -------------------------------------------------------------------------------- /source/geometry/management/pyG4GeometryManager.cc: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | 9 | #include 10 | 11 | #include "typecast.hh" 12 | #include "opaques.hh" 13 | 14 | namespace py = pybind11; 15 | 16 | void export_G4GeometryManager(py::module &m) 17 | { 18 | py::class_(m, "G4GeometryManager") 19 | 20 | .def("__copy__", [](const G4GeometryManager &self) { return G4GeometryManager(self); }) 21 | .def("__deepcopy__", [](const G4GeometryManager &self, py::dict) { return G4GeometryManager(self); }) 22 | .def("CloseGeometry", &G4GeometryManager::CloseGeometry, py::arg("pOptimise") = true, py::arg("verbose") = false, 23 | py::arg("vol") = static_cast(nullptr)) 24 | 25 | .def("OpenGeometry", &G4GeometryManager::OpenGeometry, py::arg("vol") = static_cast(nullptr)) 26 | #if G4VERSION_NUMBER >= 1130 27 | .def("IsGeometryClosed", &G4GeometryManager::IsGeometryClosed) 28 | #else 29 | .def_static("IsGeometryClosed", &G4GeometryManager::IsGeometryClosed) 30 | #endif 31 | .def("SetWorldMaximumExtent", &G4GeometryManager::SetWorldMaximumExtent, py::arg("worldExtent")) 32 | .def_static("GetInstance", &G4GeometryManager::GetInstance, py::return_value_policy::reference) 33 | .def_static("GetInstanceIfExist", &G4GeometryManager::GetInstanceIfExist, py::return_value_policy::reference); 34 | } 35 | -------------------------------------------------------------------------------- /source/geometry/management/pyG4IdentityTrajectoryFilter.cc: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #include 5 | 6 | #include "typecast.hh" 7 | #include "opaques.hh" 8 | 9 | namespace py = pybind11; 10 | 11 | class PyG4IdentityTrajectoryFilter : public G4IdentityTrajectoryFilter, public py::trampoline_self_life_support { 12 | public: 13 | using G4IdentityTrajectoryFilter::G4IdentityTrajectoryFilter; 14 | 15 | void TakeIntermediatePoint(G4ThreeVector newPoint) override 16 | { 17 | PYBIND11_OVERRIDE(void, G4IdentityTrajectoryFilter, TakeIntermediatePoint, newPoint); 18 | } 19 | }; 20 | 21 | void export_G4IdentityTrajectoryFilter(py::module &m) 22 | { 23 | py::class_( 24 | m, "G4IdentityTrajectoryFilter") 25 | 26 | .def(py::init<>()) 27 | .def("TakeIntermediatePoint", &G4IdentityTrajectoryFilter::TakeIntermediatePoint, py::arg("newPoint")); 28 | } 29 | -------------------------------------------------------------------------------- /source/geometry/management/pyG4LogicalSurface.cc: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | #include 6 | #include 7 | 8 | #include "typecast.hh" 9 | #include "opaques.hh" 10 | 11 | namespace py = pybind11; 12 | 13 | void export_G4LogicalSurface(py::module &m) 14 | { 15 | py::class_(m, "G4LogicalSurface") 16 | 17 | .def("GetSurfaceProperty", &G4LogicalSurface::GetSurfaceProperty, py::return_value_policy::reference) 18 | .def("SetSurfaceProperty", &G4LogicalSurface::SetSurfaceProperty, py::arg("ptrSurfaceProperty")) 19 | .def("GetName", &G4LogicalSurface::GetName) 20 | .def("SetName", &G4LogicalSurface::SetName, py::arg("name")) 21 | //.def("GetTransitionRadiationSurface", &G4LogicalSurface::GetTransitionRadiationSurface, 22 | // py::return_value_policy::reference) 23 | 24 | //.def("SetTransitionRadiationSurface", &G4LogicalSurface::SetTransitionRadiationSurface, py::arg("trs")) 25 | .def(py::self == py::self) 26 | .def(py::self != py::self); 27 | } 28 | -------------------------------------------------------------------------------- /source/geometry/management/pyG4PhysicalVolumeStore.cc: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | 10 | #include 11 | 12 | #include "typecast.hh" 13 | #include "opaques.hh" 14 | 15 | namespace py = pybind11; 16 | 17 | void export_G4PhysicalVolumeStore(py::module &m) 18 | { 19 | py::class_(m, "G4PhysicalVolumeStore") 20 | 21 | .def_static("Register", &G4PhysicalVolumeStore::Register, py::arg("pSolid")) 22 | .def_static("DeRegister", &G4PhysicalVolumeStore::DeRegister, py::arg("pSolid")) 23 | .def_static("GetInstance", &G4PhysicalVolumeStore::GetInstance, py::return_value_policy::reference) 24 | .def_static("SetNotifier", &G4PhysicalVolumeStore::SetNotifier, py::arg("pNotifier")) 25 | .def_static("Clean", &G4PhysicalVolumeStore::Clean) 26 | #if G4VERSION_NUMBER >= 1102 27 | .def("GetVolume", &G4PhysicalVolumeStore::GetVolume, py::arg("name"), py::arg("verbose") = true, 28 | py::arg("reverseSearch") = false, py::return_value_policy::reference); 29 | #else 30 | .def("GetVolume", &G4PhysicalVolumeStore::GetVolume, py::arg("name"), py::arg("verbose") = true, 31 | py::return_value_policy::reference); 32 | #endif 33 | } 34 | -------------------------------------------------------------------------------- /source/geometry/management/pyG4RegionStore.cc: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #include 5 | #include 6 | #include 7 | 8 | #include "typecast.hh" 9 | #include "opaques.hh" 10 | 11 | namespace py = pybind11; 12 | 13 | void export_G4RegionStore(py::module &m) 14 | { 15 | py::class_(m, "G4RegionStore") 16 | 17 | .def_static("Register", &G4RegionStore::Register, py::arg("pRegion")) 18 | .def_static("DeRegister", &G4RegionStore::DeRegister, py::arg("pRegion")) 19 | .def_static("GetInstance", &G4RegionStore::GetInstance, py::return_value_policy::reference) 20 | .def_static("SetNotifier", &G4RegionStore::SetNotifier, py::arg("pNotifier")) 21 | .def_static("Clean", &G4RegionStore::Clean) 22 | .def("IsModified", &G4RegionStore::IsModified) 23 | .def("ResetRegionModified", &G4RegionStore::ResetRegionModified) 24 | .def("UpdateMaterialList", &G4RegionStore::UpdateMaterialList, 25 | py::arg("currentWorld") = static_cast(nullptr)) 26 | 27 | .def("GetRegion", &G4RegionStore::GetRegion, py::arg("name"), py::arg("verbose") = true, 28 | py::return_value_policy::reference) 29 | 30 | .def("FindOrCreateRegion", &G4RegionStore::FindOrCreateRegion, py::arg("name"), 31 | py::return_value_policy::reference) 32 | 33 | .def("SetWorldVolume", &G4RegionStore::SetWorldVolume); 34 | } 35 | -------------------------------------------------------------------------------- /source/geometry/management/pyG4SmartVoxelNode.cc: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | #include 6 | 7 | #include "typecast.hh" 8 | #include "opaques.hh" 9 | 10 | namespace py = pybind11; 11 | 12 | void export_G4SmartVoxelNode(py::module &m) 13 | { 14 | py::class_(m, "G4SmartVoxelNode") 15 | 16 | .def(py::init(), py::arg("pSlice") = 0) 17 | .def("__copy__", [](const G4SmartVoxelNode &self) { return G4SmartVoxelNode(self); }) 18 | .def("__deepcopy__", [](const G4SmartVoxelNode &self, py::dict) { return G4SmartVoxelNode(self); }) 19 | .def("GetVolume", &G4SmartVoxelNode::GetVolume, py::arg("pVolumeNo")) 20 | .def("Insert", &G4SmartVoxelNode::Insert, py::arg("pVolumeNo")) 21 | .def("GetNoContained", &G4SmartVoxelNode::GetNoContained) 22 | .def("GetCapacity", &G4SmartVoxelNode::GetCapacity) 23 | .def("Reserve", &G4SmartVoxelNode::Reserve, py::arg("noSlices")) 24 | .def("Shrink", &G4SmartVoxelNode::Shrink) 25 | .def("GetMaxEquivalentSliceNo", &G4SmartVoxelNode::GetMaxEquivalentSliceNo) 26 | .def("SetMaxEquivalentSliceNo", &G4SmartVoxelNode::SetMaxEquivalentSliceNo, py::arg("pMax")) 27 | .def("GetMinEquivalentSliceNo", &G4SmartVoxelNode::GetMinEquivalentSliceNo) 28 | .def("SetMinEquivalentSliceNo", &G4SmartVoxelNode::SetMinEquivalentSliceNo, py::arg("pMin")) 29 | .def(py::self == py::self); 30 | } 31 | -------------------------------------------------------------------------------- /source/geometry/management/pyG4SmartVoxelProxy.cc: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | #include 6 | #include 7 | #include 8 | 9 | #include "typecast.hh" 10 | #include "opaques.hh" 11 | 12 | namespace py = pybind11; 13 | 14 | void export_G4SmartVoxelProxy(py::module &m) 15 | { 16 | py::class_(m, "G4SmartVoxelProxy") 17 | 18 | .def(py::init(), py::arg("pHeader")) 19 | .def(py::init(), py::arg("pNode")) 20 | .def("__copy__", [](const G4SmartVoxelProxy &self) { return G4SmartVoxelProxy(self); }) 21 | .def("__deepcopy__", [](const G4SmartVoxelProxy &self, py::dict) { return G4SmartVoxelProxy(self); }) 22 | .def("IsHeader", &G4SmartVoxelProxy::IsHeader) 23 | .def("IsNode", &G4SmartVoxelProxy::IsNode) 24 | .def("GetNode", &G4SmartVoxelProxy::GetNode, py::return_value_policy::reference) 25 | .def("GetHeader", &G4SmartVoxelProxy::GetHeader, py::return_value_policy::reference) 26 | .def(py::self == py::self); 27 | } 28 | -------------------------------------------------------------------------------- /source/geometry/management/pyG4SmartVoxelStat.cc: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #include 5 | #include 6 | #include 7 | 8 | #include "typecast.hh" 9 | #include "opaques.hh" 10 | 11 | namespace py = pybind11; 12 | 13 | void export_G4SmartVoxelStat(py::module &m) 14 | { 15 | py::class_(m, "G4SmartVoxelStat") 16 | 17 | .def(py::init(), py::arg("theVolume"), 18 | py::arg("theVoxel"), py::arg("theSysTime"), py::arg("theUserTime")) 19 | 20 | .def("__copy__", [](const G4SmartVoxelStat &self) { return G4SmartVoxelStat(self); }) 21 | .def("__deepcopy__", [](const G4SmartVoxelStat &self, py::dict) { return G4SmartVoxelStat(self); }) 22 | .def("GetVolume", &G4SmartVoxelStat::GetVolume, py::return_value_policy::reference) 23 | .def("GetVoxel", &G4SmartVoxelStat::GetVoxel, py::return_value_policy::reference) 24 | .def("GetSysTime", &G4SmartVoxelStat::GetSysTime) 25 | .def("GetUserTime", &G4SmartVoxelStat::GetUserTime) 26 | .def("GetTotalTime", &G4SmartVoxelStat::GetTotalTime) 27 | .def("GetNumberHeads", &G4SmartVoxelStat::GetNumberHeads) 28 | .def("GetNumberNodes", &G4SmartVoxelStat::GetNumberNodes) 29 | .def("GetNumberPointers", &G4SmartVoxelStat::GetNumberPointers) 30 | .def("GetMemoryUse", &G4SmartVoxelStat::GetMemoryUse); 31 | } 32 | -------------------------------------------------------------------------------- /source/geometry/management/pyG4SolidStore.cc: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | 14 | #include 15 | 16 | #include "typecast.hh" 17 | #include "opaques.hh" 18 | 19 | namespace py = pybind11; 20 | 21 | void export_G4SolidStore(py::module &m) 22 | { 23 | py::class_(m, "G4SolidStore") 24 | 25 | .def_static("Register", &G4SolidStore::Register, py::arg("pSolid")) 26 | .def_static("DeRegister", &G4SolidStore::DeRegister, py::arg("pSolid")) 27 | .def_static("GetInstance", &G4SolidStore::GetInstance, py::return_value_policy::reference) 28 | .def_static("SetNotifier", &G4SolidStore::SetNotifier, py::arg("pNotifier")) 29 | .def_static("Clean", &G4SolidStore::Clean) 30 | #if G4VERSION_NUMBER >= 1102 31 | .def("GetSolid", &G4SolidStore::GetSolid, py::arg("name"), py::arg("verbose") = true, 32 | py::arg("reverseSearch") = false, py::return_value_policy::reference); 33 | #else 34 | .def("GetSolid", &G4SolidStore::GetSolid, py::arg("name"), py::arg("verbose") = true, 35 | py::return_value_policy::reference); 36 | #endif 37 | } 38 | -------------------------------------------------------------------------------- /source/geometry/management/pyG4VCurvedTrajectoryFilter.cc: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #include 5 | 6 | #include "typecast.hh" 7 | #include "opaques.hh" 8 | 9 | namespace py = pybind11; 10 | 11 | class PyG4VCurvedTrajectoryFilter : public G4VCurvedTrajectoryFilter, public py::trampoline_self_life_support { 12 | public: 13 | using G4VCurvedTrajectoryFilter::G4VCurvedTrajectoryFilter; 14 | 15 | void TakeIntermediatePoint(G4ThreeVector newPoint) override 16 | { 17 | PYBIND11_OVERRIDE_PURE(void, G4VCurvedTrajectoryFilter, TakeIntermediatePoint, newPoint); 18 | } 19 | }; 20 | 21 | void export_G4VCurvedTrajectoryFilter(py::module &m) 22 | { 23 | py::class_(m, "G4VCurvedTrajectoryFilter") 24 | 25 | .def(py::init<>()) 26 | .def("__copy__", [](const PyG4VCurvedTrajectoryFilter &self) { return PyG4VCurvedTrajectoryFilter(self); }) 27 | .def("__deepcopy__", 28 | [](const PyG4VCurvedTrajectoryFilter &self, py::dict) { return PyG4VCurvedTrajectoryFilter(self); }) 29 | 30 | .def("CreateNewTrajectorySegment", &G4VCurvedTrajectoryFilter::CreateNewTrajectorySegment) 31 | .def("TakeIntermediatePoint", &G4VCurvedTrajectoryFilter::TakeIntermediatePoint, py::arg("newPoint")) 32 | .def("GimmeThePointsAndForgetThem", &G4VCurvedTrajectoryFilter::GimmeThePointsAndForgetThem, 33 | py::return_value_policy::reference); 34 | } 35 | -------------------------------------------------------------------------------- /source/geometry/management/pyG4VPhysicalVolume.hh: -------------------------------------------------------------------------------- 1 | #ifndef PYG4VPHYSICALVOLUME_HH 2 | #define PYG4VPHYSICALVOLUME_HH 3 | 4 | #include 5 | 6 | #include 7 | 8 | struct SharedPhysicalVolumeRotation { 9 | std::shared_ptr sharedRotation; 10 | }; 11 | 12 | #endif 13 | -------------------------------------------------------------------------------- /source/geometry/management/pyG4VUserRegionInformation.cc: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #include 5 | 6 | #include "typecast.hh" 7 | #include "opaques.hh" 8 | 9 | namespace py = pybind11; 10 | 11 | class PyG4VUserRegionInformation : public G4VUserRegionInformation, public py::trampoline_self_life_support { 12 | public: 13 | using G4VUserRegionInformation::G4VUserRegionInformation; 14 | 15 | void Print() const override { PYBIND11_OVERRIDE_PURE(void, G4VUserRegionInformation, Print, ); } 16 | }; 17 | 18 | void export_G4VUserRegionInformation(py::module &m) 19 | { 20 | py::class_(m, "G4VUserRegionInformation") 21 | 22 | .def(py::init<>()) 23 | .def("__copy__", [](const PyG4VUserRegionInformation &self) { return PyG4VUserRegionInformation(self); }) 24 | .def("__deepcopy__", 25 | [](const PyG4VUserRegionInformation &self, py::dict) { return PyG4VUserRegionInformation(self); }) 26 | 27 | .def("Print", &G4VUserRegionInformation::Print); 28 | } 29 | -------------------------------------------------------------------------------- /source/geometry/management/pyG4VVolumeMaterialScanner.cc: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #include 5 | #include 6 | 7 | #include "typecast.hh" 8 | #include "opaques.hh" 9 | 10 | namespace py = pybind11; 11 | 12 | class PyG4VVolumeMaterialScanner : public G4VVolumeMaterialScanner, public py::trampoline_self_life_support { 13 | public: 14 | using G4VVolumeMaterialScanner::G4VVolumeMaterialScanner; 15 | 16 | G4int GetNumberOfMaterials() const override 17 | { 18 | PYBIND11_OVERRIDE_PURE(G4int, G4VVolumeMaterialScanner, GetNumberOfMaterials, ); 19 | } 20 | 21 | G4Material *GetMaterial(G4int idx) const override 22 | { 23 | PYBIND11_OVERRIDE_PURE(G4Material *, G4VVolumeMaterialScanner, GetMaterial, idx); 24 | } 25 | }; 26 | 27 | void export_G4VVolumeMaterialScanner(py::module &m) 28 | { 29 | py::class_(m, "G4VVolumeMaterialScanner") 30 | 31 | .def(py::init<>()) 32 | .def("__copy__", [](const PyG4VVolumeMaterialScanner &self) { return PyG4VVolumeMaterialScanner(self); }) 33 | .def("__deepcopy__", 34 | [](const PyG4VVolumeMaterialScanner &self, py::dict) { return PyG4VVolumeMaterialScanner(self); }) 35 | 36 | .def("GetNumberOfMaterials", &G4VVolumeMaterialScanner::GetNumberOfMaterials) 37 | .def("GetMaterial", &G4VVolumeMaterialScanner::GetMaterial, py::arg("idx"), py::return_value_policy::reference); 38 | } 39 | -------------------------------------------------------------------------------- /source/geometry/navigation/pyG4AuxiliaryNavServices.cc: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | 13 | #include "typecast.hh" 14 | #include "opaques.hh" 15 | 16 | namespace py = pybind11; 17 | 18 | void export_G4AuxiliaryNavServices(py::module &m) 19 | { 20 | py::class_(m, "G4AuxiliaryNavServices") 21 | 22 | .def(py::init<>()) 23 | .def("__copy__", [](const G4AuxiliaryNavServices &self) { return G4AuxiliaryNavServices(self); }) 24 | .def("__deepcopy__", [](const G4AuxiliaryNavServices &self, py::dict) { return G4AuxiliaryNavServices(self); }) 25 | .def_static("CheckPointOnSurface", &G4AuxiliaryNavServices::CheckPointOnSurface, py::arg("sampleSolid"), 26 | py::arg("localPoint"), py::arg("globalDirection"), py::arg("sampleTransform"), 27 | py::arg("locatedOnEdge")) 28 | 29 | .def_static("CheckPointExiting", &G4AuxiliaryNavServices::CheckPointExiting, py::arg("sampleSolid"), 30 | py::arg("localPoint"), py::arg("globalDirection"), py::arg("sampleTransform")) 31 | 32 | .def_static("ReportTolerances", &G4AuxiliaryNavServices::ReportTolerances); 33 | } 34 | -------------------------------------------------------------------------------- /source/geometry/navigation/pyG4DrawVoxels.cc: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | 10 | #include "typecast.hh" 11 | #include "opaques.hh" 12 | 13 | namespace py = pybind11; 14 | 15 | void export_G4DrawVoxels(py::module &m) 16 | { 17 | py::class_(m, "G4DrawVoxels") 18 | 19 | .def(py::init<>()) 20 | .def("DrawVoxels", &G4DrawVoxels::DrawVoxels, py::arg("lv")) 21 | .def("CreatePlacedPolyhedra", &G4DrawVoxels::CreatePlacedPolyhedra, py::return_value_policy::reference) 22 | .def("SetVoxelsVisAttributes", &G4DrawVoxels::SetVoxelsVisAttributes) 23 | .def("SetBoundingBoxVisAttributes", &G4DrawVoxels::SetBoundingBoxVisAttributes); 24 | } 25 | -------------------------------------------------------------------------------- /source/geometry/navigation/pyG4RegularNavigationHelper.cc: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #include 5 | #include 6 | #include 7 | 8 | #include "typecast.hh" 9 | #include "opaques.hh" 10 | 11 | namespace py = pybind11; 12 | 13 | void export_G4RegularNavigationHelper(py::module &m) 14 | { 15 | py::class_(m, "G4RegularNavigationHelper") 16 | 17 | .def("__copy__", [](const G4RegularNavigationHelper &self) { return G4RegularNavigationHelper(self); }) 18 | .def("__deepcopy__", 19 | [](const G4RegularNavigationHelper &self, py::dict) { return G4RegularNavigationHelper(self); }) 20 | 21 | .def_static("Instance", &G4RegularNavigationHelper::Instance, py::return_value_policy::reference) 22 | .def("ClearStepLengths", &G4RegularNavigationHelper::ClearStepLengths) 23 | .def("AddStepLength", &G4RegularNavigationHelper::AddStepLength, py::arg("copyNo"), py::arg("slen")) 24 | .def("GetStepLengths", &G4RegularNavigationHelper::GetStepLengths) 25 | .def_readwrite("theStepLengths", &G4RegularNavigationHelper::theStepLengths); 26 | } 27 | -------------------------------------------------------------------------------- /source/geometry/solids/specific/pyG4EnclosingCylinder.cc: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #include 5 | #include 6 | 7 | #include "typecast.hh" 8 | #include "opaques.hh" 9 | 10 | namespace py = pybind11; 11 | 12 | void export_G4EnclosingCylinder(py::module &m) 13 | { 14 | py::class_(m, "G4EnclosingCylinder") 15 | 16 | .def(py::init(), py::arg("rz"), py::arg("phiIsOpen"), 17 | py::arg("startPhi"), py::arg("totalPhi")) 18 | 19 | .def("__copy__", [](const G4EnclosingCylinder &self) { return G4EnclosingCylinder(self); }) 20 | .def("__deepcopy__", [](const G4EnclosingCylinder &self, py::dict) { return G4EnclosingCylinder(self); }) 21 | .def("MustBeOutside", &G4EnclosingCylinder::MustBeOutside, py::arg("p")) 22 | .def("ShouldMiss", &G4EnclosingCylinder::ShouldMiss, py::arg("p"), py::arg("v")); 23 | } 24 | -------------------------------------------------------------------------------- /source/geometry/solids/specific/pyG4IntersectingCone.cc: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #include 5 | 6 | #include "typecast.hh" 7 | #include "opaques.hh" 8 | 9 | namespace py = pybind11; 10 | 11 | void export_G4IntersectingCone(py::module &m) 12 | { 13 | py::class_(m, "G4IntersectingCone") 14 | 15 | .def(py::init(), py::arg("r"), py::arg("z")) 16 | .def("__copy__", [](const G4IntersectingCone &self) { return G4IntersectingCone(self); }) 17 | .def("__deepcopy__", [](const G4IntersectingCone &self, py::dict) { return G4IntersectingCone(self); }) 18 | 19 | .def("LineHitsCone", &G4IntersectingCone::LineHitsCone, py::arg("p"), py::arg("v"), py::arg("s1"), py::arg("s2")) 20 | 21 | .def("HitOn", &G4IntersectingCone::HitOn, py::arg("r"), py::arg("z")) 22 | .def("RLo", &G4IntersectingCone::RLo) 23 | .def("RHi", &G4IntersectingCone::RHi) 24 | .def("ZLo", &G4IntersectingCone::ZLo) 25 | .def("ZHi", &G4IntersectingCone::ZHi); 26 | } 27 | -------------------------------------------------------------------------------- /source/geometry/solids/specific/pyG4PolyconeHistorical.cc: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #include 5 | 6 | #include "typecast.hh" 7 | #include "opaques.hh" 8 | 9 | namespace py = pybind11; 10 | 11 | void export_G4PolyconeHistorical(py::module &m) 12 | { 13 | py::class_(m, "G4PolyconeHistorical") 14 | 15 | .def(py::init<>()) 16 | .def(py::init(), py::arg("z_planes")) 17 | .def("__copy__", [](const G4PolyconeHistorical &self) { return G4PolyconeHistorical(self); }) 18 | .def("__deepcopy__", [](const G4PolyconeHistorical &self, py::dict) { return G4PolyconeHistorical(self); }) 19 | .def_readwrite("Start_angle", &G4PolyconeHistorical::Start_angle) 20 | .def_readwrite("Opening_angle", &G4PolyconeHistorical::Opening_angle) 21 | .def_readwrite("Num_z_planes", &G4PolyconeHistorical::Num_z_planes) 22 | .def_readwrite("Z_values", &G4PolyconeHistorical::Z_values) 23 | .def_readwrite("Rmin", &G4PolyconeHistorical::Rmin) 24 | .def_readwrite("Rmax", &G4PolyconeHistorical::Rmax); 25 | } 26 | -------------------------------------------------------------------------------- /source/geometry/solids/specific/pyG4PolyhedraHistorical.cc: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #include 5 | 6 | #include "typecast.hh" 7 | #include "opaques.hh" 8 | 9 | namespace py = pybind11; 10 | 11 | void export_G4PolyhedraHistorical(py::module &m) 12 | { 13 | py::class_(m, "G4PolyhedraHistorical") 14 | 15 | .def(py::init<>()) 16 | .def(py::init(), py::arg("z_planes")) 17 | .def("__copy__", [](const G4PolyhedraHistorical &self) { return G4PolyhedraHistorical(self); }) 18 | .def("__deepcopy__", [](const G4PolyhedraHistorical &self, py::dict) { return G4PolyhedraHistorical(self); }) 19 | .def_readwrite("Start_angle", &G4PolyhedraHistorical::Start_angle) 20 | .def_readwrite("Opening_angle", &G4PolyhedraHistorical::Opening_angle) 21 | .def_readwrite("numSide", &G4PolyhedraHistorical::numSide) 22 | .def_readwrite("Num_z_planes", &G4PolyhedraHistorical::Num_z_planes) 23 | .def_readwrite("Z_values", &G4PolyhedraHistorical::Z_values) 24 | .def_readwrite("Rmin", &G4PolyhedraHistorical::Rmin) 25 | .def_readwrite("Rmax", &G4PolyhedraHistorical::Rmax); 26 | } 27 | -------------------------------------------------------------------------------- /source/geometry/solids/specific/pyG4SolidExtentList.cc: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #include 5 | #include 6 | #include 7 | 8 | #include "typecast.hh" 9 | #include "opaques.hh" 10 | 11 | namespace py = pybind11; 12 | 13 | void export_G4SolidExtentList(py::module &m) 14 | { 15 | py::class_(m, "G4SolidExtentList") 16 | 17 | .def(py::init<>()) 18 | .def(py::init(), py::arg("targetAxis"), py::arg("voxelLimits")) 19 | .def("__copy__", [](const G4SolidExtentList &self) { return G4SolidExtentList(self); }) 20 | .def("__deepcopy__", [](const G4SolidExtentList &self, py::dict) { return G4SolidExtentList(self); }) 21 | .def("AddSurface", &G4SolidExtentList::AddSurface, py::arg("surface")) 22 | .def("GetExtent", &G4SolidExtentList::GetExtent, py::arg("min"), py::arg("max")); 23 | } 24 | -------------------------------------------------------------------------------- /source/geometry/solids/specific/pyG4SolidsWorkspace.cc: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include 16 | #include 17 | #include 18 | 19 | #include "typecast.hh" 20 | #include "opaques.hh" 21 | 22 | namespace py = pybind11; 23 | 24 | void export_G4SolidsWorkspace(py::module &m) 25 | { 26 | py::class_(m, "G4SolidsWorkspace") 27 | 28 | .def(py::init(), py::arg("verbose") = false) 29 | .def("__copy__", [](const G4SolidsWorkspace &self) { return G4SolidsWorkspace(self); }) 30 | .def("__deepcopy__", [](const G4SolidsWorkspace &self, py::dict) { return G4SolidsWorkspace(self); }) 31 | .def("UseWorkspace", &G4SolidsWorkspace::UseWorkspace) 32 | .def("ReleaseWorkspace", &G4SolidsWorkspace::ReleaseWorkspace) 33 | .def("DestroyWorkspace", &G4SolidsWorkspace::DestroyWorkspace) 34 | .def("InitialiseWorkspace", &G4SolidsWorkspace::InitialiseWorkspace) 35 | .def("SetVerbose", &G4SolidsWorkspace::SetVerbose, py::arg("v")) 36 | .def("GetVerbose", &G4SolidsWorkspace::GetVerbose) 37 | .def_static("GetPool", &G4SolidsWorkspace::GetPool, py::return_value_policy::reference); 38 | } 39 | -------------------------------------------------------------------------------- /source/geometry/solids/specific/pyG4TessellatedGeometryAlgorithms.cc: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #include 5 | 6 | #include "typecast.hh" 7 | #include "opaques.hh" 8 | 9 | namespace py = pybind11; 10 | 11 | void export_G4TessellatedGeometryAlgorithms(py::module &m) 12 | { 13 | py::class_(m, "G4TessellatedGeometryAlgorithms") 14 | 15 | .def(py::init<>()) 16 | .def("__copy__", 17 | [](const G4TessellatedGeometryAlgorithms &self) { return G4TessellatedGeometryAlgorithms(self); }) 18 | 19 | .def("__deepcopy__", 20 | [](const G4TessellatedGeometryAlgorithms &self, py::dict) { return G4TessellatedGeometryAlgorithms(self); }) 21 | 22 | .def_static("IntersectLineAndTriangle2D", &G4TessellatedGeometryAlgorithms::IntersectLineAndTriangle2D, 23 | py::arg("p"), py::arg("v"), py::arg("p0"), py::arg("e0"), py::arg("e1"), py::arg("location")) 24 | 25 | .def_static("IntersectLineAndLineSegment2D", &G4TessellatedGeometryAlgorithms::IntersectLineAndLineSegment2D, 26 | py::arg("p0"), py::arg("d0"), py::arg("p1"), py::arg("d1"), py::arg("location")) 27 | 28 | .def_static("cross", &G4TessellatedGeometryAlgorithms::cross, py::arg("v1"), py::arg("v2")); 29 | } 30 | -------------------------------------------------------------------------------- /source/geometry/volumes/pyG4AssemblyStore.cc: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | #include 6 | #include 7 | 8 | #include "typecast.hh" 9 | #include "opaques.hh" 10 | 11 | namespace py = pybind11; 12 | 13 | class PublicG4AssemblyStore : public G4AssemblyStore { 14 | public: 15 | using G4AssemblyStore::G4AssemblyStore; 16 | ~PublicG4AssemblyStore() {} 17 | }; 18 | 19 | void export_G4AssemblyStore(py::module &m) 20 | { 21 | py::bind_vector(m, "G4AssemblyStore") 22 | 23 | .def("__copy__", [](const PublicG4AssemblyStore &self) { return PublicG4AssemblyStore(self); }) 24 | .def("__deepcopy__", [](const PublicG4AssemblyStore &self, py::dict) { return PublicG4AssemblyStore(self); }) 25 | .def_static("Register", &G4AssemblyStore::Register, py::arg("pAssembly")) 26 | .def_static("DeRegister", &G4AssemblyStore::DeRegister, py::arg("pAssembly")) 27 | .def_static("GetInstance", &G4AssemblyStore::GetInstance, py::return_value_policy::reference) 28 | .def_static("SetNotifier", &G4AssemblyStore::SetNotifier, py::arg("pNotifier")) 29 | .def_static("Clean", &G4AssemblyStore::Clean) 30 | .def("GetAssembly", &G4AssemblyStore::GetAssembly, py::arg("id"), py::arg("verbose") = true, 31 | py::return_value_policy::reference); 32 | } 33 | -------------------------------------------------------------------------------- /source/geometry/volumes/pyG4LogicalSkinSurface.cc: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | #include 6 | #include 7 | #include 8 | 9 | #include "typecast.hh" 10 | #include "opaques.hh" 11 | 12 | namespace py = pybind11; 13 | 14 | void export_G4LogicalSkinSurface(py::module &m) 15 | { 16 | py::class_(m, "G4LogicalSkinSurface") 17 | 18 | .def(py::init(), py::arg("name"), py::arg("vol"), 19 | py::arg("surfaceProperty")) 20 | 21 | .def(py::self == py::self) 22 | .def(py::self != py::self) 23 | .def_static("GetSurface", &G4LogicalSkinSurface::GetSurface, py::arg("vol"), py::return_value_policy::reference) 24 | .def("GetLogicalVolume", &G4LogicalSkinSurface::GetLogicalVolume, py::return_value_policy::reference) 25 | .def("SetLogicalVolume", &G4LogicalSkinSurface::SetLogicalVolume, py::arg("vol")) 26 | .def_static("CleanSurfaceTable", &G4LogicalSkinSurface::CleanSurfaceTable) 27 | .def_static("GetSurfaceTable", &G4LogicalSkinSurface::GetSurfaceTable, py::return_value_policy::reference) 28 | .def_static("GetNumberOfSkinSurfaces", &G4LogicalSkinSurface::GetNumberOfSkinSurfaces) 29 | .def_static("DumpInfo", &G4LogicalSkinSurface::DumpInfo); 30 | } 31 | -------------------------------------------------------------------------------- /source/geometry/volumes/pyG4NavigationHistoryPool.cc: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | 10 | #include "typecast.hh" 11 | #include "opaques.hh" 12 | 13 | namespace py = pybind11; 14 | 15 | void export_G4NavigationHistoryPool(py::module &m) 16 | { 17 | py::class_(m, "G4NavigationHistoryPool") 18 | 19 | .def("__copy__", [](const G4NavigationHistoryPool &self) { return G4NavigationHistoryPool(self); }) 20 | .def("__deepcopy__", [](const G4NavigationHistoryPool &self, py::dict) { return G4NavigationHistoryPool(self); }) 21 | .def_static("GetInstance", &G4NavigationHistoryPool::GetInstance, py::return_value_policy::reference) 22 | .def("GetNewLevels", &G4NavigationHistoryPool::GetNewLevels, py::return_value_policy::reference) 23 | .def("GetLevels", &G4NavigationHistoryPool::GetLevels, py::return_value_policy::reference) 24 | .def("DeRegister", &G4NavigationHistoryPool::DeRegister, py::arg("pLevels")) 25 | .def("Clean", &G4NavigationHistoryPool::Clean) 26 | .def("Print", &G4NavigationHistoryPool::Print); 27 | } 28 | -------------------------------------------------------------------------------- /source/global/pyG4ApplicationState.cc: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #include 5 | 6 | #include "typecast.hh" 7 | #include "opaques.hh" 8 | 9 | namespace py = pybind11; 10 | 11 | void export_G4ApplicationState(py::module &m) 12 | { 13 | py::enum_(m, "G4ApplicationState") 14 | .value("G4State_PreInit", G4State_PreInit) 15 | .value("G4State_Init", G4State_Init) 16 | .value("G4State_Idle", G4State_Idle) 17 | .value("G4State_GeomClosed", G4State_GeomClosed) 18 | .value("G4State_EventProc", G4State_EventProc) 19 | .value("G4State_Quit", G4State_Quit) 20 | .value("G4State_Abort", G4State_Abort) 21 | .export_values(); 22 | } 23 | -------------------------------------------------------------------------------- /source/global/pyG4ExceptionSeverity.cc: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #include 5 | 6 | #include "typecast.hh" 7 | #include "opaques.hh" 8 | 9 | namespace py = pybind11; 10 | 11 | void export_G4ExceptionSeverity(py::module &m) 12 | { 13 | py::enum_(m, "G4ExceptionSeverity") 14 | .value("FatalException", FatalException) 15 | .value("FatalErrorInArgument", FatalErrorInArgument) 16 | .value("RunMustBeAborted", RunMustBeAborted) 17 | .value("EventMustBeAborted", EventMustBeAborted) 18 | .value("JustWarning", JustWarning) 19 | .export_values(); 20 | } 21 | -------------------------------------------------------------------------------- /source/global/pyG4GeometryTolerance.cc: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #include 5 | 6 | #include "typecast.hh" 7 | #include "opaques.hh" 8 | 9 | namespace py = pybind11; 10 | 11 | void export_G4GeometryTolerance(py::module &m) 12 | { 13 | py::class_(m, "G4GeometryTolerance") 14 | .def_static("GetInstance", &G4GeometryTolerance::GetInstance, py::return_value_policy::reference) 15 | .def("GetSurfaceTolerance", &G4GeometryTolerance::GetSurfaceTolerance) 16 | .def("GetAngularTolerance", &G4GeometryTolerance::GetAngularTolerance) 17 | .def("GetRadialTolerance", &G4GeometryTolerance::GetRadialTolerance); 18 | } -------------------------------------------------------------------------------- /source/global/pyG4RandomDirection.cc: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #include 5 | 6 | #include "typecast.hh" 7 | #include "opaques.hh" 8 | 9 | namespace py = pybind11; 10 | 11 | void export_G4RandomDirection(py::module &m) 12 | { 13 | m.def("G4RandomDirection", py::overload_cast<>(&G4RandomDirection)); 14 | m.def("G4RandomDirection", py::overload_cast(&G4RandomDirection)); 15 | } 16 | -------------------------------------------------------------------------------- /source/global/pyG4StateManager.cc: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #include 5 | 6 | #include "typecast.hh" 7 | #include "opaques.hh" 8 | 9 | namespace py = pybind11; 10 | 11 | void export_G4StateManager(py::module &m) 12 | { 13 | py::class_(m, "G4StateManager", "state manager") 14 | .def_static("GetStateManager", &G4StateManager::GetStateManager, "Get an instance of G4StateManager", 15 | py::return_value_policy::reference) 16 | 17 | .def("GetCurrentState", &G4StateManager::GetCurrentState) 18 | .def("GetPreviousState", &G4StateManager::GetPreviousState) 19 | .def("GetStateString", &G4StateManager::GetStateString); 20 | } 21 | -------------------------------------------------------------------------------- /source/global/pyG4Timer.cc: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #include 5 | 6 | #include "typecast.hh" 7 | #include "opaques.hh" 8 | 9 | namespace py = pybind11; 10 | 11 | void export_G4Timer(py::module &m) 12 | { 13 | py::class_(m, "G4Timer", "Timer") 14 | .def(py::init<>()) 15 | 16 | .def("Start", &G4Timer::Start) 17 | .def("Stop", &G4Timer::Stop) 18 | .def("IsValid", &G4Timer::IsValid) 19 | .def("GetRealElapsed", &G4Timer::GetRealElapsed) 20 | .def("GetSystemElapsed", &G4Timer::GetSystemElapsed) 21 | .def("GetUserElapsed", &G4Timer::GetUserElapsed); 22 | } 23 | -------------------------------------------------------------------------------- /source/global/pyG4Version.cc: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #include 5 | 6 | #include "typecast.hh" 7 | #include "opaques.hh" 8 | 9 | namespace py = pybind11; 10 | 11 | void export_G4Version(py::module &m) 12 | { 13 | m.attr("G4VERSION_NUMBER") = G4VERSION_NUMBER; 14 | m.attr("G4Version") = G4Version.c_str(); 15 | m.attr("G4Date") = G4Date.c_str(); 16 | } 17 | -------------------------------------------------------------------------------- /source/global/pygeomdefs.cc: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #include 5 | 6 | #include "typecast.hh" 7 | #include "opaques.hh" 8 | 9 | namespace py = pybind11; 10 | 11 | void export_geomdefs(py::module &m) 12 | { 13 | py::enum_(m, "EAxis") 14 | .value("kXAxis", kXAxis) 15 | .value("kYAxis", kYAxis) 16 | .value("kZAxis", kZAxis) 17 | .value("kRho", kRho) 18 | .value("kRadial3D", kRadial3D) 19 | .value("kPhi", kPhi) 20 | .value("kUndefined", kUndefined) 21 | .export_values(); 22 | 23 | py::enum_(m, "EInside") 24 | .value("kOutside", kOutside) 25 | .value("kSurface", kSurface) 26 | .value("kInside", kInside) 27 | .export_values(); 28 | 29 | py::enum_(m, "EVolume") 30 | .value("kNormal", kNormal) 31 | .value("kReplica", kReplica) 32 | .value("kParameterised", kParameterised) 33 | .export_values(); 34 | } 35 | -------------------------------------------------------------------------------- /source/global/pyglobals.cc: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | #include 6 | #include 7 | #include 8 | 9 | #include "typecast.hh" 10 | #include "opaques.hh" 11 | 12 | namespace py = pybind11; 13 | 14 | void export_globals(py::module &m) 15 | { 16 | py::bind_vector(m, "G4intVector"); 17 | py::bind_vector(m, "G4doubleVector"); 18 | py::bind_vector(m, "G4StringVector"); 19 | py::bind_vector(m, "G4ThreeVectorVector"); 20 | py::bind_vector(m, "G4TwoVectorVector"); 21 | } 22 | -------------------------------------------------------------------------------- /source/graphics_reps/pyG4AttDef.cc: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #include 5 | 6 | #include "typecast.hh" 7 | #include "opaques.hh" 8 | 9 | namespace py = pybind11; 10 | 11 | void export_G4AttDef(py::module &m) 12 | { 13 | py::class_(m, "G4AttDef") 14 | .def(py::init()) 15 | .def(py::init()) 16 | .def(py::init<>()) 17 | 18 | .def("GetName", &G4AttDef::GetName) 19 | .def("GetDesc", &G4AttDef::GetDesc) 20 | .def("GetCategory", &G4AttDef::GetCategory) 21 | .def("GetExtra", &G4AttDef::GetExtra) 22 | .def("GetValueType", &G4AttDef::GetValueType) 23 | 24 | .def("SetName", &G4AttDef::SetName) 25 | .def("SetDesc", &G4AttDef::SetDesc) 26 | .def("SetCategory", &G4AttDef::SetCategory) 27 | .def("SetExtra", &G4AttDef::SetExtra) 28 | .def("SetValueType", &G4AttDef::SetValueType); 29 | } 30 | -------------------------------------------------------------------------------- /source/graphics_reps/pyG4AttDefStore.cc: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #include 5 | #include 6 | 7 | #include "typecast.hh" 8 | #include "opaques.hh" 9 | 10 | namespace py = pybind11; 11 | 12 | class ScopeG4AttDefStore {}; 13 | 14 | void export_G4AttDefStore(py::module &m) 15 | { 16 | py::class_(m, "G4AttDefStore") 17 | .def_static( 18 | "GetInstance", 19 | [](const G4String &storeKey) { 20 | G4bool isNew; 21 | std::map *store = G4AttDefStore::GetInstance(storeKey, isNew); 22 | return std::make_tuple(store, isNew); 23 | }, 24 | py::return_value_policy::automatic_reference) 25 | 26 | .def_static("GetStoreKey", [](const std::map *definitions) { 27 | G4String key; 28 | G4bool contains = G4AttDefStore::GetStoreKey(definitions, key); 29 | return std::make_tuple(contains, key); 30 | }); 31 | } 32 | -------------------------------------------------------------------------------- /source/graphics_reps/pyG4AttValue.cc: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #include 5 | 6 | #include "typecast.hh" 7 | #include "opaques.hh" 8 | 9 | namespace py = pybind11; 10 | 11 | void export_G4AttValue(py::module &m) 12 | { 13 | py::class_(m, "G4AttValue") 14 | .def(py::init()) 15 | .def(py::init<>()) 16 | 17 | .def("GetName", &G4AttValue::GetName) 18 | .def("GetValue", &G4AttValue::GetValue) 19 | .def("GetShowLabel", &G4AttValue::GetShowLabel) 20 | 21 | .def("SetName", &G4AttValue::SetName) 22 | .def("SetValue", &G4AttValue::SetValue) 23 | .def("SetShowLabel", &G4AttValue::SetShowLabel); 24 | } 25 | -------------------------------------------------------------------------------- /source/graphics_reps/pyG4Circle.cc: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #include 5 | 6 | #include "typecast.hh" 7 | #include "opaques.hh" 8 | 9 | namespace py = pybind11; 10 | 11 | void export_G4Circle(py::module &m) 12 | { 13 | py::class_(m, "G4Circle") 14 | .def(py::init<>()) 15 | .def(py::init()) 16 | .def(py::init()) 17 | 18 | .def( 19 | "__str__", 20 | [](const G4Circle &self) { 21 | std::stringstream ss; 22 | ss << self; 23 | return ss.str(); 24 | }, 25 | py::is_operator()); 26 | } 27 | -------------------------------------------------------------------------------- /source/graphics_reps/pyG4Colour.cc: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | #include 6 | #include 7 | 8 | #include 9 | 10 | #include "typecast.hh" 11 | #include "opaques.hh" 12 | 13 | namespace py = pybind11; 14 | 15 | void export_G4Colour(py::module &m) 16 | { 17 | py::class_(m, "G4Colour", "colour class") 18 | 19 | .def(py::init<>()) 20 | .def(py::init()) 21 | .def(py::init()) 22 | .def(py::init()) 23 | .def(py::init()) 24 | .def(py::init()) 25 | 26 | .def("GetRed", &G4Colour::GetRed) 27 | .def("GetGreen", &G4Colour::GetGreen) 28 | .def("GetBlue", &G4Colour::GetBlue) 29 | .def("GetAlpha", &G4Colour::GetAlpha) 30 | 31 | .def( 32 | "__str__", 33 | [](const G4Colour &self) { 34 | std::stringstream ss; 35 | ss << std::setprecision(std::numeric_limits::digits10 + 1) << self; 36 | return ss.str(); 37 | }, 38 | py::is_operator()) 39 | 40 | .def(py::self != py::self); 41 | 42 | m.attr("G4Color") = m.attr("G4Colour"); 43 | } 44 | -------------------------------------------------------------------------------- /source/graphics_reps/pyG4Square.cc: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #include 5 | 6 | #include "typecast.hh" 7 | #include "opaques.hh" 8 | 9 | namespace py = pybind11; 10 | 11 | void export_G4Square(py::module &m) 12 | { 13 | py::class_(m, "G4Square") 14 | .def(py::init<>()) 15 | .def(py::init()) 16 | .def(py::init(), py::arg("position")) 17 | 18 | .def( 19 | "__str__", 20 | [](const G4Square &self) { 21 | std::stringstream ss; 22 | ss << self; 23 | return ss.str(); 24 | }, 25 | py::is_operator()); 26 | } 27 | -------------------------------------------------------------------------------- /source/graphics_reps/pyG4Text.cc: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #include 5 | 6 | #include "typecast.hh" 7 | #include "opaques.hh" 8 | 9 | namespace py = pybind11; 10 | 11 | void export_G4Text(py::module &m) 12 | { 13 | py::class_ g4Text(m, "G4Text"); 14 | 15 | py::enum_(g4Text, "Layout") 16 | .value("left", G4Text::left) 17 | .value("centre", G4Text::centre) 18 | .value("right", G4Text::right) 19 | .export_values(); 20 | 21 | g4Text.def(py::init(), py::arg("text")) 22 | .def(py::init(), py::arg("text"), py::arg("position")) 23 | .def(py::init()) 24 | 25 | .def("GetText", &G4Text::GetText) 26 | .def("GetLayout", &G4Text::GetLayout) 27 | 28 | .def("GetXOffset", &G4Text::GetXOffset) 29 | .def("GetYOffset", &G4Text::GetYOffset) 30 | 31 | .def("SetText", &G4Text::SetText) 32 | .def("SetLayout", &G4Text::SetLayout) 33 | .def("SetOffset", &G4Text::SetOffset, py::arg("dx"), py::arg("dy")) 34 | 35 | .def( 36 | "__str__", 37 | [](const G4Text &self) { 38 | std::stringstream ss; 39 | ss << self; 40 | return ss.str(); 41 | }, 42 | py::is_operator()); 43 | } 44 | -------------------------------------------------------------------------------- /source/graphics_reps/pyG4TypeKey.cc: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | #include 6 | 7 | #include 8 | 9 | #include "typecast.hh" 10 | #include "opaques.hh" 11 | 12 | namespace py = pybind11; 13 | 14 | void export_G4TypeKey(py::module &m) 15 | { 16 | py::class_(m, "G4TypeKey") 17 | .def(py::init<>()) 18 | 19 | .def("IsValid", &G4TypeKey::IsValid) 20 | .def(py::self == py::self) 21 | .def(py::self != py::self) 22 | .def(py::self > py::self) 23 | .def(py::self < py::self) 24 | 25 | .def("__call__", &G4TypeKey::operator(), py::is_operator()) 26 | .def( 27 | "__str__", 28 | [](const G4TypeKey &self) { 29 | std::stringstream ss; 30 | ss << std::setprecision(std::numeric_limits::digits10 + 1) << self; 31 | return ss.str(); 32 | }, 33 | py::is_operator()) 34 | 35 | .def( 36 | "__repr__", 37 | [](const G4TypeKey &self) { 38 | std::stringstream ss; 39 | ss << std::setprecision(std::numeric_limits::digits10 + 1) << self; 40 | return ss.str(); 41 | }, 42 | py::is_operator()); 43 | } 44 | -------------------------------------------------------------------------------- /source/graphics_reps/pyG4Visible.cc: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | #include 6 | #include 7 | 8 | #include 9 | 10 | #include "typecast.hh" 11 | #include "opaques.hh" 12 | 13 | namespace py = pybind11; 14 | 15 | void export_G4Visible(py::module &m) 16 | { 17 | py::class_(m, "G4Visible") 18 | 19 | .def(py::init<>()) 20 | .def("__copy__", [](const G4Visible &self) { return new G4Visible(self); }) 21 | .def("__deepcopy__", [](const G4Visible &self, py::dict) { return new G4Visible(self); }) 22 | .def(py::init()) 23 | .def("GetVisAttributes", &G4Visible::GetVisAttributes, py::return_value_policy::reference) 24 | .def("SetVisAttributes", py::overload_cast(&G4Visible::SetVisAttributes)) 25 | .def(py::self != py::self) 26 | .def( 27 | "__str__", 28 | [](const G4Visible &self) { 29 | std::stringstream ss; 30 | ss << std::setprecision(std::numeric_limits::digits10 + 1) << self; 31 | return ss.str(); 32 | }, 33 | py::is_operator()); 34 | } 35 | -------------------------------------------------------------------------------- /source/graphics_reps/pymodG4graphics_reps.cc: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #include "typecast.hh" 5 | #include "opaques.hh" 6 | 7 | namespace py = pybind11; 8 | 9 | void export_G4VisAttributes(py::module &); 10 | void export_G4TypeKey(py::module &); 11 | void export_G4AttValue(py::module &); 12 | void export_G4AttDef(py::module &); 13 | void export_G4Colour(py::module &); 14 | void export_G4Visible(py::module &); 15 | void export_G4VMarker(py::module &); 16 | void export_G4Circle(py::module &); 17 | void export_G4VVisManager(py::module &); 18 | void export_G4AttDefStore(py::module &); 19 | void export_G4Square(py::module &); 20 | void export_G4Text(py::module &); 21 | 22 | void export_modG4graphics_reps(py::module &m) 23 | { 24 | export_G4VisAttributes(m); 25 | export_G4TypeKey(m); 26 | export_G4AttValue(m); 27 | export_G4AttDef(m); 28 | export_G4Colour(m); 29 | export_G4Visible(m); 30 | export_G4VMarker(m); 31 | export_G4Circle(m); 32 | export_G4VVisManager(m); 33 | export_G4AttDefStore(m); 34 | export_G4Square(m); 35 | export_G4Text(m); 36 | } 37 | -------------------------------------------------------------------------------- /source/intercoms/pyG4UIcmdWith3Vector.cc: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #include 5 | #include 6 | 7 | #include "typecast.hh" 8 | #include "opaques.hh" 9 | 10 | namespace py = pybind11; 11 | 12 | void export_G4UIcmdWith3Vector(py::module &m) 13 | { 14 | py::class_(m, "G4UIcmdWith3Vector") 15 | 16 | .def(py::init(), py::arg("theCommandPath"), py::arg("theMessenger")) 17 | 18 | .def_static("GetNew3VectorValue", &G4UIcmdWith3Vector::GetNew3VectorValue) 19 | .def("SetParameterName", &G4UIcmdWith3Vector::SetParameterName, py::arg("theNameX"), py::arg("theNameY"), 20 | py::arg("theNameZ"), py::arg("omittable"), py::arg("currentAsDefault") = false) 21 | 22 | .def("SetDefaultValue", &G4UIcmdWith3Vector::SetDefaultValue); 23 | } 24 | -------------------------------------------------------------------------------- /source/intercoms/pyG4UIcmdWithABool.cc: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #include 5 | #include 6 | 7 | #include "typecast.hh" 8 | #include "opaques.hh" 9 | 10 | namespace py = pybind11; 11 | 12 | void export_G4UIcmdWithABool(py::module &m) 13 | { 14 | py::class_(m, "G4UIcmdWithABool") 15 | 16 | .def(py::init(), py::arg("theCommandPath"), py::arg("theMessenger")) 17 | .def_static("GetNewBoolValue", &G4UIcmdWithABool::GetNewBoolValue) 18 | .def("SetParameterName", &G4UIcmdWithABool::SetParameterName, py::arg("theName"), py::arg("omittable"), 19 | py::arg("currentAsDefault") = false) 20 | 21 | .def("SetDefaultValue", &G4UIcmdWithABool::SetDefaultValue); 22 | } 23 | -------------------------------------------------------------------------------- /source/intercoms/pyG4UIcmdWithADouble.cc: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #include 5 | #include 6 | 7 | #include "typecast.hh" 8 | #include "opaques.hh" 9 | 10 | namespace py = pybind11; 11 | 12 | void export_G4UIcmdWithADouble(py::module &m) 13 | { 14 | py::class_(m, "G4UIcmdWithADouble") 15 | 16 | .def(py::init(), py::arg("theCommandPath"), py::arg("theMessenger")) 17 | .def_static("GetNewDoubleValue", &G4UIcmdWithADouble::GetNewDoubleValue) 18 | .def("SetParameterName", &G4UIcmdWithADouble::SetParameterName, py::arg("theName"), py::arg("omittable"), 19 | py::arg("currentAsDefault") = false) 20 | 21 | .def("SetDefaultValue", &G4UIcmdWithADouble::SetDefaultValue); 22 | } 23 | -------------------------------------------------------------------------------- /source/intercoms/pyG4UIcmdWithALongInt.cc: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #include 5 | #include 6 | 7 | #include "typecast.hh" 8 | #include "opaques.hh" 9 | 10 | namespace py = pybind11; 11 | 12 | void export_G4UIcmdWithALongInt(py::module &m) 13 | { 14 | py::class_(m, "G4UIcmdWithALongInt") 15 | 16 | .def(py::init(), py::arg("theCommandPath"), py::arg("theMessenger")) 17 | .def_static("GetNewLongIntValue", &G4UIcmdWithALongInt::GetNewLongIntValue) 18 | .def("SetParameterName", &G4UIcmdWithALongInt::SetParameterName, py::arg("theName"), py::arg("omittable"), 19 | py::arg("currentAsDefault") = false) 20 | 21 | .def("SetDefaultValue", &G4UIcmdWithALongInt::SetDefaultValue); 22 | } 23 | -------------------------------------------------------------------------------- /source/intercoms/pyG4UIcmdWithAString.cc: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #include 5 | #include 6 | 7 | #include "typecast.hh" 8 | #include "opaques.hh" 9 | 10 | namespace py = pybind11; 11 | 12 | void export_G4UIcmdWithAString(py::module &m) 13 | { 14 | py::class_(m, "G4UIcmdWithAString") 15 | 16 | .def(py::init(), py::arg("theCommandPath"), py::arg("theMessenger")) 17 | .def("SetParameterName", &G4UIcmdWithAString::SetParameterName, py::arg("theName"), py::arg("omittable"), 18 | py::arg("currentAsDefault") = false) 19 | 20 | .def("SetCandidates", &G4UIcmdWithAString::SetCandidates) 21 | .def("SetDefaultValue", &G4UIcmdWithAString::SetDefaultValue); 22 | } 23 | -------------------------------------------------------------------------------- /source/intercoms/pyG4UIcmdWithAnInteger.cc: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #include 5 | #include 6 | 7 | #include "typecast.hh" 8 | #include "opaques.hh" 9 | 10 | namespace py = pybind11; 11 | 12 | void export_G4UIcmdWithAnInteger(py::module &m) 13 | { 14 | py::class_(m, "G4UIcmdWithAnInteger") 15 | 16 | .def(py::init(), py::arg("theCommandPath"), py::arg("theMessenger")) 17 | .def_static("GetNewIntValue", &G4UIcmdWithAnInteger::GetNewIntValue) 18 | .def("SetParameterName", &G4UIcmdWithAnInteger::SetParameterName, py::arg("theName"), py::arg("omittable"), 19 | py::arg("currentAsDefault") = false) 20 | 21 | .def("SetDefaultValue", &G4UIcmdWithAnInteger::SetDefaultValue); 22 | } 23 | -------------------------------------------------------------------------------- /source/intercoms/pyG4UIcmdWithoutParameter.cc: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #include 5 | #include 6 | 7 | #include "typecast.hh" 8 | #include "opaques.hh" 9 | 10 | namespace py = pybind11; 11 | 12 | void export_G4UIcmdWithoutParameter(py::module &m) 13 | { 14 | py::class_(m, "G4UIcmdWithoutParameter") 15 | 16 | .def(py::init(), py::arg("theCommandPath"), py::arg("theMessenger")); 17 | } 18 | -------------------------------------------------------------------------------- /source/intercoms/pyG4UIcommandStatus.cc: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #include 5 | 6 | #include "typecast.hh" 7 | #include "opaques.hh" 8 | 9 | namespace py = pybind11; 10 | 11 | void export_G4UIcommandStatus(py::module &m) 12 | { 13 | py::enum_(m, "G4UIcommandStatus") 14 | .value("fCommandSucceeded", fCommandSucceeded) 15 | .value("fCommandNotFound", fCommandNotFound) 16 | .value("fIllegalApplicationState", fIllegalApplicationState) 17 | .value("fParameterOutOfRange", fParameterOutOfRange) 18 | .value("fParameterUnreadable", fParameterUnreadable) 19 | .value("fParameterOutOfCandidates", fParameterOutOfCandidates) 20 | .value("fAliasNotFound", fAliasNotFound) 21 | .export_values(); 22 | } 23 | -------------------------------------------------------------------------------- /source/intercoms/pyG4UIcommandTree.cc: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #include 5 | 6 | #include "typecast.hh" 7 | #include "opaques.hh" 8 | 9 | namespace py = pybind11; 10 | 11 | void export_G4UIcommandTree(py::module &m) 12 | { 13 | py::class_(m, "G4UIcommandTree", "UI command tree") 14 | 15 | .def(py::init()) 16 | 17 | .def("FindPath", &G4UIcommandTree::FindPath, py::return_value_policy::reference) 18 | .def("List", &G4UIcommandTree::List) 19 | .def("ListCurrent", &G4UIcommandTree::ListCurrent) 20 | .def("ListCurrentWithNum", &G4UIcommandTree::ListCurrentWithNum) 21 | .def("CreateHTML", &G4UIcommandTree::CreateHTML) 22 | .def("GetGuidance", &G4UIcommandTree::GetGuidance, py::return_value_policy::reference) 23 | .def("GetPathName", &G4UIcommandTree::GetPathName) 24 | 25 | .def("GetTreeEntry", &G4UIcommandTree::GetTreeEntry) 26 | .def("GetCommandEntry", &G4UIcommandTree::GetCommandEntry) 27 | .def("GetTree", py::overload_cast(&G4UIcommandTree::GetTree), py::return_value_policy::reference) 28 | .def("GetTree", py::overload_cast(&G4UIcommandTree::GetTree), py::return_value_policy::reference) 29 | .def("GetCommand", &G4UIcommandTree::GetCommand, py::return_value_policy::reference) 30 | 31 | .def("GetTitle", &G4UIcommandTree::GetTitle); 32 | } 33 | -------------------------------------------------------------------------------- /source/intercoms/pyG4UIdirectory.cc: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #include 5 | 6 | #include "typecast.hh" 7 | #include "opaques.hh" 8 | 9 | namespace py = pybind11; 10 | 11 | void export_G4UIdirectory(py::module &m) 12 | { 13 | py::class_(m, "G4UIdirectory") 14 | .def(py::init(), py::arg("theCommandPath"), py::arg("commandsToBeBroadcasted") = true) 15 | .def(py::init(), py::arg("theCommandPath"), py::arg("commandsToBeBroadcasted") = true); 16 | } 17 | -------------------------------------------------------------------------------- /source/intercoms/pyG4UImessenger.cc: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | #include 6 | 7 | #include "typecast.hh" 8 | #include "opaques.hh" 9 | 10 | namespace py = pybind11; 11 | 12 | class PyG4UImessenger : public G4UImessenger { 13 | 14 | public: 15 | using G4UImessenger::G4UImessenger; 16 | 17 | G4String GetCurrentValue(G4UIcommand *command) override 18 | { 19 | PYBIND11_OVERRIDE(G4String, G4UImessenger, GetCurrentValue, command); 20 | } 21 | 22 | void SetNewValue(G4UIcommand *command, G4String newValue) override 23 | { 24 | PYBIND11_OVERRIDE(void, G4UImessenger, SetNewValue, command, newValue); 25 | } 26 | }; 27 | 28 | void export_G4UImessenger(py::module &m) 29 | { 30 | py::class_(m, "G4UImessenger") 31 | .def(py::init<>()) 32 | .def(py::init(), py::arg("path"), py::arg("dsc"), 33 | py::arg("commandsToBeBroadcasted") = true) 34 | 35 | .def("GetCurrentValue", &G4UImessenger::GetCurrentValue) 36 | .def("SetNewValue", &G4UImessenger::SetNewValue) 37 | .def("CommandsShouldBeInMaster", &G4UImessenger::CommandsShouldBeInMaster); 38 | } 39 | -------------------------------------------------------------------------------- /source/intercoms/pyG4UIparameter.cc: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #include 5 | 6 | #include "typecast.hh" 7 | #include "opaques.hh" 8 | 9 | namespace py = pybind11; 10 | 11 | void export_G4UIparameter(py::module &m) 12 | { 13 | py::class_(m, "G4UIparameter", "UI parameter") 14 | 15 | .def(py::init<>()) 16 | .def(py::init()) 17 | .def(py::init()) 18 | 19 | .def("List", &G4UIparameter::List) 20 | .def("GetDefaultValue", &G4UIparameter::GetDefaultValue) 21 | .def("GetParameterType", &G4UIparameter::GetParameterType) 22 | .def("GetParameterRange", &G4UIparameter::GetParameterRange) 23 | .def("GetParameterName", &G4UIparameter::GetParameterName) 24 | .def("GetParameterCandidates", &G4UIparameter::GetParameterCandidates) 25 | .def("IsOmittable", &G4UIparameter::IsOmittable) 26 | .def("GetCurrentAsDefault", &G4UIparameter::GetCurrentAsDefault) 27 | .def("GetParameterGuidance", &G4UIparameter::GetParameterGuidance); 28 | } 29 | -------------------------------------------------------------------------------- /source/interface/pymodG4interface.cc: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #include "typecast.hh" 5 | #include "opaques.hh" 6 | 7 | namespace py = pybind11; 8 | 9 | void export_G4VUIshell(py::module &); 10 | void export_G4UIExecutive(py::module &); 11 | 12 | void export_modG4interface(py::module &m) 13 | { 14 | export_G4VUIshell(m); 15 | export_G4UIExecutive(m); 16 | } 17 | -------------------------------------------------------------------------------- /source/materials/pyG4AtomicFormFactor.cc: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #include 5 | 6 | #include "typecast.hh" 7 | #include "opaques.hh" 8 | 9 | namespace py = pybind11; 10 | 11 | void export_G4AtomicFormFactor(py::module &m) 12 | { 13 | py::class_(m, "G4AtomicFormFactor") 14 | 15 | .def("__copy__", [](const G4AtomicFormFactor &self) { return new G4AtomicFormFactor(self); }) 16 | .def("__deepcopy__", [](const G4AtomicFormFactor &self, py::dict) { return new G4AtomicFormFactor(self); }) 17 | .def("Get", &G4AtomicFormFactor::Get, py::arg("kScatteringVector"), py::arg("Z"), py::arg("charge") = 0) 18 | .def_static("GetManager", &G4AtomicFormFactor::GetManager, py::return_value_policy::reference); 19 | } 20 | -------------------------------------------------------------------------------- /source/materials/pyG4AtomicShells.cc: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #include 5 | 6 | #include "typecast.hh" 7 | #include "opaques.hh" 8 | 9 | namespace py = pybind11; 10 | 11 | void export_G4AtomicShells(py::module &m) 12 | { 13 | py::class_(m, "G4AtomicShells") 14 | 15 | .def_static("GetBindingEnergy", &G4AtomicShells::GetBindingEnergy, py::arg("Z"), py::arg("SubshellNb")) 16 | .def_static("GetNumberOfElectrons", &G4AtomicShells::GetNumberOfElectrons, py::arg("Z"), py::arg("SubshellNb")) 17 | .def_static("GetNumberOfFreeElectrons", &G4AtomicShells::GetNumberOfFreeElectrons, py::arg("Z"), py::arg("th")) 18 | .def_static("GetNumberOfShells", &G4AtomicShells::GetNumberOfShells, py::arg("Z")) 19 | .def_static("GetTotalBindingEnergy", &G4AtomicShells::GetTotalBindingEnergy, py::arg("Z")); 20 | } 21 | -------------------------------------------------------------------------------- /source/materials/pyG4AtomicShells_XDB_EADL.cc: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #include 5 | 6 | #include "typecast.hh" 7 | #include "opaques.hh" 8 | 9 | namespace py = pybind11; 10 | 11 | void export_G4AtomicShells_XDB_EADL(py::module &m) 12 | { 13 | py::class_(m, "G4AtomicShells_XDB_EADL") 14 | 15 | .def_static("GetBindingEnergy", &G4AtomicShells_XDB_EADL::GetBindingEnergy, py::arg("Z"), py::arg("SubshellNb")) 16 | .def_static("GetNumberOfElectrons", &G4AtomicShells_XDB_EADL::GetNumberOfElectrons, py::arg("Z"), 17 | py::arg("SubshellNb")) 18 | .def_static("GetNumberOfFreeElectrons", &G4AtomicShells_XDB_EADL::GetNumberOfFreeElectrons, py::arg("Z"), 19 | py::arg("th")) 20 | .def_static("GetNumberOfShells", &G4AtomicShells_XDB_EADL::GetNumberOfShells, py::arg("Z")) 21 | .def_static("GetTotalBindingEnergy", &G4AtomicShells_XDB_EADL::GetTotalBindingEnergy, py::arg("Z")); 22 | } 23 | -------------------------------------------------------------------------------- /source/materials/pyG4CrystalAtomBase.cc: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #include 5 | 6 | #include "typecast.hh" 7 | #include "opaques.hh" 8 | 9 | namespace py = pybind11; 10 | 11 | void export_G4CrystalAtomBase(py::module &m) 12 | { 13 | py::class_(m, "G4CrystalAtomBase") 14 | 15 | .def("__copy__", [](const G4CrystalAtomBase &self) { return new G4CrystalAtomBase(self); }) 16 | .def("__deepcopy__", [](const G4CrystalAtomBase &self, py::dict) { return new G4CrystalAtomBase(self); }) 17 | .def(py::init<>()) 18 | .def(py::init(), py::arg("apos")) 19 | .def("AddPos", &G4CrystalAtomBase::AddPos, py::arg("a3vec")) 20 | .def("DelPos", &G4CrystalAtomBase::DelPos, py::arg("idx")) 21 | .def("GetPos", py::overload_cast<>(&G4CrystalAtomBase::GetPos)) 22 | .def("GetPos", py::overload_cast(&G4CrystalAtomBase::GetPos), py::arg("idx")) 23 | .def("SetPos", &G4CrystalAtomBase::SetPos, py::arg("a3vecvec")); 24 | } 25 | -------------------------------------------------------------------------------- /source/materials/pyG4DensityEffectCalculator.cc: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #include 5 | #include 6 | 7 | #include "typecast.hh" 8 | #include "opaques.hh" 9 | 10 | namespace py = pybind11; 11 | 12 | void export_G4DensityEffectCalculator(py::module &m) 13 | { 14 | py::class_(m, "G4DensityEffectCalculator") 15 | 16 | .def("__copy__", [](const G4DensityEffectCalculator &self) { return new G4DensityEffectCalculator(self); }) 17 | .def("__deepcopy__", 18 | [](const G4DensityEffectCalculator &self, py::dict) { return new G4DensityEffectCalculator(self); }) 19 | 20 | .def(py::init()) 21 | .def("ComputeDensityCorrection", &G4DensityEffectCalculator::ComputeDensityCorrection, py::arg("x")); 22 | } 23 | -------------------------------------------------------------------------------- /source/materials/pyG4ElementTable.cc: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | #include 6 | 7 | #include "typecast.hh" 8 | #include "opaques.hh" 9 | 10 | namespace py = pybind11; 11 | 12 | void export_G4ElementTable(py::module &m) 13 | { 14 | py::bind_vector(m, "G4ElementTable"); 15 | 16 | m.attr("G4ElementVector") = m.attr("G4ElementTable"); 17 | } 18 | -------------------------------------------------------------------------------- /source/materials/pyG4IonisParamElm.cc: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #include 5 | 6 | #include "typecast.hh" 7 | #include "opaques.hh" 8 | 9 | namespace py = pybind11; 10 | 11 | void export_G4IonisParamElm(py::module &m) 12 | { 13 | py::class_(m, "G4IonisParamElm") 14 | 15 | .def(py::init(), py::arg("Z")) 16 | .def("GetAlow", &G4IonisParamElm::GetAlow) 17 | .def("GetBlow", &G4IonisParamElm::GetBlow) 18 | .def("GetClow", &G4IonisParamElm::GetClow) 19 | .def("GetFermiVelocity", &G4IonisParamElm::GetFermiVelocity) 20 | .def("GetLFactor", &G4IonisParamElm::GetLFactor) 21 | .def("GetMeanExcitationEnergy", &G4IonisParamElm::GetMeanExcitationEnergy) 22 | .def("GetShellCorrectionVector", &G4IonisParamElm::GetShellCorrectionVector, py::return_value_policy::reference) 23 | .def("GetTau0", &G4IonisParamElm::GetTau0) 24 | .def("GetTaul", &G4IonisParamElm::GetTaul) 25 | .def("GetZ", &G4IonisParamElm::GetZ) 26 | .def("GetZ3", &G4IonisParamElm::GetZ3) 27 | .def("GetZZ3", &G4IonisParamElm::GetZZ3) 28 | .def("GetlogZ3", &G4IonisParamElm::GetlogZ3); 29 | } 30 | -------------------------------------------------------------------------------- /source/materials/pyG4MaterialPropertyVector.cc: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #include "typecast.hh" 5 | #include "opaques.hh" 6 | 7 | namespace py = pybind11; 8 | 9 | void export_G4MaterialPropertyVector(py::module &m) 10 | { 11 | m.attr("G4MaterialPropertyVector") = m.attr("G4PhysicsFreeVector"); 12 | } -------------------------------------------------------------------------------- /source/materials/pyG4MaterialTable.cc: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | #include 6 | 7 | #include "typecast.hh" 8 | #include "opaques.hh" 9 | 10 | namespace py = pybind11; 11 | 12 | void export_G4MaterialTable(py::module &m) 13 | { 14 | py::bind_vector(m, "G4MaterialTable"); 15 | } 16 | -------------------------------------------------------------------------------- /source/materials/pyG4MicroElecSiStructure.cc: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #include 5 | 6 | #include "typecast.hh" 7 | #include "opaques.hh" 8 | 9 | namespace py = pybind11; 10 | 11 | void export_G4MicroElecSiStructure(py::module &m) 12 | { 13 | py::class_(m, "G4MicroElecSiStructure") 14 | 15 | .def("__copy__", [](const G4MicroElecSiStructure &self) { return new G4MicroElecSiStructure(self); }) 16 | .def("__deepcopy__", 17 | [](const G4MicroElecSiStructure &self, py::dict) { return new G4MicroElecSiStructure(self); }) 18 | 19 | .def(py::init<>()) 20 | .def("Energy", &G4MicroElecSiStructure::Energy, py::arg("level")) 21 | .def("NumberOfLevels", &G4MicroElecSiStructure::NumberOfLevels); 22 | } 23 | -------------------------------------------------------------------------------- /source/materials/pyG4NistMessenger.cc: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | 9 | #include "typecast.hh" 10 | #include "opaques.hh" 11 | 12 | namespace py = pybind11; 13 | 14 | class PyG4NistMessenger : public G4NistMessenger, public py::trampoline_self_life_support { 15 | public: 16 | using G4NistMessenger::G4NistMessenger; 17 | 18 | G4String GetCurrentValue(G4UIcommand *command) override 19 | { 20 | PYBIND11_OVERRIDE(G4String, G4NistMessenger, GetCurrentValue, command); 21 | } 22 | }; 23 | 24 | void export_G4NistMessenger(py::module &m) 25 | { 26 | py::class_(m, "G4NistMessenger") 27 | 28 | .def("__copy__", [](const PyG4NistMessenger &self) { return new PyG4NistMessenger(self); }) 29 | .def("__deepcopy__", [](const PyG4NistMessenger &self, py::dict) { return new PyG4NistMessenger(self); }) 30 | .def("__copy__", [](const G4NistMessenger &self) { return new G4NistMessenger(self); }) 31 | .def("__deepcopy__", [](const G4NistMessenger &self, py::dict) { return new G4NistMessenger(self); }) 32 | .def(py::init()) 33 | .def("SetNewValue", &G4NistMessenger::SetNewValue); 34 | } 35 | -------------------------------------------------------------------------------- /source/materials/pyG4OpticalMaterialProperties.cc: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #include "typecast.hh" 5 | #include "opaques.hh" 6 | 7 | namespace py = pybind11; 8 | 9 | namespace G4OpticalMaterialProperties { 10 | 11 | void ConvertToEnergy(std::vector &wavelength); 12 | G4MaterialPropertyVector *GetRefractiveIndex(const G4String &material); 13 | G4MaterialPropertyVector *GetProperty(const G4String &key, const G4String &mat); 14 | 15 | } // namespace G4OpticalMaterialProperties 16 | 17 | void export_G4OpticalMaterialProperties(py::module &m) 18 | { 19 | struct ScopedG4OpticalMaterialProperties {}; 20 | 21 | py::class_(m, "G4OpticalMaterialProperties") 22 | 23 | .def_static("ConvertToEnergy", &G4OpticalMaterialProperties::ConvertToEnergy, py::arg("wavelength")) 24 | .def_static("GetProperty", &G4OpticalMaterialProperties::GetProperty, py::arg("key"), py::arg("mat"), 25 | py::return_value_policy::reference) 26 | 27 | .def_static("GetRefractiveIndex", &G4OpticalMaterialProperties::GetRefractiveIndex, py::arg("material"), 28 | py::return_value_policy::reference); 29 | } 30 | -------------------------------------------------------------------------------- /source/materials/pyG4VMaterialExtension.cc: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #include 5 | 6 | #include "typecast.hh" 7 | #include "opaques.hh" 8 | 9 | namespace py = pybind11; 10 | 11 | class PyG4VMaterialExtension : public G4VMaterialExtension, public py::trampoline_self_life_support { 12 | public: 13 | using G4VMaterialExtension::G4VMaterialExtension; 14 | 15 | void Print() const override { PYBIND11_OVERRIDE_PURE(void, G4VMaterialExtension, Print, ); } 16 | }; 17 | 18 | void export_G4VMaterialExtension(py::module &m) 19 | { 20 | py::class_(m, "G4VMaterialExtension") 21 | 22 | .def("__copy__", [](const PyG4VMaterialExtension &self) { return new PyG4VMaterialExtension(self); }) 23 | .def("__deepcopy__", 24 | [](const PyG4VMaterialExtension &self, py::dict) { return new PyG4VMaterialExtension(self); }) 25 | 26 | .def(py::init(), py::arg("name")) 27 | .def("GetHash", &G4VMaterialExtension::GetHash) 28 | .def("GetName", &G4VMaterialExtension::GetName) 29 | .def("Print", &G4VMaterialExtension::Print); 30 | } 31 | -------------------------------------------------------------------------------- /source/opaques.hh: -------------------------------------------------------------------------------- 1 | #ifndef OPAQUES_HH 2 | #define OPAQUES_HH 3 | 4 | #include 5 | 6 | #include 7 | #include 8 | #include 9 | 10 | #include 11 | #include 12 | #include 13 | 14 | #include 15 | #include 16 | 17 | PYBIND11_MAKE_OPAQUE(G4MaterialTable); 18 | PYBIND11_MAKE_OPAQUE(G4ElementTable); 19 | PYBIND11_MAKE_OPAQUE(G4IsotopeTable); 20 | 21 | typedef std::vector G4ProcVector; 22 | 23 | PYBIND11_MAKE_OPAQUE(G4ProcVector); 24 | 25 | PYBIND11_MAKE_OPAQUE(G4UnitsTable); 26 | PYBIND11_MAKE_OPAQUE(G4UnitsContainer); 27 | 28 | PYBIND11_MAKE_OPAQUE(TrajectoryVector); 29 | 30 | typedef std::vector G4intVector; 31 | typedef std::vector G4doubleVector; 32 | typedef std::vector G4StringVector; 33 | typedef std::vector G4ThreeVectorVector; 34 | typedef std::vector G4TwoVectorVector; 35 | 36 | PYBIND11_MAKE_OPAQUE(G4intVector); 37 | PYBIND11_MAKE_OPAQUE(G4doubleVector); 38 | PYBIND11_MAKE_OPAQUE(G4StringVector); 39 | PYBIND11_MAKE_OPAQUE(G4ThreeVectorVector); 40 | PYBIND11_MAKE_OPAQUE(G4TwoVectorVector); 41 | 42 | #ifdef G4_HAS_GDML 43 | #include 44 | PYBIND11_MAKE_OPAQUE(G4GDMLAuxListType); 45 | #endif // G4_HAS_GDML 46 | 47 | #endif // OPAQUES_HH 48 | -------------------------------------------------------------------------------- /source/particles/pyG4DecayTable.cc: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | #include 6 | 7 | #include "typecast.hh" 8 | #include "opaques.hh" 9 | 10 | namespace py = pybind11; 11 | 12 | void export_G4DecayTable(py::module &m) 13 | { 14 | py::class_(m, "G4DecayTable", "decay table") 15 | .def(py::init<>()) 16 | 17 | .def(py::self == py::self) 18 | .def(py::self != py::self) 19 | 20 | .def("Insert", &G4DecayTable::Insert) 21 | .def("entries", &G4DecayTable::entries) 22 | .def("SelectADecayChannel", &G4DecayTable::SelectADecayChannel, py::arg("parentMass") = -1., 23 | py::return_value_policy::reference_internal) 24 | 25 | .def("GetDecayChannel", &G4DecayTable::SelectADecayChannel, py::arg("index"), 26 | py::return_value_policy::reference_internal) 27 | 28 | .def("__getitem__", &G4DecayTable::operator[], py::is_operator()) 29 | .def("DumpInfo", &G4DecayTable::DumpInfo); 30 | } 31 | -------------------------------------------------------------------------------- /source/particles/pyG4Leptons.cc: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include 16 | #include 17 | 18 | #include "typecast.hh" 19 | #include "opaques.hh" 20 | 21 | namespace py = pybind11; 22 | 23 | #define ADD_LEPTON(name) \ 24 | py::class_(m, "G4" #name) \ 25 | .def_static("Definition", &G4##name::Definition, py::return_value_policy::reference) \ 26 | .def_static(#name "Definition", &G4##name::name##Definition, py::return_value_policy::reference) \ 27 | .def_static(#name, &G4##name::name, py::return_value_policy::reference) 28 | 29 | void export_G4Leptons(py::module &m) 30 | { 31 | ADD_LEPTON(AntiNeutrinoE); 32 | ADD_LEPTON(AntiNeutrinoMu); 33 | ADD_LEPTON(AntiNeutrinoTau); 34 | ADD_LEPTON(Electron); 35 | // ADD_LEPTON(LeptonConstructor); 36 | ADD_LEPTON(MuonMinus); 37 | ADD_LEPTON(MuonPlus); 38 | ADD_LEPTON(NeutrinoE); 39 | ADD_LEPTON(NeutrinoMu); 40 | ADD_LEPTON(NeutrinoTau); 41 | ADD_LEPTON(Positron); 42 | ADD_LEPTON(TauMinus); 43 | ADD_LEPTON(TauPlus); 44 | } 45 | -------------------------------------------------------------------------------- /source/particles/pyG4PrimaryVertex.cc: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #include 5 | 6 | #include "typecast.hh" 7 | #include "opaques.hh" 8 | 9 | namespace py = pybind11; 10 | 11 | void export_G4PrimaryVertex(py::module &m) 12 | { 13 | py::class_(m, "G4PrimaryVertex", "primary vertex") 14 | .def(py::init<>()) 15 | .def(py::init()) 16 | .def(py::init()) 17 | 18 | .def_property_readonly("X0", &G4PrimaryVertex::GetX0) 19 | .def_property_readonly("Y0", &G4PrimaryVertex::GetY0) 20 | .def_property_readonly("Z0", &G4PrimaryVertex::GetZ0) 21 | .def_property_readonly("T0", &G4PrimaryVertex::GetT0) 22 | 23 | .def("GetPosition", &G4PrimaryVertex::GetPosition) 24 | .def("GetX0", &G4PrimaryVertex::GetX0) 25 | .def("GetY0", &G4PrimaryVertex::GetY0) 26 | .def("GetZ0", &G4PrimaryVertex::GetZ0) 27 | .def("GetT0", &G4PrimaryVertex::GetT0) 28 | .def("GetNumberOfParticle", &G4PrimaryVertex::GetNumberOfParticle) 29 | .def("GetPrimary", &G4PrimaryVertex::GetPrimary, py::arg("i") = 0, py::return_value_policy::reference_internal) 30 | .def("SetPrimary", &G4PrimaryVertex::SetPrimary) 31 | .def("GetWeight", &G4PrimaryVertex::GetWeight) 32 | .def("SetWeight", &G4PrimaryVertex::SetWeight) 33 | .def("Print", &G4PrimaryVertex::Print); 34 | } 35 | -------------------------------------------------------------------------------- /source/particles/pymodG4particles.cc: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #include "typecast.hh" 5 | #include "opaques.hh" 6 | 7 | namespace py = pybind11; 8 | 9 | void export_G4ParticleDefinition(py::module &); 10 | void export_G4DynamicParticle(py::module &); 11 | void export_G4ParticleTable(py::module &); 12 | void export_G4DecayTable(py::module &); 13 | void export_G4PrimaryParticle(py::module &); 14 | void export_G4PrimaryVertex(py::module &); 15 | void export_PyG4ParticleList(py::module &); 16 | void export_G4Adjoint(py::module &); 17 | void export_G4Barions(py::module &); 18 | void export_G4Bosons(py::module &); 19 | void export_G4Ions(py::module &); 20 | void export_G4Leptons(py::module &); 21 | void export_G4Mesons(py::module &); 22 | void export_G4IonTable(py::module &); 23 | 24 | void export_modG4particles(py::module &m) 25 | { 26 | export_G4ParticleDefinition(m); 27 | export_G4DynamicParticle(m); 28 | export_G4ParticleTable(m); 29 | export_G4DecayTable(m); 30 | export_G4PrimaryParticle(m); 31 | export_G4PrimaryVertex(m); 32 | export_PyG4ParticleList(m); 33 | export_G4Adjoint(m); 34 | export_G4Barions(m); 35 | export_G4Bosons(m); 36 | export_G4Ions(m); 37 | export_G4Leptons(m); 38 | export_G4Mesons(m); 39 | export_G4IonTable(m); 40 | } 41 | -------------------------------------------------------------------------------- /source/persistency/pyG4GDMLAuxStructType.cc: -------------------------------------------------------------------------------- 1 | #ifdef G4_HAS_GDML 2 | 3 | #include 4 | #include 5 | #include 6 | 7 | #include 8 | 9 | #include "typecast.hh" 10 | #include "opaques.hh" 11 | 12 | namespace py = pybind11; 13 | 14 | void export_G4GDMLAuxStructType(py::module &m) 15 | { 16 | py::class_(m, "G4GDMLAuxStructType") 17 | 18 | .def(py::init<>()) 19 | .def("__copy__", [](const G4GDMLAuxStructType &self) { return new G4GDMLAuxStructType(self); }) 20 | .def("__deepcopy__", [](const G4GDMLAuxStructType &self, py::dict) { return new G4GDMLAuxStructType(self); }) 21 | .def_readwrite("auxList", &G4GDMLAuxStructType::auxList) 22 | .def_readwrite("type", &G4GDMLAuxStructType::type) 23 | .def_readwrite("unit", &G4GDMLAuxStructType::unit) 24 | .def_readwrite("value", &G4GDMLAuxStructType::value); 25 | 26 | py::bind_vector(m, "G4GDMLAuxListType"); 27 | } 28 | 29 | #endif // G4_HAS_GDML 30 | -------------------------------------------------------------------------------- /source/persistency/pymodG4persistency.cc: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #include "typecast.hh" 5 | #include "opaques.hh" 6 | 7 | namespace py = pybind11; 8 | 9 | #ifdef G4_HAS_GDML 10 | void export_G4GDMLAuxStructType(py::module &); 11 | void export_G4GDMLParser(py::module &); 12 | #endif 13 | 14 | void export_modG4persistency(py::module &m) 15 | { 16 | #ifdef G4_HAS_GDML 17 | export_G4GDMLAuxStructType(m); 18 | export_G4GDMLParser(m); 19 | #endif 20 | } 21 | -------------------------------------------------------------------------------- /source/physics_lists/pyG4DecayPhysics.cc: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | 10 | #include "typecast.hh" 11 | #include "opaques.hh" 12 | 13 | namespace py = pybind11; 14 | 15 | #define ADD_DECAY_PHYSICS(name) \ 16 | py::class_(m, #name) \ 17 | .def(py::init<>()) \ 18 | .def("ConstructParticle", &name::ConstructParticle) \ 19 | .def("ConstructProcess", &name::ConstructProcess) 20 | 21 | void export_G4DecayPhysics(py::module &m) 22 | { 23 | ADD_DECAY_PHYSICS(G4DecayPhysics); 24 | ADD_DECAY_PHYSICS(G4MuonicAtomDecayPhysics); 25 | ADD_DECAY_PHYSICS(G4RadioactiveDecayPhysics); 26 | ADD_DECAY_PHYSICS(G4SpinDecayPhysics); 27 | ADD_DECAY_PHYSICS(G4UnknownDecayPhysics); 28 | } 29 | -------------------------------------------------------------------------------- /source/physics_lists/pyG4FastSimulationPhysics.cc: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #include 5 | 6 | #include "typecast.hh" 7 | #include "opaques.hh" 8 | 9 | namespace py = pybind11; 10 | 11 | class PyG4FastSimulationPhysics : public G4FastSimulationPhysics, public py::trampoline_self_life_support { 12 | public: 13 | using G4FastSimulationPhysics::G4FastSimulationPhysics; 14 | 15 | void ConstructParticle() override { PYBIND11_OVERRIDE(void, G4FastSimulationPhysics, ConstructParticle, ); } 16 | 17 | void ConstructProcess() override { PYBIND11_OVERRIDE(void, G4FastSimulationPhysics, ConstructProcess, ); } 18 | }; 19 | 20 | void export_G4FastSimulationPhysics(py::module &m) 21 | { 22 | py::class_(m, "G4FastSimulationPhysics") 23 | 24 | .def(py::init(), py::arg("name") = "FastSimP") 25 | 26 | .def("ConstructParticle", &G4FastSimulationPhysics::ConstructParticle) 27 | .def("ConstructProcess", &G4FastSimulationPhysics::ConstructProcess) 28 | 29 | .def("ActivateFastSimulation", &G4FastSimulationPhysics::ActivateFastSimulation, py::arg("particleName"), 30 | py::arg("parallelGeometryName") = "") 31 | .def("BeVerbose", &G4FastSimulationPhysics::BeVerbose); 32 | } 33 | -------------------------------------------------------------------------------- /source/physics_lists/pyG4GammaLeptoNuclearPhysics.cc: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #include 5 | 6 | #include "typecast.hh" 7 | #include "opaques.hh" 8 | 9 | namespace py = pybind11; 10 | 11 | void export_G4GLNPhysics(py::module &m) 12 | { 13 | py::class_(m, "G4EmExtraPhysics") 14 | .def(py::init<>()) 15 | .def("ConstructParticle", &G4EmExtraPhysics::ConstructParticle) 16 | .def("ConstructProcess", &G4EmExtraPhysics::ConstructProcess); 17 | } 18 | -------------------------------------------------------------------------------- /source/physics_lists/pyG4ImportanceBiasing.cc: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #include 5 | 6 | #include "typecast.hh" 7 | #include "opaques.hh" 8 | 9 | namespace py = pybind11; 10 | 11 | class PyG4ImportanceBiasing : public G4ImportanceBiasing, public py::trampoline_self_life_support { 12 | public: 13 | using G4ImportanceBiasing::G4ImportanceBiasing; 14 | 15 | void ConstructParticle() override { PYBIND11_OVERRIDE(void, G4ImportanceBiasing, ConstructParticle, ); } 16 | 17 | void ConstructProcess() override { PYBIND11_OVERRIDE(void, G4ImportanceBiasing, ConstructProcess, ); } 18 | }; 19 | 20 | void export_G4ImportanceBiasing(py::module &m) 21 | { 22 | py::class_(m, "G4ImportanceBiasing") 23 | 24 | .def(py::init(), py::arg("name") = "NoParallelWP") 25 | .def(py::init(), py::arg("msg"), py::arg("name") = "NoParallelWP") 26 | 27 | .def("ConstructParticle", &G4ImportanceBiasing::ConstructParticle) 28 | .def("ConstructProcess", &G4ImportanceBiasing::ConstructProcess); 29 | } 30 | -------------------------------------------------------------------------------- /source/physics_lists/pyG4IonPhysics.cc: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | 11 | #include "typecast.hh" 12 | #include "opaques.hh" 13 | 14 | namespace py = pybind11; 15 | 16 | #define ADD_ION_PHYSICS(name) \ 17 | py::class_(m, #name) \ 18 | .def(py::init<>()) \ 19 | .def("ConstructParticle", &name::ConstructParticle) \ 20 | .def("ConstructProcess", &name::ConstructProcess) 21 | 22 | void export_G4IonPhysics(py::module &m) 23 | { 24 | ADD_ION_PHYSICS(G4IonBinaryCascadePhysics); 25 | ADD_ION_PHYSICS(G4IonINCLXXPhysics); 26 | ADD_ION_PHYSICS(G4IonPhysics); 27 | ADD_ION_PHYSICS(G4IonPhysicsPHP); 28 | ADD_ION_PHYSICS(G4IonPhysicsXS); 29 | ADD_ION_PHYSICS(G4IonQMDPhysics); 30 | } 31 | -------------------------------------------------------------------------------- /source/physics_lists/pyG4NeutronTrackingCut.cc: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #include 5 | #include 6 | 7 | #include "typecast.hh" 8 | #include "opaques.hh" 9 | 10 | namespace py = pybind11; 11 | 12 | class PyG4NeutronTrackingCut : public G4NeutronTrackingCut, public py::trampoline_self_life_support { 13 | public: 14 | using G4NeutronTrackingCut::G4NeutronTrackingCut; 15 | 16 | void ConstructParticle() override { PYBIND11_OVERRIDE(void, G4NeutronTrackingCut, ConstructParticle, ); } 17 | 18 | void ConstructProcess() override { PYBIND11_OVERRIDE(void, G4NeutronTrackingCut, ConstructProcess, ); } 19 | }; 20 | 21 | void export_G4NeutronTrackingCut(py::module &m) 22 | { 23 | py::class_(m, "G4NeutronTrackingCut") 24 | 25 | .def(py::init(), py::arg("ver") = 0) 26 | .def(py::init(), py::arg("name"), py::arg("ver") = 0) 27 | 28 | .def("ConstructParticle", &G4NeutronTrackingCut::ConstructParticle) 29 | .def("ConstructProcess", &G4NeutronTrackingCut::ConstructProcess) 30 | 31 | .def("SetTimeLimit", &G4NeutronTrackingCut::SetTimeLimit) 32 | .def("SetKineticEnergyLimit", &G4NeutronTrackingCut::SetKineticEnergyLimit); 33 | } 34 | -------------------------------------------------------------------------------- /source/physics_lists/pyG4ParallelWorldPhysics.cc: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #include 5 | 6 | #include "typecast.hh" 7 | #include "opaques.hh" 8 | 9 | namespace py = pybind11; 10 | 11 | class PyG4ParallelWorldPhysics : public G4ParallelWorldPhysics, py::trampoline_self_life_support { 12 | public: 13 | using G4ParallelWorldPhysics::G4ParallelWorldPhysics; 14 | 15 | void ConstructParticle() override { PYBIND11_OVERRIDE(void, G4ParallelWorldPhysics, ConstructParticle, ); } 16 | 17 | void ConstructProcess() override { PYBIND11_OVERRIDE(void, G4ParallelWorldPhysics, ConstructProcess, ); } 18 | }; 19 | 20 | void export_G4ParallelWorldPhysics(py::module &m) 21 | { 22 | py::class_(m, "G4ParallelWorldPhysics") 23 | 24 | .def(py::init(), py::arg("name") = "ParallelWP", py::arg("layerdMass") = false) 25 | 26 | .def("ConstructParticle", &G4ParallelWorldPhysics::ConstructParticle) 27 | .def("ConstructProcess", &G4ParallelWorldPhysics::ConstructProcess); 28 | } 29 | -------------------------------------------------------------------------------- /source/physics_lists/pyG4StepLimiterPhysics.cc: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #include 5 | 6 | #include "typecast.hh" 7 | #include "opaques.hh" 8 | 9 | namespace py = pybind11; 10 | 11 | class PyG4StepLimiterPhysics : public G4StepLimiterPhysics, public py::trampoline_self_life_support { 12 | public: 13 | using G4StepLimiterPhysics::G4StepLimiterPhysics; 14 | 15 | void ConstructParticle() override { PYBIND11_OVERRIDE(void, G4StepLimiterPhysics, ConstructParticle, ); } 16 | 17 | void ConstructProcess() override { PYBIND11_OVERRIDE(void, G4StepLimiterPhysics, ConstructProcess, ); } 18 | }; 19 | 20 | void export_G4StepLimiterPhysics(py::module &m) 21 | { 22 | py::class_(m, "G4StepLimiterPhysics") 23 | 24 | .def(py::init(), py::arg("name") = "stepLimiter") 25 | 26 | .def("ConstructParticle", &G4StepLimiterPhysics::ConstructParticle) 27 | .def("ConstructProcess", &G4StepLimiterPhysics::ConstructProcess) 28 | .def("SetApplyToAll", &G4StepLimiterPhysics::SetApplyToAll) 29 | .def("GetApplyToAll", &G4StepLimiterPhysics::GetApplyToAll); 30 | } 31 | -------------------------------------------------------------------------------- /source/physics_lists/pyG4StoppingPhysics.cc: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #include 5 | #include 6 | #include 7 | #if G4VERSION_NUMBER >= 1120 8 | #include 9 | #endif 10 | 11 | #include "typecast.hh" 12 | #include "opaques.hh" 13 | 14 | namespace py = pybind11; 15 | 16 | #define ADD_STOPPING_PHYSICS(name) \ 17 | py::class_(m, #name) \ 18 | .def(py::init<>()) \ 19 | .def("ConstructParticle", &name::ConstructParticle) \ 20 | .def("ConstructProcess", &name::ConstructProcess) 21 | 22 | void export_G4StoppingPhysics(py::module &m) 23 | { 24 | ADD_STOPPING_PHYSICS(G4StoppingPhysics); 25 | ADD_STOPPING_PHYSICS(G4StoppingPhysicsFritiofWithBinaryCascade); 26 | #if G4VERSION_NUMBER >= 1120 27 | ADD_STOPPING_PHYSICS(G4StoppingPhysicsWithINCLXX) 28 | .def("SetMuonMinusCapture", &G4StoppingPhysicsWithINCLXX::SetMuonMinusCapture); 29 | #endif 30 | } 31 | -------------------------------------------------------------------------------- /source/physics_lists/pyG4WeightWindowBiasing.cc: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #include 5 | 6 | #include "typecast.hh" 7 | #include "opaques.hh" 8 | 9 | namespace py = pybind11; 10 | 11 | class PyG4WeightWindowBiasing : public G4WeightWindowBiasing, public py::trampoline_self_life_support { 12 | public: 13 | using G4WeightWindowBiasing::G4WeightWindowBiasing; 14 | 15 | void ConstructParticle() override { PYBIND11_OVERRIDE(void, G4WeightWindowBiasing, ConstructParticle, ); } 16 | 17 | void ConstructProcess() override { PYBIND11_OVERRIDE(void, G4WeightWindowBiasing, ConstructProcess, ); } 18 | }; 19 | 20 | void export_G4WeightWindowBiasing(py::module &m) 21 | { 22 | py::class_(m, "G4WeightWindowBiasing") 23 | 24 | .def(py::init(), py::arg("name") = "NoParallelWP") 25 | .def(py::init(), 26 | py::arg("msg"), py::arg("wwAlg"), py::arg("placeOfAction"), py::arg("name") = "NoParallelWP") 27 | 28 | .def("ConstructParticle", &G4WeightWindowBiasing::ConstructParticle) 29 | .def("ConstructProcess", &G4WeightWindowBiasing::ConstructProcess); 30 | } 31 | -------------------------------------------------------------------------------- /source/physics_lists/pyPhysListFactory.cc: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #include 5 | 6 | #include "typecast.hh" 7 | #include "opaques.hh" 8 | 9 | namespace py = pybind11; 10 | 11 | void export_PhysListFactory(py::module &m) 12 | { 13 | py::class_(m, "G4PhysListFactory", "phys list factory") 14 | .def(py::init<>()) 15 | .def("GetReferencePhysList", &G4PhysListFactory::GetReferencePhysList, 16 | py::return_value_policy::reference_internal) 17 | 18 | .def("ReferencePhysList", &G4PhysListFactory::ReferencePhysList, py::return_value_policy::reference_internal) 19 | .def("IsReferencePhysList", &G4PhysListFactory::IsReferencePhysList) 20 | .def("AvailablePhysLists", &G4PhysListFactory::AvailablePhysLists) 21 | .def("AvailablePhysListsEM", &G4PhysListFactory::AvailablePhysListsEM) 22 | .def("SetVerbose", &G4PhysListFactory::SetVerbose, py::arg("val")); 23 | } 24 | -------------------------------------------------------------------------------- /source/physics_lists/pymodG4physicslists.cc: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #include "typecast.hh" 5 | #include "opaques.hh" 6 | 7 | namespace py = pybind11; 8 | 9 | void export_PhysicsLists(py::module &); 10 | void export_PhysListFactory(py::module &); 11 | void export_G4StepLimiterPhysics(py::module &); 12 | void export_G4DecayPhysics(py::module &); 13 | void export_G4EmPhysics(py::module &); 14 | void export_G4GLNPhysics(py::module &); 15 | void export_G4HadronElasticPhysics(py::module &); 16 | void export_G4HadronInelasticPhysics(py::module &); 17 | void export_G4IonPhysics(py::module &); 18 | void export_G4StoppingPhysics(py::module &); 19 | void export_G4WeightWindowBiasing(py::module &); 20 | void export_G4FastSimulationPhysics(py::module &); 21 | void export_G4GenericBiasingPhysics(py::module &); 22 | void export_G4ImportanceBiasing(py::module &); 23 | void export_G4ParallelWorldPhysics(py::module &); 24 | void export_G4NeutronTrackingCut(py::module &); 25 | 26 | void export_modG4physics_list(py::module &m) 27 | { 28 | export_PhysicsLists(m); 29 | export_PhysListFactory(m); 30 | export_G4StepLimiterPhysics(m); 31 | export_G4DecayPhysics(m); 32 | export_G4EmPhysics(m); 33 | export_G4GLNPhysics(m); 34 | export_G4HadronElasticPhysics(m); 35 | export_G4HadronInelasticPhysics(m); 36 | export_G4IonPhysics(m); 37 | export_G4StoppingPhysics(m); 38 | export_G4WeightWindowBiasing(m); 39 | export_G4FastSimulationPhysics(m); 40 | export_G4GenericBiasingPhysics(m); 41 | export_G4ImportanceBiasing(m); 42 | export_G4ParallelWorldPhysics(m); 43 | export_G4NeutronTrackingCut(m); 44 | } 45 | -------------------------------------------------------------------------------- /source/processes/pyG4CrossSectionHandler.cc: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #include 5 | 6 | #include "typecast.hh" 7 | #include "opaques.hh" 8 | 9 | namespace py = pybind11; 10 | 11 | void export_G4CrossSectionHandler(py::module &m) 12 | { 13 | py::class_(m, "G4CrossSectionHandler", "cross section handler") 14 | .def(py::init<>()); 15 | } 16 | -------------------------------------------------------------------------------- /source/processes/pyG4ProcVector.cc: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | #include 6 | 7 | #include "typecast.hh" 8 | #include "opaques.hh" 9 | 10 | namespace py = pybind11; 11 | 12 | void export_G4ProcVector(py::module &m) 13 | { 14 | py::bind_vector(m, "G4ProcVector"); 15 | } 16 | -------------------------------------------------------------------------------- /source/processes/pyG4ProcessType.cc: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #include 5 | #include "typecast.hh" 6 | #include "opaques.hh" 7 | 8 | namespace py = pybind11; 9 | 10 | void export_G4ProcessType(py::module &m) 11 | { 12 | py::enum_(m, "G4ProcessType") 13 | .value("fNotDefined", fNotDefined) 14 | .value("fTransportation", fTransportation) 15 | .value("fElectromagnetic", fElectromagnetic) 16 | .value("fOptical", fOptical) 17 | .value("fHadronic", fHadronic) 18 | .value("fPhotolepton_hadron", fPhotolepton_hadron) 19 | .value("fDecay", fDecay) 20 | .value("fGeneral", fGeneral) 21 | .value("fParameterisation", fParameterisation) 22 | .value("fUserDefined", fUserDefined) 23 | .export_values(); 24 | } 25 | -------------------------------------------------------------------------------- /source/processes/pyG4ProductionCutsTable.cc: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #include 5 | #include 6 | 7 | #include "typecast.hh" 8 | #include "opaques.hh" 9 | 10 | namespace py = pybind11; 11 | 12 | void export_G4ProductionCutsTable(py::module &m) 13 | { 14 | py::class_(m, "G4ProductionCutsTable", "production cuts table") 15 | 16 | .def_static("GetProductionCutsTable", &G4ProductionCutsTable::GetProductionCutsTable, 17 | py::return_value_policy::reference) 18 | 19 | // TODO 20 | 21 | .def("GetLowEdgeEnergy", &G4ProductionCutsTable::GetLowEdgeEnergy) 22 | .def("GetHighEdgeEnergy", &G4ProductionCutsTable::GetHighEdgeEnergy) 23 | .def("SetEnergyRange", &G4ProductionCutsTable::SetEnergyRange) 24 | .def("DumpCouples", &G4ProductionCutsTable::DumpCouples) 25 | .def("IsModified", &G4ProductionCutsTable::IsModified) 26 | .def("ConvertRangeToEnergy", &G4ProductionCutsTable::ConvertRangeToEnergy) 27 | .def("SetVerboseLevel", &G4ProductionCutsTable::SetVerboseLevel) 28 | .def("GetVerboseLevel", &G4ProductionCutsTable::GetVerboseLevel); 29 | } 30 | -------------------------------------------------------------------------------- /source/processes/pyG4VProcess.cc: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #include 5 | 6 | #include "typecast.hh" 7 | #include "opaques.hh" 8 | 9 | namespace py = pybind11; 10 | 11 | void export_G4VProcess(py::module &m) 12 | { 13 | py::class_(m, "G4VProcess", "base class for process") 14 | 15 | .def("SetPILfactor", &G4VProcess::SetPILfactor) 16 | .def("GetPILfactor", &G4VProcess::GetPILfactor) 17 | .def("IsApplicable", &G4VProcess::IsApplicable) 18 | .def("BuildPhysicsTable", &G4VProcess::BuildPhysicsTable) 19 | .def("PreparePhysicsTable", &G4VProcess::PreparePhysicsTable) 20 | .def("StorePhysicsTable", &G4VProcess::StorePhysicsTable) 21 | .def("RetrievePhysicsTable", &G4VProcess::RetrievePhysicsTable) 22 | .def("GetPhysicsTableFileName", &G4VProcess::GetPhysicsTableFileName, py::arg("particle"), py::arg("directory"), 23 | py::arg("tableName"), py::arg("ascii") = false) 24 | 25 | .def("GetProcessName", &G4VProcess::GetProcessName) 26 | .def("GetProcessType", &G4VProcess::GetProcessType) 27 | .def("DumpInfo", &G4VProcess::DumpInfo) 28 | .def("SetVerboseLevel", &G4VProcess::SetVerboseLevel) 29 | .def("GetVerboseLevel", &G4VProcess::GetVerboseLevel); 30 | } 31 | -------------------------------------------------------------------------------- /source/processes/pymodG4processes.cc: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #include "typecast.hh" 5 | #include "opaques.hh" 6 | 7 | namespace py = pybind11; 8 | 9 | void export_G4VProcess(py::module &); 10 | void export_G4ProcVector(py::module &); 11 | void export_G4ProcessType(py::module &); 12 | void export_G4EmCalculator(py::module &); 13 | void export_G4ProductionCutsTable(py::module &); 14 | void export_G4VCrossSectionHandler(py::module &); 15 | void export_G4CrossSectionHandler(py::module &); 16 | void export_G4ProcessTable(py::module &); 17 | void export_G4ProcessManager(py::module &); 18 | void export_G4EmParameters(py::module &); 19 | void export_G4HadronicParameters(py::module &); 20 | 21 | void export_modG4processes(py::module &m) 22 | { 23 | export_G4VProcess(m); 24 | export_G4ProcessType(m); 25 | export_G4ProcVector(m); 26 | export_G4EmCalculator(m); 27 | export_G4ProductionCutsTable(m); 28 | export_G4VCrossSectionHandler(m); 29 | export_G4CrossSectionHandler(m); 30 | export_G4ProcessTable(m); 31 | export_G4ProcessManager(m); 32 | export_G4EmParameters(m); 33 | export_G4HadronicParameters(m); 34 | } 35 | -------------------------------------------------------------------------------- /source/run/pyG4VPhysicsConstructor.cc: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #include 5 | 6 | #include "typecast.hh" 7 | #include "opaques.hh" 8 | 9 | namespace py = pybind11; 10 | 11 | class PyG4VPhysicsConstructor : public G4VPhysicsConstructor, public py::trampoline_self_life_support { 12 | 13 | public: 14 | using G4VPhysicsConstructor::G4VPhysicsConstructor; 15 | 16 | void ConstructParticle() override { PYBIND11_OVERRIDE_PURE(void, G4VPhysicsConstructor, ConstructParticle, ); } 17 | 18 | void ConstructProcess() override { PYBIND11_OVERRIDE_PURE(void, G4VPhysicsConstructor, ConstructProcess, ); } 19 | }; 20 | 21 | void export_G4VPhysicsConstructor(py::module &m) 22 | { 23 | py::class_(m, "G4VPhysicsConstructor", 24 | "base class of user physics constructor") 25 | 26 | .def(py::init(), py::arg("name") = "") 27 | .def(py::init()) 28 | 29 | .def("ConstructParticle", &G4VPhysicsConstructor::ConstructParticle) 30 | .def("ConstructProcess", &G4VPhysicsConstructor::ConstructProcess) 31 | 32 | .def("SetPhysicsName", &G4VPhysicsConstructor::SetPhysicsName, py::arg("name") = "") 33 | .def("GetPhysicsName", &G4VPhysicsConstructor::GetPhysicsName) 34 | .def("SetVerboseLevel", &G4VPhysicsConstructor::SetVerboseLevel) 35 | .def("GetVerboseLevel", &G4VPhysicsConstructor::GetVerboseLevel); 36 | } 37 | -------------------------------------------------------------------------------- /source/run/pyG4VUserPrimaryGeneratorAction.cc: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #include 5 | #include 6 | 7 | #include "typecast.hh" 8 | #include "opaques.hh" 9 | 10 | namespace py = pybind11; 11 | 12 | class PyG4VUserPrimaryGeneratorAction : public G4VUserPrimaryGeneratorAction, public py::trampoline_self_life_support { 13 | 14 | public: 15 | using G4VUserPrimaryGeneratorAction::G4VUserPrimaryGeneratorAction; 16 | 17 | void GeneratePrimaries(G4Event *anEvent) override 18 | { 19 | PYBIND11_OVERRIDE_PURE(void, G4VUserPrimaryGeneratorAction, GeneratePrimaries, anEvent); 20 | } 21 | }; 22 | 23 | void export_G4VUserPrimaryGeneratorAction(py::module &m) 24 | { 25 | py::class_( 26 | m, "G4VUserPrimaryGeneratorAction", "base class of user primary generator action") 27 | 28 | .def(py::init<>()) 29 | .def("GeneratePrimaries", &G4VUserPrimaryGeneratorAction::GeneratePrimaries); 30 | } 31 | -------------------------------------------------------------------------------- /source/run/pymodG4run.cc: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #include "typecast.hh" 5 | #include "opaques.hh" 6 | 7 | namespace py = pybind11; 8 | 9 | void export_G4Run(py::module &); 10 | void export_G4UserRunAction(py::module &); 11 | void export_G4VUserPrimaryGeneratorAction(py::module &); 12 | void export_G4VUserParallelWorld(py::module &); 13 | void export_G4VUserDetectorConstruction(py::module &); 14 | void export_G4VUserPhysicsList(py::module &); 15 | void export_G4VModularPhysicsList(py::module &); 16 | void export_G4VPhysicsConstructor(py::module &); 17 | void export_G4VUserActionInitialization(py::module &); 18 | void export_G4RunManager(py::module &); 19 | void export_G4RunManagerKernel(py::module &); 20 | void export_G4MTRunManager(py::module &); 21 | 22 | void export_modG4run(py::module &m) 23 | { 24 | export_G4Run(m); 25 | export_G4UserRunAction(m); 26 | export_G4VUserPrimaryGeneratorAction(m); 27 | export_G4VUserParallelWorld(m); 28 | export_G4VUserDetectorConstruction(m); 29 | export_G4VUserPhysicsList(m); 30 | export_G4VModularPhysicsList(m); 31 | export_G4VPhysicsConstructor(m); 32 | export_G4VUserActionInitialization(m); 33 | export_G4RunManager(m); 34 | export_G4RunManagerKernel(m); 35 | export_G4MTRunManager(m); 36 | } 37 | -------------------------------------------------------------------------------- /source/tasking/pyG4VUserTaskQueue.cc: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #include 5 | 6 | #include "typecast.hh" 7 | #include "opaques.hh" 8 | 9 | namespace py = pybind11; 10 | 11 | // TODO 12 | void export_G4VUserTaskQueue(py::module &m) 13 | { 14 | py::class_(m, "G4VUserTaskQueue"); 15 | } -------------------------------------------------------------------------------- /source/tasking/pymodG4tasking.cc: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #include "typecast.hh" 5 | #include "opaques.hh" 6 | 7 | namespace py = pybind11; 8 | 9 | void export_G4VUserTaskQueue(py::module &); 10 | void export_G4RunManagerFactory(py::module &); 11 | void export_G4TaskRunManager(py::module &); 12 | 13 | void export_modG4tasking(py::module &m) 14 | { 15 | export_G4VUserTaskQueue(m); 16 | export_G4TaskRunManager(m); 17 | export_G4RunManagerFactory(m); 18 | } 19 | -------------------------------------------------------------------------------- /source/track/pyG4StepStatus.cc: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #include 5 | 6 | #include "typecast.hh" 7 | #include "opaques.hh" 8 | 9 | namespace py = pybind11; 10 | 11 | void export_G4StepStatus(py::module &m) 12 | { 13 | py::enum_(m, "G4StepStatus") 14 | .value("fWorldBoundary", fWorldBoundary) 15 | .value("fGeomBoundary", fGeomBoundary) 16 | .value("fAtRestDoItProc", fAtRestDoItProc) 17 | .value("fAlongStepDoItProc", fAlongStepDoItProc) 18 | .value("fPostStepDoItProc", fPostStepDoItProc) 19 | .value("fUserDefinedLimit", fUserDefinedLimit) 20 | .value("fExclusivelyForcedProc", fExclusivelyForcedProc) 21 | .value("fUndefined", fUndefined) 22 | .export_values(); 23 | } 24 | -------------------------------------------------------------------------------- /source/track/pyG4TrackStatus.cc: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #include 5 | #include 6 | 7 | #include "typecast.hh" 8 | #include "opaques.hh" 9 | 10 | namespace py = pybind11; 11 | 12 | void export_G4TrackStatus(py::module &m) 13 | { 14 | py::enum_(m, "G4TrackStatus") 15 | .value("fAlive", fAlive) 16 | .value("fStopButAlive", fStopButAlive) 17 | .value("fStopAndKill", fStopAndKill) 18 | .value("fKillTrackAndSecondaries", fKillTrackAndSecondaries) 19 | .value("fSuspend", fSuspend) 20 | #if G4VERSION_NUMBER >= 1120 21 | .value("fSuspendAndWait", fSuspendAndWait) 22 | #endif 23 | .value("fPostponeToNextEvent", fPostponeToNextEvent) 24 | .export_values(); 25 | } 26 | -------------------------------------------------------------------------------- /source/track/pymodG4track.cc: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #include "typecast.hh" 5 | #include "opaques.hh" 6 | 7 | namespace py = pybind11; 8 | 9 | void export_G4Track(py::module &); 10 | void export_G4TrackStatus(py::module &); 11 | void export_G4Step(py::module &); 12 | void export_G4StepPoint(py::module &); 13 | void export_G4StepStatus(py::module &); 14 | 15 | void export_modG4track(py::module &m) 16 | { 17 | export_G4Track(m); 18 | export_G4TrackStatus(m); 19 | export_G4Step(m); 20 | export_G4StepPoint(m); 21 | export_G4StepStatus(m); 22 | } 23 | -------------------------------------------------------------------------------- /source/tracking/pyG4TrackingManager.cc: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #include 5 | 6 | #include "typecast.hh" 7 | #include "opaques.hh" 8 | 9 | namespace py = pybind11; 10 | 11 | void export_G4TrackingManager(py::module &m) 12 | { 13 | py::class_(m, "G4TrackingManager", "tracking manager class") 14 | .def(py::init<>()) 15 | 16 | // TODO 17 | .def("GetStoreTrajectory", &G4TrackingManager::GetStoreTrajectory) 18 | .def("SetStoreTrajectory", &G4TrackingManager::SetStoreTrajectory) 19 | .def("SetVerboseLevel", &G4TrackingManager::SetVerboseLevel) 20 | .def("GetVerboseLevel", &G4TrackingManager::GetVerboseLevel) 21 | .def("SetUserTrackInformation", &G4TrackingManager::SetUserTrackInformation); 22 | } 23 | -------------------------------------------------------------------------------- /source/tracking/pyG4UserSteppingAction.cc: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #include 5 | #include 6 | #include 7 | 8 | #include "typecast.hh" 9 | #include "opaques.hh" 10 | 11 | namespace py = pybind11; 12 | 13 | class PyG4UserSteppingAction : public G4UserSteppingAction, public py::trampoline_self_life_support { 14 | 15 | public: 16 | using G4UserSteppingAction::G4UserSteppingAction; 17 | 18 | void SetSteppingManagerPointer(G4SteppingManager *pValue) override 19 | { 20 | PYBIND11_OVERRIDE(void, G4UserSteppingAction, SetSteppingManagerPointer, pValue); 21 | } 22 | 23 | void UserSteppingAction(const G4Step *aStep) override 24 | { 25 | PYBIND11_OVERRIDE(void, G4UserSteppingAction, UserSteppingAction, aStep); 26 | } 27 | }; 28 | 29 | void export_G4UserSteppingAction(py::module &m) 30 | { 31 | py::class_(m, "G4UserSteppingAction", "stepping action class") 32 | 33 | .def(py::init<>()) 34 | .def("SetSteppingManagerPointer", &G4UserSteppingAction::SetSteppingManagerPointer) 35 | .def("UserSteppingAction", &G4UserSteppingAction::UserSteppingAction); 36 | } 37 | -------------------------------------------------------------------------------- /source/tracking/pyG4UserTrackingAction.cc: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #include 5 | #include 6 | #include 7 | 8 | #include "typecast.hh" 9 | #include "opaques.hh" 10 | 11 | namespace py = pybind11; 12 | 13 | class PyG4UserTrackingAction : public G4UserTrackingAction, public py::trampoline_self_life_support { 14 | 15 | public: 16 | using G4UserTrackingAction::G4UserTrackingAction; 17 | 18 | void SetTrackingManagerPointer(G4TrackingManager *pValue) override 19 | { 20 | PYBIND11_OVERRIDE(void, G4UserTrackingAction, SetTrackingManagerPointer, pValue); 21 | } 22 | 23 | void PreUserTrackingAction(const G4Track *atrack) override 24 | { 25 | PYBIND11_OVERRIDE(void, G4UserTrackingAction, PreUserTrackingAction, atrack); 26 | } 27 | 28 | void PostUserTrackingAction(const G4Track *atrack) override 29 | { 30 | PYBIND11_OVERRIDE(void, G4UserTrackingAction, PostUserTrackingAction, atrack); 31 | } 32 | }; 33 | 34 | void export_G4UserTrackingAction(py::module &m) 35 | { 36 | py::class_(m, "G4UserTrackingAction", "tracking action class") 37 | 38 | .def(py::init<>()) 39 | 40 | .def("SetTrackingManagerPointer", &G4UserTrackingAction::SetTrackingManagerPointer) 41 | .def("PreUserTrackingAction", &G4UserTrackingAction::PreUserTrackingAction) 42 | .def("PostUserTrackingAction", &G4UserTrackingAction::PostUserTrackingAction); 43 | } 44 | -------------------------------------------------------------------------------- /source/tracking/pymodG4tracking.cc: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #include "typecast.hh" 5 | #include "opaques.hh" 6 | 7 | namespace py = pybind11; 8 | 9 | void export_G4TrackingManager(py::module &); 10 | void export_G4UserSteppingAction(py::module &); 11 | void export_G4UserTrackingAction(py::module &); 12 | void export_G4VTrajectoryPoint(py::module &); 13 | void export_G4TrajectoryPoint(py::module &); 14 | void export_G4VTrajectory(py::module &); 15 | void export_G4Trajectory(py::module &); 16 | void export_G4VSteppingVerbose(py::module &); 17 | void export_G4SteppingVerbose(py::module &); 18 | 19 | void export_modG4tracking(py::module &m) 20 | { 21 | export_G4TrackingManager(m); 22 | export_G4UserSteppingAction(m); 23 | export_G4UserTrackingAction(m); 24 | export_G4VTrajectoryPoint(m); 25 | export_G4TrajectoryPoint(m); 26 | export_G4VTrajectory(m); 27 | export_G4Trajectory(m); 28 | export_G4VSteppingVerbose(m); 29 | export_G4SteppingVerbose(m); 30 | } 31 | -------------------------------------------------------------------------------- /source/visualization/pyG4ASCIITree.cc: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #include 5 | 6 | #include "typecast.hh" 7 | #include "opaques.hh" 8 | 9 | namespace py = pybind11; 10 | 11 | void export_G4ASCIITree(py::module &m) 12 | { 13 | py::class_(m, "G4ASCIITree", "ASCII tree visualization module").def(py::init<>()); 14 | // TOOD 15 | } 16 | -------------------------------------------------------------------------------- /source/visualization/pyG4DAWNFILE.cc: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #include 5 | 6 | #include "typecast.hh" 7 | #include "opaques.hh" 8 | 9 | namespace py = pybind11; 10 | 11 | void export_G4DAWNFILE(py::module &m) 12 | { 13 | py::class_(m, "G4DAWNFILE", "DAWN(file) visualization module").def(py::init<>()); 14 | // TODO 15 | } 16 | -------------------------------------------------------------------------------- /source/visualization/pyG4HepRepFile.cc: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #include 5 | 6 | #include "typecast.hh" 7 | #include "opaques.hh" 8 | 9 | namespace py = pybind11; 10 | 11 | void export_G4HepRepFile(py::module &m) 12 | { 13 | py::class_(m, "G4HepRepFile", "HepRep(File) visualization module"); 14 | } 15 | -------------------------------------------------------------------------------- /source/visualization/pyG4OpenGLImmediateQt.cc: -------------------------------------------------------------------------------- 1 | #ifdef G4_HAS_QT 2 | 3 | #include 4 | #include 5 | 6 | #include 7 | 8 | #include "typecast.hh" 9 | #include "opaques.hh" 10 | 11 | namespace py = pybind11; 12 | 13 | void export_G4OpenGLImmediateQt(py::module &m) 14 | { 15 | py::class_(m, "G4OpenGLImmediateQt", "OpenGL(Qt) visualization module") 16 | 17 | .def(py::init<>()); 18 | // TODO 19 | } 20 | 21 | #endif // G4_HAS_QT 22 | -------------------------------------------------------------------------------- /source/visualization/pyG4OpenGLImmediateWin32.cc: -------------------------------------------------------------------------------- 1 | #ifdef G4_HAS_OPENGLWIN 2 | 3 | #include 4 | #include 5 | 6 | #include 7 | 8 | #include "typecast.hh" 9 | #include "opaques.hh" 10 | 11 | namespace py = pybind11; 12 | 13 | void export_G4OpenGLImmediateWin32(py::module &m) 14 | { 15 | py::class_(m, "G4OpenGLImmediateWin32", 16 | "OpenGL(Immediate Win32) visualization module") 17 | .def(py::init<>()); 18 | // TODO 19 | } 20 | 21 | #endif // G4_HAS_OPENGLWIN 22 | -------------------------------------------------------------------------------- /source/visualization/pyG4OpenGLImmediateX.cc: -------------------------------------------------------------------------------- 1 | #ifdef G4_HAS_OPENGLX 2 | 3 | #include 4 | #include 5 | 6 | #include 7 | 8 | #include "typecast.hh" 9 | #include "opaques.hh" 10 | 11 | namespace py = pybind11; 12 | 13 | void export_G4OpenGLImmediateX(py::module &m) 14 | { 15 | py::class_(m, "G4OpenGLImmediateX", 16 | "OpenGL(Immediate X) visualization module") 17 | .def(py::init<>()); 18 | // TODO 19 | } 20 | 21 | #endif // G4_HAS_OPENGLX 22 | -------------------------------------------------------------------------------- /source/visualization/pyG4OpenGLImmediateXm.cc: -------------------------------------------------------------------------------- 1 | #ifdef G4_HAS_OPENGLXM 2 | 3 | #include 4 | #include 5 | 6 | #include 7 | 8 | #include "typecast.hh" 9 | #include "opaques.hh" 10 | 11 | namespace py = pybind11; 12 | 13 | void export_G4OpenGLImmediateXm(py::module &m) 14 | { 15 | py::class_(m, "G4OpenGLImmediateXm", 16 | "OpenGL(Immediate XM) visualization module") 17 | .def(py::init<>()); 18 | // TODO 19 | } 20 | 21 | #endif 22 | -------------------------------------------------------------------------------- /source/visualization/pyG4OpenGLStoredX.cc: -------------------------------------------------------------------------------- 1 | #ifdef G4_HAS_OPENGLX 2 | 3 | #include 4 | #include 5 | 6 | #include 7 | 8 | #include "typecast.hh" 9 | #include "opaques.hh" 10 | 11 | namespace py = pybind11; 12 | 13 | void export_G4OpenGLStoredX(py::module &m) 14 | { 15 | py::class_(m, "G4OpenGLStoredX", "OpenGL(Stored X) visualization module") 16 | .def(py::init<>()); 17 | } 18 | 19 | #endif // G4_HAS_OPENGLX 20 | -------------------------------------------------------------------------------- /source/visualization/pyG4OpenGLStoredXm.cc: -------------------------------------------------------------------------------- 1 | #ifdef G4_HAS_OPENGLXM 2 | 3 | #include 4 | #include 5 | 6 | #include 7 | 8 | #include "typecast.hh" 9 | #include "opaques.hh" 10 | 11 | namespace py = pybind11; 12 | 13 | void export_G4OpenGLStoredXm(py::module &m) 14 | { 15 | py::class_(m, "G4OpenGLStoredXm", "OpenGL(Stored XM) visualization module") 16 | .def(py::init<>()); 17 | } 18 | 19 | #endif // G4_HAS_OPENGLXM 20 | -------------------------------------------------------------------------------- /source/visualization/pyG4RayTracer.cc: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #include 5 | 6 | #include "typecast.hh" 7 | #include "opaques.hh" 8 | 9 | namespace py = pybind11; 10 | 11 | void export_G4RayTracer(py::module &m) 12 | { 13 | py::class_(m, "G4RayTracer", "RayTracer visualization module").def(py::init<>()); 14 | } 15 | -------------------------------------------------------------------------------- /source/visualization/pyG4RayTracerX.cc: -------------------------------------------------------------------------------- 1 | #ifdef G4_HAS_RAYTRACERX 2 | 3 | #include 4 | #include 5 | 6 | #include 7 | 8 | #include "typecast.hh" 9 | #include "opaques.hh" 10 | 11 | namespace py = pybind11; 12 | 13 | void export_G4RayTracerX(py::module &m) 14 | { 15 | py::class_(m, "G4RayTracerX", "RayTracerX visualization module").def(py::init<>()); 16 | } 17 | 18 | #endif // G4_HAS_RAYTRACERX 19 | -------------------------------------------------------------------------------- /source/visualization/pyG4VRML2File.cc: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #include 5 | 6 | #include "typecast.hh" 7 | #include "opaques.hh" 8 | 9 | namespace py = pybind11; 10 | 11 | void export_G4VRML2File(py::module &m) 12 | { 13 | py::class_(m, "G4VRML2File", "VRML-2(file) visualization module").def(py::init<>()); 14 | } 15 | -------------------------------------------------------------------------------- /source/visualization/pyG4VisExecutive.cc: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #include 5 | 6 | #include "typecast.hh" 7 | #include "opaques.hh" 8 | 9 | namespace py = pybind11; 10 | 11 | void export_G4VisExecutive(py::module &m) 12 | { 13 | py::class_(m, "G4VisExecutive") 14 | .def(py::init(), py::arg("verbosity") = "warnings"); 15 | } 16 | -------------------------------------------------------------------------------- /tests/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Mostly copied from .github workflow 2 | add_test(NAME test_B1 COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/test_B1.py) 3 | add_test(NAME test_destruction COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/test_destruction.py) 4 | add_test(NAME test_examples COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/test_examples.py) 5 | 6 | set_tests_properties(test_B1 test_destruction test_examples 7 | PROPERTIES ENVIRONMENT PYTHONPATH=$) -------------------------------------------------------------------------------- /tests/test_destruction.py: -------------------------------------------------------------------------------- 1 | from geant4_pybind import * 2 | 3 | runManager = G4RunManagerFactory.CreateRunManager(G4RunManagerType.Default) 4 | 5 | physicsList1 = QBBC() 6 | 7 | del physicsList1 8 | 9 | physicsList2 = QBBC() 10 | physicsList3 = QBBC() 11 | runManager.SetUserInitialization(physicsList2) 12 | 13 | del physicsList2 14 | 15 | del runManager 16 | --------------------------------------------------------------------------------