CMS 3D CMS Logo

SiStripClusterizerConditionsGPU.cc
Go to the documentation of this file.
3 
9 
11 
12 namespace stripgpu {
14  const SiStripGain* gains,
15  const SiStripNoises& noises)
16 
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  }
71 
73  cudaStream_t stream) const {
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  }
100 } // namespace stripgpu
static const char noise_[]
static const uint16_t NUMBER_OF_FEDS
static float getRawNoise(const uint16_t &strip, const Range &range)
Definition: SiStripNoises.h:65
std::vector< std::uint16_t, cms::cuda::HostAllocator< std::uint16_t > > noise_
Data const & getGPUProductAsync(cudaStream_t stream) const
__host__ __device__ std::uint32_t channelIndex(fedId_t fed, fedCh_t channel)
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
sistrip classes
float sensorThicknessInverse(DetId detid)
string quality
static float getStripGain(const uint16_t &strip, const SiStripApvGain::Range &range)
Definition: SiStripGain.h:77
void copyAsync(device::unique_ptr< T > &dst, const host::unique_ptr< T > &src, cudaStream_t stream)
Definition: copyAsync.h:20
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...
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:80
static const uint16_t FEDCH_PER_FED
double a
Definition: hdecay.h:121
conn
Definition: getInfo.py:9
static const char gain_[]
SiStripClusterizerConditionsGPU(const SiStripQuality &quality, const SiStripGain *gains, const SiStripNoises &noises)
std::vector< float, cms::cuda::HostAllocator< float > > gain_
static const uint16_t APVS_PER_FEDCH
std::vector< float, cms::cuda::HostAllocator< float > > invthick_