CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
PreMixingDigiSimLinkWorker< DigiSimLinkCollection > Class Template Reference

#include <PreMixingDigiSimLinkWorker.h>

Inheritance diagram for PreMixingDigiSimLinkWorker< DigiSimLinkCollection >:
PreMixingWorker

Public Member Functions

template<>
void addPileups (PileUpEventPrincipal const &pep, edm::EventSetup const &iSetup)
 
void addPileups (PileUpEventPrincipal const &pep, edm::EventSetup const &iSetup) override
 
void addSignals (edm::Event const &iEvent, edm::EventSetup const &iSetup) override
 
void initializeEvent (edm::Event const &iEvent, edm::EventSetup const &iSetup) override
 
 PreMixingDigiSimLinkWorker (const edm::ParameterSet &ps, edm::ProducesCollector, edm::ConsumesCollector &&iC)
 
void put (edm::Event &iEvent, edm::EventSetup const &iSetup, std::vector< PileupSummaryInfo > const &ps, int bunchSpacing) override
 
 ~PreMixingDigiSimLinkWorker () override=default
 
- Public Member Functions inherited from PreMixingWorker
virtual void beginLuminosityBlock (edm::LuminosityBlock const &iLumi, edm::EventSetup const &iSetup)
 
virtual void beginRun (edm::Run const &iRun, edm::EventSetup const &iSetup)
 
virtual void endRun ()
 
virtual void finalizeBunchCrossing (edm::Event &iEvent, edm::EventSetup const &iSetup, int bunchCrossing)
 
virtual void initializeBunchCrossing (edm::Event const &iEvent, edm::EventSetup const &iSetup, int bunchCrossing)
 
 PreMixingWorker ()=default
 
virtual ~PreMixingWorker ()=default
 

Private Attributes

std::string collectionDM_
 
std::unique_ptr< DigiSimLinkCollection > merged_
 
edm::InputTag pileupTag_
 
edm::EDGetTokenT< DigiSimLinkCollection > signalToken_
 

Detailed Description

template<typename DigiSimLinkCollection>
class PreMixingDigiSimLinkWorker< DigiSimLinkCollection >

Definition at line 16 of file PreMixingDigiSimLinkWorker.h.

Constructor & Destructor Documentation

◆ PreMixingDigiSimLinkWorker()

template<typename DigiSimLinkCollection >
PreMixingDigiSimLinkWorker< DigiSimLinkCollection >::PreMixingDigiSimLinkWorker ( const edm::ParameterSet ps,
edm::ProducesCollector  producesCollector,
edm::ConsumesCollector &&  iC 
)

Definition at line 38 of file PreMixingDigiSimLinkWorker.h.

References PreMixingDigiSimLinkWorker< DigiSimLinkCollection >::collectionDM_, and edm::ProducesCollector::produces().

41  : signalToken_(iC.consumes<DigiSimLinkCollection>(ps.getParameter<edm::InputTag>("labelSig"))),
42  pileupTag_(ps.getParameter<edm::InputTag>("pileInputTag")),
43  collectionDM_(ps.getParameter<std::string>("collectionDM")) {
44  producesCollector.produces<DigiSimLinkCollection>(collectionDM_);
45 }
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
T getParameter(std::string const &) const
Definition: ParameterSet.h:307
ProductRegistryHelper::BranchAliasSetterT< ProductType > produces()
edm::EDGetTokenT< DigiSimLinkCollection > signalToken_

◆ ~PreMixingDigiSimLinkWorker()

template<typename DigiSimLinkCollection >
PreMixingDigiSimLinkWorker< DigiSimLinkCollection >::~PreMixingDigiSimLinkWorker ( )
overridedefault

Member Function Documentation

◆ addPileups() [1/2]

template<>
void PreMixingDigiSimLinkWorker< DTDigiSimLinkCollection >::addPileups ( PileUpEventPrincipal const &  pep,
edm::EventSetup const &  iSetup 
)
virtual

Implements PreMixingWorker.

Definition at line 7 of file PreMixingDTDigiSimLinkWorker.cc.

References PileUpEventPrincipal::getByLabel(), and edm::HandleBase::isValid().

