ATLAS Offline Software
Loading...
Searching...
No Matches
DataHolders.cxx File Reference
#include <vector>
#include <memory>
#include "CaloRecGPU/DataHolders.h"
#include "MacroHelpers.h"
#include "xAODCaloEvent/CaloClusterContainer.h"
#include "CaloDetDescr/CaloDetDescrManager.h"
#include "TileEvent/TileCell.h"
#include "CaloEvent/CaloPrefetch.h"
#include "boost/chrono/chrono.hpp"
#include "boost/chrono/thread_clock.hpp"

Go to the source code of this file.

Macros

#define CALORECGPU_MOMENTS_INPUT_HELPER(VAR_NAME, PROPER_MOMENT, NORMAL_ASSIGN, IS_CALCULATED, MOMENT_NAME, ...)
#define CALORECGPU_MOMENTS_INPUT_HELPER_11(VAR_NAME, MOMENT_NAME)
#define CALORECGPU_MOMENTS_INPUT_HELPER_10(VAR_NAME, MOMENT_NAME)
#define CALORECGPU_MOMENTS_INPUT_HELPER_00(...)
#define CALORECGPU_MOMENTS_INPUT_HELPER_01(...)
#define CALORECGPU_MOMENTS_EXTRA_TAGS_HELPER(VARNAME)
#define CALORECGPU_MOMENTS_TO_GPU_HELPER(VAR_NAME, PROPER_MOMENT, NORMAL_ASSIGN, IS_CALCULATED, MOMENT_NAME, ...)
#define CALORECGPU_MOMENTS_TO_GPU_HELPER_11(VAR_NAME, MOMENT_NAME)
#define CALORECGPU_MOMENTS_TO_GPU_HELPER_10(VAR_NAME, MOMENT_NAME)
#define CALORECGPU_MOMENTS_TO_GPU_HELPER_01(VAR_NAME, MOMENT_NAME)
#define CALORECGPU_MOMENTS_TO_GPU_HELPER_00(VAR_NAME, MOMENT_NAME)
#define CALORECGPU_MOMENTS_OUTPUT_HELPER(VAR_NAME, PROPER_MOMENT, NORMAL_ASSIGN, IS_CALCULATED, MOMENT_NAME, ...)
#define CALORECGPU_MOMENTS_OUTPUT_HELPER_11(VAR_NAME, MOMENT_NAME)
#define CALORECGPU_MOMENTS_OUTPUT_HELPER_10(VAR_NAME, MOMENT_NAME)
#define CALORECGPU_MOMENTS_OUTPUT_HELPER_00(...)
#define CALORECGPU_MOMENTS_OUTPUT_HELPER_01(...)

Functions

template<class ReadStateFrom, class OutputCells, class InputCells, class CopyFunc>
static void cell_transfer_helper (ReadStateFrom &state_holder, OutputCells &output_cells, InputCells &input_cells, CopyFunc copy_func, const bool full_copy, CaloRecGPU::CUDA_Helpers::CUDAStreamPtrHolder stream)
template<class ReadStateFrom, class OutputClusters, class InputClusters, class CopyFunc>
static void cluster_transfer_helper_basic_info (ReadStateFrom &state_holder, OutputClusters &output_clusters, InputClusters &input_clusters, CopyFunc copy_func, CaloRecGPU::CUDA_Helpers::CUDAStreamPtrHolder stream)
template<class ReadStateFrom, class OutputClusters, class InputClusters, class CopyFunc>
static void cluster_transfer_helper_cell_assignment (ReadStateFrom &state_holder, OutputClusters &output_clusters, InputClusters &input_clusters, CopyFunc copy_func, CaloRecGPU::CUDA_Helpers::CUDAStreamPtrHolder stream, const int num_total_cells=NCaloCells)
template<class ReadStateFrom, class OutputClusters, class InputClusters, class CopyFunc>
static void cluster_transfer_helper_moments (ReadStateFrom &state_holder, OutputClusters &output_clusters, InputClusters &input_clusters, const MomentsOptionsArray &moments_to_add, CopyFunc copy_func, CaloRecGPU::CUDA_Helpers::CUDAStreamPtrHolder stream)
template<class ReadStateFrom, class OutputClusters, class InputClusters, class CopyFunc>
static void cluster_transfer_helper (ReadStateFrom &state_holder, OutputClusters &output_clusters, InputClusters &input_clusters, const MomentsOptionsArray &moments_to_add, CopyFunc copy_func, const bool full_copy, CaloRecGPU::CUDA_Helpers::CUDAStreamPtrHolder stream, const int num_total_cells=CaloRecGPU::NCaloCells)
static void export_cluster_initialize_links (const ClusterInfoArr *clusters, std::vector< std::unique_ptr< CaloClusterCellLink > > &cell_links, const DataLink< CaloCellContainer > &cell_collection_link, const bool skip_validation)
static void export_cluster_process_cells (const ClusterInfoArr *clusters, const CellInfoArr *cells, std::vector< std::unique_ptr< CaloClusterCellLink > > &cell_links, const std::vector< int > &extra_cells_to_fill)
static void export_cluster_sort (const ClusterInfoArr *clusters, std::vector< int > &cluster_order, const bool really_sort)
static void export_cluster_fill_cells_and_basic_info (const ClusterInfoArr *clusters, xAOD::CaloClusterContainer *cluster_collection, std::vector< std::unique_ptr< CaloClusterCellLink > > &cell_links, std::vector< int > &cluster_order, const bool save_uncalibrated)
static void export_cluster_fill_moments (const ClusterInfoArr *clusters, xAOD::CaloClusterContainer *cluster_collection, std::vector< int > &cluster_order, const MomentsOptionsArray &moments_to_add, const bool output_extra_moments)

