CMS 3D CMS Logo

List of all members | Classes | Public Types | Public Member Functions | Static Public Attributes | Private Member Functions | Private Attributes
stripgpu::SiStripClusterizerConditionsGPU Class Reference

#include <SiStripClusterizerConditionsGPU.h>

Classes

class  Data
 
class  DetToFed
 

Public Types

using DetToFeds = std::vector< DetToFed >
 

Public Member Functions

const DetToFedsdetToFeds () const
 
Data const & getGPUProductAsync (cudaStream_t stream) const
 
 SiStripClusterizerConditionsGPU (const SiStripQuality &quality, const SiStripGain *gains, const SiStripNoises &noises)
 
 ~SiStripClusterizerConditionsGPU ()=default
 

Static Public Attributes

static constexpr std::uint16_t badBit = 1 << 15
 

Private Member Functions

void setInvThickness (fedId_t fed, fedCh_t channel, float invthick)
 
void setStrip (fedId_t fed, fedCh_t channel, stripId_t strip, std::uint16_t noise, float gain, bool bad)
 

Private Attributes

std::vector< detId_t, cms::cuda::HostAllocator< detId_t > > detID_
 
DetToFeds detToFeds_
 
std::vector< float, cms::cuda::HostAllocator< float > > gain_
 
cms::cuda::ESProduct< DatagpuData_
 
std::vector< float, cms::cuda::HostAllocator< float > > invthick_
 
std::vector< apvPair_t, cms::cuda::HostAllocator< apvPair_t > > iPair_
 
std::vector< std::uint16_t, cms::cuda::HostAllocator< std::uint16_t > > noise_
 

Detailed Description

Definition at line 31 of file SiStripClusterizerConditionsGPU.h.

Member Typedef Documentation

◆ DetToFeds

Definition at line 48 of file SiStripClusterizerConditionsGPU.h.

Constructor & Destructor Documentation

◆ SiStripClusterizerConditionsGPU()

stripgpu::SiStripClusterizerConditionsGPU::SiStripClusterizerConditionsGPU ( const SiStripQuality quality,
const SiStripGain gains,
const SiStripNoises noises 
)

Definition at line 13 of file SiStripClusterizerConditionsGPU.cc.

References a, b, officialStyle::chan, stripgpu::channelIndex(), getInfo::conn, detID_, detToFeds_, PedestalClient_cfi::gain, ecalph2::gains, SiStripNoises::getRawNoise(), SiStripGain::getStripGain(), iPair_, hgchebackDigitizer_cfi::noise, hgcalLayerClustersEE_cfi::noises, hltrates_dqm_sourceclient-live_cfg::offset, quality, siStripClusterTools::sensorThicknessInverse(), setInvThickness(), setStrip(), jetUpdater_cfi::sort, and nano_mu_digi_cff::strip.

