Skip to content

Commit

Permalink
Merge pull request #18917 from perrozzi/portHepmcMariniTo71
Browse files Browse the repository at this point in the history
bug fix to read non-edm hepmc files in 71
  • Loading branch information
cmsbuild committed Jul 19, 2017
2 parents b8616bf + f1a341a commit 629714f
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 5 deletions.
8 changes: 6 additions & 2 deletions IOMC/Input/src/MCFileSource.cc
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
#include "IOMC/Input/interface/HepMCFileReader.h"
#include "IOMC/Input/interface/MCFileSource.h"
#include "SimDataFormats/GeneratorProducts/interface/HepMCProduct.h"
#include "SimDataFormats/GeneratorProducts/interface/GenEventInfoProduct.h"

namespace edm {

Expand All @@ -32,7 +33,8 @@ MCFileSource::MCFileSource(const ParameterSet & pset, InputSourceDescription con
}

reader_->initialize(fileName);
produces<HepMCProduct>();
produces<HepMCProduct>("generator");
produces<GenEventInfoProduct>("generator");
}


Expand All @@ -54,7 +56,9 @@ void MCFileSource::produce(Event &e) {

std::auto_ptr<HepMCProduct> bare_product(new HepMCProduct());
bare_product->addHepMCData(evt_);
e.put(bare_product);
e.put(bare_product,"generator");
std::auto_ptr<GenEventInfoProduct> info ( new GenEventInfoProduct( evt_ ) );
e.put(std::move(info),"generator" );
}

}
2 changes: 1 addition & 1 deletion SimG4Core/Application/interface/RunManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ class RunManager
G4RunManagerKernel * m_kernel;

Generator * m_generator;
std::string m_InTag ;
edm::InputTag m_InTag ;

bool m_nonBeam;
std::auto_ptr<PhysicsList> m_physicsList;
Expand Down
2 changes: 1 addition & 1 deletion SimG4Core/Application/python/g4SimHits_cfi.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@
Generator = cms.PSet(
HectorEtaCut,
# string HepMCProductLabel = "VtxSmeared"
HepMCProductLabel = cms.string('generator'),
HepMCProductLabel = cms.InputTag('generator'),
ApplyPCuts = cms.bool(True),
ApplyPtransCut = cms.bool(False),
MinPCut = cms.double(0.04), ## the cut is in GeV
Expand Down
2 changes: 1 addition & 1 deletion SimG4Core/Application/src/RunManager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ RunManager::RunManager(edm::ParameterSet const & p)
createWatchers(m_p, m_registry, m_watchers, m_producers);

m_generator = new Generator(m_pGenerator);
m_InTag = m_pGenerator.getParameter<std::string>("HepMCProductLabel") ;
m_InTag = m_pGenerator.getParameter<edm::InputTag>("HepMCProductLabel") ;

}

Expand Down

0 comments on commit 629714f

Please sign in to comment.