Macro Definition Documentation

◆ CALORECGPU_MOMENTS_EXTRA_TAGS_HELPER

#define CALORECGPU_MOMENTS_EXTRA_TAGS_HELPER ( VARNAME)
Value:
if (remaining_cells > 0) \
{ \
constexpr int max_size_per_array = (sizeof(float) * NMaxClusters)/sizeof(tag_type); \
copy_func(output_clusters->moments. VARNAME, \
input_clusters->moments. VARNAME, \
sizeof(tag_type) * std::min(remaining_cells, max_size_per_array), stream); \
remaining_cells -= max_size_per_array; \
} (void) 0 \
TagBase::carrier tag_type
constexpr int NMaxClusters

◆ CALORECGPU_MOMENTS_INPUT_HELPER

#define CALORECGPU_MOMENTS_INPUT_HELPER ( VAR_NAME,
PROPER_MOMENT,
NORMAL_ASSIGN,
IS_CALCULATED,
MOMENT_NAME,
... )
Value:
CRGPU_CONCAT(CRGPU_CONCAT(CALORECGPU_MOMENTS_INPUT_HELPER_, NORMAL_ASSIGN), IS_CALCULATED) (VAR_NAME, MOMENT_NAME)
#define CRGPU_CONCAT(X, Y)
Helper macro, concatenates two arguments.

◆ CALORECGPU_MOMENTS_INPUT_HELPER_00

#define CALORECGPU_MOMENTS_INPUT_HELPER_00 ( ...)

◆ CALORECGPU_MOMENTS_INPUT_HELPER_01

#define CALORECGPU_MOMENTS_INPUT_HELPER_01 ( ...)

◆ CALORECGPU_MOMENTS_INPUT_HELPER_10

#define CALORECGPU_MOMENTS_INPUT_HELPER_10 ( VAR_NAME,
MOMENT_NAME )
Value:
if (output_extra_moments && moments_to_add[xAOD::CaloCluster:: MOMENT_NAME]) \
{ \
m_clusters->moments. VAR_NAME [cluster_number] = cluster->getMomentValue(xAOD::CaloCluster:: MOMENT_NAME ); \
}

◆ CALORECGPU_MOMENTS_INPUT_HELPER_11

#define CALORECGPU_MOMENTS_INPUT_HELPER_11 ( VAR_NAME,
MOMENT_NAME )
Value:
if (moments_to_add[xAOD::CaloCluster:: MOMENT_NAME]) \
{ \
m_clusters->moments. VAR_NAME [cluster_number] = cluster->getMomentValue(xAOD::CaloCluster:: MOMENT_NAME ); \
}

◆ CALORECGPU_MOMENTS_OUTPUT_HELPER

#define CALORECGPU_MOMENTS_OUTPUT_HELPER ( VAR_NAME,
PROPER_MOMENT,
NORMAL_ASSIGN,
IS_CALCULATED,
MOMENT_NAME,
... )
Value:
CRGPU_CONCAT(CRGPU_CONCAT(CALORECGPU_MOMENTS_OUTPUT_HELPER_, NORMAL_ASSIGN), IS_CALCULATED) (VAR_NAME, MOMENT_NAME)

◆ CALORECGPU_MOMENTS_OUTPUT_HELPER_00

#define CALORECGPU_MOMENTS_OUTPUT_HELPER_00 ( ...)

◆ CALORECGPU_MOMENTS_OUTPUT_HELPER_01

#define CALORECGPU_MOMENTS_OUTPUT_HELPER_01 ( ...)

◆ CALORECGPU_MOMENTS_OUTPUT_HELPER_10

#define CALORECGPU_MOMENTS_OUTPUT_HELPER_10 ( VAR_NAME,
MOMENT_NAME )
Value:
if (output_extra_moments && moments_to_add[xAOD::CaloCluster:: MOMENT_NAME]) \
{ \
cluster->insertMoment(xAOD::CaloCluster:: MOMENT_NAME , clusters->moments. VAR_NAME [cluster_index]); \
}

