CMS 3D CMS Logo

HEBRecHitGPU.cc
Go to the documentation of this file.
1 #include <iostream>
2 #include <string>
3 
11 
13 
18 
23 
25 public:
26  explicit HEBRecHitGPU(const edm::ParameterSet &ps);
27  ~HEBRecHitGPU() override;
28  void beginRun(edm::Run const &, edm::EventSetup const &) override;
29 
30  void produce(edm::Event &, const edm::EventSetup &) override;
31 
32 private:
35 
36  std::unique_ptr<HGChebRecHitCollection> rechits_;
37 
38  //constants
41 
42  //memory
45 
46  //conditions (geometry, topology, ...)
47  std::unique_ptr<hgcal::RecHitTools> tools_;
48 
49  //data processing
52 
56 
58 };
59 
61  : uncalibRecHitCPUToken_{consumes<HGCUncalibratedRecHitCollection>(
62  ps.getParameter<edm::InputTag>("HGCHEBUncalibRecHitsTok"))},
63  recHitGPUToken_{produces<cms::cuda::Product<HGCRecHitGPUProduct>>()} {
64  cdata_.keV2DIGI_ = ps.getParameter<double>("HGCHEB_keV2DIGI");
65  cdata_.noise_MIP_ = ps.getParameter<edm::ParameterSet>("HGCHEB_noise_MIP").getParameter<double>("noise_MIP");
66  vdata_.weights_ = ps.getParameter<std::vector<double>>("weights");
67  cdata_.uncalib2GeV_ = 1e-6 / cdata_.keV2DIGI_;
68  cdata_.layerOffset_ = 28;
69  assert_sizes_constants_(vdata_);
70 
71  kcdata_ = new KernelConstantData<HGChebUncalibRecHitConstantData>(cdata_, vdata_);
72  convert_constant_data_(kcdata_);
73 
74  tools_ = std::make_unique<hgcal::RecHitTools>();
75 }
76 
78 
80  std::string str1 = "The '";
81  std::string str2 = "' array must be of size ";
82  std::string str3 = " to hold the configuration data.";
83  return str1 + var + str2 + std::to_string(s) + str3;
84 }
85 
88  edm::LogError("WrongSize") << this->assert_error_message_("weights", vdata_.fCPerMIP_.size());
89 }
90 
92 
94  cms::cuda::ScopedContextProduce ctx{event.streamID()};
95 
96  const auto &hits = event.get(uncalibRecHitCPUToken_);
97  unsigned int nhits(hits.size());
98  rechits_ = std::make_unique<HGCRecHitCollection>();
99 
100  if (nhits == 0)
101  edm::LogError("HEBRecHitGPU") << "WARNING: no input hits!";
102 
103  prod_ = HGCRecHitGPUProduct(nhits, ctx.stream());
104  d_uncalib_ = HGCUncalibRecHitDevice(nhits, ctx.stream());
106 
108  km.run_kernels(kcdata_, ctx.stream());
109 
110  ctx.emplace(event, recHitGPUToken_, std::move(prod_));
111 }
112 
114  for (size_t i = 0; i < kcdata->vdata_.weights_.size(); ++i)
115  kcdata->data_.weights_[i] = kcdata->vdata_.weights_[i];
116 }
117 
HGChebUncalibRecHitConstantData
Definition: HGCUncalibRecHitsToRecHitsConstants.h:61
HEBRecHitGPU::h_uncalib_
HGCUncalibRecHitHost< HGChebUncalibratedRecHitCollection > h_uncalib_
Definition: HEBRecHitGPU.cc:55
HGCUncalibRecHitHost
Definition: HGCUncalibRecHitHost.h:12
HEBRecHitGPU::produce
void produce(edm::Event &, const edm::EventSetup &) override
Definition: HEBRecHitGPU.cc:93
mps_fire.i
i
Definition: mps_fire.py:428
HEBRecHitGPU::convert_collection_data_to_soa_
void convert_collection_data_to_soa_(const uint32_t &, const HGChebUncalibratedRecHitCollection &)
MessageLogger.h
MessageLogger.h
HEBRecHitGPU::assert_error_message_
std::string assert_error_message_(std::string, const size_t &)
Definition: HEBRecHitGPU.cc:79
hfClusterShapes_cfi.hits
hits
Definition: hfClusterShapes_cfi.py:5
KernelConstantData::vdata_
HGCConstantVectorData vdata_
Definition: KernelManagerHGCalRecHit.h:30
KernelConstantData::data_
T data_
Definition: KernelManagerHGCalRecHit.h:29
cms::cuda::ScopedContextProduce
Definition: ScopedContext.h:149
edm::Run
Definition: Run.h:45
HEBRecHitGPU::tools_
std::unique_ptr< hgcal::RecHitTools > tools_
Definition: HEBRecHitGPU.cc:47
HGCRecHitGPUProduct.h
edm::EDGetTokenT
Definition: EDGetToken.h:33
edm::EDPutTokenT
Definition: EDPutToken.h:33
HEBRecHitGPU
Definition: HEBRecHitGPU.cc:24
RecHitTools.h
HGCConstantVectorData
Definition: HGCUncalibRecHitsToRecHitsConstants.h:7
EDProducer.h
edm::SortedCollection
Definition: SortedCollection.h:49
vd
std::vector< DeviationSensor2D * > vd
Definition: DeviationsFromFileSensor2D.h:21
HGCRecHitGPUProduct
Definition: HGCRecHitGPUProduct.h:12
KernelManagerHGCalRecHit
Definition: KernelManagerHGCalRecHit.h:33
HEBRecHitGPU::rechits_
std::unique_ptr< HGChebRecHitCollection > rechits_
Definition: HEBRecHitGPU.cc:36
singleTopDQM_cfi.setup
setup
Definition: singleTopDQM_cfi.py:37
HEBRecHitGPU::uncalibRecHitCPUToken_
edm::EDGetTokenT< HGChebUncalibratedRecHitCollection > uncalibRecHitCPUToken_
Definition: HEBRecHitGPU.cc:33
HGChebUncalibRecHitConstantData::weights_
double weights_[heb_weights]
Definition: HGCUncalibRecHitsToRecHitsConstants.h:65
HEBRecHitGPU::~HEBRecHitGPU
~HEBRecHitGPU() override
Definition: HEBRecHitGPU.cc:77
trigObjTnPSource_cfi.var
var
Definition: trigObjTnPSource_cfi.py:21
MakerMacros.h
alignCSCRings.s
s
Definition: alignCSCRings.py:92
HGCUncalibRecHitHost.h
DEFINE_FWK_MODULE
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
HEBRecHitGPU::kcdata_
KernelConstantData< HGChebUncalibRecHitConstantData > * kcdata_
Definition: HEBRecHitGPU.cc:57
HGCUncalibRecHitDevice
Definition: HGCUncalibRecHitDevice.h:11
KernelManagerHGCalRecHit.h
HGCConstantVectorData::fCPerMIP_
std::vector< double > fCPerMIP_
Definition: HGCUncalibRecHitsToRecHitsConstants.h:9
HEBRecHitGPU::vdata_
HGCConstantVectorData vdata_
Definition: HEBRecHitGPU.cc:40
nhits
Definition: HIMultiTrackSelector.h:42
EDGetToken.h
HEBRecHitGPU::cdata_
HGChebUncalibRecHitConstantData cdata_
Definition: HEBRecHitGPU.cc:39
HGCRecHitCollections.h
edm::ParameterSet
Definition: ParameterSet.h:47
HEBRecHitGPU::assert_sizes_constants_
void assert_sizes_constants_(const HGCConstantVectorData &)
Definition: HEBRecHitGPU.cc:86
EDPutToken.h
HEBRecHitGPU::HEBRecHitGPU
HEBRecHitGPU(const edm::ParameterSet &ps)
Definition: HEBRecHitGPU.cc:60
HEBRecHitGPU::beginRun
void beginRun(edm::Run const &, edm::EventSetup const &) override
Definition: HEBRecHitGPU.cc:91
cudaCheck.h
edm::stream::EDProducer
Definition: EDProducer.h:36
edm::EventSetup
Definition: EventSetup.h:58
edm::LogError
Log< level::Error, false > LogError
Definition: MessageLogger.h:123
AlCaHLTBitMon_QueryRunRegistry.string
string string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
InputTag.h
HGCRecHitGPUProduct::get
HGCRecHitSoA get()
Definition: HGCRecHitGPUProduct.h:27
KernelManagerHGCalRecHit::run_kernels
void run_kernels(const KernelConstantData< HGCeeUncalibRecHitConstantData > *, const cudaStream_t &)
ContextState.h
eostools.move
def move(src, dest)
Definition: eostools.py:511
HGCUncalibRecHitDevice::get
HGCUncalibRecHitSoA get() const
Definition: HGCUncalibRecHitDevice.h:23
ScopedContext.h
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
KernelConstantData< HGChebUncalibRecHitConstantData >
ParameterSet.h
HEBRecHitGPU::convert_constant_data_
void convert_constant_data_(KernelConstantData< HGChebUncalibRecHitConstantData > *)
Definition: HEBRecHitGPU.cc:113
HGCUncalibRecHitDevice.h
HEBRecHitGPU::recHitGPUToken_
edm::EDPutTokenT< cms::cuda::Product< HGCRecHitGPUProduct > > recHitGPUToken_
Definition: HEBRecHitGPU.cc:34
HGCConstantVectorData::weights_
std::vector< double > weights_
Definition: HGCUncalibRecHitsToRecHitsConstants.h:13
event
Definition: event.py:1
edm::Event
Definition: Event.h:73
HEBRecHitGPU::d_uncalib_
HGCUncalibRecHitDevice d_uncalib_
Definition: HEBRecHitGPU.cc:54
edm::Log
Definition: MessageLogger.h:70
edm::InputTag
Definition: InputTag.h:15
HGChebUncalibRecHitConstantData::heb_weights
static constexpr size_t heb_weights
Definition: HGCUncalibRecHitsToRecHitsConstants.h:63
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37
HEBRecHitGPU::prod_
HGCRecHitGPUProduct prod_
Definition: HEBRecHitGPU.cc:53