Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ApplyCuts (rebase) #334

Merged
merged 13 commits into from
Jan 17, 2025

Large diffs are not rendered by default.

8 changes: 8 additions & 0 deletions include/AdePT/core/AdePTTransport.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ inline __constant__ __device__ struct G4HepEmData g4HepEmData;

inline __constant__ __device__ adeptint::VolAuxData *gVolAuxData = nullptr;
inline __constant__ __device__ double BzFieldValue = 0;
inline __constant__ __device__ bool ApplyCuts = false;

bool InitializeVolAuxArray(adeptint::VolAuxArray &array)
{
Expand Down Expand Up @@ -108,6 +109,13 @@ G4HepEmState *InitG4HepEm()
return state;
}

bool InitializeApplyCuts(bool applycuts)
{
// Initialize ApplyCut
COPCORE_CUDA_CHECK(cudaMemcpyToSymbol(ApplyCuts, &applycuts, sizeof(bool)));
return true;
}

// Kernel function to initialize tracks comming from a Geant4 buffer
__global__ void InitTracks(adeptint::TrackData *trackinfo, int ntracks, int startTrack, int event,
Secondaries secondaries, const vecgeom::VPlacedVolume *world, AdeptScoring *userScoring,
Expand Down
2 changes: 2 additions & 0 deletions include/AdePT/core/AdePTTransport.h
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,8 @@ class AdePTTransport : public AdePTTransportInterface {
/// @brief Create material-cut couple index array
/// @brief Initialize service and copy geometry & physics data on device
void Initialize(bool common_data = false);
/// @brief Initializes the ApplyCut flag. Can only be called after G4 Physics is build
bool InitializeApplyCuts(bool applycuts);
/// @brief Final cleanup
void Cleanup();
/// @brief Interface for transporting a buffer of tracks in AdePT.
Expand Down
7 changes: 7 additions & 0 deletions include/AdePT/core/AdePTTransport.icc
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ namespace adept_impl {
/// Forward declarations for methods implemented in AdePTTransport.cu
using TrackBuffer = adeptint::TrackBuffer;
bool InitializeField(double);
bool InitializeApplyCuts(bool);
bool InitializeVolAuxArray(adeptint::VolAuxArray &);
void FreeVolAuxArray(adeptint::VolAuxArray &);
G4HepEmState *InitG4HepEm();
Expand Down Expand Up @@ -60,6 +61,12 @@ bool AdePTTransport<IntegrationLayer>::InitializeField(double bz)
return adept_impl::InitializeField(bz);
}

template <typename IntegrationLayer>
bool AdePTTransport<IntegrationLayer>::InitializeApplyCuts(bool applycuts)
{
return adept_impl::InitializeApplyCuts(applycuts);
}

template <typename IntegrationLayer>
void AdePTTransport<IntegrationLayer>::AddTrack(int pdg, int parent_id, double energy, double x, double y, double z,
double dirx, double diry, double dirz, double globalTime,
Expand Down
2 changes: 2 additions & 0 deletions include/AdePT/core/AdePTTransportInterface.hh
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ public:
virtual void SetCUDAStackLimit(int limit) = 0;
/// @brief Initialize service and copy geometry & physics data on device
virtual void Initialize(bool common_data = false) = 0;
/// @brief Initialize the ApplyCuts flag on device
virtual bool InitializeApplyCuts(bool applycuts) = 0;
/// @brief Interface for transporting a buffer of tracks in AdePT.
virtual void Shower(int event, int threadId) = 0;
virtual void Cleanup() = 0;
Expand Down
1 change: 1 addition & 0 deletions include/AdePT/core/AdePTTransportStruct.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -109,5 +109,6 @@ extern __constant__ struct G4HepEmData g4HepEmData;

extern __constant__ __device__ adeptint::VolAuxData *gVolAuxData;
extern __constant__ __device__ double BzFieldValue;
extern __constant__ __device__ bool ApplyCuts;
} // namespace adept_impl
#endif
Loading
Loading