diff --git a/GeneratorInterface/HiGenCommon/python/VtxSmearedMatch5TeVPPbBoostReversed_cff.py b/GeneratorInterface/HiGenCommon/python/VtxSmearedMatch5TeVPPbBoostReversed_cff.py index 73c0a5b960d13..f06f9650a5ba8 100644 --- a/GeneratorInterface/HiGenCommon/python/VtxSmearedMatch5TeVPPbBoostReversed_cff.py +++ b/GeneratorInterface/HiGenCommon/python/VtxSmearedMatch5TeVPPbBoostReversed_cff.py @@ -4,6 +4,6 @@ VtxSmeared = cms.EDProducer("MixBoostEvtVtxGenerator", useCF = cms.untracked.bool(True), signalLabel = cms.InputTag("generator","unsmeared"), - mixLabel = cms.InputTag("mix","generatorunsmeared"), + mixLabel = cms.InputTag("mix","generatorSmeared"), Beta=cms.double(0.434) ) diff --git a/GeneratorInterface/HiGenCommon/python/VtxSmearedMatch5TeVPPbBoost_cff.py b/GeneratorInterface/HiGenCommon/python/VtxSmearedMatch5TeVPPbBoost_cff.py index f4a59aa280890..7bb5d600c7958 100644 --- a/GeneratorInterface/HiGenCommon/python/VtxSmearedMatch5TeVPPbBoost_cff.py +++ b/GeneratorInterface/HiGenCommon/python/VtxSmearedMatch5TeVPPbBoost_cff.py @@ -4,6 +4,6 @@ VtxSmeared = cms.EDProducer("MixBoostEvtVtxGenerator", useCF = cms.untracked.bool(True), signalLabel = cms.InputTag("generator","unsmeared"), - mixLabel = cms.InputTag("mix","generatorunsmeared"), + mixLabel = cms.InputTag("mix","generatorSmeared"), Beta=cms.double(-0.434) ) diff --git a/GeneratorInterface/HiGenCommon/python/VtxSmearedMatchHI_cff.py b/GeneratorInterface/HiGenCommon/python/VtxSmearedMatchHI_cff.py index 6637c3e2894f8..ae817f4a0b676 100644 --- a/GeneratorInterface/HiGenCommon/python/VtxSmearedMatchHI_cff.py +++ b/GeneratorInterface/HiGenCommon/python/VtxSmearedMatchHI_cff.py @@ -4,5 +4,5 @@ VtxSmeared = cms.EDProducer("MixEvtVtxGenerator", useCF = cms.untracked.bool(True), signalLabel = cms.InputTag("generator","unsmeared"), - mixLabel = cms.InputTag("mix","generatorunsmeared") + mixLabel = cms.InputTag("mix","generatorSmeared") ) diff --git a/PhysicsTools/HepMCCandAlgos/plugins/GenParticleProducer.cc b/PhysicsTools/HepMCCandAlgos/plugins/GenParticleProducer.cc index 144011cb60127..8e8243866bfc0 100755 --- a/PhysicsTools/HepMCCandAlgos/plugins/GenParticleProducer.cc +++ b/PhysicsTools/HepMCCandAlgos/plugins/GenParticleProducer.cc @@ -101,7 +101,7 @@ GenParticleProducer::GenParticleProducer( const ParameterSet & cfg ) : produces >().setBranchAlias( alias + "BarCodes" ); } - if(useCF_) mixToken_ = mayConsume >(InputTag(cfg.getParameter( "mix" ),"generatorunsmeared")); + if(useCF_) mixToken_ = mayConsume >(InputTag(cfg.getParameter( "mix" ),"generatorSmeared")); else srcToken_ = mayConsume(cfg.getParameter( "src" )); } diff --git a/SimGeneral/MixingModule/plugins/MixingModule.cc b/SimGeneral/MixingModule/plugins/MixingModule.cc index c7ae04b2ae803..0c1054f392cd7 100644 --- a/SimGeneral/MixingModule/plugins/MixingModule.cc +++ b/SimGeneral/MixingModule/plugins/MixingModule.cc @@ -135,15 +135,15 @@ namespace edm { branchesActivate(TypeID(typeid(HepMCProduct)).friendlyClassName(),std::string(""),tag,label); bool makeCrossingFrame = pset.getUntrackedParameter("makeCrossingFrame", false); if(makeCrossingFrame) { - workersObjects_.push_back(new MixingWorker(minBunch_,maxBunch_,bunchSpace_,std::string(""),label,labelCF,maxNbSources_,tag,tagCF)); + workersObjects_.push_back(new MixingWorker(minBunch_,maxBunch_,bunchSpace_,std::string(""),label,labelCF,maxNbSources_,tag,tagCF,tags)); produces >(label); } consumes(tag); LogInfo("MixingModule") <<"Will mix "<1) { - InputTag fallbackTag = tags[1]; + for(size_t i = 1; i < tags.size(); ++i) { + InputTag fallbackTag = tags[i]; std::string fallbackLabel; branchesActivate(TypeID(typeid(HepMCProduct)).friendlyClassName(),std::string(""),fallbackTag,fallbackLabel); mayConsume(fallbackTag); diff --git a/SimGeneral/MixingModule/plugins/MixingWorker.cc b/SimGeneral/MixingModule/plugins/MixingWorker.cc index ea6baa43e7142..4133b859d0a4d 100644 --- a/SimGeneral/MixingModule/plugins/MixingWorker.cc +++ b/SimGeneral/MixingModule/plugins/MixingWorker.cc @@ -11,48 +11,48 @@ namespace edm { template <> void MixingWorker::addPileups(const EventPrincipal& ep, ModuleCallingContext const* mcc, unsigned int eventNr) { // HepMCProduct does not come as a vector.... - std::shared_ptr const> shPtr = getProductByTag(ep, tag_, mcc); - if(!shPtr) { - shPtr = getProductByTag(ep, InputTag("generator"), mcc); - } - if (shPtr) { - LogDebug("MixingModule") <<"HepMC pileup objects added, eventNr "<setPileupPtr(shPtr); - crFrame_->addPileups(*shPtr->product()); + for(InputTag const& tag : allTags_) { + std::shared_ptr const> shPtr = getProductByTag(ep, tag, mcc); + if(shPtr) { + LogDebug("MixingModule") << "HepMC pileup objects added, eventNr " << eventNr << " Tag " << tag << std::endl; + crFrame_->setPileupPtr(shPtr); + crFrame_->addPileups(*shPtr->product()); + break; + } } } template <> void MixingWorker::addSignals(const Event &e) { //HepMC - here the interface is different!!! + bool got = false; Handle result_t; - bool got = e.getByLabel(tag_,result_t); - if (got) { - LogDebug("MixingModule") <<" adding HepMCProduct from signal event with "<addSignals(result_t.product(),e.id()); - } else { - LogInfo("MixingModule") <<"!!!!!!! Did not get any signal data for HepMCProduct with "<addSignals(result_t.product(), e.id()); + break; + } + } + if(!got) { + LogInfo("MixingModule") << "!!!!!!! Did not get any signal data for HepMCProduct with " << allTags_[0]; } } template <> bool MixingWorker::checkSignal(const Event &e) { - bool got; - InputTag t; - + bool got = false; Handle result_t; - got = e.getByLabel(tag_,result_t); - t = InputTag(tag_.label(),tag_.instance()); - if(!got) { - got = e.getByLabel(InputTag("generator","unsmeared"),result_t); - } - - if (got) { - LogInfo("MixingModule") <<" Will create a CrossingFrame for HepMCProduct with " - << " with InputTag= "<< t.encode(); + for(InputTag const& tag : allTags_) { + got = e.getByLabel(tag, result_t); + if(got) { + InputTag t = InputTag(tag.label(), tag.instance()); + LogInfo("MixingModule") <<" Will create a CrossingFrame for HepMCProduct with " + << " with InputTag= "<< t.encode(); + break; + } } - return got; } - }//namespace edm diff --git a/SimGeneral/MixingModule/plugins/MixingWorker.h b/SimGeneral/MixingModule/plugins/MixingWorker.h index f00c7988b6380..ae1c61078678d 100644 --- a/SimGeneral/MixingModule/plugins/MixingWorker.h +++ b/SimGeneral/MixingModule/plugins/MixingWorker.h @@ -50,9 +50,13 @@ namespace edm subdet_(std::string(" ")), label_(std::string(" ")), labelCF_(std::string(" ")), - maxNbSources_(5) { - tag_=InputTag(); - tagSignal_=InputTag(); + maxNbSources_(5), + tag_(), + tagSignal_(), + allTags_(), + crFrame_(nullptr), + secSourceCF_(nullptr) + { } /*Normal constructor*/ @@ -69,7 +73,32 @@ namespace edm labelCF_(labelCF), maxNbSources_(maxNbSources), tag_(tag), - tagSignal_(tagCF) + tagSignal_(tagCF), + allTags_(), + crFrame_(nullptr), + secSourceCF_(nullptr) + { + } + + /*constructor for HepMCproduct case*/ + MixingWorker(int minBunch,int maxBunch, int bunchSpace, + std::string subdet,std::string label, + std::string labelCF,int maxNbSources, InputTag& tag, + InputTag& tagCF, + std::vector const& tags) : + MixingWorkerBase(), + minBunch_(minBunch), + maxBunch_(maxBunch), + bunchSpace_(bunchSpace), + subdet_(subdet), + label_(label), + labelCF_(labelCF), + maxNbSources_(maxNbSources), + tag_(tag), + tagSignal_(tagCF), + allTags_(tags), + crFrame_(nullptr), + secSourceCF_(nullptr) { } @@ -131,7 +160,6 @@ namespace edm LogDebug("MixingModule") <<" CF was put for type "< *PCF); @@ -146,6 +174,7 @@ namespace edm unsigned int const maxNbSources_; InputTag tag_; InputTag tagSignal_; + std::vector allTags_; // for HepMCProduct CrossingFrame * crFrame_; PCrossingFrame * secSourceCF_; diff --git a/SimGeneral/MixingModule/python/HiEventMixing_cff.py b/SimGeneral/MixingModule/python/HiEventMixing_cff.py index 0a6d6a24bd0f0..0ec0b1f1e0459 100644 --- a/SimGeneral/MixingModule/python/HiEventMixing_cff.py +++ b/SimGeneral/MixingModule/python/HiEventMixing_cff.py @@ -30,7 +30,7 @@ mixObjects = cms.PSet( mixHepMC = cms.PSet( - input = cms.VInputTag(cms.InputTag("generator","unsmeared"),cms.InputTag("generator")), + input = cms.VInputTag(cms.InputTag("generatorSmeared","",cms.InputTag.skipCurrentProcess()),cms.InputTag("generator","unsmeared"),cms.InputTag("generator","",cms.InputTag.skipCurrentProcess())), makeCrossingFrame = cms.untracked.bool(True), type = cms.string('HepMCProduct') ) diff --git a/SimGeneral/MixingModule/python/HiMixGEN_cff.py b/SimGeneral/MixingModule/python/HiMixGEN_cff.py index 2c42d3f791225..2f296ced78691 100644 --- a/SimGeneral/MixingModule/python/HiMixGEN_cff.py +++ b/SimGeneral/MixingModule/python/HiMixGEN_cff.py @@ -29,7 +29,7 @@ mixObjects = cms.PSet( mixHepMC = cms.PSet( - input = cms.VInputTag(cms.InputTag("generator","unsmeared"),cms.InputTag("generator")), + input = cms.VInputTag(cms.InputTag("generatorSmeared","",cms.InputTag.skipCurrentProcess()),cms.InputTag("generator","unsmeared"),cms.InputTag("generator","",cms.InputTag.skipCurrentProcess())), makeCrossingFrame = cms.untracked.bool(True), type = cms.string('HepMCProduct') ) diff --git a/SimMuon/GEMDigitizer/python/customizeGEMDigi.py b/SimMuon/GEMDigitizer/python/customizeGEMDigi.py index 7ec4b110a531e..e261fbe50e656 100644 --- a/SimMuon/GEMDigitizer/python/customizeGEMDigi.py +++ b/SimMuon/GEMDigitizer/python/customizeGEMDigi.py @@ -95,7 +95,7 @@ subdets = cms.vstring() ), mixHepMC = cms.PSet( - input = cms.VInputTag(cms.InputTag("generator")), + input = cms.VInputTag(cms.InputTag("generatorSmeared"),cms.InputTag("generator")), makeCrossingFrame = cms.untracked.bool(True), type = cms.string('HepMCProduct') ),