1 #ifndef HI_MixEvtVtxGenerator_H 2 #define HI_MixEvtVtxGenerator_H 41 virtual HepMC::FourVector* getVertex(
edm::Event&);
42 virtual HepMC::FourVector* getRecVertex(
edm::Event&);
64 produces<edm::HepMCProduct>();
66 if (
pset.exists(
"vtxOffset"))
67 vtxOffset =
pset.getParameter<std::vector<double> >(
"vtxOffset");
72 useCF_ =
pset.getUntrackedParameter<
bool>(
"useCF",
false);
87 HepMC::GenVertex* genvtx =
nullptr;
95 throw cms::Exception(
"MatchVtx") <<
"Mixing has " <<
mix.size() <<
" sub-events, should have been at least 2" 100 throw cms::Exception(
"MatchVtx") <<
"Input background does not have smeared vertex!" << endl;
107 inev =
input->GetEvent();
110 genvtx = inev->signal_process_vertex();
112 HepMC::GenEvent::particle_const_iterator
pt = inev->particles_begin();
113 HepMC::GenEvent::particle_const_iterator ptend = inev->particles_end();
114 while (!genvtx || (genvtx->particles_in_size() == 1 &&
pt != ptend)) {
116 cout <<
"End reached, No Gen Vertex!" << endl;
117 genvtx = (*pt)->production_vertex();
121 double aX, aY, aZ, aT;
123 aX = genvtx->position().x();
124 aY = genvtx->position().y();
125 aZ = genvtx->position().z();
126 aT = genvtx->position().t();
129 fVertex =
new HepMC::FourVector();
131 LogInfo(
"MatchVtx") <<
" setting vertex " 132 <<
" aX " << aX <<
" aY " << aY <<
" aZ " << aZ <<
" aT " << aT << endl;
149 fVertex =
new HepMC::FourVector();
150 fVertex->set(10.0 * aX, 10.0 * aY, 10.0 * aZ, 0.0);
164 <<
"Signal HepMCProduct is not compatible for embedding - it's vertex is already smeared." << std::endl;
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
virtual HepMC::FourVector * getRecVertex(edm::Event &)
bool isVtxGenApplied() const
std::vector< double > vtxOffset
#define DEFINE_FWK_MODULE(type)
T const * product() const
MixEvtVtxGenerator(const edm::ParameterSet &)
void produce(edm::Event &, const edm::EventSetup &) override
bool getByToken(EDGetToken token, Handle< PROD > &result) const
virtual HepMC::FourVector * getVertex(edm::Event &)
static std::string const input
edm::EDGetTokenT< CrossingFrame< HepMCProduct > > cfLabel
const HepMC::GenEvent * GetEvent() const
Log< level::Info, false > LogInfo
edm::EDGetTokenT< reco::VertexCollection > hiLabel
edm::EDGetTokenT< HepMCProduct > signalLabel
HepMC::FourVector * fVertex
~MixEvtVtxGenerator() override