CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes | Static Private Attributes
HGCUncalibRecHitHost< T > Class Template Reference

#include <HGCUncalibRecHitHost.h>

Public Member Functions

void defineSoAMemoryLayout_ ()
 
void fillSoA_ (const T &c)
 
HGCUncalibRecHitSoA get () const
 
 HGCUncalibRecHitHost ()=default
 
 HGCUncalibRecHitHost (const HGCUncalibRecHitHost &)=delete
 
 HGCUncalibRecHitHost (HGCUncalibRecHitHost &&)=default
 
 HGCUncalibRecHitHost (uint32_t nhits, const T &hits, const cudaStream_t &stream)
 
uint32_t nBytes () const
 
uint32_t nHits () const
 
HGCUncalibRecHitHostoperator= (const HGCUncalibRecHitHost &)=delete
 
HGCUncalibRecHitHostoperator= (HGCUncalibRecHitHost &&)=default
 
uint32_t pad () const
 
 ~HGCUncalibRecHitHost ()=default
 

Private Attributes

uint32_t nhits_
 
uint32_t pad_
 
cms::cuda::host::unique_ptr< std::byte[]> ptr_
 
uint32_t size_tot_
 
HGCUncalibRecHitSoA soa_
 

Static Private Attributes

static constexpr std::array< int, memory::npointers::ntypes_hgcuncalibrechits_soasizes_
 

Detailed Description

template<class T>
class HGCUncalibRecHitHost< T >

Definition at line 12 of file HGCUncalibRecHitHost.h.

Constructor & Destructor Documentation

◆ HGCUncalibRecHitHost() [1/4]

template<class T>
HGCUncalibRecHitHost< T >::HGCUncalibRecHitHost ( )
default

◆ HGCUncalibRecHitHost() [2/4]

template<class T>
HGCUncalibRecHitHost< T >::HGCUncalibRecHitHost ( uint32_t  nhits,
const T hits,
const cudaStream_t &  stream 
)
inlineexplicit

Definition at line 15 of file HGCUncalibRecHitHost.h.

15  : nhits_(nhits) {
16  size_tot_ = std::accumulate(sizes_.begin(), sizes_.end(), 0); //this might be done at compile time
17  pad_ = ((nhits - 1) / 32 + 1) * 32; //align to warp boundary (assumption: warpSize = 32)
18  ptr_ = cms::cuda::make_host_unique<std::byte[]>(pad_ * size_tot_, stream);
19 
21  fillSoA_(hits);
22  }

◆ ~HGCUncalibRecHitHost()

template<class T>
HGCUncalibRecHitHost< T >::~HGCUncalibRecHitHost ( )
default

◆ HGCUncalibRecHitHost() [3/4]

template<class T>
HGCUncalibRecHitHost< T >::HGCUncalibRecHitHost ( const HGCUncalibRecHitHost< T > &  )
delete

◆ HGCUncalibRecHitHost() [4/4]

template<class T>
HGCUncalibRecHitHost< T >::HGCUncalibRecHitHost ( HGCUncalibRecHitHost< T > &&  )
default

Member Function Documentation

◆ defineSoAMemoryLayout_()

template<class T>
void HGCUncalibRecHitHost< T >::defineSoAMemoryLayout_ ( )
inline

Definition at line 30 of file HGCUncalibRecHitHost.h.

30  {
31  soa_.amplitude_ = reinterpret_cast<float *>(ptr_.get());
37  soa_.flags_ = reinterpret_cast<uint32_t *>(soa_.OOTchi2_ + pad_);
38  soa_.aux_ = soa_.flags_ + pad_;
39  soa_.id_ = soa_.aux_ + pad_;
40  soa_.aux_ = soa_.flags_ + pad_;
41  soa_.id_ = soa_.aux_ + pad_;
42 
44  soa_.nhits_ = nhits_;
45  soa_.pad_ = pad_;
46  }

Referenced by HGCUncalibRecHitHost< edm::SortedCollection >::HGCUncalibRecHitHost().

◆ fillSoA_()

template<class T>
void HGCUncalibRecHitHost< T >::fillSoA_ ( const T c)
inline

Definition at line 48 of file HGCUncalibRecHitHost.h.

48  {
49  for (unsigned i(0); i < nhits_; ++i) {
50  soa_.amplitude_[i] = c[i].amplitude();
51  soa_.pedestal_[i] = c[i].pedestal();
52  soa_.jitter_[i] = c[i].jitter();
53  soa_.chi2_[i] = c[i].chi2();
54  soa_.OOTamplitude_[i] = c[i].outOfTimeEnergy();
55  soa_.OOTchi2_[i] = c[i].outOfTimeChi2();
56  soa_.flags_[i] = c[i].flags();
57  soa_.aux_[i] = 0;
58  soa_.id_[i] = c[i].id().rawId();
59  }
60  }

Referenced by HGCUncalibRecHitHost< edm::SortedCollection >::HGCUncalibRecHitHost().

◆ get()

template<class T>
HGCUncalibRecHitSoA HGCUncalibRecHitHost< T >::get ( ) const
inline

◆ nBytes()

template<class T>
uint32_t HGCUncalibRecHitHost< T >::nBytes ( ) const
inline

Definition at line 65 of file HGCUncalibRecHitHost.h.

65 { return size_tot_; }

