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

Detailed Description

Definition at line 37 of file DataMixingPileupCopy.h.

Constructor & Destructor Documentation

DataMixingPileupCopy::DataMixingPileupCopy ( )

Definition at line 27 of file DataMixingPileupCopy.cc.

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

standard constructor

Definition at line 30 of file DataMixingPileupCopy.cc.

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

30  :
31  label_(ps.getParameter<std::string>("Label"))
32 
33  {
34 
35  // Pileup/Playback information
36 
37  PileupInfoInputTag_ = ps.getParameter<edm::InputTag>("PileupInfoInputTag");
38  BunchSpacingInputTag_ = ps.getParameter<edm::InputTag>("BunchSpacingInputTag");
39  CFPlaybackInputTag_ = ps.getParameter<edm::InputTag>("CFPlaybackInputTag");
40 
41 
42  // apparently, we don't need consumes from Secondary input stream
43  //iC.consumes<std::vector<PileupSummaryInfo>>(PileupInfoInputTag_);
44  //iC.consumes<int>(BunchSpacingInputTag_);
45  //iC.consumes<CrossingFramePlaybackInfoNew>(CFPlaybackInputTag_);
46  }
T getParameter(std::string const &) const
DataMixingPileupCopy::~DataMixingPileupCopy ( )
virtual

Default destructor

Definition at line 49 of file DataMixingPileupCopy.cc.

49  {
50  }

Member Function Documentation

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

Definition at line 53 of file DataMixingPileupCopy.cc.

References bsStorage_, BunchSpacingInputTag_, CFPlaybackInputTag_, CrossingFramePlaybackStorage_, FoundPlayback_, edm::EventPrincipal::id(), LogDebug, PileupInfoInputTag_, and PileupSummaryStorage_.

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

54  {
55 
56  LogDebug("DataMixingPileupCopy") <<"\n===============> adding pileup Info from event "<<ep->id();
57 
58  // find PileupSummaryInfo, CFPlayback information, if it's there
59 
60  // Pileup info first
61 
62  std::shared_ptr<Wrapper< std::vector<PileupSummaryInfo> > const> PileupInfoPTR =
63  getProductByTag<std::vector<PileupSummaryInfo>>(*ep,PileupInfoInputTag_, mcc);
64 
65  std::shared_ptr<Wrapper< int > const> bsPTR =
66  getProductByTag<int>(*ep,BunchSpacingInputTag_, mcc);
67 
68  if(PileupInfoPTR ) {
69  PileupSummaryStorage_ = *(PileupInfoPTR->product()) ;
70  LogDebug("DataMixingEMWorker") << "PileupInfo Size: " << PileupSummaryStorage_.size();
71  }
72 
73  if(bsPTR ) {
74  bsStorage_ = *(bsPTR->product()) ;
75  }
76  else {
77  bsStorage_=10000;
78  }
79 
80  // Playback
81  std::shared_ptr<Wrapper<CrossingFramePlaybackInfoNew> const> PlaybackPTR =
82  getProductByTag<CrossingFramePlaybackInfoNew>(*ep,CFPlaybackInputTag_, mcc);
83  FoundPlayback_ = false;
84  if(PlaybackPTR ) {
85  CrossingFramePlaybackStorage_ = *(PlaybackPTR->product()) ;
86  FoundPlayback_ = true;
87  }
88  }
#define LogDebug(id)
CrossingFramePlaybackInfoNew CrossingFramePlaybackStorage_
EventID const & id() const
std::vector< PileupSummaryInfo > PileupSummaryStorage_
void edm::DataMixingPileupCopy::getPileupInfo ( std::vector< PileupSummaryInfo > &  ps,
int &  bs 
)
inline

Definition at line 53 of file DataMixingPileupCopy.h.

References bsStorage_, and PileupSummaryStorage_.

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

std::vector< PileupSummaryInfo > PileupSummaryStorage_
void DataMixingPileupCopy::putPileupInfo ( edm::Event e)

Definition at line 90 of file DataMixingPileupCopy.cc.

References bsStorage_, CrossingFramePlaybackStorage_, FoundPlayback_, eostools::move(), PileupSummaryStorage_, and edm::Event::put().

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

90  {
91  std::unique_ptr<std::vector<PileupSummaryInfo> > PSIVector(new std::vector<PileupSummaryInfo>);
92  std::unique_ptr<int> bsInt(new int);
93 
94  std::vector<PileupSummaryInfo>::const_iterator PSiter;
95  for(PSiter = PileupSummaryStorage_.begin(); PSiter != PileupSummaryStorage_.end(); PSiter++){
96  PSIVector->push_back(*PSiter);
97  }
98 
99  *bsInt=bsStorage_;
100 
101  if(FoundPlayback_ ) {
102  std::unique_ptr<CrossingFramePlaybackInfoNew> CFPlaybackInfo(new CrossingFramePlaybackInfoNew(CrossingFramePlaybackStorage_));
103  e.put(std::move(CFPlaybackInfo));
104  }
105  e.put(std::move(PSIVector));
106  e.put(std::move(bsInt),"bunchSpacing");
107 
108  // clear local storage after this event
109  PileupSummaryStorage_.clear();
110  }
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:122
CrossingFramePlaybackInfoNew CrossingFramePlaybackStorage_
std::vector< PileupSummaryInfo > PileupSummaryStorage_
def move(src, dest)
Definition: eostools.py:510

Member Data Documentation

int edm::DataMixingPileupCopy::bsStorage_
private

Definition at line 68 of file DataMixingPileupCopy.h.

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

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

Definition at line 61 of file DataMixingPileupCopy.h.

Referenced by addPileupInfo(), and DataMixingPileupCopy().

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

Definition at line 62 of file DataMixingPileupCopy.h.

Referenced by addPileupInfo(), and DataMixingPileupCopy().

CrossingFramePlaybackInfoNew edm::DataMixingPileupCopy::CrossingFramePlaybackStorage_
private

Definition at line 65 of file DataMixingPileupCopy.h.

Referenced by addPileupInfo(), and putPileupInfo().

bool edm::DataMixingPileupCopy::FoundPlayback_
private

Definition at line 74 of file DataMixingPileupCopy.h.

Referenced by addPileupInfo(), and putPileupInfo().

std::string edm::DataMixingPileupCopy::label_
private
edm::InputTag edm::DataMixingPileupCopy::PileupInfoInputTag_
private

Definition at line 60 of file DataMixingPileupCopy.h.

Referenced by addPileupInfo(), and DataMixingPileupCopy().

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

Definition at line 67 of file DataMixingPileupCopy.h.

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