forked from cms-sw/cmssw
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request cms-sw#105 from CMS-HGCAL/hackathon_base_CMSSW_14_…
…1_0_pre0 Update with DIGIs SOA
- Loading branch information
Showing
16 changed files
with
299 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,11 @@ | ||
<use name="rootcore"/> | ||
<use name="eigen"/> | ||
<use name="DataFormats/Portable"/> | ||
<use name="DataFormats/Common"/> | ||
<use name="DataFormats/ForwardDetId"/> | ||
<use name="DataFormats/DetId"/> | ||
<use name="HeterogeneousCore/AlpakaInterface"/> | ||
<flags ALPAKA_BACKENDS="!serial"/> | ||
<export> | ||
<lib name="1"/> | ||
</export> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
#ifndef DataFormats_HGCalDigi_interface_HGCalDigiHostCollection_h | ||
#define DataFormats_HGCalDigi_interface_HGCalDigiHostCollection_h | ||
|
||
#include "DataFormats/Portable/interface/PortableHostCollection.h" | ||
#include "DataFormats/HGCalDigi/interface/HGCalDigiSoA.h" | ||
|
||
namespace hgcaldigi { | ||
|
||
// SoA with x, y, z, id fields in host memory | ||
using HGCalDigiHostCollection = PortableHostCollection<HGCalDigiSoA>; | ||
|
||
} // namespace hgcaldigi | ||
|
||
#endif // DataFormats_HGCalDigi_interface_HGCalDigiHostCollection_h |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
#ifndef DataFormats_HGCalDigi_interface_HGCalDigiSoA_h | ||
#define DataFormats_HGCalDigi_interface_HGCalDigiSoA_h | ||
|
||
#include <Eigen/Core> | ||
#include <Eigen/Dense> | ||
|
||
#include "DataFormats/SoATemplate/interface/SoACommon.h" | ||
#include "DataFormats/SoATemplate/interface/SoALayout.h" | ||
#include "DataFormats/SoATemplate/interface/SoAView.h" | ||
|
||
namespace hgcaldigi { | ||
|
||
// Generate structure of arrays (SoA) layout with Digi dataformat | ||
GENERATE_SOA_LAYOUT(HGCalDigiSoALayout, | ||
// columns: one value per element | ||
SOA_COLUMN(uint32_t, electronicsId), | ||
SOA_COLUMN(uint8_t, tctp), | ||
SOA_COLUMN(uint16_t, adcm1), | ||
SOA_COLUMN(uint16_t, adc), | ||
SOA_COLUMN(uint16_t, tot), | ||
SOA_COLUMN(uint16_t, toa), | ||
SOA_COLUMN(uint16_t, cm), | ||
SOA_COLUMN(uint16_t, flags) | ||
) | ||
using HGCalDigiSoA = HGCalDigiSoALayout<>; | ||
|
||
} // namespace hgcaldigi | ||
|
||
#endif // DataFormats_HGCalDigi_interface_HGCalDigiSoA_h |
23 changes: 23 additions & 0 deletions
23
DataFormats/HGCalDigi/interface/alpaka/HGCalDigiDeviceCollection.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
#ifndef DataFormats_HGCalDigi_interface_alpaka_HGCalDigiDeviceCollection_h | ||
#define DataFormats_HGCalDigi_interface_alpaka_HGCalDigiDeviceCollection_h | ||
|
||
#include "DataFormats/Portable/interface/alpaka/PortableCollection.h" | ||
#include "DataFormats/HGCalDigi/interface/HGCalDigiSoA.h" | ||
#include "HeterogeneousCore/AlpakaInterface/interface/config.h" | ||
|
||
namespace ALPAKA_ACCELERATOR_NAMESPACE { | ||
|
||
namespace hgcaldigi { | ||
|
||
// make the names from the top-level hgcaldigi namespace visible for unqualified lookup | ||
// inside the ALPAKA_ACCELERATOR_NAMESPACE::hgcaldigi namespace | ||
using namespace ::hgcaldigi; | ||
|
||
// SoA in device global memory | ||
using HGCalDigiDeviceCollection = PortableCollection<HGCalDigiSoA>; | ||
|
||
} // namespace hgcaldigi | ||
|
||
} // namespace ALPAKA_ACCELERATOR_NAMESPACE | ||
|
||
#endif // DataFormats_HGCalDigi_interface_alpaka_HGCalDigiDeviceCollection_h |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
#include "DataFormats/Common/interface/DeviceProduct.h" | ||
#include "DataFormats/Common/interface/Wrapper.h" | ||
#include "DataFormats/HGCalDigi/interface/HGCalDigiSoA.h" | ||
#include "DataFormats/HGCalDigi/interface/alpaka/HGCalDigiDeviceCollection.h" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
<lcgdict> | ||
<class name="alpaka_cuda_async::hgcaldigi::HGCalDigiDeviceCollection" persistent="false"/> | ||
<class name="edm::DeviceProduct<alpaka_cuda_async::hgcaldigi::HGCalDigiDeviceCollection>" persistent="false"/> | ||
<class name="edm::Wrapper<edm::DeviceProduct<alpaka_cuda_async::hgcaldigi::HGCalDigiDeviceCollection>>" persistent="false"/> | ||
</lcgdict> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
#include "DataFormats/Common/interface/DeviceProduct.h" | ||
#include "DataFormats/Common/interface/Wrapper.h" | ||
#include "DataFormats/HGCalDigi/interface/HGCalDigiSoA.h" | ||
#include "DataFormats/HGCalDigi/interface/alpaka/HGCalDigiDeviceCollection.h" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
<lcgdict> | ||
<class name="alpaka_rocm_async::hgcaldigi::HGCalDigiDeviceCollection" persistent="false"/> | ||
<class name="edm::DeviceProduct<alpaka_rocm_async::hgcaldigi::HGCalDigiDeviceCollection>" persistent="false"/> | ||
<class name="edm::Wrapper<edm::DeviceProduct<alpaka_rocm_async::hgcaldigi::HGCalDigiDeviceCollection>>" persistent="false"/> | ||
</lcgdict> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
#include "DataFormats/Portable/interface/PortableHostCollectionReadRules.h" | ||
#include "DataFormats/HGCalDigi/interface/HGCalDigiHostCollection.h" | ||
|
||
SET_PORTABLEHOSTCOLLECTION_READ_RULES(hgcaldigi::HGCalDigiHostCollection); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,9 @@ | ||
#include <vector> | ||
#include <bitset> | ||
|
||
#include "DataFormats/Common/interface/Wrapper.h" | ||
#include "DataFormats/HGCalDigi/interface/HGCalElectronicsId.h" | ||
#include "DataFormats/HGCalDigi/interface/HGCalDigiCollections.h" | ||
#include "DataFormats/HGCalDigi/interface/PHGCSimAccumulator.h" | ||
#include "DataFormats/HGCalDigi/interface/HGCalRawDataEmulatorInfo.h" | ||
#include "DataFormats/HGCalDigi/interface/HGCalDigiHostCollection.h" | ||
#include "DataFormats/HGCalDigi/interface/HGCalDigiSoA.h" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,14 @@ | ||
<use name="FWCore/Framework"/> | ||
<use name="FWCore/Utilities"/> | ||
<use name="Geometry/Records"/> | ||
<use name="SimCalorimetry/HGCalSimProducers"/> | ||
<use name="SimDataFormats/CaloTest"/> | ||
<use name="SimGeneral/MixingModule"/> | ||
<use name="SimGeneral/PreMixingModule"/> | ||
<use name="root"/> | ||
<flags EDM_PLUGIN="1"/> | ||
<!-- host-only plugins --> | ||
<library file="*.cc" name="SimCalorimetryHGCalSimProducersPlugins"> | ||
<use name="FWCore/Framework"/> | ||
<use name="FWCore/Utilities"/> | ||
<use name="Geometry/Records"/> | ||
<use name="CondFormats/HGCalObjects"/> | ||
<use name="SimCalorimetry/HGCalSimProducers"/> | ||
<use name="SimDataFormats/CaloTest"/> | ||
<use name="SimGeneral/MixingModule"/> | ||
<use name="SimGeneral/PreMixingModule"/> | ||
<use name="DataFormats/HGCalDigi"/> | ||
<use name="root"/> | ||
<flags EDM_PLUGIN="1"/> | ||
</library> |
104 changes: 104 additions & 0 deletions
104
SimCalorimetry/HGCalSimProducers/plugins/HGCalDigiSoaFiller.cc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,104 @@ | ||
#include "FWCore/Utilities/interface/InputTag.h" | ||
#include "FWCore/Framework/interface/Frameworkfwd.h" | ||
#include "FWCore/Framework/interface/stream/EDProducer.h" | ||
#include "FWCore/Framework/interface/Event.h" | ||
#include "FWCore/Framework/interface/MakerMacros.h" | ||
#include "FWCore/Framework/interface/ESWatcher.h" | ||
#include "FWCore/ParameterSet/interface/ParameterSet.h" | ||
#include "FWCore/ParameterSet/interface/ParameterSetDescription.h" | ||
#include "FWCore/Utilities/interface/StreamID.h" | ||
|
||
#include "DataFormats/HGCalDigi/interface/HGCalElectronicsId.h" | ||
#include "DataFormats/HGCDigi/interface/HGCDigiCollections.h" | ||
#include "DataFormats/HGCalDigi/interface/HGCalDigiHostCollection.h" | ||
|
||
/** | ||
* @short consumes channel digis and packs then in a realistic FEDRawData stream | ||
*/ | ||
class HGCalDigiSoaFiller : public edm::stream::EDProducer<> { | ||
|
||
public: | ||
|
||
/** | ||
@short constructor | ||
*/ | ||
explicit HGCalDigiSoaFiller(edm::ParameterSet const& config) | ||
: digisCEET_( consumes<edm::SortedCollection<HGCalDataFrame> >(config.getParameter<edm::InputTag>("eeChannelDigis") ) ), | ||
digisCEHSiT_( consumes<edm::SortedCollection<HGCalDataFrame> >(config.getParameter<edm::InputTag>("cehsiChannelDigis") ) ), | ||
digisCEHSiPMT_( consumes<edm::SortedCollection<HGCalDataFrame> >(config.getParameter<edm::InputTag>("cehsipmChannelDigis") ) ) { | ||
|
||
digiProdT_ = produces(config.getParameter<std::string>("digisProdName")); | ||
|
||
} | ||
|
||
/** | ||
@short parameters to be used with this plugin | ||
*/ | ||
static void fillDescriptions(edm::ConfigurationDescriptions& descriptions) { | ||
edm::ParameterSetDescription desc; | ||
desc.add<edm::InputTag>("eeChannelDigis", edm::InputTag("simHGCalUnsuppressedDigis","EE")); | ||
desc.add<edm::InputTag>("cehsiChannelDigis", edm::InputTag("simHGCalUnsuppressedDigis","HEfront")); | ||
desc.add<edm::InputTag>("cehsipmChannelDigis", edm::InputTag("simHGCalUnsuppressedDigis","HEback")); | ||
desc.add<std::string>("digisProdName", "HGC"); | ||
descriptions.addWithDefaultLabel(desc); | ||
|
||
} | ||
|
||
|
||
private: | ||
|
||
/** | ||
@short steers the conversion to SOA | ||
*/ | ||
void produce(edm::Event &iEvent, const edm::EventSetup &iSetup) override { | ||
|
||
//FIXME | ||
int itSample = 2; | ||
|
||
//read "classic" channel digis | ||
auto const &digisCEE = iEvent.get(digisCEET_); | ||
//auto const &digisCEHSi = iEvent.get(digisCEHSiT_); | ||
//auto const &digisCEHSiPM = iEvent.get(digisCEHSiPMT_); | ||
|
||
//fill the SoA collection | ||
int finaldigi_size = 100; //FIXME : to be retrieved from Elec Mapping | ||
hgcaldigi::HGCalDigiHostCollection digiProd(finaldigi_size,cms::alpakatools::host()); | ||
for(auto d : digisCEE) { | ||
|
||
int i=0; | ||
uint32_t detid( d.id().rawId() ); | ||
uint32_t eleid( detid ); //FIXME : from mapping | ||
|
||
//read digi (in-time sample only) | ||
uint32_t toa = d.sample(itSample).toa(); | ||
uint32_t tctp = d.sample(itSample).mode() ? 3 : 0; | ||
uint32_t adcm1( d.sample(itSample-1).data() ); | ||
uint32_t adc( tctp<3 ? d.sample(itSample).data() : 0 ); | ||
uint32_t tot( tctp==3 ? d.sample(itSample).data() : 0 ); | ||
|
||
std::cout << "Filling with " << eleid << " " << toa << " " << tctp << " " << adcm1 << " " << adc << " " << tot << std::endl; | ||
|
||
auto idigi = digiProd.view()[i]; | ||
idigi.electronicsId() = eleid; | ||
idigi.tctp() = tctp; | ||
idigi.adcm1() = adcm1; | ||
idigi.adc() = adc; | ||
idigi.tot() = tot; | ||
idigi.toa() = toa; | ||
idigi.cm() = 0; | ||
idigi.flags() = 0; | ||
|
||
break; | ||
} | ||
|
||
|
||
iEvent.emplace(digiProdT_, std::move(digiProd)); | ||
} | ||
|
||
|
||
edm::EDGetTokenT<edm::SortedCollection<HGCalDataFrame> > digisCEET_,digisCEHSiT_,digisCEHSiPMT_; | ||
edm::EDPutTokenT<hgcaldigi::HGCalDigiHostCollection> digiProdT_; | ||
}; | ||
|
||
// define this as a plug-in | ||
DEFINE_FWK_MODULE(HGCalDigiSoaFiller); |
69 changes: 69 additions & 0 deletions
69
SimCalorimetry/HGCalSimProducers/test/hgcalRealistiDigis_cfg.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
import FWCore.ParameterSet.Config as cms | ||
|
||
from Configuration.Eras.Era_Phase2C17I13M9_cff import Phase2C17I13M9 as Era_Phase2 | ||
process = cms.Process("REALDIGI", Era_Phase2) | ||
|
||
|
||
from FWCore.ParameterSet.VarParsing import VarParsing | ||
options = VarParsing ('standard') | ||
options.register('geometry', 'Extended2026D94', VarParsing.multiplicity.singleton, VarParsing.varType.string, 'geometry to use') | ||
options.register('modules','Geometry/HGCalMapping/data/ModuleMaps/modulelocator_test.txt',mytype=VarParsing.varType.string, | ||
info="Path to module mapper. Absolute, or relative to CMSSW src directory") | ||
options.register('sicells','Geometry/HGCalMapping/data/CellMaps/WaferCellMapTraces.txt',mytype=VarParsing.varType.string, | ||
info="Path to Si cell mapper. Absolute, or relative to CMSSW src directory") | ||
options.register('sipmcells','Geometry/HGCalMapping/data/CellMaps/channels_sipmontile.hgcal.txt',mytype=VarParsing.varType.string, | ||
info="Path to SiPM-on-tile cell mapper. Absolute, or relative to CMSSW src directory") | ||
options.parseArguments() | ||
|
||
if len(options.files)==0: | ||
options.files=['file:/eos/cms/store/group/dpg_hgcal/comm_hgcal/psilva/hackhathon/23234.103_TTbar_14TeV+2026D94Aging3000/step2.root'] | ||
print(f'Using hackathon test files: {options.files}') | ||
|
||
#set geometry/global tag | ||
process.load('Configuration.StandardSequences.Services_cff') | ||
process.load('Configuration.StandardSequences.MagneticField_cff') | ||
process.load('Configuration.EventContent.EventContent_cff') | ||
process.load("FWCore.MessageService.MessageLogger_cfi") | ||
process.load("Configuration.StandardSequences.FrontierConditions_GlobalTag_cff") | ||
process.load('Configuration.Geometry.Geometry%sReco_cff'%options.geometry) | ||
process.load('Configuration.Geometry.Geometry%s_cff'%options.geometry) | ||
from Configuration.AlCa.GlobalTag import GlobalTag | ||
process.GlobalTag = GlobalTag(process.GlobalTag, 'auto:phase2_realistic', '') | ||
|
||
process.MessageLogger.cerr.threshold = '' | ||
process.MessageLogger.cerr.FwkReport.reportEvery = 500 | ||
|
||
process.source = cms.Source("PoolSource", | ||
fileNames = cms.untracked.vstring(options.files), | ||
duplicateCheckMode = cms.untracked.string("noDuplicateCheck") | ||
) | ||
process.maxEvents = cms.untracked.PSet( input = cms.untracked.int32(options.maxEvents) ) | ||
|
||
|
||
#ESSources/Producers for the logical mapping | ||
#indexers | ||
process.load('Geometry.HGCalMapping.hgCalMappingIndexESSource_cfi') | ||
process.hgCalMappingIndexESSource.modules = cms.FileInPath(options.modules) | ||
process.hgCalMappingIndexESSource.si = cms.FileInPath(options.sicells) | ||
process.hgCalMappingIndexESSource.sipm = cms.FileInPath(options.sipmcells) | ||
|
||
process.load('Configuration.StandardSequences.Accelerators_cff') | ||
process.hgCalMappingModuleESProducer = cms.ESProducer('hgcal::HGCalMappingModuleESProducer@alpaka', | ||
filename=cms.FileInPath(options.modules), | ||
moduleindexer=cms.ESInputTag('') ) | ||
process.hgCalMappingCellESProducer = cms.ESProducer('hgcal::HGCalMappingCellESProducer@alpaka', | ||
filelist=cms.vstring(options.sicells,options.sipmcells), | ||
cellindexer=cms.ESInputTag('') ) | ||
|
||
#realistic digis producer | ||
process.load('SimCalorimetry.HGCalSimProducers.hgCalDigiSoaFiller_cfi') | ||
process.t = cms.Task(process.hgCalDigiSoaFiller) | ||
process.p = cms.Path(process.t) | ||
|
||
#output | ||
process.output = cms.OutputModule('PoolOutputModule', | ||
fileName = cms.untracked.string(options.output), | ||
outputCommands = cms.untracked.vstring('drop *', | ||
'keep *_*_*_REALDIGI')) | ||
|
||
process.output_path = cms.EndPath(process.output) |