9 int const x1 =
static_cast<int>(std::floor(x));
10 int const x2 =
static_cast<int>(std::floor(x + 1));
11 float const y2 = coder.
charge(shape, x2,
i);
12 float const y1 = coder.
charge(shape, x1,
i);
22 offsetForHashes_{
static_cast<uint32_t
>(pedestals.getAllContainers()[0].second.size())},
23 values_(totalChannels_ * 4) {
24 #ifdef HCAL_MAHI_CPUDEBUG 25 std::cout <<
"hello from converted pedestals" << std::endl;
26 std::cout <<
"pedestals HB values = " << pedestals.getAllContainers()[0].second.size()
27 <<
" HE values = " << pedestals.getAllContainers()[1].second.size() << std::endl;
28 std::cout <<
"qiedata HB values = " << qieData.getAllContainers()[0].second.size()
29 <<
" HE values = " << qieData.getAllContainers()[1].second.size() << std::endl;
33 auto const pedestalsAll = pedestals.getAllContainers();
34 auto const qieDataAll = qieData.getAllContainers();
35 auto const qieTypesAll = qieTypes.getAllContainers();
38 auto const unitIsADC = pedestals.isADC();
41 auto const& pedestalBarrelValues = pedestalsAll[0].second;
42 auto const& qieDataBarrelValues = qieDataAll[0].second;
43 auto const& qieTypesBarrelValues = qieTypesAll[0].second;
45 #ifdef HCAL_MAHI_CPUDEBUG 46 assert(pedestalBarrelValues.size() == qieDataBarrelValues.size());
47 assert(pedestalBarrelValues.size() == qieTypesBarrelValues.size());
50 for (
uint64_t i = 0;
i < pedestalBarrelValues.size(); ++
i) {
51 auto const& qieCoder = qieDataBarrelValues[
i];
52 auto const qieType = qieTypesBarrelValues[
i].getValue() > 1 ? 1 : 0;
53 auto const& qieShape = qieData.getShape(qieType);
55 values_[
i * 4] = unitIsADC ?
convert(pedestalBarrelValues[
i].
getValue(0), 0, qieCoder, qieShape)
57 values_[
i * 4 + 1] = unitIsADC ?
convert(pedestalBarrelValues[
i].
getValue(1), 1, qieCoder, qieShape)
59 values_[
i * 4 + 2] = unitIsADC ?
convert(pedestalBarrelValues[
i].
getValue(2), 2, qieCoder, qieShape)
61 values_[
i * 4 + 3] = unitIsADC ?
convert(pedestalBarrelValues[
i].
getValue(3), 3, qieCoder, qieShape)
66 auto const& pedestalEndcapValues = pedestalsAll[1].second;
67 auto const& qieDataEndcapValues = qieDataAll[1].second;
68 auto const& qieTypesEndcapValues = qieTypesAll[1].second;
70 #ifdef HCAL_MAHI_CPUDEBUG 71 assert(pedestalEndcapValues.size() == qieDataEndcapValues.size());
72 assert(pedestalEndcapValues.size() == qieTypesEndcapValues.size());
75 auto const offset = pedestalBarrelValues.size();
76 for (
uint64_t i = 0;
i < pedestalEndcapValues.size(); ++
i) {
77 auto const& qieCoder = qieDataEndcapValues[
i];
78 auto const qieType = qieTypesEndcapValues[
i].getValue() > 1 ? 1 : 0;
79 auto const& qieShape = qieData.getShape(qieType);
82 values_[off * 4] = unitIsADC ?
convert(pedestalEndcapValues[
i].
getValue(0), 0, qieCoder, qieShape)
84 values_[off * 4 + 1] = unitIsADC ?
convert(pedestalEndcapValues[
i].
getValue(1), 1, qieCoder, qieShape)
86 values_[off * 4 + 2] = unitIsADC ?
convert(pedestalEndcapValues[
i].
getValue(2), 2, qieCoder, qieShape)
88 values_[off * 4 + 3] = unitIsADC ?
convert(pedestalEndcapValues[
i].
getValue(3), 3, qieCoder, qieShape)
91 #ifdef HCAL_MAHI_CPUDEBUG 92 if (pedestalEndcapValues[
i].rawId() == DETID_TO_DEBUG) {
93 printf(
"qietype = %d\n", qieType);
94 printf(
"ped0 = %f ped1 = %f ped2 = %f ped3 = %f\n",
99 printf(
"converted: ped0 = %f ped1 = %f ped2 = %f ped3 = %f\n",
101 values_[off * 4 + 1],
102 values_[off * 4 + 2],
103 values_[off * 4 + 3]);
110 auto const& product =
product_.dataForCurrentDeviceAsync(
Product const & getProduct(cudaStream_t) const
uint32_t T const *__restrict__ uint32_t const *__restrict__ int32_t int Histo::index_type cudaStream_t stream
edm::propagate_const_array< cms::cuda::device::unique_ptr< float[]> > values
cms::cuda::ESProduct< Product > product_
void copyAsync(device::unique_ptr< T > &dst, const host::unique_ptr< T > &src, cudaStream_t stream)
def convert(infile, ofile)
const tAllContWithNames getAllContainers() const
std::vector< float, cms::cuda::HostAllocator< float > > values_
unsigned long long uint64_t
HcalConvertedPedestalsGPU(HcalPedestals const &, HcalQIEData const &, HcalQIETypes const &)
#define TYPELOOKUP_DATA_REG(_dataclass_)
const JetExtendedData & getValue(const Container &, const reco::JetBaseRef &)
get value for the association. Throw exception if no association found
float charge(const HcalQIEShape &fShape, unsigned fAdc, unsigned fCapId) const
ADC [0..127] + capid [0..3] -> fC conversion.