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 (uint32_t nhits, const T &hits, const cudaStream_t &stream)
 
 HGCUncalibRecHitHost (const HGCUncalibRecHitHost &)=delete
 
 HGCUncalibRecHitHost (HGCUncalibRecHitHost &&)=default
 
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  }
uint32_t T const *__restrict__ uint32_t const *__restrict__ int32_t int Histo::index_type cudaStream_t stream
void fillSoA_(const T &c)
static constexpr std::array< int, memory::npointers::ntypes_hgcuncalibrechits_soa > sizes_
cms::cuda::host::unique_ptr< std::byte[]> ptr_

◆ ~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.

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

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  }
HGCUncalibRecHitSoA soa_
std::uint32_t * flags_
cms::cuda::host::unique_ptr< std::byte[]> ptr_

◆ fillSoA_()

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

Definition at line 48 of file HGCUncalibRecHitHost.h.

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

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  }
HGCUncalibRecHitSoA soa_
std::uint32_t * flags_

◆ 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_
staticprivate

◆ soa_

template<class T>
HGCUncalibRecHitSoA HGCUncalibRecHitHost< T >::soa_
private