Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-05-27 07:24:26

0001 // This file is part of the ACTS project.
0002 //
0003 // Copyright (C) 2016 CERN for the benefit of the ACTS project
0004 //
0005 // This Source Code Form is subject to the terms of the Mozilla Public
0006 // License, v. 2.0. If a copy of the MPL was not distributed with this
0007 // file, You can obtain one at https://mozilla.org/MPL/2.0/.
0008 
0009 #include "detector_construction.hpp"
0010 #include "detray/definitions/detail/cuda_definitions.hpp"
0011 #include "detray/utils/logging.hpp"
0012 
0013 namespace detray::tutorial {
0014 
0015 /// Kernel that runs the entire propagation loop
0016 __global__ void print_kernel(
0017     typename detray::tutorial::detector_host_t::view_type det_data) {
0018   int gid = threadIdx.x + blockIdx.x * blockDim.x;
0019 
0020   if (gid > 0) {
0021     return;
0022   }
0023 
0024   // Setup of the device-side detector
0025   detray::tutorial::detector_device_t det(det_data);
0026 
0027   DETRAY_INFO_DEVICE("Number of volumes: %d", det.volumes().size());
0028   DETRAY_INFO_DEVICE("Number of transforms: %d", det.transform_store().size());
0029   DETRAY_INFO_DEVICE("First translation: {%f,%f,%f}",
0030                      det.transform_store().at(0).translation()[0],
0031                      det.transform_store().at(0).translation()[1],
0032                      det.transform_store().at(0).translation()[2]);
0033   DETRAY_INFO_DEVICE("Number of rectangles: %d",
0034                      det.mask_store().get<mask_id::e_rectangle2D>().size());
0035   DETRAY_INFO_DEVICE("Number of trapezoids: %d",
0036                      det.mask_store().get<mask_id::e_trapezoid2D>().size());
0037   DETRAY_INFO_DEVICE("Number of portal discs: %d",
0038                      det.mask_store().get<mask_id::e_ring2D>().size());
0039   DETRAY_INFO_DEVICE(
0040       "Number of portal cylinders: %d",
0041       det.mask_store().get<mask_id::e_concentric_cylinder2D>().size());
0042   DETRAY_INFO_DEVICE(
0043       "Number of portal collections: %d",
0044       det.accelerator_store().get<acc_id::e_surface_brute_force>().size());
0045   DETRAY_INFO_DEVICE(
0046       "Number of disc grids: %d",
0047       det.accelerator_store().get<acc_id::e_surface_ring2D_grid>().size());
0048   DETRAY_INFO_DEVICE("Number of cylinder grids: %d",
0049                      det.accelerator_store()
0050                          .get<acc_id::e_surface_concentric_cylinder2D_grid>()
0051                          .size());
0052 }
0053 
0054 void print(typename detray::tutorial::detector_host_t::view_type det_data) {
0055   // run the tutorial kernel
0056   print_kernel<<<1, 1>>>(det_data);
0057 
0058   // cuda error check
0059   DETRAY_CUDA_ERROR_CHECK(cudaGetLastError());
0060   DETRAY_CUDA_ERROR_CHECK(cudaDeviceSynchronize());
0061 }
0062 
0063 }  // namespace detray::tutorial