◆ CALORECGPU_MOMENTS_OUTPUT_HELPER_11

#define CALORECGPU_MOMENTS_OUTPUT_HELPER_11 ( VAR_NAME,
MOMENT_NAME )
Value:
if (moments_to_add[xAOD::CaloCluster:: MOMENT_NAME]) \
{ \
cluster->insertMoment(xAOD::CaloCluster:: MOMENT_NAME , clusters->moments. VAR_NAME [cluster_index]); \
}

◆ CALORECGPU_MOMENTS_TO_GPU_HELPER

#define CALORECGPU_MOMENTS_TO_GPU_HELPER ( VAR_NAME,
PROPER_MOMENT,
NORMAL_ASSIGN,
IS_CALCULATED,
MOMENT_NAME,
... )
Value:
CRGPU_CONCAT(CRGPU_CONCAT(CALORECGPU_MOMENTS_TO_GPU_HELPER_, PROPER_MOMENT), IS_CALCULATED) (VAR_NAME, MOMENT_NAME)

◆ CALORECGPU_MOMENTS_TO_GPU_HELPER_00

#define CALORECGPU_MOMENTS_TO_GPU_HELPER_00 ( VAR_NAME,
MOMENT_NAME )
Value:
{ \
moments_copy_helper(output_clusters->moments. VAR_NAME, input_clusters->moments. VAR_NAME); \
}

◆ CALORECGPU_MOMENTS_TO_GPU_HELPER_01

#define CALORECGPU_MOMENTS_TO_GPU_HELPER_01 ( VAR_NAME,
MOMENT_NAME )
Value:
moments_copy_helper(output_clusters->moments. VAR_NAME, input_clusters->moments. VAR_NAME);

◆ CALORECGPU_MOMENTS_TO_GPU_HELPER_10

#define CALORECGPU_MOMENTS_TO_GPU_HELPER_10 ( VAR_NAME,
MOMENT_NAME )
Value:
moments_to_add[xAOD::CaloCluster:: MOMENT_NAME ] ) \
{ \
moments_copy_helper(output_clusters->moments. VAR_NAME, input_clusters->moments. VAR_NAME); \
}

◆ CALORECGPU_MOMENTS_TO_GPU_HELPER_11

#define CALORECGPU_MOMENTS_TO_GPU_HELPER_11 ( VAR_NAME,
MOMENT_NAME )
Value:
if (moments_to_add[xAOD::CaloCluster:: MOMENT_NAME ]) \
{ \
moments_copy_helper(output_clusters->moments. VAR_NAME, input_clusters->moments. VAR_NAME); \
}

Function Documentation

◆ cell_transfer_helper()

template<class ReadStateFrom, class OutputCells, class InputCells, class CopyFunc>
void cell_transfer_helper ( ReadStateFrom & state_holder,
OutputCells & output_cells,
InputCells & input_cells,
CopyFunc copy_func,
const bool full_copy,
CaloRecGPU::CUDA_Helpers::CUDAStreamPtrHolder stream )
static

Definition at line 579 of file DataHolders.cxx.

585{
586 if (full_copy)
587 {
588 copy_func(output_cells, input_cells, sizeof(CaloRecGPU::CellInfoArr), stream);
589 }
590 else
591 {
592 copy_func(output_cells->gain,
593 input_cells->gain,
594 sizeof(unsigned char) * state_holder->number, stream);
595
596 copy_func(output_cells->energy,
597 input_cells->energy,
598 sizeof(float) * state_holder->number, stream);
599
600 copy_func(output_cells->time,
601 input_cells->time,
602 sizeof(float) * state_holder->number, stream);
603
604 copy_func(output_cells->qualityProvenance,
605 input_cells->qualityProvenance,
606 sizeof(QualityProvenance::carrier) * state_holder->number, stream);
607
608 copy_func(output_cells->hashID,
609 input_cells->hashID,
610 sizeof(int) * state_holder->number, stream);
611
612 copy_func(output_cells->hashIDToCollection,
613 input_cells->hashIDToCollection,
614 sizeof(int) * CaloRecGPU::NCaloCells, stream);
615
616 }
617}
constexpr int NCaloCells
Contains the per-event cell information: energy, timing, gain, quality and provenance.

◆ cluster_transfer_helper()

template<class ReadStateFrom, class OutputClusters, class InputClusters, class CopyFunc>
void cluster_transfer_helper ( ReadStateFrom & state_holder,
OutputClusters & output_clusters,
InputClusters & input_clusters,
const MomentsOptionsArray & moments_to_add,
CopyFunc copy_func,
const bool full_copy,
CaloRecGPU::CUDA_Helpers::CUDAStreamPtrHolder stream,
const int num_total_cells = CaloRecGPU::NCaloCells )
static

Definition at line 777 of file DataHolders.cxx.

