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

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
ProductRegistryHelper::BranchAliasSetterT< ProductType > produces()
edm::EDGetTokenT< DigiSimLinkCollection > signalToken_
template<typename DigiSimLinkCollection >
PreMixingDigiSimLinkWorker< DigiSimLinkCollection >::~PreMixingDigiSimLinkWorker ( )
overridedefault

Member Function Documentation

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

Implements PreMixingWorker.

Definition at line 7 of file PreMixingDTDigiSimLinkWorker.cc.

References HTMLExport::elem(), 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
def elem(elemtype, innerHTML='', html_class='', kwargs)
Definition: HTMLExport.py:19
std::unique_ptr< DigiSimLinkCollection > merged_
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(), edm::HandleBase::isValid(), PreMixingDigiSimLinkWorker< DigiSimLinkCollection >::merged_, and PreMixingDigiSimLinkWorker< DigiSimLinkCollection >::pileupTag_.

Referenced by PreMixingDigiSimLinkWorker< DigiSimLinkCollection >::initializeEvent().

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_
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 edm::Event::getByToken(), edm::HandleBase::isValid(), PreMixingDigiSimLinkWorker< DigiSimLinkCollection >::merged_, and PreMixingDigiSimLinkWorker< DigiSimLinkCollection >::signalToken_.

Referenced by PreMixingDigiSimLinkWorker< DigiSimLinkCollection >::initializeEvent().

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_
template<typename DigiSimLinkCollection >
void PreMixingDigiSimLinkWorker< DigiSimLinkCollection >::initializeEvent ( edm::Event const &  iEvent,
edm::EventSetup const &  iSetup 
)
inlineoverridevirtual
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 PreMixingDigiSimLinkWorker< DigiSimLinkCollection >::collectionDM_, PreMixingDigiSimLinkWorker< DigiSimLinkCollection >::merged_, eostools::move(), and edm::Event::put().

Referenced by PreMixingDigiSimLinkWorker< DigiSimLinkCollection >::initializeEvent().

77  {
79 }
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:131
std::unique_ptr< DigiSimLinkCollection > merged_
def move(src, dest)
Definition: eostools.py:511

Member Data Documentation

template<typename DigiSimLinkCollection >
std::string PreMixingDigiSimLinkWorker< DigiSimLinkCollection >::collectionDM_
private
template<typename DigiSimLinkCollection >
std::unique_ptr<DigiSimLinkCollection> PreMixingDigiSimLinkWorker< DigiSimLinkCollection >::merged_
private
template<typename DigiSimLinkCollection >
edm::InputTag PreMixingDigiSimLinkWorker< DigiSimLinkCollection >::pileupTag_
private
template<typename DigiSimLinkCollection >
edm::EDGetTokenT<DigiSimLinkCollection> PreMixingDigiSimLinkWorker< DigiSimLinkCollection >::signalToken_
private