CMS 3D CMS Logo

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

#include <DataMixingPileupCopy.h>

Public Member Functions

void addPileupInfo (const edm::EventPrincipal *, unsigned int EventId, ModuleCallingContext const *mcc)
 
 DataMixingPileupCopy ()
 
 DataMixingPileupCopy (const edm::ParameterSet &ps, edm::ConsumesCollector &&iC)
 
void getPileupInfo (std::vector< PileupSummaryInfo > &ps, int &bs)
 
void putPileupInfo (edm::Event &e)
 
virtual ~DataMixingPileupCopy ()
 

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_
 
std::string label_
 
edm::InputTag PileupInfoInputTag_
 
std::vector< PileupSummaryInfoPileupSummaryStorage_
 

Detailed Description

Definition at line 40 of file DataMixingPileupCopy.h.

Constructor & Destructor Documentation

◆ DataMixingPileupCopy() [1/2]

DataMixingPileupCopy::DataMixingPileupCopy ( )

Definition at line 22 of file DataMixingPileupCopy.cc.

22 {}

◆ DataMixingPileupCopy() [2/2]

DataMixingPileupCopy::DataMixingPileupCopy ( const edm::ParameterSet ps,
edm::ConsumesCollector &&  iC 
)
explicit

standard constructor

Definition at line 25 of file DataMixingPileupCopy.cc.

References BunchSpacingInputTag_, CFPlaybackInputTag_, GenPUProtonsInputTags_, edm::ParameterSet::getParameter(), and PileupInfoInputTag_.

26  : label_(ps.getParameter<std::string>("Label"))
27 
28  {
29  // Pileup/Playback information
30 
31  PileupInfoInputTag_ = ps.getParameter<edm::InputTag>("PileupInfoInputTag");
32  BunchSpacingInputTag_ = ps.getParameter<edm::InputTag>("BunchSpacingInputTag");
33  CFPlaybackInputTag_ = ps.getParameter<edm::InputTag>("CFPlaybackInputTag");
34 
35  GenPUProtonsInputTags_ = ps.getParameter<std::vector<edm::InputTag>>("GenPUProtonsInputTags");
36 
37  // apparently, we don't need consumes from Secondary input stream
38  // iC.consumes<std::vector<PileupSummaryInfo>>(PileupInfoInputTag_);
39  // iC.consumes<int>(BunchSpacingInputTag_);
40  // iC.consumes<CrossingFramePlaybackInfoNew>(CFPlaybackInputTag_);
41  }
T getParameter(std::string const &) const
Definition: ParameterSet.h:307
std::vector< edm::InputTag > GenPUProtonsInputTags_

◆ ~DataMixingPileupCopy()

DataMixingPileupCopy::~DataMixingPileupCopy ( )
virtual

Default destructor

Definition at line 44 of file DataMixingPileupCopy.cc.

44 {}

Member Function Documentation

◆ addPileupInfo()

void DataMixingPileupCopy::addPileupInfo ( const edm::EventPrincipal ep,
unsigned int  EventId,
ModuleCallingContext const *  mcc 
)

Definition at line 46 of file DataMixingPileupCopy.cc.

References bsStorage_, BunchSpacingInputTag_, CFPlaybackInputTag_, CrossingFramePlaybackStorage_, ecalHexDisplay_cfg::ep, FoundPlayback_, GenPUProtons_, GenPUProtons_labels_, GenPUProtonsInputTags_, LogDebug, PileupInfoInputTag_, and PileupSummaryStorage_.

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