785{
786 if (full_copy)
787 {
788 copy_func(output_clusters, input_clusters, sizeof(CaloRecGPU::ClusterInfoArr), stream);
789 }
790 else
791 {
792 cluster_transfer_helper_basic_info(state_holder, output_clusters, input_clusters, copy_func, stream);
793
794 cluster_transfer_helper_cell_assignment(state_holder, output_clusters, input_clusters, copy_func, stream, num_total_cells);
795
796 cluster_transfer_helper_moments(state_holder, output_clusters, input_clusters, moments_to_add, copy_func, stream);
797 }
798}
static void cluster_transfer_helper_moments(ReadStateFrom &state_holder, OutputClusters &output_clusters, InputClusters &input_clusters, const MomentsOptionsArray &moments_to_add, CopyFunc copy_func, CaloRecGPU::CUDA_Helpers::CUDAStreamPtrHolder stream)
static void cluster_transfer_helper_cell_assignment(ReadStateFrom &state_holder, OutputClusters &output_clusters, InputClusters &input_clusters, CopyFunc copy_func, CaloRecGPU::CUDA_Helpers::CUDAStreamPtrHolder stream, const int num_total_cells=NCaloCells)
static void cluster_transfer_helper_basic_info(ReadStateFrom &state_holder, OutputClusters &output_clusters, InputClusters &input_clusters, CopyFunc copy_func, CaloRecGPU::CUDA_Helpers::CUDAStreamPtrHolder stream)

◆ cluster_transfer_helper_basic_info()

template<class ReadStateFrom, class OutputClusters, class InputClusters, class CopyFunc>
void cluster_transfer_helper_basic_info ( ReadStateFrom & state_holder,
OutputClusters & output_clusters,
InputClusters & input_clusters,
CopyFunc copy_func,
CaloRecGPU::CUDA_Helpers::CUDAStreamPtrHolder stream )
static

Definition at line 620 of file DataHolders.cxx.

625{
626
627 if (state_holder->has_basic_info())
628 {
629 copy_func(output_clusters->clusterEnergy,
630 input_clusters->clusterEnergy,
631 sizeof(float) * state_holder->number, stream);
632
633 copy_func(output_clusters->clusterEt,
634 input_clusters->clusterEt,
635 sizeof(float) * state_holder->number, stream);
636
637 copy_func(output_clusters->clusterEta,
638 input_clusters->clusterEta,
639 sizeof(float) * state_holder->number, stream);
640
641 copy_func(output_clusters->clusterPhi,
642 input_clusters->clusterPhi,
643 sizeof(float) * state_holder->number, stream);
644
645 copy_func(output_clusters->seedCellIndex,
646 input_clusters->seedCellIndex,
647 sizeof(int) * state_holder->number, stream);
648 }
649
650}

◆ cluster_transfer_helper_cell_assignment()

template<class ReadStateFrom, class OutputClusters, class InputClusters, class CopyFunc>
void cluster_transfer_helper_cell_assignment ( ReadStateFrom & state_holder,
OutputClusters & output_clusters,
InputClusters & input_clusters,
CopyFunc copy_func,
CaloRecGPU::CUDA_Helpers::CUDAStreamPtrHolder stream,
const int num_total_cells = NCaloCells )
static

Definition at line 653 of file DataHolders.cxx.

659{
660
661 if (state_holder->has_cells_per_cluster())
662 {
663 copy_func(output_clusters->cellsPrefixSum,
664 input_clusters->cellsPrefixSum,
665 sizeof(int) * (state_holder->number + 1), stream);
666
667 copy_func(output_clusters->cells.indices,
668 input_clusters->cells.indices,
669 sizeof(int) * state_holder->number_cells, stream);
670
671 copy_func(output_clusters->cellWeights,
672 input_clusters->cellWeights,
673 sizeof(float) * state_holder->number_cells, stream);
674
675 copy_func(output_clusters->clusterIndices,
676 input_clusters->clusterIndices,
677 sizeof(int) * state_holder->number_cells, stream);
678
679 int remaining_cells = num_total_cells;
680
681#define CALORECGPU_MOMENTS_EXTRA_TAGS_HELPER(VARNAME) \
682 if (remaining_cells > 0) \
683 { \
684 constexpr int max_size_per_array = (sizeof(float) * NMaxClusters)/sizeof(tag_type); \
685 copy_func(output_clusters->moments. VARNAME, \
686 input_clusters->moments. VARNAME, \
687 sizeof(tag_type) * std::min(remaining_cells, max_size_per_array), stream); \
688 remaining_cells -= max_size_per_array; \
689 } (void) 0 \
690
697
698 }
699 else if (state_holder->state != CaloRecGPU::ClusterInformationState::None)
700 {
701 copy_func(output_clusters->cells.tags,
702 input_clusters->cells.tags,
703 sizeof(tag_type) * state_holder->number_cells, stream);
704
705 }
706}
#define CALORECGPU_MOMENTS_EXTRA_TAGS_HELPER(VARNAME)

