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::ProducerBase &producer, 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::ProducerBase producer,
edm::ConsumesCollector &&  iC 
)

Definition at line 35 of file PreMixingDigiSimLinkWorker.h.

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

35  :
36  signalToken_(iC.consumes<DigiSimLinkCollection>(ps.getParameter<edm::InputTag>("labelSig"))),
37  pileupTag_(ps.getParameter<edm::InputTag>("pileInputTag")),
38  collectionDM_(ps.getParameter<std::string>("collectionDM"))
39 {
40  producer.produces<DigiSimLinkCollection>(collectionDM_);
41 }
BranchAliasSetterT< ProductType > produces()
declare what type of product will make and with which optional label
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
T getParameter(std::string const &) const
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().

7  {
9  pep.getByLabel(pileupTag_, digis);
10  if(digis.isValid()) {
11  for(const auto& elem: *digis) {
12  merged_->put(elem.second, elem.first);
13  }
14  }
15 }
bool isValid() const
Definition: HandleBase.h:74
def elem(elemtype, innerHTML='', html_class='', kwargs)
Definition: HTMLExport.py:18
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 57 of file PreMixingDigiSimLinkWorker.h.

References popcon2dropbox::copy(), PileUpEventPrincipal::getByLabel(), edm::HandleBase::isValid(), PreMixingDigiSimLinkWorker< DigiSimLinkCollection >::merged_, and PreMixingDigiSimLinkWorker< DigiSimLinkCollection >::pileupTag_.

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

57  {
59  pep.getByLabel(pileupTag_, digis);
60  if(digis.isValid()) {
61  for(const auto& detsetSource: *digis) {
62  auto& detsetTarget = merged_->find_or_insert(detsetSource.detId());
63  std::copy(detsetSource.begin(), detsetSource.end(), std::back_inserter(detsetTarget));
64  }
65  }
66 }
def copy(args, dbName)
bool isValid() const
Definition: HandleBase.h:74
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 44 of file PreMixingDigiSimLinkWorker.h.

References edm::Event::getByToken(), edm::HandleBase::isValid(), PreMixingDigiSimLinkWorker< DigiSimLinkCollection >::merged_, and PreMixingDigiSimLinkWorker< DigiSimLinkCollection >::signalToken_.

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

44  {
46  iEvent.getByToken(signalToken_, digis);
47 
48  if(digis.isValid()) {
49  merged_ = std::make_unique<DigiSimLinkCollection>(*digis); // for signal we can just copy
50  }
51  else {
52  merged_ = std::make_unique<DigiSimLinkCollection>();
53  }
54 }
edm::EDGetTokenT< DigiSimLinkCollection > signalToken_
int iEvent
Definition: GenABIO.cc:230
bool isValid() const
Definition: HandleBase.h:74
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 69 of file PreMixingDigiSimLinkWorker.h.

References PreMixingDigiSimLinkWorker< DigiSimLinkCollection >::collectionDM_, PreMixingDigiSimLinkWorker< DigiSimLinkCollection >::merged_, eostools::move(), and edm::Event::put().

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

69  {
71 }
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:137
std::unique_ptr< DigiSimLinkCollection > merged_
def move(src, dest)
Definition: eostools.py:510

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