Skip to content

Commit

Permalink
Matti's comments: change include guard name; string -> FileInPath; re…
Browse files Browse the repository at this point in the history
…move unneeded comments; cuda rocm -> \!serial
  • Loading branch information
IzaakWN committed Oct 8, 2024
1 parent 098cf11 commit 6460d96
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 16 deletions.
2 changes: 1 addition & 1 deletion DataFormats/HGCalRecHit/BuildFile.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<use name="DataFormats/DetId"/>
<use name="DataFormats/ForwardDetId"/>
<use name="HeterogeneousCore/AlpakaInterface"/>
<flags ALPAKA_BACKENDS="cuda rocm"/>
<flags ALPAKA_BACKENDS="!serial"/>
<export>
<lib name="1"/>
</export>
2 changes: 0 additions & 2 deletions DataFormats/HGCalRecHit/interface/HGCalRecHitSoA.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@ namespace hgcalrechit {

// Generate structure of arrays (SoA) layout with RecHit dataformat
GENERATE_SOA_LAYOUT(HGCalRecHitSoALayout,
// columns: one value per element
//SOA_COLUMN(uint32_t, detid), // redundant since common dense indexing
SOA_COLUMN(double, energy),
SOA_COLUMN(double, time),
SOA_COLUMN(uint16_t, flags))
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#ifndef __HGCalRecHitCalibrationAlgorithms_H__
#define __HGCalRecHitCalibrationAlgorithms_H__
#ifndef RecoLocalCalo_HGCalRecAlgos_interface_alpaka_HGCalRecHitCalibrationAlgorithms_h
#define RecoLocalCalo_HGCalRecAlgos_interface_alpaka_HGCalRecHitCalibrationAlgorithms_h

// Alpaka imports
#include <alpaka/alpaka.hpp>
Expand Down Expand Up @@ -46,4 +46,4 @@ namespace ALPAKA_ACCELERATOR_NAMESPACE {

} // namespace ALPAKA_ACCELERATOR_NAMESPACE

#endif // __HGCalRecHitCalibrationAlgorithms_H__
#endif // RecoLocalCalo_HGCalRecAlgos_interface_alpaka_HGCalRecHitCalibrationAlgorithms_h
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
// #include "FWCore/Framework/interface/MakerMacros.h"
// #include "FWCore/Framework/interface/SourceFactory.h"
// #include "FWCore/Framework/interface/ESHandle.h"
// #include "FWCore/Framework/interface/ESProducer.h"
// #include "FWCore/Framework/interface/ESTransientHandle.h"
// #include "FWCore/Framework/interface/EventSetupRecordIntervalFinder.h"
#include "FWCore/ParameterSet/interface/FileInPath.h"
#include "FWCore/ParameterSet/interface/ParameterSet.h"
#include "FWCore/Utilities/interface/ESGetToken.h"
//#include "FWCore/Utilities/interface/ESGetToken.h"
// #include "DataFormats/Math/interface/libminifloat.h"

#include "HeterogeneousCore/AlpakaCore/interface/alpaka/ESGetToken.h"
Expand Down Expand Up @@ -39,7 +36,7 @@ namespace ALPAKA_ACCELERATOR_NAMESPACE {
class HGCalCalibrationESProducer : public ESProducer {
public:
HGCalCalibrationESProducer(const edm::ParameterSet& iConfig)
: ESProducer(iConfig), filename_(iConfig.getParameter<std::string>("filename")) {
: ESProducer(iConfig), filename_(iConfig.getParameter<edm::FileInPath>("filename")) {
auto cc = setWhatProduced(this);
indexToken_ = cc.consumes(iConfig.getParameter<edm::ESInputTag>("indexSource"));
configToken_ = cc.consumes(iConfig.getParameter<edm::ESInputTag>("configSource"));
Expand All @@ -48,7 +45,7 @@ namespace ALPAKA_ACCELERATOR_NAMESPACE {

static void fillDescriptions(edm::ConfigurationDescriptions& descriptions) {
edm::ParameterSetDescription desc;
desc.add<std::string>("filename", "HGCalCommissioning/LocalCalibration/data/calibration_parameters_v2.json");
desc.add<edm::FileInPath>("filename")->setComment("Path to JSON file with calibration parameters");
desc.add<edm::ESInputTag>("indexSource", edm::ESInputTag(""))
->setComment("Label for module indexer to set SoA size");
desc.add<edm::ESInputTag>("configSource", edm::ESInputTag(""))
Expand Down Expand Up @@ -88,8 +85,7 @@ namespace ALPAKA_ACCELERATOR_NAMESPACE {
// << ", moduleMap.getMaxERxSize()=" << nmod << std::endl;

// load calib parameters from JSON
edm::FileInPath fip(filename_);
std::ifstream infile(fip.fullPath().c_str());
std::ifstream infile(filename_.fullPath().c_str());
json calib_data = json::parse(infile);
for (const auto& it : calib_data.items()) { // loop over module typecodes in JSON file
std::string module = it.key(); // module typecode, e.g. "ML-F3PT-TX-0003"
Expand Down Expand Up @@ -163,7 +159,7 @@ namespace ALPAKA_ACCELERATOR_NAMESPACE {
private:
edm::ESGetToken<HGCalMappingModuleIndexer, HGCalElectronicsMappingRcd> indexToken_;
edm::ESGetToken<HGCalConfiguration, HGCalModuleConfigurationRcd> configToken_;
const std::string filename_;
const edm::FileInPath filename_;
};

} // namespace hgcalrechit
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ namespace ALPAKA_ACCELERATOR_NAMESPACE {
if (iConfig.exists("gain"))
gain_ = iConfig.getParameter<int>("gain");
auto cc = setWhatProduced(this); //HGCalConfigurationESProducer::produce
//findingRecord<HGCalModuleConfigurationRcd>();
indexToken_ = cc.consumes(iConfig.getParameter<edm::ESInputTag>("indexSource"));
configToken_ = cc.consumes(iConfig.getParameter<edm::ESInputTag>("configSource"));
}
Expand Down

0 comments on commit 6460d96

Please sign in to comment.