Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007 #include <map>
00008 #include "FWCore/MessageLogger/interface/MessageLogger.h"
00009 #include "FWCore/Utilities/interface/EDMException.h"
00010 #include "FWCore/Framework/interface/ConstProductRegistry.h"
00011 #include "FWCore/ServiceRegistry/interface/Service.h"
00012 #include "DataFormats/Common/interface/Handle.h"
00013 #include "DataFormats/Provenance/interface/Provenance.h"
00014 #include "DataFormats/Provenance/interface/BranchDescription.h"
00015
00016
00017 #include "DataMixingPileupCopy.h"
00018
00019
00020 using namespace std;
00021
00022 namespace edm
00023 {
00024
00025
00026
00027 DataMixingPileupCopy::DataMixingPileupCopy() { }
00028
00029
00030 DataMixingPileupCopy::DataMixingPileupCopy(const edm::ParameterSet& ps) :
00031 label_(ps.getParameter<std::string>("Label"))
00032
00033 {
00034
00035
00036
00037 PileupInfoInputTag_ = ps.getParameter<edm::InputTag>("PileupInfoInputTag");
00038 CFPlaybackInputTag_ = ps.getParameter<edm::InputTag>("CFPlaybackInputTag");
00039
00040 }
00041
00042
00043 DataMixingPileupCopy::~DataMixingPileupCopy() {
00044 }
00045
00046
00047 void DataMixingPileupCopy::addPileupInfo(const EventPrincipal *ep, unsigned int eventNr) {
00048
00049 LogDebug("DataMixingPileupCopy") <<"\n===============> adding pileup Info from event "<<ep->id();
00050
00051
00052
00053
00054
00055 boost::shared_ptr<Wrapper< std::vector<PileupSummaryInfo> > const> PileupInfoPTR =
00056 getProductByTag<std::vector<PileupSummaryInfo>>(*ep,PileupInfoInputTag_ );
00057
00058 if(PileupInfoPTR ) {
00059
00060 PileupSummaryStorage_ = *(PileupInfoPTR->product()) ;
00061
00062 LogDebug("DataMixingEMWorker") << "PileupInfo Size: " << PileupSummaryStorage_.size();
00063
00064 }
00065
00066
00067
00068 boost::shared_ptr<Wrapper<CrossingFramePlaybackInfoExtended> const> PlaybackPTR =
00069 getProductByTag<CrossingFramePlaybackInfoExtended>(*ep,CFPlaybackInputTag_ );
00070
00071 if(PlaybackPTR ) {
00072
00073 CrossingFramePlaybackStorage_ = *(PlaybackPTR->product()) ;
00074
00075 }
00076
00077 }
00078
00079 void DataMixingPileupCopy::putPileupInfo(edm::Event &e) {
00080
00081 std::auto_ptr<std::vector<PileupSummaryInfo> > PSIVector(new std::vector<PileupSummaryInfo>);
00082
00083 std::vector<PileupSummaryInfo>::const_iterator PSiter;
00084
00085 for(PSiter = PileupSummaryStorage_.begin(); PSiter != PileupSummaryStorage_.end(); PSiter++){
00086
00087 PSIVector->push_back(*PSiter);
00088
00089 }
00090
00091 std::vector<std::vector<edm::EventID> > IdVect;
00092
00093 CrossingFramePlaybackStorage_.getEventStartInfo(IdVect, 0);
00094
00095 std::auto_ptr< CrossingFramePlaybackInfoExtended > CFPlaybackInfo( new CrossingFramePlaybackInfoExtended(0, IdVect.size(), 1 ));
00096
00097 CFPlaybackInfo->setEventStartInfo(IdVect, 0);
00098
00099
00100 e.put(PSIVector);
00101 e.put(CFPlaybackInfo);
00102
00103
00104 PileupSummaryStorage_.clear();
00105
00106 }
00107
00108 }