CMS 3D CMS Logo

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

Public Member Functions

 HcalRecHitSoAToLegacy (edm::ParameterSet const &ps)
 
 ~HcalRecHitSoAToLegacy () override=default
 
- 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
 

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &)
 

Private Member Functions

void produce (edm::Event &, edm::EventSetup const &) override
 

Private Attributes

const edm::EDPutTokenT< HBHERecHitCollectionrecHitsLegacyTokenOut_
 
const edm::EDGetTokenT< hcal::RecHitHostCollectionrecHitsTokenIn_
 

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 14 of file HcalRecHitSoAToLegacy.cc.

Constructor & Destructor Documentation

◆ HcalRecHitSoAToLegacy()

HcalRecHitSoAToLegacy::HcalRecHitSoAToLegacy ( edm::ParameterSet const &  ps)
explicit

Definition at line 37 of file HcalRecHitSoAToLegacy.cc.

References edm::ParameterSet::getParameter().

38  : recHitsTokenIn_{consumes<hcal::RecHitHostCollection>(ps.getParameter<edm::InputTag>("src"))},
39  recHitsLegacyTokenOut_{produces<HBHERecHitCollection>()} {}
const edm::EDGetTokenT< hcal::RecHitHostCollection > recHitsTokenIn_
const edm::EDPutTokenT< HBHERecHitCollection > recHitsLegacyTokenOut_

◆ ~HcalRecHitSoAToLegacy()

HcalRecHitSoAToLegacy::~HcalRecHitSoAToLegacy ( )
overridedefault

Member Function Documentation

◆ fillDescriptions()

void HcalRecHitSoAToLegacy::fillDescriptions ( edm::ConfigurationDescriptions confDesc)
static

Definition at line 29 of file HcalRecHitSoAToLegacy.cc.

References edm::ConfigurationDescriptions::addWithDefaultLabel(), and submitPVResolutionJobs::desc.

29  {
31 
32  desc.add<edm::InputTag>("src", edm::InputTag{"hbheRecHitProducerPortable"});
33 
34  confDesc.addWithDefaultLabel(desc);
35 }
void addWithDefaultLabel(ParameterSetDescription const &psetDescription)

◆ produce()

void HcalRecHitSoAToLegacy::produce ( edm::Event event,
edm::EventSetup const &  setup 
)
overrideprivate

Definition at line 41 of file HcalRecHitSoAToLegacy.cc.

References mps_fire::i, eostools::move(), recHitsLegacyTokenOut_, and recHitsTokenIn_.

41  {
42  // populate the legacy collection
43  auto recHitsLegacy = std::make_unique<HBHERecHitCollection>();
44 
45  // get input from host SoA
46  auto const& hcalRechitSoAView = event.get(recHitsTokenIn_).const_view();
47 
48  recHitsLegacy->reserve(hcalRechitSoAView.metadata().size());
49 
50  for (auto i = 0; i < hcalRechitSoAView.metadata().size(); i++) {
51  auto const& rechit = hcalRechitSoAView[i];
52  // skip bad channels
53  if (rechit.chi2() < 0)
54  continue;
55 
56  // build a legacy rechit with the computed detid and MAHI energy
57  recHitsLegacy->emplace_back(HcalDetId{rechit.detId()},
58  rechit.energy(),
59  0 // timeRising
60  );
61  // update the legacy rechit with the Chi2 and M0 values
62  recHitsLegacy->back().setChiSquared(rechit.chi2());
63  recHitsLegacy->back().setRawEnergy(rechit.energyM0());
64  }
65 
66  // put the legacy collection
67  event.put(recHitsLegacyTokenOut_, std::move(recHitsLegacy));
68 }
const edm::EDGetTokenT< hcal::RecHitHostCollection > recHitsTokenIn_
const edm::EDPutTokenT< HBHERecHitCollection > recHitsLegacyTokenOut_
def move(src, dest)
Definition: eostools.py:511

Member Data Documentation

◆ recHitsLegacyTokenOut_

const edm::EDPutTokenT<HBHERecHitCollection> HcalRecHitSoAToLegacy::recHitsLegacyTokenOut_
private

Definition at line 26 of file HcalRecHitSoAToLegacy.cc.

Referenced by produce().

◆ recHitsTokenIn_

const edm::EDGetTokenT<hcal::RecHitHostCollection> HcalRecHitSoAToLegacy::recHitsTokenIn_
private

Definition at line 25 of file HcalRecHitSoAToLegacy.cc.

Referenced by produce().