CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
edm::PreMixingPileupCopy Class Reference

#include <PreMixingPileupCopy.h>

Public Member Functions

void addPileupInfo (PileUpEventPrincipal const &pep)
 
int getBunchSpacing () const
 
const std::vector< PileupSummaryInfo > & getPileupSummaryInfo () const
 
 PreMixingPileupCopy (const edm::ParameterSet &ps, edm::ProducerBase &producer, edm::ConsumesCollector &&iC)
 
void putPileupInfo (edm::Event &e)
 
 ~PreMixingPileupCopy ()=default
 

Private Attributes

int bsStorage_
 
edm::InputTag bunchSpacingInputTag_
 
edm::InputTag cfPlaybackInputTag_
 
CrossingFramePlaybackInfoNew crossingFramePlaybackStorage_
 
bool foundPlayback_
 
std::vector< std::vector< reco::GenParticle > > genPUProtons_
 
std::vector< std::string > genPUProtons_labels_
 
std::vector< edm::InputTaggenPUProtonsInputTags_
 
edm::InputTag pileupInfoInputTag_
 
std::vector< PileupSummaryInfopileupSummaryStorage_
 

Detailed Description

Definition at line 33 of file PreMixingPileupCopy.h.

Constructor & Destructor Documentation

PreMixingPileupCopy::PreMixingPileupCopy ( const edm::ParameterSet ps,
edm::ProducerBase producer,
edm::ConsumesCollector &&  iC 
)

Definition at line 14 of file PreMixingPileupCopy.cc.

References genPUProtonsInputTags_, edm::ProductRegistryHelper::produces(), and GlobalPosition_Frontier_DevDB_cff::tag.

14  :
15  pileupInfoInputTag_(ps.getParameter<edm::InputTag>("PileupInfoInputTag")),
16  bunchSpacingInputTag_(ps.getParameter<edm::InputTag>("BunchSpacingInputTag")),
17  cfPlaybackInputTag_(ps.getParameter<edm::InputTag>("CFPlaybackInputTag")),
18  genPUProtonsInputTags_(ps.getParameter<std::vector<edm::InputTag> >("GenPUProtonsInputTags"))
19  {
20  producer.produces<std::vector<PileupSummaryInfo> >();
21  producer.produces<int>("bunchSpacing");
23 
24  for(const auto& tag: genPUProtonsInputTags_) {
25  producer.produces<std::vector<reco::GenParticle> >(tag.label());
26  }
27  }
BranchAliasSetterT< ProductType > produces()
declare what type of product will make and with which optional label
T getParameter(std::string const &) const
std::vector< edm::InputTag > genPUProtonsInputTags_
edm::PreMixingPileupCopy::~PreMixingPileupCopy ( )
default

Member Function Documentation

void PreMixingPileupCopy::addPileupInfo ( PileUpEventPrincipal const &  pep)

Definition at line 29 of file PreMixingPileupCopy.cc.

References bsStorage_, bunchSpacingInputTag_, cfPlaybackInputTag_, crossingFramePlaybackStorage_, foundPlayback_, genPUProtons_, genPUProtons_labels_, genPUProtonsInputTags_, PileUpEventPrincipal::getByLabel(), edm::EventPrincipal::id(), edm::HandleBase::isValid(), LogDebug, pileupInfoInputTag_, pileupSummaryStorage_, PileUpEventPrincipal::principal(), and GlobalPosition_Frontier_DevDB_cff::tag.

Referenced by edm::PreMixingModule::pileWorker().

29  {
30 
31  LogDebug("PreMixingPileupCopy") <<"\n===============> adding pileup Info from event "<<pep.principal().id();
32 
33  // find PileupSummaryInfo, CFPlayback information, if it's there
34 
35  // Pileup info first
37  pep.getByLabel(pileupInfoInputTag_, pileupInfoHandle);
38 
39  edm::Handle<int> bsHandle;
40  pep.getByLabel(bunchSpacingInputTag_, bsHandle);
41 
42  if(pileupInfoHandle.isValid()) {
43  pileupSummaryStorage_ = *pileupInfoHandle;
44  LogDebug("PreMixingPileupCopy") << "PileupInfo Size: " << pileupSummaryStorage_.size();
45  }
46  bsStorage_ = bsHandle.isValid() ? *bsHandle : 10000;
47 
48  // Gen. PU protons
50  for(const auto& tag: genPUProtonsInputTags_) {
51  pep.getByLabel(tag, genPUProtonsHandle);
52  if(genPUProtonsHandle.isValid()) {
53  genPUProtons_.push_back(*genPUProtonsHandle);
54  genPUProtons_labels_.push_back(tag.label());
55  }
56  else {
57  edm::LogWarning("PreMixingPileupCopy") << "Missing product with label: " << tag.label();
58  }
59  }
60 
61  // Playback
63  pep.getByLabel(cfPlaybackInputTag_, playbackHandle);
64  foundPlayback_ = false;
65  if(playbackHandle.isValid()) {
66  crossingFramePlaybackStorage_ = *playbackHandle;
67  foundPlayback_ = true;
68  }
69  }
#define LogDebug(id)
std::vector< std::vector< reco::GenParticle > > genPUProtons_
CrossingFramePlaybackInfoNew crossingFramePlaybackStorage_
std::vector< std::string > genPUProtons_labels_
std::vector< PileupSummaryInfo > pileupSummaryStorage_
std::vector< edm::InputTag > genPUProtonsInputTags_
bool isValid() const
Definition: HandleBase.h:74
int edm::PreMixingPileupCopy::getBunchSpacing ( ) const
inline

