CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes
HEFRecHitGPU Class Reference
Inheritance diagram for HEFRecHitGPU:
edm::stream::EDProducer<>

Public Member Functions

 HEFRecHitGPU (const edm::ParameterSet &ps)
 
void produce (edm::Event &, const edm::EventSetup &) override
 
 ~HEFRecHitGPU () override
 
- Public Member Functions inherited from edm::stream::EDProducer<>
 EDProducer ()=default
 
 EDProducer (const EDProducer &)=delete
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginProcessBlocks () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndProcessBlocks () const final
 
bool hasAbilityToProduceInEndRuns () const final
 
const EDProduceroperator= (const EDProducer &)=delete
 

Private Member Functions

std::string assert_error_message_ (std::string, const size_t &, const size_t &)
 
void assert_sizes_constants_ (const HGCConstantVectorData &)
 
void convert_collection_data_to_soa_ (const uint32_t &, const HGChefUncalibratedRecHitCollection &)
 
void convert_constant_data_ (KernelConstantData< HGChefUncalibRecHitConstantData > *)
 

Private Attributes

HGChefUncalibRecHitConstantData cdata_
 
HGCUncalibRecHitDevice d_uncalib_
 
HGCUncalibRecHitHost< HGChefUncalibratedRecHitCollectionh_uncalib_
 
KernelConstantData< HGChefUncalibRecHitConstantData > * kcdata_
 
HGCRecHitGPUProduct prod_
 
edm::EDPutTokenT< cms::cuda::Product< HGCRecHitGPUProduct > > recHitGPUToken_
 
std::unique_ptr< HGChefRecHitCollectionrechits_
 
std::unique_ptr< hgcal::RecHitToolstools_
 
edm::EDGetTokenT< HGChefUncalibratedRecHitCollectionuncalibRecHitCPUToken_
 
HGCConstantVectorData vdata_
 

Additional Inherited Members

- Public Types inherited from edm::stream::EDProducer<>
using CacheTypes = CacheContexts< T... >
 
using GlobalCache = typename CacheTypes::GlobalCache
 
using HasAbility = AbilityChecker< T... >
 
using InputProcessBlockCache = typename CacheTypes::InputProcessBlockCache
 
using LuminosityBlockCache = typename CacheTypes::LuminosityBlockCache
 
using LuminosityBlockContext = LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCache >
 
using LuminosityBlockSummaryCache = typename CacheTypes::LuminosityBlockSummaryCache
 
using RunCache = typename CacheTypes::RunCache
 
using RunContext = RunContextT< RunCache, GlobalCache >
 
using RunSummaryCache = typename CacheTypes::RunSummaryCache
 

Detailed Description

Definition at line 24 of file HEFRecHitGPU.cc.

Constructor & Destructor Documentation

◆ HEFRecHitGPU()

HEFRecHitGPU::HEFRecHitGPU ( const edm::ParameterSet ps)
explicit

Definition at line 59 of file HEFRecHitGPU.cc.

References edm::ParameterSet::getParameter().

60  : uncalibRecHitCPUToken_{consumes<HGCUncalibratedRecHitCollection>(
61  ps.getParameter<edm::InputTag>("HGCHEFUncalibRecHitsTok"))},
62  recHitGPUToken_{produces<cms::cuda::Product<HGCRecHitGPUProduct>>()} {
63  cdata_.keV2DIGI_ = ps.getParameter<double>("HGCHEF_keV2DIGI");
64  cdata_.xmin_ = ps.getParameter<double>("minValSiPar"); //float
65  cdata_.xmax_ = ps.getParameter<double>("maxValSiPar"); //float
66  cdata_.aterm_ = ps.getParameter<double>("noiseSiPar"); //float
67  cdata_.cterm_ = ps.getParameter<double>("constSiPar"); //float
68  vdata_.fCPerMIP_ = ps.getParameter<std::vector<double>>("HGCHEF_fCPerMIP");
69  vdata_.cce_ = ps.getParameter<edm::ParameterSet>("HGCHEF_cce").getParameter<std::vector<double>>("values");
70  vdata_.noise_fC_ = ps.getParameter<edm::ParameterSet>("HGCHEF_noise_fC").getParameter<std::vector<double>>("values");
71  vdata_.rcorr_ = ps.getParameter<std::vector<double>>("rcorr");
72  vdata_.weights_ = ps.getParameter<std::vector<double>>("weights");
74  cdata_.layerOffset_ = 28;
76 
79 
80  tools_ = std::make_unique<hgcal::RecHitTools>();
81 }
void convert_constant_data_(KernelConstantData< HGChefUncalibRecHitConstantData > *)
T getParameter(std::string const &) const
Definition: ParameterSet.h:307
edm::EDPutTokenT< cms::cuda::Product< HGCRecHitGPUProduct > > recHitGPUToken_
Definition: HEFRecHitGPU.cc:33
KernelConstantData< HGChefUncalibRecHitConstantData > * kcdata_
Definition: HEFRecHitGPU.cc:56
HGChefUncalibRecHitConstantData cdata_
Definition: HEFRecHitGPU.cc:38
void assert_sizes_constants_(const HGCConstantVectorData &)
Definition: HEFRecHitGPU.cc:92
HGCConstantVectorData vdata_
Definition: HEFRecHitGPU.cc:39
std::unique_ptr< hgcal::RecHitTools > tools_
Definition: HEFRecHitGPU.cc:46
edm::EDGetTokenT< HGChefUncalibratedRecHitCollection > uncalibRecHitCPUToken_
Definition: HEFRecHitGPU.cc:32

