@@ -743,7 +743,8 @@ namespace ALPAKA_ACCELERATOR_NAMESPACE::lst {
743
743
acc, &mdsOccupancy.totOccupancyMDs ()[lowerModuleIndex], 1u , alpaka::hierarchy::Threads{});
744
744
if (totOccupancyMDs >= (ranges.miniDoubletModuleOccupancy ()[lowerModuleIndex])) {
745
745
#ifdef WARNINGS
746
- printf (" Mini-doublet excess alert! Module index = %d\n " , lowerModuleIndex);
746
+ printf (
747
+ " Mini-doublet excess alert! Module index = %d, Occupancy = %d\n " , lowerModuleIndex, totOccupancyMDs);
747
748
#endif
748
749
} else {
749
750
int mdModuleIndex =
@@ -773,9 +774,38 @@ namespace ALPAKA_ACCELERATOR_NAMESPACE::lst {
773
774
}
774
775
};
775
776
777
+ // Helper function to determine eta bin for occupancies
778
+ ALPAKA_FN_ACC ALPAKA_FN_INLINE int getEtaBin (const float module_eta) {
779
+ if (module_eta < 0 .75f )
780
+ return 0 ;
781
+ else if (module_eta < 1 .5f )
782
+ return 1 ;
783
+ else if (module_eta < 2 .25f )
784
+ return 2 ;
785
+ else if (module_eta < 3 .0f )
786
+ return 3 ;
787
+ return -1 ;
788
+ }
789
+
790
+ // Helper function to determine category number for occupancies
791
+ ALPAKA_FN_ACC ALPAKA_FN_INLINE int getCategoryNumber (const short module_layers,
792
+ const short module_subdets,
793
+ const short module_rings) {
794
+ if (module_subdets == Barrel) {
795
+ return (module_layers <= 3 ) ? 0 : 1 ;
796
+ } else if (module_subdets == Endcap) {
797
+ if (module_layers <= 2 ) {
798
+ return (module_rings >= 11 ) ? 2 : 3 ;
799
+ } else {
800
+ return (module_rings >= 8 ) ? 2 : 3 ;
801
+ }
802
+ }
803
+ return -1 ;
804
+ }
805
+
776
806
struct CreateMDArrayRangesGPU {
777
807
template <typename TAcc>
778
- ALPAKA_FN_ACC void operator ()(TAcc const & acc, ModulesConst modules, ObjectRanges ranges) const {
808
+ ALPAKA_FN_ACC void operator ()(TAcc const & acc, ModulesConst modules, ObjectRanges ranges, const float ptCut ) const {
779
809
// implementation is 1D with a single block
780
810
static_assert (std::is_same_v<TAcc, ALPAKA_ACCELERATOR_NAMESPACE::Acc1D>, " Should be Acc1D" );
781
811
ALPAKA_ASSERT_ACC ((alpaka::getWorkDiv<alpaka::Grid, alpaka::Blocks>(acc)[0 ] == 1 ));
@@ -790,67 +820,43 @@ namespace ALPAKA_ACCELERATOR_NAMESPACE::lst {
790
820
}
791
821
alpaka::syncBlockThreads (acc);
792
822
823
+ // Occupancy matrix for 0.8 GeV pT Cut
824
+ constexpr int p08_occupancy_matrix[4 ][4 ] = {
825
+ {49 , 42 , 37 , 41 }, // category 0
826
+ {100 , 100 , 0 , 0 }, // category 1
827
+ {0 , 16 , 19 , 0 }, // category 2
828
+ {0 , 14 , 20 , 25 } // category 3
829
+ };
830
+
831
+ // Occupancy matrix for 0.6 GeV pT Cut, 99.99%
832
+ constexpr int p06_occupancy_matrix[4 ][4 ] = {
833
+ {60 , 57 , 54 , 48 }, // category 0
834
+ {259 , 195 , 0 , 0 }, // category 1
835
+ {0 , 23 , 28 , 0 }, // category 2
836
+ {0 , 25 , 25 , 33 } // category 3
837
+ };
838
+
839
+ // Select the appropriate occupancy matrix based on ptCut
840
+ const auto & occupancy_matrix = (ptCut < 0 .8f ) ? p06_occupancy_matrix : p08_occupancy_matrix;
841
+
793
842
for (uint16_t i = globalThreadIdx[0 ]; i < modules.nLowerModules (); i += gridThreadExtent[0 ]) {
794
843
short module_rings = modules.rings ()[i];
795
844
short module_layers = modules.layers ()[i];
796
845
short module_subdets = modules.subdets ()[i];
797
846
float module_eta = alpaka::math::abs (acc, modules.eta ()[i]);
798
847
799
- int category_number;
800
- if (module_layers <= 3 && module_subdets == 5 )
801
- category_number = 0 ;
802
- else if (module_layers >= 4 && module_subdets == 5 )
803
- category_number = 1 ;
804
- else if (module_layers <= 2 && module_subdets == 4 && module_rings >= 11 )
805
- category_number = 2 ;
806
- else if (module_layers >= 3 && module_subdets == 4 && module_rings >= 8 )
807
- category_number = 2 ;
808
- else if (module_layers <= 2 && module_subdets == 4 && module_rings <= 10 )
809
- category_number = 3 ;
810
- else if (module_layers >= 3 && module_subdets == 4 && module_rings <= 7 )
811
- category_number = 3 ;
812
- else
813
- category_number = -1 ;
814
-
815
- int eta_number;
816
- if (module_eta < 0 .75f )
817
- eta_number = 0 ;
818
- else if (module_eta < 1 .5f )
819
- eta_number = 1 ;
820
- else if (module_eta < 2 .25f )
821
- eta_number = 2 ;
822
- else if (module_eta < 3 .0f )
823
- eta_number = 3 ;
824
- else
825
- eta_number = -1 ;
826
-
827
- int occupancy;
828
- if (category_number == 0 && eta_number == 0 )
829
- occupancy = 49 ;
830
- else if (category_number == 0 && eta_number == 1 )
831
- occupancy = 42 ;
832
- else if (category_number == 0 && eta_number == 2 )
833
- occupancy = 37 ;
834
- else if (category_number == 0 && eta_number == 3 )
835
- occupancy = 41 ;
836
- else if (category_number == 1 )
837
- occupancy = 100 ;
838
- else if (category_number == 2 && eta_number == 1 )
839
- occupancy = 16 ;
840
- else if (category_number == 2 && eta_number == 2 )
841
- occupancy = 19 ;
842
- else if (category_number == 3 && eta_number == 1 )
843
- occupancy = 14 ;
844
- else if (category_number == 3 && eta_number == 2 )
845
- occupancy = 20 ;
846
- else if (category_number == 3 && eta_number == 3 )
847
- occupancy = 25 ;
848
- else {
849
- occupancy = 0 ;
848
+ int category_number = getCategoryNumber (module_layers, module_subdets, module_rings);
849
+ int eta_number = getEtaBin (module_eta);
850
+
851
+ int occupancy = 0 ;
852
+ if (category_number != -1 && eta_number != -1 ) {
853
+ occupancy = occupancy_matrix[category_number][eta_number];
854
+ }
850
855
#ifdef WARNINGS
856
+ else {
851
857
printf (" Unhandled case in createMDArrayRangesGPU! Module index = %i\n " , i);
852
- #endif
853
858
}
859
+ #endif
854
860
855
861
unsigned int nTotMDs = alpaka::atomicAdd (acc, &nTotalMDs, occupancy, alpaka::hierarchy::Threads{});
856
862
0 commit comments