◆ cluster_transfer_helper_moments()

template<class ReadStateFrom, class OutputClusters, class InputClusters, class CopyFunc>
void cluster_transfer_helper_moments ( ReadStateFrom & state_holder,
OutputClusters & output_clusters,
InputClusters & input_clusters,
const MomentsOptionsArray & moments_to_add,
CopyFunc copy_func,
CaloRecGPU::CUDA_Helpers::CUDAStreamPtrHolder stream )
static

Definition at line 709 of file DataHolders.cxx.

715{
716 if (state_holder->has_moments())
717 {
718 auto moments_copy_helper = [&](auto & output_arr, const auto & input_arr)
719 {
720 if constexpr(std::is_pointer_v<std::decay_t<decltype(*input_arr)>>)
721 //This is a per-sampling array.
722 {
723 for (int i = 0; i < CaloRecGPU::NumSamplings; ++i)
724 {
725 copy_func(output_arr[i],
726 input_arr[i],
727 sizeof(decltype(input_arr[0][0])) * state_holder->number,
728 stream);
729 }
730 }
731 else
732 {
733 copy_func(output_arr,
734 input_arr,
735 sizeof(decltype(input_arr[0])) * state_holder->number,
736 stream);
737 }
738 };
739
740 if (!moments_to_add[xAOD::CaloCluster::NCELL_SAMPLING])
741 //We need to tranfer the number of cells per sampling in any case
742 //to be able to properly populate the sampling bit pattern...
743 {
744 moments_copy_helper(output_clusters->moments.nCellSampling, input_clusters->moments.nCellSampling);
745 }
746
747#define CALORECGPU_MOMENTS_TO_GPU_HELPER(VAR_NAME, PROPER_MOMENT, NORMAL_ASSIGN, IS_CALCULATED, MOMENT_NAME, ...) \
748 CRGPU_CONCAT(CRGPU_CONCAT(CALORECGPU_MOMENTS_TO_GPU_HELPER_, PROPER_MOMENT), IS_CALCULATED) (VAR_NAME, MOMENT_NAME)
749
750#define CALORECGPU_MOMENTS_TO_GPU_HELPER_11(VAR_NAME, MOMENT_NAME) \
751 if (moments_to_add[xAOD::CaloCluster:: MOMENT_NAME ]) \
752 { \
753 moments_copy_helper(output_clusters->moments. VAR_NAME, input_clusters->moments. VAR_NAME); \
754 }
755
756#define CALORECGPU_MOMENTS_TO_GPU_HELPER_10(VAR_NAME, MOMENT_NAME) \
757 if ( state_holder->state == CaloRecGPU::ClusterInformationState::WithExtraMoments && \
758 moments_to_add[xAOD::CaloCluster:: MOMENT_NAME ] ) \
759 { \
760 moments_copy_helper(output_clusters->moments. VAR_NAME, input_clusters->moments. VAR_NAME); \
761 }
762
763#define CALORECGPU_MOMENTS_TO_GPU_HELPER_01(VAR_NAME, MOMENT_NAME) \
764 moments_copy_helper(output_clusters->moments. VAR_NAME, input_clusters->moments. VAR_NAME);
765
766#define CALORECGPU_MOMENTS_TO_GPU_HELPER_00(VAR_NAME, MOMENT_NAME) \
767 if (state_holder->state == CaloRecGPU::ClusterInformationState::WithExtraMoments) \
768 { \
769 moments_copy_helper(output_clusters->moments. VAR_NAME, input_clusters->moments. VAR_NAME); \
770 }
771
773 }
774}
#define CALORECGPU_MOMENTS_TO_GPU_HELPER(VAR_NAME, PROPER_MOMENT, NORMAL_ASSIGN, IS_CALCULATED, MOMENT_NAME,...)
#define CALORECGPU_FORALLMOMENTS_INSTANTIATE(MACRO,...)
@ NCELL_SAMPLING
Number of cells in sampling layer.
constexpr int NumSamplings

◆ export_cluster_fill_cells_and_basic_info()

void export_cluster_fill_cells_and_basic_info ( const ClusterInfoArr * clusters,
xAOD::CaloClusterContainer * cluster_collection,
std::vector< std::unique_ptr< CaloClusterCellLink > > & cell_links,
std::vector< int > & cluster_order,
const bool save_uncalibrated )
static

Definition at line 1059 of file DataHolders.cxx.

