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.

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  }

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

◆ ~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.

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  }

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

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

◆ getPileupInfo()

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

Definition at line 53 of file DataMixingPileupCopy.h.

53  {
55  bs = bsStorage_;
56  }

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

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

◆ putPileupInfo()

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

Definition at line 94 of file DataMixingPileupCopy.cc.

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  }

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

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

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().

edm::DataMixingPileupCopy::GenPUProtonsInputTags_
std::vector< edm::InputTag > GenPUProtonsInputTags_
Definition: DataMixingPileupCopy.h:65
edm::DataMixingPileupCopy::label_
std::string label_
Definition: DataMixingPileupCopy.h:77
edm::DataMixingPileupCopy::bsStorage_
int bsStorage_
Definition: DataMixingPileupCopy.h:70
edm::DataMixingPileupCopy::FoundPlayback_
bool FoundPlayback_
Definition: DataMixingPileupCopy.h:79
edm::DataMixingPileupCopy::PileupSummaryStorage_
std::vector< PileupSummaryInfo > PileupSummaryStorage_
Definition: DataMixingPileupCopy.h:69
edm::DataMixingPileupCopy::CrossingFramePlaybackStorage_
CrossingFramePlaybackInfoNew CrossingFramePlaybackStorage_
Definition: DataMixingPileupCopy.h:67
edm::LogWarning
Log< level::Warning, false > LogWarning
Definition: MessageLogger.h:122
heavyIonCSV_trainingSettings.idx
idx
Definition: heavyIonCSV_trainingSettings.py:5
CrossingFramePlaybackInfoNew
Definition: CrossingFramePlaybackInfoNew.h:22
cms::cuda::bs
bs
Definition: HistoContainer.h:127
edm::DataMixingPileupCopy::CFPlaybackInputTag_
edm::InputTag CFPlaybackInputTag_
Definition: DataMixingPileupCopy.h:63
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
LogDebug
#define LogDebug(id)
Definition: MessageLogger.h:233
edm::DataMixingPileupCopy::GenPUProtons_labels_
std::vector< std::string > GenPUProtons_labels_
Definition: DataMixingPileupCopy.h:72
eostools.move
def move(src, dest)
Definition: eostools.py:511
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
edm::DataMixingPileupCopy::BunchSpacingInputTag_
edm::InputTag BunchSpacingInputTag_
Definition: DataMixingPileupCopy.h:62
edm::DataMixingPileupCopy::PileupInfoInputTag_
edm::InputTag PileupInfoInputTag_
Definition: DataMixingPileupCopy.h:61
SiStripBadComponentsDQMServiceTemplate_cfg.ep
ep
Definition: SiStripBadComponentsDQMServiceTemplate_cfg.py:86
edm::InputTag
Definition: InputTag.h:15
edm::DataMixingPileupCopy::GenPUProtons_
std::vector< std::vector< reco::GenParticle > > GenPUProtons_
Definition: DataMixingPileupCopy.h:73
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37