CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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

void beginRun (edm::Run const &, edm::EventSetup const &) override
 
 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
< HGChefUncalibratedRecHitCollection
h_uncalib_
 
KernelConstantData
< HGChefUncalibRecHitConstantData > * 
kcdata_
 
HGCRecHitGPUProduct prod_
 
edm::EDPutTokenT
< cms::cuda::Product
< HGCRecHitGPUProduct > > 
recHitGPUToken_
 
std::unique_ptr
< HGChefRecHitCollection
rechits_
 
std::unique_ptr
< hgcal::RecHitTools
tools_
 
edm::EDGetTokenT
< HGChefUncalibratedRecHitCollection
uncalibRecHitCPUToken_
 
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 ( const edm::ParameterSet ps)
explicit

Definition at line 60 of file HEFRecHitGPU.cc.

References edm::ParameterSet::getParameter().

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

Definition at line 84 of file HEFRecHitGPU.cc.

References kcdata_.

84 { delete kcdata_; }
KernelConstantData< HGChefUncalibRecHitConstantData > * kcdata_
Definition: HEFRecHitGPU.cc:57

Member Function Documentation

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

Definition at line 86 of file HEFRecHitGPU.cc.

References AlCaHLTBitMon_QueryRunRegistry::string, and cond::impl::to_string().

Referenced by assert_sizes_constants_().

86  {
87  std::string str1 = "The '";
88  std::string str2 = "' array must be of size ";
89  std::string str3 = " to hold the configuration data, but is of size ";
90  return str1 + var + str2 + std::to_string(s1) + str3 + std::to_string(s2);
91 }
std::string to_string(const V &value)
Definition: OMSAccess.h:71
void HEFRecHitGPU::assert_sizes_constants_ ( const HGCConstantVectorData vd)
private

Definition at line 93 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_.