48  {
49  LogDebug("DataMixingPileupCopy") << "\n===============> adding pileup Info from event " << ep->id();
50 
51  // find PileupSummaryInfo, CFPlayback information, if it's there
52 
53  // Pileup info first
54 
55  std::shared_ptr<Wrapper<std::vector<PileupSummaryInfo>> const> PileupInfoPTR =
56  getProductByTag<std::vector<PileupSummaryInfo>>(*ep, PileupInfoInputTag_, mcc);
57 
58  std::shared_ptr<Wrapper<int> const> bsPTR = getProductByTag<int>(*ep, BunchSpacingInputTag_, mcc);
59 
60  if (PileupInfoPTR) {
61  PileupSummaryStorage_ = *(PileupInfoPTR->product());
62  LogDebug("DataMixingEMWorker") << "PileupInfo Size: " << PileupSummaryStorage_.size();
63  }
64 
65  if (bsPTR) {
66  bsStorage_ = *(bsPTR->product());
67  } else {
68  bsStorage_ = 10000;
69  }
70 
71  // Gen. PU protons
72  std::shared_ptr<edm::Wrapper<std::vector<reco::GenParticle>> const> GenPUProtonsPTR;
73  for (std::vector<edm::InputTag>::const_iterator it_InputTag = GenPUProtonsInputTags_.begin();
74  it_InputTag != GenPUProtonsInputTags_.end();
75  ++it_InputTag) {
76  GenPUProtonsPTR = getProductByTag<std::vector<reco::GenParticle>>(*ep, *it_InputTag, mcc);
77  if (GenPUProtonsPTR != nullptr) {
78  GenPUProtons_.push_back(*(GenPUProtonsPTR->product()));
79  GenPUProtons_labels_.push_back(it_InputTag->label());
80  } else
81  edm::LogWarning("DataMixingPileupCopy") << "Missing product with label: " << (*it_InputTag).label();
82  }
83 
84  // Playback
85  std::shared_ptr<Wrapper<CrossingFramePlaybackInfoNew> const> PlaybackPTR =
86  getProductByTag<CrossingFramePlaybackInfoNew>(*ep, CFPlaybackInputTag_, mcc);
87  FoundPlayback_ = false;
88  if (PlaybackPTR) {
89  CrossingFramePlaybackStorage_ = *(PlaybackPTR->product());
90  FoundPlayback_ = true;
91  }
92  }
std::vector< std::vector< reco::GenParticle > > GenPUProtons_
CrossingFramePlaybackInfoNew CrossingFramePlaybackStorage_
std::vector< PileupSummaryInfo > PileupSummaryStorage_
std::vector< std::string > GenPUProtons_labels_
std::vector< edm::InputTag > GenPUProtonsInputTags_
Log< level::Warning, false > LogWarning
#define LogDebug(id)

◆ getPileupInfo()

void edm::DataMixingPileupCopy::getPileupInfo ( std::vector< PileupSummaryInfo > &  ps,
int &  bs 
)
inline

Definition at line 53 of file DataMixingPileupCopy.h.

References cms::cuda::bs, bsStorage_, and PileupSummaryStorage_.

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

53  {
55  bs = bsStorage_;
56  }
std::vector< PileupSummaryInfo > PileupSummaryStorage_

◆ putPileupInfo()

void DataMixingPileupCopy::putPileupInfo ( edm::Event e)

Definition at line 94 of file DataMixingPileupCopy.cc.

References bsStorage_, CrossingFramePlaybackStorage_, MillePedeFileConverter_cfg::e, FoundPlayback_, GenPUProtons_, GenPUProtons_labels_, heavyIonCSV_trainingSettings::idx, eostools::move(), and PileupSummaryStorage_.

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