◆ nHits()

template<class T>
uint32_t HGCUncalibRecHitHost< T >::nHits ( ) const
inline

Definition at line 63 of file HGCUncalibRecHitHost.h.

63 { return nhits_; }

◆ operator=() [1/2]

template<class T>
HGCUncalibRecHitHost& HGCUncalibRecHitHost< T >::operator= ( const HGCUncalibRecHitHost< T > &  )
delete

◆ operator=() [2/2]

template<class T>
HGCUncalibRecHitHost& HGCUncalibRecHitHost< T >::operator= ( HGCUncalibRecHitHost< T > &&  )
default

◆ pad()

template<class T>
uint32_t HGCUncalibRecHitHost< T >::pad ( ) const
inline

Definition at line 64 of file HGCUncalibRecHitHost.h.

64 { return pad_; }

Member Data Documentation

◆ nhits_

template<class T>
uint32_t HGCUncalibRecHitHost< T >::nhits_
private

◆ pad_

template<class T>
uint32_t HGCUncalibRecHitHost< T >::pad_
private

◆ ptr_

template<class T>
cms::cuda::host::unique_ptr<std::byte[]> HGCUncalibRecHitHost< T >::ptr_
private

◆ size_tot_

template<class T>
uint32_t HGCUncalibRecHitHost< T >::size_tot_
private

◆ sizes_

template<class T>
constexpr std::array<int, memory::npointers::ntypes_hgcuncalibrechits_soa> HGCUncalibRecHitHost< T >::sizes_
staticconstexprprivate

◆ soa_

template<class T>
HGCUncalibRecHitSoA HGCUncalibRecHitHost< T >::soa_
private
HGCUncalibRecHitHost::nhits_
uint32_t nhits_
Definition: HGCUncalibRecHitHost.h:75
mps_fire.i
i
Definition: mps_fire.py:428
HGCUncalibRecHitSoA::jitter_
float * jitter_
Definition: HGCUncalibRecHitSoA.h:10
dqmMemoryStats.float
float
Definition: dqmMemoryStats.py:127
HGCUncalibRecHitSoA::pad_
std::uint32_t pad_
Definition: HGCUncalibRecHitSoA.h:21
hfClusterShapes_cfi.hits
hits
Definition: hfClusterShapes_cfi.py:5
HGCUncalibRecHitSoA::amplitude_
float * amplitude_
Definition: HGCUncalibRecHitSoA.h:8
HGCUncalibRecHitHost::ptr_
cms::cuda::host::unique_ptr< std::byte[]> ptr_
Definition: HGCUncalibRecHitHost.h:68
memory::npointers::uint32_hgcuncalibrechits_soa
constexpr unsigned uint32_hgcuncalibrechits_soa
Definition: HGCUncalibRecHitSoA.h:27
HGCUncalibRecHitSoA::nhits_
std::uint32_t nhits_
Definition: HGCUncalibRecHitSoA.h:20
cms::cuda::stream
cudaStream_t stream
Definition: HistoContainer.h:57
HGCUncalibRecHitSoA::pedestal_
float * pedestal_
Definition: HGCUncalibRecHitSoA.h:9
memory::npointers::float_hgcuncalibrechits_soa
constexpr unsigned float_hgcuncalibrechits_soa
Definition: HGCUncalibRecHitSoA.h:26
HGCUncalibRecHitHost::size_tot_
uint32_t size_tot_
Definition: HGCUncalibRecHitHost.h:73
HGCUncalibRecHitSoA::aux_
std::uint32_t * aux_
Definition: HGCUncalibRecHitSoA.h:16
HGCUncalibRecHitSoA::chi2_
float * chi2_
Definition: HGCUncalibRecHitSoA.h:11
HGCUncalibRecHitSoA::id_
std::uint32_t * id_
Definition: HGCUncalibRecHitSoA.h:17
nhits
Definition: HIMultiTrackSelector.h:42
HGCUncalibRecHitHost::pad_
uint32_t pad_
Definition: HGCUncalibRecHitHost.h:74
HGCUncalibRecHitSoA::nbytes_
std::uint32_t nbytes_
Definition: HGCUncalibRecHitSoA.h:19
HGCUncalibRecHitSoA::OOTchi2_
float * OOTchi2_
Definition: HGCUncalibRecHitSoA.h:13
HGCUncalibRecHitSoA::flags_
std::uint32_t * flags_
Definition: HGCUncalibRecHitSoA.h:15
HGCUncalibRecHitSoA::OOTamplitude_
float * OOTamplitude_
Definition: HGCUncalibRecHitSoA.h:12
HGCUncalibRecHitHost::sizes_
static constexpr std::array< int, memory::npointers::ntypes_hgcuncalibrechits_soa > sizes_
Definition: HGCUncalibRecHitHost.h:70
HGCUncalibRecHitHost::fillSoA_
void fillSoA_(const T &c)
Definition: HGCUncalibRecHitHost.h:48
HGCUncalibRecHitHost::soa_
HGCUncalibRecHitSoA soa_
Definition: HGCUncalibRecHitHost.h:69
c
auto & c
Definition: CAHitNtupletGeneratorKernelsImpl.h:46
HGCUncalibRecHitHost::defineSoAMemoryLayout_
void defineSoAMemoryLayout_()
Definition: HGCUncalibRecHitHost.h:30