15 throw cms::Exception(
"HeterogeneousHGCalEEConditionsWrapper") <<
"select_pointer_d(heterogeneous): no item.";
20 const std::vector<double>& select_pointer_d(
const HGCalParameters* cpuObject,
const unsigned& item) {
32 <<
"select_pointer_d(non-heterogeneous): no item.";
42 throw cms::Exception(
"HeterogeneousHGCalEEConditionsWrapper") <<
"select_pointer_i(heterogeneous): no item.";
47 const std::vector<int32_t>& select_pointer_i(
const HGCalParameters* cpuObject,
const unsigned& item) {
53 <<
"select_pointer_i(non-heterogeneous): no item.";
66 std::vector<size_t> cumsum_sizes(this->
sizes_.size() + 1, 0);
67 std::partial_sum(this->
sizes_.begin(), this->
sizes_.end(), cumsum_sizes.begin() + 1);
68 for (
unsigned i(1);
i < cumsum_sizes.size(); ++
i)
70 unsigned typesEEsize(0);
72 typesEEsize =
sizeof(double);
73 else if (
cp::typesEE[
i - 1] == cp::HeterogeneousHGCalEEParametersType::Int32_t)
74 typesEEsize =
sizeof(int32_t);
76 throw cms::Exception(
"HeterogeneousHGCalEEConditionsWrapper") <<
"Wrong HeterogeneousHGCalParameters type";
77 cumsum_sizes[
i] /= typesEEsize;
80 for (
unsigned j(0);
j < this->
sizes_.size(); ++
j) {
83 const unsigned jm1(
j - 1);
88 cp::typesEE[
j] == cp::HeterogeneousHGCalEEParametersType::Int32_t)
89 ::select_pointer_i(&this->
params_,
j) =
90 reinterpret_cast<int32_t*
>(::select_pointer_d(&this->
params_, jm1) + this->
sizes_[jm1]);
94 for (
unsigned i(cumsum_sizes[
j]);
i < cumsum_sizes[j + 1]; ++
i) {
95 unsigned index(
i - cumsum_sizes[j]);
97 ::select_pointer_d(&this->
params_, j)[
index] = ::select_pointer_d(cpuHGCalParameters, j)[
index];
98 }
else if (
cp::typesEE[j] == cp::HeterogeneousHGCalEEParametersType::Int32_t)
99 ::select_pointer_i(&this->
params_, j)[
index] = ::select_pointer_i(cpuHGCalParameters, j)[
index];
101 throw cms::Exception(
"HeterogeneousHGCalEEConditionsWrapper") <<
"Wrong HeterogeneousHGCalParameters type";
108 std::vector<size_t> sizes(npointers);
109 for (
unsigned i(0);
i < npointers; ++
i) {
111 sizes[
i] = ::select_pointer_d(cpuHGCalParameters,
i).size();
113 sizes[
i] = ::select_pointer_i(cpuHGCalParameters,
i).size();
116 std::vector<size_t> sizes_units(npointers);
117 for (
unsigned i(0);
i < npointers; ++
i) {
119 sizes_units[
i] =
sizeof(double);
120 else if (
cp::typesEE[
i] == cp::HeterogeneousHGCalEEParametersType::Int32_t)
121 sizes_units[
i] =
sizeof(int32_t);
125 this->
sizes_.resize(npointers);
126 std::transform(sizes.begin(), sizes.end(), sizes_units.begin(), this->
sizes_.begin(), std::multiplies<size_t>());
156 for (
unsigned j(0);
j < this->
sizes_.size() - 1; ++
j) {
161 cp::typesEE[
j + 1] == cp::HeterogeneousHGCalEEParametersType::Int32_t)
163 reinterpret_cast<int32_t*
>(::select_pointer_d(&(data.
host->
params),
j) + this->
sizes_[
j]);
166 <<
"compare this functions' logic with hgcal_conditions::parameters::typesEE";
173 cudaMemcpyHostToDevice,
183 if (
host !=
nullptr) {
hgcal_conditions::HeterogeneousEEConditionsESProduct const * getHeterogeneousConditionsESProductAsync(cudaStream_t stream) const
std::vector< size_t > sizes_
hgcal_conditions::HeterogeneousEEConditionsESProduct * host
parameters::HeterogeneousHGCalEEParameters params
std::vector< double > cellFineY_
HeterogeneousHGCalEEConditionsWrapper(const HGCalParameters *)
uint32_t T const *__restrict__ uint32_t const *__restrict__ int32_t int Histo::index_type cudaStream_t stream
std::vector< double > cellCoarseX_
const std::array< HeterogeneousHGCalEEParametersType, 5 > typesEE
~HeterogeneousHGCalEEConditionsWrapper()
std::int32_t * waferTypeL_
void calculate_memory_bytes(const HGCalParameters *)
cp::HeterogeneousHGCalEEParameters params_
std::vector< double > cellFineX_
char data[epos_bytes_allocation]
cms::cuda::ESProduct< GPUData > gpuData_
#define cudaCheck(ARG,...)
std::vector< double > cellCoarseY_
std::vector< int > waferTypeL_
hgcal_conditions::HeterogeneousEEConditionsESProduct * device