93  {
95  edm::LogError("WrongSize") << this->assert_error_message_(
98  edm::LogError("WrongSize") << this->assert_error_message_(
101  edm::LogError("WrongSize") << this->assert_error_message_(
104  edm::LogError("WrongSize") << this->assert_error_message_(
107  edm::LogError("WrongSize") << this->assert_error_message_(
109 }
std::string assert_error_message_(std::string, const size_t &, const size_t &)
Definition: HEFRecHitGPU.cc:86
HGCConstantVectorData vdata_
Definition: HEFRecHitGPU.cc:40
void HEFRecHitGPU::beginRun ( edm::Run const &  ,
edm::EventSetup const &  setup 
)
override

Definition at line 111 of file HEFRecHitGPU.cc.

111 {}
void HEFRecHitGPU::convert_collection_data_to_soa_ ( const uint32_t &  ,
const HGChefUncalibratedRecHitCollection  
)
private
void HEFRecHitGPU::convert_constant_data_ ( KernelConstantData< HGChefUncalibRecHitConstantData > *  kcdata)
private

Definition at line 133 of file HEFRecHitGPU.cc.

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

133  {
134  for (size_t i = 0; i < kcdata->vdata_.fCPerMIP_.size(); ++i)
135  kcdata->data_.fCPerMIP_[i] = kcdata->vdata_.fCPerMIP_[i];
136  for (size_t i = 0; i < kcdata->vdata_.cce_.size(); ++i)
137  kcdata->data_.cce_[i] = kcdata->vdata_.cce_[i];
138  for (size_t i = 0; i < kcdata->vdata_.noise_fC_.size(); ++i)
139  kcdata->data_.noise_fC_[i] = kcdata->vdata_.noise_fC_[i];
140  for (size_t i = 0; i < kcdata->vdata_.rcorr_.size(); ++i)
141  kcdata->data_.rcorr_[i] = kcdata->vdata_.rcorr_[i];
142  for (size_t i = 0; i < kcdata->vdata_.weights_.size(); ++i)
143  kcdata->data_.weights_[i] = kcdata->vdata_.weights_[i];
144 }
for(Iditer=Id.begin();Iditer!=Id.end();Iditer++)
HGCConstantVectorData vdata_
void HEFRecHitGPU::produce ( edm::Event event,
const edm::EventSetup setup 
)
override

Definition at line 113 of file HEFRecHitGPU.cc.

References d_uncalib_, HGCUncalibRecHitDevice::get(), HGCRecHitGPUProduct::get(), cms::cuda::impl::ScopedContextGetterBase::get(), h_uncalib_, kcdata_, eostools::move(), nhits, prod_, recHitGPUToken_, rechits_, KernelManagerHGCalRecHit::run_kernels(), and uncalibRecHitCPUToken_.

113  {
114  cms::cuda::ScopedContextProduce ctx{event.streamID()};
115 
116  const auto &hits = event.get(uncalibRecHitCPUToken_);
117  unsigned int nhits(hits.size());
118  rechits_ = std::make_unique<HGCRecHitCollection>();
119 
120  if (nhits == 0)
121  edm::LogError("HEFRecHitGPU") << "WARNING: no input hits!";
122 
123  prod_ = HGCRecHitGPUProduct(nhits, ctx.stream());
124  d_uncalib_ = HGCUncalibRecHitDevice(nhits, ctx.stream());
126 
127  KernelManagerHGCalRecHit km(h_uncalib_.get(), d_uncalib_.get(), prod_.get());
128  km.run_kernels(kcdata_, ctx.stream());
129 
130  ctx.emplace(event, recHitGPUToken_, std::move(prod_));
131 }
std::unique_ptr< HGChefRecHitCollection > rechits_
Definition: HEFRecHitGPU.cc:36
edm::EDPutTokenT< cms::cuda::Product< HGCRecHitGPUProduct > > recHitGPUToken_
Definition: HEFRecHitGPU.cc:34
HGCUncalibRecHitSoA get() const
Log< level::Error, false > LogError
KernelConstantData< HGChefUncalibRecHitConstantData > * kcdata_
Definition: HEFRecHitGPU.cc:57
def move
Definition: eostools.py:511
HGCRecHitGPUProduct prod_
Definition: HEFRecHitGPU.cc:53
void run_kernels(const KernelConstantData< HGCeeUncalibRecHitConstantData > *, const cudaStream_t &)
HGCUncalibRecHitDevice d_uncalib_
Definition: HEFRecHitGPU.cc:54
edm::EDGetTokenT< HGChefUncalibratedRecHitCollection > uncalibRecHitCPUToken_
Definition: HEFRecHitGPU.cc:33
HGCUncalibRecHitHost< HGChefUncalibratedRecHitCollection > h_uncalib_
Definition: HEFRecHitGPU.cc:55
const T & get(const Product< T > &data)
Definition: ScopedContext.h:58

Member Data Documentation

HGChefUncalibRecHitConstantData HEFRecHitGPU::cdata_
private

Definition at line 39 of file HEFRecHitGPU.cc.

HGCUncalibRecHitDevice HEFRecHitGPU::d_uncalib_
private

Definition at line 54 of file HEFRecHitGPU.cc.

Referenced by produce().

HGCUncalibRecHitHost<HGChefUncalibratedRecHitCollection> HEFRecHitGPU::h_uncalib_
private

Definition at line 55 of file HEFRecHitGPU.cc.

Referenced by produce().

KernelConstantData<HGChefUncalibRecHitConstantData>* HEFRecHitGPU::kcdata_
private

Definition at line 57 of file HEFRecHitGPU.cc.

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

HGCRecHitGPUProduct HEFRecHitGPU::prod_
private

Definition at line 53 of file HEFRecHitGPU.cc.

Referenced by produce().

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

Definition at line 34 of file HEFRecHitGPU.cc.

Referenced by produce().

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

Definition at line 36 of file HEFRecHitGPU.cc.

Referenced by produce().

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

Definition at line 47 of file HEFRecHitGPU.cc.

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

Definition at line 33 of file HEFRecHitGPU.cc.

Referenced by produce().

HGCConstantVectorData HEFRecHitGPU::vdata_
private

Definition at line 40 of file HEFRecHitGPU.cc.

Referenced by assert_sizes_constants_().