22  // connected: map<DetID, std::vector<int>>
23  // map of KEY=detid DATA=vector of apvs, maximum 6 APVs per detector module :
24  const auto& connected = quality.cabling()->connected();
25  // detCabling: map<DetID, std::vector<const FedChannelConnection *>
26  // map of KEY=detid DATA=vector<FedChannelConnection>
27  const auto& detCabling = quality.cabling()->getDetCabling();
28 
29  for (const auto& conn : connected) {
30  const auto det = conn.first;
31  if (!quality.IsModuleBad(det)) {
32  const auto detConn_it = detCabling.find(det);
33 
34  if (detCabling.end() != detConn_it) {
35  for (const auto& chan : (*detConn_it).second) {
36  if (chan && chan->fedId() && chan->isConnected()) {
37  const auto detID = chan->detId();
38  const auto fedID = chan->fedId();
39  const auto fedCh = chan->fedCh();
40  const auto iPair = chan->apvPairNumber();
41 
42  detToFeds_.emplace_back(detID, iPair, fedID, fedCh);
43 
44  detID_[channelIndex(fedID, fedCh)] = detID;
45  iPair_[channelIndex(fedID, fedCh)] = iPair;
47 
48  auto offset = 256 * iPair;
49 
50  for (auto strip = 0; strip < 256; ++strip) {
51  const auto gainRange = gains->getRange(det);
52 
53  const auto detstrip = strip + offset;
54  const std::uint16_t noise = SiStripNoises::getRawNoise(detstrip, noises.getRange(det));
55  const auto gain = SiStripGain::getStripGain(detstrip, gainRange);
56  const auto bad = quality.IsStripBad(quality.getRange(det), detstrip);
57 
58  // gain is actually stored per-APV, not per-strip
59  setStrip(fedID, fedCh, detstrip, noise, gain, bad);
60  }
61  }
62  }
63  }
64  }
65  }
66 
67  std::sort(detToFeds_.begin(), detToFeds_.end(), [](const DetToFed& a, const DetToFed& b) {
68  return a.detID() < b.detID() || (a.detID() == b.detID() && a.pair() < b.pair());
69  });
70  }
static const uint16_t NUMBER_OF_FEDS
static float getRawNoise(const uint16_t &strip, const Range &range)
Definition: SiStripNoises.h:66
std::vector< std::uint16_t, cms::cuda::HostAllocator< std::uint16_t > > noise_
__host__ __device__ std::uint32_t channelIndex(fedId_t fed, fedCh_t channel)
std::vector< detId_t, cms::cuda::HostAllocator< detId_t > > detID_
float sensorThicknessInverse(DetId detid)
string quality
static float getStripGain(const uint16_t &strip, const SiStripApvGain::Range &range)
Definition: SiStripGain.h:77
void setInvThickness(fedId_t fed, fedCh_t channel, float invthick)
void setStrip(fedId_t fed, fedCh_t channel, stripId_t strip, std::uint16_t noise, float gain, bool bad)
constexpr float gains[NGAINS]
Definition: EcalConstants.h:20
static const uint16_t STRIPS_PER_FEDCH
double b
Definition: hdecay.h:120
std::vector< apvPair_t, cms::cuda::HostAllocator< apvPair_t > > iPair_
chan
lumi = TPaveText(lowX+0.38, lowY+0.061, lowX+0.45, lowY+0.161, "NDC") lumi.SetBorderSize( 0 ) lumi...
static const uint16_t FEDCH_PER_FED
double a
Definition: hdecay.h:121
conn
Definition: getInfo.py:9
std::vector< float, cms::cuda::HostAllocator< float > > gain_
static const uint16_t APVS_PER_FEDCH
std::vector< float, cms::cuda::HostAllocator< float > > invthick_

◆ ~SiStripClusterizerConditionsGPU()

stripgpu::SiStripClusterizerConditionsGPU::~SiStripClusterizerConditionsGPU ( )
default

Member Function Documentation

◆ detToFeds()

const DetToFeds& stripgpu::SiStripClusterizerConditionsGPU::detToFeds ( ) const
inline

◆ getGPUProductAsync()

SiStripClusterizerConditionsGPU::Data const & stripgpu::SiStripClusterizerConditionsGPU::getGPUProductAsync ( cudaStream_t  stream) const

Definition at line 72 of file SiStripClusterizerConditionsGPU.cc.

References cms::cuda::copyAsync(), data, detID_, gain_, gpuData_, invthick_, iPair_, noise_, and cms::cuda::stream.

73  {
74  auto const& data = gpuData_.dataForCurrentDeviceAsync(stream, [this](Data& data, cudaStream_t stream) {
75  data.noise_ = cms::cuda::make_device_unique<std::uint16_t[]>(noise_.size(), stream);
76  data.invthick_ = cms::cuda::make_device_unique<float[]>(invthick_.size(), stream);
77  data.detID_ = cms::cuda::make_device_unique<detId_t[]>(detID_.size(), stream);
78  data.iPair_ = cms::cuda::make_device_unique<apvPair_t[]>(iPair_.size(), stream);
79  data.gain_ = cms::cuda::make_device_unique<float[]>(gain_.size(), stream);
80 
86 
87  data.hostView_ = cms::cuda::make_host_unique<SiStripClusterizerConditionsGPU::Data::DeviceView>(stream);
88  data.hostView_->noise_ = data.noise_.get();
89  data.hostView_->invthick_ = data.invthick_.get();
90  data.hostView_->detID_ = data.detID_.get();
91  data.hostView_->iPair_ = data.iPair_.get();
92  data.hostView_->gain_ = data.gain_.get();
93 
94  data.deviceView_ = cms::cuda::make_device_unique<SiStripClusterizerConditionsGPU::Data::DeviceView>(stream);
95  cms::cuda::copyAsync(data.deviceView_, data.hostView_, stream);
96  });
97 
98  return data;
99  }
std::vector< std::uint16_t, cms::cuda::HostAllocator< std::uint16_t > > noise_
std::vector< detId_t, cms::cuda::HostAllocator< detId_t > > detID_
uint32_t T const *__restrict__ uint32_t const *__restrict__ int32_t int Histo::index_type cudaStream_t stream
void copyAsync(device::unique_ptr< T > &dst, const host::unique_ptr< T > &src, cudaStream_t stream)
Definition: copyAsync.h:20
std::vector< apvPair_t, cms::cuda::HostAllocator< apvPair_t > > iPair_
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:80
std::vector< float, cms::cuda::HostAllocator< float > > gain_
std::vector< float, cms::cuda::HostAllocator< float > > invthick_