Definition at line 40 of file PreMixingPileupCopy.h.

References MillePedeFileConverter_cfg::e.

Referenced by edm::PreMixingModule::put().

const std::vector<PileupSummaryInfo>& edm::PreMixingPileupCopy::getPileupSummaryInfo ( ) const
inline

Definition at line 39 of file PreMixingPileupCopy.h.

Referenced by edm::PreMixingModule::put().

39 { return pileupSummaryStorage_; }
std::vector< PileupSummaryInfo > pileupSummaryStorage_
void PreMixingPileupCopy::putPileupInfo ( edm::Event e)

Definition at line 71 of file PreMixingPileupCopy.cc.

References bsStorage_, crossingFramePlaybackStorage_, foundPlayback_, genPUProtons_, genPUProtons_labels_, training_settings::idx, eostools::move(), pileupSummaryStorage_, and edm::Event::put().

Referenced by edm::PreMixingModule::put().

71  {
72  if(foundPlayback_ ) {
73  e.put(std::make_unique<CrossingFramePlaybackInfoNew>(std::move(crossingFramePlaybackStorage_)));
74  }
75  e.put(std::make_unique<std::vector<PileupSummaryInfo> >(std::move(pileupSummaryStorage_)));
76  e.put(std::make_unique<int>(bsStorage_), "bunchSpacing");
77 
78  // Gen. PU protons
79  for(size_t idx = 0; idx < genPUProtons_.size(); ++idx){
80  e.put(std::make_unique<std::vector<reco::GenParticle> >(std::move(genPUProtons_[idx])),
82  }
83 
84  // clear local storage after this event
85  pileupSummaryStorage_.clear();
86  genPUProtons_.clear();
87  genPUProtons_labels_.clear();
88  }
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:137
std::vector< std::vector< reco::GenParticle > > genPUProtons_
CrossingFramePlaybackInfoNew crossingFramePlaybackStorage_
std::vector< std::string > genPUProtons_labels_
std::vector< PileupSummaryInfo > pileupSummaryStorage_
def move(src, dest)
Definition: eostools.py:510

Member Data Documentation

int edm::PreMixingPileupCopy::bsStorage_
private

Definition at line 53 of file PreMixingPileupCopy.h.

Referenced by addPileupInfo(), and putPileupInfo().

edm::InputTag edm::PreMixingPileupCopy::bunchSpacingInputTag_
private

Definition at line 45 of file PreMixingPileupCopy.h.

Referenced by addPileupInfo().

edm::InputTag edm::PreMixingPileupCopy::cfPlaybackInputTag_
private

Definition at line 46 of file PreMixingPileupCopy.h.

Referenced by addPileupInfo().

CrossingFramePlaybackInfoNew edm::PreMixingPileupCopy::crossingFramePlaybackStorage_
private

Definition at line 51 of file PreMixingPileupCopy.h.

Referenced by addPileupInfo(), and putPileupInfo().

bool edm::PreMixingPileupCopy::foundPlayback_
private

Definition at line 58 of file PreMixingPileupCopy.h.

Referenced by addPileupInfo(), and putPileupInfo().

std::vector<std::vector<reco::GenParticle> > edm::PreMixingPileupCopy::genPUProtons_
private

Definition at line 56 of file PreMixingPileupCopy.h.

Referenced by addPileupInfo(), and putPileupInfo().

std::vector<std::string> edm::PreMixingPileupCopy::genPUProtons_labels_
private

Definition at line 55 of file PreMixingPileupCopy.h.

Referenced by addPileupInfo(), and putPileupInfo().

std::vector<edm::InputTag> edm::PreMixingPileupCopy::genPUProtonsInputTags_
private

Definition at line 48 of file PreMixingPileupCopy.h.

Referenced by addPileupInfo(), and PreMixingPileupCopy().

edm::InputTag edm::PreMixingPileupCopy::pileupInfoInputTag_
private

Definition at line 44 of file PreMixingPileupCopy.h.

Referenced by addPileupInfo().

std::vector<PileupSummaryInfo> edm::PreMixingPileupCopy::pileupSummaryStorage_
private

Definition at line 52 of file PreMixingPileupCopy.h.

Referenced by addPileupInfo(), and putPileupInfo().