94  {
95  std::unique_ptr<std::vector<PileupSummaryInfo>> PSIVector(new std::vector<PileupSummaryInfo>);
96  std::unique_ptr<int> bsInt(new int);
97 
98  std::vector<PileupSummaryInfo>::const_iterator PSiter;
99  for (PSiter = PileupSummaryStorage_.begin(); PSiter != PileupSummaryStorage_.end(); PSiter++) {
100  PSIVector->push_back(*PSiter);
101  }
102 
103  *bsInt = bsStorage_;
104 
105  if (FoundPlayback_) {
106  std::unique_ptr<CrossingFramePlaybackInfoNew> CFPlaybackInfo(
108  e.put(std::move(CFPlaybackInfo));
109  }
110  e.put(std::move(PSIVector));
111  e.put(std::move(bsInt), "bunchSpacing");
112 
113  // Gen. PU protons
114  for (size_t idx = 0; idx < GenPUProtons_.size(); ++idx) {
115  std::unique_ptr<std::vector<reco::GenParticle>> GenPUProtons_ptr(new std::vector<reco::GenParticle>());
116  std::vector<reco::GenParticle>::const_iterator it_GenParticle = GenPUProtons_.at(idx).begin();
117  std::vector<reco::GenParticle>::const_iterator it_GenParticle_end = GenPUProtons_.at(idx).end();
118  for (; it_GenParticle != it_GenParticle_end; ++it_GenParticle)
119  GenPUProtons_ptr->push_back(*it_GenParticle);
120 
121  e.put(std::move(GenPUProtons_ptr), GenPUProtons_labels_.at(idx));
122  }
123 
124  // clear local storage after this event
125  PileupSummaryStorage_.clear();
126  GenPUProtons_.clear();
127  GenPUProtons_labels_.clear();
128  }
std::vector< std::vector< reco::GenParticle > > GenPUProtons_
CrossingFramePlaybackInfoNew CrossingFramePlaybackStorage_
std::vector< PileupSummaryInfo > PileupSummaryStorage_
std::vector< std::string > GenPUProtons_labels_
def move(src, dest)
Definition: eostools.py:511

Member Data Documentation

◆ bsStorage_

int edm::DataMixingPileupCopy::bsStorage_
private

Definition at line 70 of file DataMixingPileupCopy.h.

Referenced by addPileupInfo(), getPileupInfo(), and putPileupInfo().

◆ BunchSpacingInputTag_

edm::InputTag edm::DataMixingPileupCopy::BunchSpacingInputTag_
private

Definition at line 62 of file DataMixingPileupCopy.h.

Referenced by addPileupInfo(), and DataMixingPileupCopy().

◆ CFPlaybackInputTag_

edm::InputTag edm::DataMixingPileupCopy::CFPlaybackInputTag_
private

Definition at line 63 of file DataMixingPileupCopy.h.

Referenced by addPileupInfo(), and DataMixingPileupCopy().

◆ CrossingFramePlaybackStorage_

CrossingFramePlaybackInfoNew edm::DataMixingPileupCopy::CrossingFramePlaybackStorage_
private

Definition at line 67 of file DataMixingPileupCopy.h.

Referenced by addPileupInfo(), and putPileupInfo().

◆ FoundPlayback_

bool edm::DataMixingPileupCopy::FoundPlayback_
private

Definition at line 79 of file DataMixingPileupCopy.h.

Referenced by addPileupInfo(), and putPileupInfo().

◆ GenPUProtons_

std::vector<std::vector<reco::GenParticle> > edm::DataMixingPileupCopy::GenPUProtons_
private

Definition at line 73 of file DataMixingPileupCopy.h.

Referenced by addPileupInfo(), and putPileupInfo().

◆ GenPUProtons_labels_

std::vector<std::string> edm::DataMixingPileupCopy::GenPUProtons_labels_
private

Definition at line 72 of file DataMixingPileupCopy.h.

Referenced by addPileupInfo(), and putPileupInfo().

◆ GenPUProtonsInputTags_

std::vector<edm::InputTag> edm::DataMixingPileupCopy::GenPUProtonsInputTags_
private

Definition at line 65 of file DataMixingPileupCopy.h.

Referenced by addPileupInfo(), and DataMixingPileupCopy().

◆ label_

std::string edm::DataMixingPileupCopy::label_
private

◆ PileupInfoInputTag_

edm::InputTag edm::DataMixingPileupCopy::PileupInfoInputTag_
private

Definition at line 61 of file DataMixingPileupCopy.h.

Referenced by addPileupInfo(), and DataMixingPileupCopy().

◆ PileupSummaryStorage_

std::vector<PileupSummaryInfo> edm::DataMixingPileupCopy::PileupSummaryStorage_
private

Definition at line 69 of file DataMixingPileupCopy.h.

Referenced by addPileupInfo(), getPileupInfo(), and putPileupInfo().