◆ setInvThickness()

void stripgpu::SiStripClusterizerConditionsGPU::setInvThickness ( fedId_t  fed,
fedCh_t  channel,
float  invthick 
)
inlineprivate

Definition at line 119 of file SiStripClusterizerConditionsGPU.h.

References stripgpu::channelIndex(), and invthick_.

Referenced by SiStripClusterizerConditionsGPU().

119  {
120  invthick_[channelIndex(fed, channel)] = invthick;
121  }
__host__ __device__ std::uint32_t channelIndex(fedId_t fed, fedCh_t channel)
std::vector< float, cms::cuda::HostAllocator< float > > invthick_

◆ setStrip()

void stripgpu::SiStripClusterizerConditionsGPU::setStrip ( fedId_t  fed,
fedCh_t  channel,
stripId_t  strip,
std::uint16_t  noise,
float  gain,
bool  bad 
)
inlineprivate

Definition at line 111 of file SiStripClusterizerConditionsGPU.h.

References stripgpu::apvIndex(), badBit, PedestalClient_cfi::gain, gain_, hgchebackDigitizer_cfi::noise, noise_, nano_mu_digi_cff::strip, and stripgpu::stripIndex().

Referenced by SiStripClusterizerConditionsGPU().

111  {
112  gain_[apvIndex(fed, channel, strip)] = gain;
113  noise_[stripIndex(fed, channel, strip)] = noise;
114  if (bad) {
115  noise_[stripIndex(fed, channel, strip)] |= badBit;
116  }
117  }
std::vector< std::uint16_t, cms::cuda::HostAllocator< std::uint16_t > > noise_
__host__ __device__ std::uint32_t stripIndex(fedId_t fed, fedCh_t channel, stripId_t strip)
__host__ __device__ std::uint32_t apvIndex(fedId_t fed, fedCh_t channel, stripId_t strip)
std::vector< float, cms::cuda::HostAllocator< float > > gain_

Member Data Documentation

◆ badBit

constexpr std::uint16_t stripgpu::SiStripClusterizerConditionsGPU::badBit = 1 << 15
static

◆ detID_

std::vector<detId_t, cms::cuda::HostAllocator<detId_t> > stripgpu::SiStripClusterizerConditionsGPU::detID_
private

◆ detToFeds_

DetToFeds stripgpu::SiStripClusterizerConditionsGPU::detToFeds_
private

◆ gain_

std::vector<float, cms::cuda::HostAllocator<float> > stripgpu::SiStripClusterizerConditionsGPU::gain_
private

Definition at line 128 of file SiStripClusterizerConditionsGPU.h.

Referenced by getGPUProductAsync(), and setStrip().

◆ gpuData_

cms::cuda::ESProduct<Data> stripgpu::SiStripClusterizerConditionsGPU::gpuData_
private

Definition at line 132 of file SiStripClusterizerConditionsGPU.h.

Referenced by getGPUProductAsync().

◆ invthick_

std::vector<float, cms::cuda::HostAllocator<float> > stripgpu::SiStripClusterizerConditionsGPU::invthick_
private

Definition at line 125 of file SiStripClusterizerConditionsGPU.h.

Referenced by getGPUProductAsync(), and setInvThickness().

◆ iPair_

std::vector<apvPair_t, cms::cuda::HostAllocator<apvPair_t> > stripgpu::SiStripClusterizerConditionsGPU::iPair_
private

◆ noise_

std::vector<std::uint16_t, cms::cuda::HostAllocator<std::uint16_t> > stripgpu::SiStripClusterizerConditionsGPU::noise_
private

Definition at line 124 of file SiStripClusterizerConditionsGPU.h.

Referenced by getGPUProductAsync(), and setStrip().