1064{
1065 const int total_size = (cluster_order.size() ? cluster_order.size() : clusters->number);
1066 for (int i = 0; i < total_size; ++i)
1067 {
1068 const int cluster_index = (cluster_order.size() ? cluster_order[i] : i);
1069
1070 if (cell_links[cluster_index] != nullptr && cell_links[cluster_index]->size() > 0)
1071 {
1072 xAOD::CaloCluster * cluster = new xAOD::CaloCluster();
1073 cluster_collection->push_back(cluster);
1074
1075 cluster->addCellLink(std::move(cell_links[cluster_index]));
1076
1077 if (clusters->has_basic_info())
1078 {
1079
1080 cluster->setE (clusters->clusterEnergy[cluster_index]);
1081 cluster->setEta(clusters->clusterEta [cluster_index]);
1082 cluster->setPhi(clusters->clusterPhi [cluster_index]);
1083
1084 if (save_uncalibrated)
1085 {
1086 cluster->setRawE(cluster->calE());
1087 cluster->setRawEta(cluster->calEta());
1088 cluster->setRawPhi(cluster->calPhi());
1089 cluster->setRawM(cluster->calM());
1090 }
1091 }
1092 }
1093 }
1094}
value_type push_back(value_type pElem)
Add an element to the end of the collection.
void setRawEta(flt_t)
Set for signal state UNCALIBRATED.
void setRawPhi(flt_t)
Set for signal state UNCALIBRATED.
bool setPhi(const CaloSample sampling, const float phi)
Set in a given sampling. Returns false if the sample isn't part of the cluster.
flt_t calPhi() const
Get in signal state CALIBRATED.
void addCellLink(CaloClusterCellLink *CCCL)
void setRawE(flt_t)
Set Energy for signal state UNCALIBRATED.
void setRawM(flt_t)
Set mass for singal state UNCALIBRATED.
bool setEta(const CaloSample sampling, const float eta)
Set in a given sampling. Returns false if the sample isn't part of the cluster.
flt_t calEta() const
Get in signal state CALIBRATED.
flt_t calE() const
Geet Energy in signal state CALIBRATED.
flt_t calM() const
Get mass in signal state CALIBRATED.
CaloCluster_v1 CaloCluster
Define the latest version of the calorimeter cluster class.

◆ export_cluster_fill_moments()

void export_cluster_fill_moments ( const ClusterInfoArr * clusters,
xAOD::CaloClusterContainer * cluster_collection,
std::vector< int > & cluster_order,
const MomentsOptionsArray & moments_to_add,
const bool output_extra_moments )
static

Definition at line 1096 of file DataHolders.cxx.