◆ ~HEFRecHitGPU()

HEFRecHitGPU::~HEFRecHitGPU ( )
override

Definition at line 83 of file HEFRecHitGPU.cc.

References kcdata_.

83 { delete kcdata_; }
KernelConstantData< HGChefUncalibRecHitConstantData > * kcdata_
Definition: HEFRecHitGPU.cc:56

Member Function Documentation

◆ assert_error_message_()

std::string HEFRecHitGPU::assert_error_message_ ( std::string  var,
const size_t &  s1,
const size_t &  s2 
)
private

Definition at line 85 of file HEFRecHitGPU.cc.

References AlCaHLTBitMon_QueryRunRegistry::string, to_string(), and ALCARECOEcalPhiSym_cff::var.

Referenced by assert_sizes_constants_().

85  {
86  std::string str1 = "The '";
87  std::string str2 = "' array must be of size ";
88  std::string str3 = " to hold the configuration data, but is of size ";
89  return str1 + var + str2 + std::to_string(s1) + str3 + std::to_string(s2);
90 }
static std::string to_string(const XMLCh *ch)

◆ assert_sizes_constants_()

void HEFRecHitGPU::assert_sizes_constants_ ( const HGCConstantVectorData vd)
private

Definition at line 92 of file HEFRecHitGPU.cc.

References assert_error_message_(), HGCConstantVectorData::cce_, HGCConstantVectorData::fCPerMIP_, HGChefUncalibRecHitConstantData::hef_cce, HGChefUncalibRecHitConstantData::hef_fCPerMIP, HGChefUncalibRecHitConstantData::hef_noise_fC, HGChefUncalibRecHitConstantData::hef_rcorr, HGChefUncalibRecHitConstantData::hef_weights, HGCConstantVectorData::noise_fC_, HGCConstantVectorData::rcorr_, vdata_, and HGCConstantVectorData::weights_.