8  {
10  pep.getByLabel(pileupTag_, digis);
11  if (digis.isValid()) {
12  for (const auto &elem : *digis) {
13  merged_->put(elem.second, elem.first);
14  }
15  }
16 }
bool isValid() const
Definition: HandleBase.h:70
std::unique_ptr< DigiSimLinkCollection > merged_

◆ addPileups() [2/2]

template<typename DigiSimLinkCollection >
void PreMixingDigiSimLinkWorker< DigiSimLinkCollection >::addPileups ( PileUpEventPrincipal const &  pep,
edm::EventSetup const &  iSetup 
)
overridevirtual

Implements PreMixingWorker.

Definition at line 61 of file PreMixingDigiSimLinkWorker.h.

References filterCSVwithJSON::copy, PileUpEventPrincipal::getByLabel(), and edm::HandleBase::isValid().

62  {
64  pep.getByLabel(pileupTag_, digis);
65  if (digis.isValid()) {
66  for (const auto& detsetSource : *digis) {
67  auto& detsetTarget = merged_->find_or_insert(detsetSource.detId());
68  std::copy(detsetSource.begin(), detsetSource.end(), std::back_inserter(detsetTarget));
69  }
70  }
71 }
bool isValid() const
Definition: HandleBase.h:70
std::unique_ptr< DigiSimLinkCollection > merged_

◆ addSignals()

template<typename DigiSimLinkCollection >
void PreMixingDigiSimLinkWorker< DigiSimLinkCollection >::addSignals ( edm::Event const &  iEvent,
edm::EventSetup const &  iSetup 
)
overridevirtual

Implements PreMixingWorker.

Definition at line 48 of file PreMixingDigiSimLinkWorker.h.

References iEvent, and edm::HandleBase::isValid().

49  {
51  iEvent.getByToken(signalToken_, digis);
52 
53  if (digis.isValid()) {
54  merged_ = std::make_unique<DigiSimLinkCollection>(*digis); // for signal we can just copy
55  } else {
56  merged_ = std::make_unique<DigiSimLinkCollection>();
57  }
58 }
edm::EDGetTokenT< DigiSimLinkCollection > signalToken_
int iEvent
Definition: GenABIO.cc:224
bool isValid() const
Definition: HandleBase.h:70
std::unique_ptr< DigiSimLinkCollection > merged_

◆ initializeEvent()

template<typename DigiSimLinkCollection >
void PreMixingDigiSimLinkWorker< DigiSimLinkCollection >::initializeEvent ( edm::Event const &  iEvent,
edm::EventSetup const &  iSetup 
)
inlineoverridevirtual

Implements PreMixingWorker.

Definition at line 21 of file PreMixingDigiSimLinkWorker.h.

21 {}

◆ put()

template<typename DigiSimLinkCollection >
void PreMixingDigiSimLinkWorker< DigiSimLinkCollection >::put ( edm::Event iEvent,
edm::EventSetup const &  iSetup,
std::vector< PileupSummaryInfo > const &  ps,
int  bunchSpacing 
)
overridevirtual

Implements PreMixingWorker.

Definition at line 74 of file PreMixingDigiSimLinkWorker.h.

References iEvent, and eostools::move().

77  {
79 }
int iEvent
Definition: GenABIO.cc:224
std::unique_ptr< DigiSimLinkCollection > merged_
def move(src, dest)
Definition: eostools.py:511

Member Data Documentation

◆ collectionDM_

template<typename DigiSimLinkCollection >
std::string PreMixingDigiSimLinkWorker< DigiSimLinkCollection >::collectionDM_
private

◆ merged_

template<typename DigiSimLinkCollection >
std::unique_ptr<DigiSimLinkCollection> PreMixingDigiSimLinkWorker< DigiSimLinkCollection >::merged_
private

Definition at line 34 of file PreMixingDigiSimLinkWorker.h.

◆ pileupTag_

template<typename DigiSimLinkCollection >
edm::InputTag PreMixingDigiSimLinkWorker< DigiSimLinkCollection >::pileupTag_
private

Definition at line 31 of file PreMixingDigiSimLinkWorker.h.

◆ signalToken_

template<typename DigiSimLinkCollection >
edm::EDGetTokenT<DigiSimLinkCollection> PreMixingDigiSimLinkWorker< DigiSimLinkCollection >::signalToken_
private

Definition at line 30 of file PreMixingDigiSimLinkWorker.h.