1101{
1102 if (clusters->has_moments())
1103 {
1104 const int total_size = (cluster_order.size() ? cluster_order.size() : clusters->number);
1105 for (int i = 0; i < total_size; ++i)
1106 {
1107 const int cluster_index = (cluster_order.size() ? cluster_order[i] : i);
1108
1109 xAOD::CaloCluster * cluster = (*cluster_collection)[cluster_index];
1110
1111 cluster->clearSamplingData();
1112
1113 uint32_t sampling_pattern = 0;
1114 for (int sampl = 0; sampl < NumSamplings; ++sampl)
1115 {
1116 const int cells_per_sampling = clusters->moments.nCellSampling[sampl][cluster_index];
1117
1118 if (cells_per_sampling > 0)
1119 {
1120 sampling_pattern |= (0x1U << sampl);
1121 }
1122 }
1123
1124 if (clusters->moments.nExtraCellSampling[cluster_index] > 0)
1125 {
1126 sampling_pattern |= (1U << static_cast<unsigned int>(CaloSampling::EME2));
1127 }
1128
1129 cluster->setSamplingPattern(sampling_pattern);
1130
1131 for (int s = 0; s < NumSamplings; ++s)
1132 {
1133 if (sampling_pattern & (1U << s))
1134 {
1135 cluster->setNumberCellsInSampling(static_cast<CaloSampling::CaloSample>(s), clusters->moments.nCellSampling[s][cluster_index], false);
1136 }
1137 }
1138
1139 if (clusters->moments.nExtraCellSampling[cluster_index] > 0)
1140 {
1141 cluster->setNumberCellsInSampling(CaloSampling::EME2, clusters->moments.nExtraCellSampling[cluster_index], true);
1142 }
1143
1144 for (int s = 0; s < NumSamplings; ++s)
1145 {
1146 if (sampling_pattern & (1U << s))
1147 {
1148 cluster->setEnergy(static_cast<CaloSampling::CaloSample>(s), clusters->moments.energyPerSample[s][cluster_index]);
1149 }
1150 }
1151 for (int s = 0; s < NumSamplings; ++s)
1152 {
1153 if (sampling_pattern & (1U << s))
1154 {
1155 cluster->setEmax(static_cast<CaloSampling::CaloSample>(s), clusters->moments.maxEPerSample[s][cluster_index]);
1156 }
1157 }
1158 for (int s = 0; s < NumSamplings; ++s)
1159 {
1160 if (sampling_pattern & (1U << s))
1161 {
1162 cluster->setEtamax(static_cast<CaloSampling::CaloSample>(s), clusters->moments.maxEtaPerSample[s][cluster_index] );
1163 }
1164 }
1165 for (int s = 0; s < NumSamplings; ++s)
1166 {
1167 if (sampling_pattern & (1U << s))
1168 {
1169 cluster->setPhimax(static_cast<CaloSampling::CaloSample>(s), clusters->moments.maxPhiPerSample[s][cluster_index]);
1170 }
1171 }
1172 for (int s = 0; s < NumSamplings; ++s)
1173 {
1174 if (sampling_pattern & (1U << s))
1175 {
1176 cluster->setEta(static_cast<CaloSampling::CaloSample>(s), clusters->moments.etaPerSample[s][cluster_index]);
1177 }
1178 }
1179 for (int s = 0; s < NumSamplings; ++s)
1180 {
1181 if (sampling_pattern & (1U << s))
1182 {
1183 cluster->setPhi(static_cast<CaloSampling::CaloSample>(s), clusters->moments.phiPerSample[s][cluster_index]);
1184 }
1185 }
1186
1187 cluster->setTime(clusters->moments.time[cluster_index]);
1188 cluster->setSecondTime(clusters->moments.secondTime[cluster_index]);
1189
1190#define CALORECGPU_MOMENTS_OUTPUT_HELPER(VAR_NAME, PROPER_MOMENT, NORMAL_ASSIGN, IS_CALCULATED, MOMENT_NAME, ...) \
1191 CRGPU_CONCAT(CRGPU_CONCAT(CALORECGPU_MOMENTS_OUTPUT_HELPER_, NORMAL_ASSIGN), IS_CALCULATED) (VAR_NAME, MOMENT_NAME)
1192
1193#define CALORECGPU_MOMENTS_OUTPUT_HELPER_11(VAR_NAME, MOMENT_NAME) \
1194 if (moments_to_add[xAOD::CaloCluster:: MOMENT_NAME]) \
1195 { \
1196 cluster->insertMoment(xAOD::CaloCluster:: MOMENT_NAME , clusters->moments. VAR_NAME [cluster_index]); \
1197 }
1198
1199#define CALORECGPU_MOMENTS_OUTPUT_HELPER_10(VAR_NAME, MOMENT_NAME) \
1200 if (output_extra_moments && moments_to_add[xAOD::CaloCluster:: MOMENT_NAME]) \
1201 { \
1202 cluster->insertMoment(xAOD::CaloCluster:: MOMENT_NAME , clusters->moments. VAR_NAME [cluster_index]); \
1203 }
1204
1205#define CALORECGPU_MOMENTS_OUTPUT_HELPER_00(...)
1206#define CALORECGPU_MOMENTS_OUTPUT_HELPER_01(...)
1207
1209 }
1210 }
1211}
#define CALORECGPU_MOMENTS_OUTPUT_HELPER(VAR_NAME, PROPER_MOMENT, NORMAL_ASSIGN, IS_CALCULATED, MOMENT_NAME,...)
void setSecondTime(flt_t stime)
Set second moment of cell timing distribution.
void setTime(flt_t)
Set cluster time.
bool setPhimax(const CaloSample sampling, const float phiMax)
Set the phi of the cell with the highest energy in a particular sampling.
bool setEmax(const CaloSample sampling, const float eMax)
Set the Energy of the cell with the highest energy in a particular sampling.
bool setEnergy(const CaloSample sampling, const float e)
Set energy for a given sampling. Returns false if the sample isn't part of the cluster.
void setSamplingPattern(const unsigned sp, const bool clearSamplingVars=false)
Set sampling pattern (one bit per sampling.
void setNumberCellsInSampling(CaloSampling::CaloSample samp, int ncells, bool isInnerWheel=false)
Set the number of cells in a sampling layer.
bool setEtamax(const CaloSample sampling, const float etaMax)
Set the eta of the cell with the highest energy in a particular sampling.
void clearSamplingData()
Clear the sampling data.
setEventNumber uint32_t

◆ export_cluster_initialize_links()

void export_cluster_initialize_links ( const ClusterInfoArr * clusters,
std::vector< std::unique_ptr< CaloClusterCellLink > > & cell_links,
const DataLink< CaloCellContainer > & cell_collection_link,
const bool skip_validation )
static

Definition at line 896 of file DataHolders.cxx.

900{
901 cell_links.reserve(clusters->number);
902
903 for (int i = 0; i < clusters->number; ++i)
904 {
905 if (skip_validation || clusters->seedCellIndex[i] >= 0)
906 {
907 cell_links.emplace_back(std::make_unique<CaloClusterCellLink>(cell_collection_link));
908 cell_links.back()->reserve(256);
909 //To be adjusted.
910 }
911 else
912 {
913 cell_links.emplace_back(nullptr);
914 //The excluded clusters don't have any cells.
915 }
916 }
917}

◆ export_cluster_process_cells()

void export_cluster_process_cells ( const ClusterInfoArr * clusters,
const CellInfoArr * cells,
std::vector< std::unique_ptr< CaloClusterCellLink > > & cell_links,
const std::vector< int > & extra_cells_to_fill )
static

Definition at line 922 of file DataHolders.cxx.

926{
927
928 std::vector<int> real_cells_to_fill;
929
930 if (cells->number == CaloRecGPU::NCaloCells && !cells->all_cells_valid)
931 {
932 real_cells_to_fill.reserve(extra_cells_to_fill.size());
933
934 for (const int cell : extra_cells_to_fill)
935 {
936 if (cells->hashIDToCollection[cell] <= 0)
937 {
938 real_cells_to_fill.push_back(cell);
939 }
940 }
941 }
942
943 auto corrected_index_to_real_index = [&](const int index)
944 {
945 if (cells->all_cells_valid)
946 {
947 return index;
948 }
949
950 int ret = index;
951
952 for (const int cell : real_cells_to_fill)
953 {
954 ret -= (index > cell);
955 }
956
957 return ret;
958 };
959
960 if (clusters->has_cells_per_cluster())
961 {
962 for (int i = 0; i < clusters->number_cells; ++i)
963 {
964 std::unique_ptr<CaloClusterCellLink> & this_link_ptr = cell_links[clusters->clusterIndices[i]];
965 if (this_link_ptr)
966 //This should always be true at this stage,
967 //but guarding against any potentially invalidated clusters.
968 {
969 this_link_ptr->addCell(corrected_index_to_real_index(clusters->cells.indices[i]), clusters->cellWeights[i]);
970 }
971 }
972 }
973 else
974 {
975 for (int i = 0; i < clusters->number; ++i)
976 {
977 if (cell_links[i])
978 {
979 cell_links[i]->addCell(corrected_index_to_real_index(clusters->seedCellIndex[i]), 1);
980 //Seed cells aren't shared, by construction.
981 }
982 }
983
984 for (int i = 0; i < clusters->number_cells; ++i)
985 {
986 const ClusterTag this_tag = clusters->cells.tags[i];
987
988 if (this_tag.is_part_of_cluster())
989 {
990 const int this_cell_index = corrected_index_to_real_index(i);
991
992 const int this_index = this_tag.cluster_index();
993 const int32_t weight_pattern = this_tag.secondary_cluster_weight();
994
995 float tempf = 1.0f;
996
997 std::memcpy(&tempf, &weight_pattern, sizeof(float));
998
999 const float reverse_weight = tempf;
1000
1001 const float this_weight = 1.0f - reverse_weight;
1002
1003 if (cell_links[this_index] && clusters->seedCellIndex[this_index] != i)
1004 {
1005 cell_links[this_index]->addCell(this_cell_index, this_weight);
1006 }
1007
1008 if (this_tag.is_shared_between_clusters())
1009 {
1010 const int other_index = this_tag.secondary_cluster_index();
1011 if (cell_links[other_index] && clusters->seedCellIndex[other_index] != i)
1012 {
1013 cell_links[other_index]->addCell(this_cell_index, reverse_weight);
1014 }
1015 }
1016 }
1017 }
1018 }
1019}
Definition index.py:1
The class that actually expresses the cluster assignment.
constexpr int32_t secondary_cluster_index() const
constexpr int32_t secondary_cluster_weight() const
constexpr bool is_shared_between_clusters() const
constexpr bool is_part_of_cluster() const
constexpr int32_t cluster_index() const

◆ export_cluster_sort()

void export_cluster_sort ( const ClusterInfoArr * clusters,
std::vector< int > & cluster_order,
const bool really_sort )
static

Definition at line 1021 of file DataHolders.cxx.

1024{
1025 if (really_sort)
1026 {
1027 cluster_order.resize(clusters->number);
1028
1029 std::iota(cluster_order.begin(), cluster_order.end(), 0);
1030
1031 std::sort(cluster_order.begin(), cluster_order.end(), [&](const int a, const int b) -> bool
1032 {
1033 const bool a_valid = clusters->seedCellIndex[a] >= 0;
1034 const bool b_valid = clusters->seedCellIndex[b] >= 0;
1035 if (a_valid && b_valid)
1036 {
1037 return (clusters->clusterEt[a] > clusters->clusterEt[b]);
1038 }
1039 else if (a_valid)
1040 {
1041 return true;
1042 }
1043 else if (b_valid)
1044 {
1045 return false;
1046 }
1047 else
1048 {
1049 return b > a;
1050 }
1051 } );
1052 }
1053 else
1054 {
1055 cluster_order.clear();
1056 }
1057}
static Double_t a
if(febId1==febId2)
void sort(typename DataModel_detail::iterator< DVL > beg, typename DataModel_detail::iterator< DVL > end)
Specialization of sort for DataVector/List.