92  {
94  edm::LogError("WrongSize") << this->assert_error_message_(
97  edm::LogError("WrongSize") << this->assert_error_message_(
100  edm::LogError("WrongSize") << this->assert_error_message_(
103  edm::LogError("WrongSize") << this->assert_error_message_(
106  edm::LogError("WrongSize") << this->assert_error_message_(
108 }
std::string assert_error_message_(std::string, const size_t &, const size_t &)
Definition: HEFRecHitGPU.cc:85
HGCConstantVectorData vdata_
Definition: HEFRecHitGPU.cc:39

◆ convert_collection_data_to_soa_()

void HEFRecHitGPU::convert_collection_data_to_soa_ ( const uint32_t &  ,
const HGChefUncalibratedRecHitCollection  
)
private

◆ convert_constant_data_()

void HEFRecHitGPU::convert_constant_data_ ( KernelConstantData< HGChefUncalibRecHitConstantData > *  kcdata)
private

Definition at line 130 of file HEFRecHitGPU.cc.

References HGCConstantVectorData::cce_, HGChefUncalibRecHitConstantData::cce_, KernelConstantData< T >::data_, HGCConstantVectorData::fCPerMIP_, HGChefUncalibRecHitConstantData::fCPerMIP_, cms::cuda::for(), mps_fire::i, HGCConstantVectorData::noise_fC_, HGChefUncalibRecHitConstantData::noise_fC_, HGCConstantVectorData::rcorr_, HGChefUncalibRecHitConstantData::rcorr_, KernelConstantData< T >::vdata_, HGCConstantVectorData::weights_, and HGChefUncalibRecHitConstantData::weights_.

130  {
131  for (size_t i = 0; i < kcdata->vdata_.fCPerMIP_.size(); ++i)
132  kcdata->data_.fCPerMIP_[i] = kcdata->vdata_.fCPerMIP_[i];
133  for (size_t i = 0; i < kcdata->vdata_.cce_.size(); ++i)
134  kcdata->data_.cce_[i] = kcdata->vdata_.cce_[i];
135  for (size_t i = 0; i < kcdata->vdata_.noise_fC_.size(); ++i)
136  kcdata->data_.noise_fC_[i] = kcdata->vdata_.noise_fC_[i];
137  for (size_t i = 0; i < kcdata->vdata_.rcorr_.size(); ++i)
138  kcdata->data_.rcorr_[i] = kcdata->vdata_.rcorr_[i];
139  for (size_t i = 0; i < kcdata->vdata_.weights_.size(); ++i)
140  kcdata->data_.weights_[i] = kcdata->vdata_.weights_[i];
141 }
for(int i=first, nt=offsets[nh];i< nt;i+=gridDim.x *blockDim.x)
HGCConstantVectorData vdata_

◆ produce()

void HEFRecHitGPU::produce ( edm::Event event,
const edm::EventSetup setup 
)
override

Definition at line 110 of file HEFRecHitGPU.cc.

References d_uncalib_, HGCUncalibRecHitDevice::get(), HGCRecHitGPUProduct::get(), h_uncalib_, hfClusterShapes_cfi::hits, kcdata_, eostools::move(), TrackingDataMCValidation_Standalone_cff::nhits, prod_, recHitGPUToken_, rechits_, KernelManagerHGCalRecHit::run_kernels(), and uncalibRecHitCPUToken_.

110  {
111  cms::cuda::ScopedContextProduce ctx{event.streamID()};
112 
113  const auto &hits = event.get(uncalibRecHitCPUToken_);
114  unsigned int nhits(hits.size());
115  rechits_ = std::make_unique<HGCRecHitCollection>();
116 
117  if (nhits == 0)
118  edm::LogError("HEFRecHitGPU") << "WARNING: no input hits!";
119 
120  prod_ = HGCRecHitGPUProduct(nhits, ctx.stream());
121  d_uncalib_ = HGCUncalibRecHitDevice(nhits, ctx.stream());
123 
125  km.run_kernels(kcdata_, ctx.stream());
126 
127  ctx.emplace(event, recHitGPUToken_, std::move(prod_));
128 }
std::unique_ptr< HGChefRecHitCollection > rechits_
Definition: HEFRecHitGPU.cc:35
edm::EDPutTokenT< cms::cuda::Product< HGCRecHitGPUProduct > > recHitGPUToken_
Definition: HEFRecHitGPU.cc:33
Log< level::Error, false > LogError
KernelConstantData< HGChefUncalibRecHitConstantData > * kcdata_
Definition: HEFRecHitGPU.cc:56
HGCRecHitGPUProduct prod_
Definition: HEFRecHitGPU.cc:52
void run_kernels(const KernelConstantData< HGCeeUncalibRecHitConstantData > *, const cudaStream_t &)
HGCUncalibRecHitDevice d_uncalib_
Definition: HEFRecHitGPU.cc:53
HGCUncalibRecHitSoA get() const
edm::EDGetTokenT< HGChefUncalibratedRecHitCollection > uncalibRecHitCPUToken_
Definition: HEFRecHitGPU.cc:32
HGCUncalibRecHitHost< HGChefUncalibratedRecHitCollection > h_uncalib_
Definition: HEFRecHitGPU.cc:54
def move(src, dest)
Definition: eostools.py:511
Definition: event.py:1

Member Data Documentation

◆ cdata_

HGChefUncalibRecHitConstantData HEFRecHitGPU::cdata_
private

Definition at line 38 of file HEFRecHitGPU.cc.

◆ d_uncalib_

HGCUncalibRecHitDevice HEFRecHitGPU::d_uncalib_
private

Definition at line 53 of file HEFRecHitGPU.cc.

Referenced by produce().

◆ h_uncalib_

HGCUncalibRecHitHost<HGChefUncalibratedRecHitCollection> HEFRecHitGPU::h_uncalib_
private

Definition at line 54 of file HEFRecHitGPU.cc.

Referenced by produce().

◆ kcdata_

KernelConstantData<HGChefUncalibRecHitConstantData>* HEFRecHitGPU::kcdata_
private

Definition at line 56 of file HEFRecHitGPU.cc.

Referenced by produce(), and ~HEFRecHitGPU().

◆ prod_

HGCRecHitGPUProduct HEFRecHitGPU::prod_
private

Definition at line 52 of file HEFRecHitGPU.cc.

Referenced by produce().

◆ recHitGPUToken_

edm::EDPutTokenT<cms::cuda::Product<HGCRecHitGPUProduct> > HEFRecHitGPU::recHitGPUToken_
private

Definition at line 33 of file HEFRecHitGPU.cc.

Referenced by produce().

◆ rechits_

std::unique_ptr<HGChefRecHitCollection> HEFRecHitGPU::rechits_
private

Definition at line 35 of file HEFRecHitGPU.cc.

Referenced by produce().

◆ tools_

std::unique_ptr<hgcal::RecHitTools> HEFRecHitGPU::tools_
private

Definition at line 46 of file HEFRecHitGPU.cc.

◆ uncalibRecHitCPUToken_

edm::EDGetTokenT<HGChefUncalibratedRecHitCollection> HEFRecHitGPU::uncalibRecHitCPUToken_
private

Definition at line 32 of file HEFRecHitGPU.cc.

Referenced by produce().

◆ vdata_

HGCConstantVectorData HEFRecHitGPU::vdata_
private

Definition at line 39 of file HEFRecHitGPU.cc.

Referenced by assert_sizes_constants_().