1 #ifndef HI_MixEvtVtxGenerator_H 2 #define HI_MixEvtVtxGenerator_H 45 virtual HepMC::FourVector* getVertex(
edm::Event&);
46 virtual HepMC::FourVector* getRecVertex(
edm::Event&);
70 produces<edm::HepMCProduct>();
93 HepMC::GenVertex* genvtx =
nullptr;
102 <<
"Mixing has "<<
mix.size()<<
" sub-events, should have been at least 2" 107 throw cms::Exception(
"MatchVtx")<<
"Input background does not have smeared vertex!"<<endl;
117 genvtx = inev->signal_process_vertex();
119 HepMC::GenEvent::particle_const_iterator
pt=inev->particles_begin();
120 HepMC::GenEvent::particle_const_iterator ptend=inev->particles_end();
121 while(!genvtx || ( genvtx->particles_in_size() == 1 && pt != ptend ) ){
122 if(pt == ptend)
cout<<
"End reached, No Gen Vertex!"<<endl;
123 genvtx = (*pt)->production_vertex();
129 aX = genvtx->position().x();
130 aY = genvtx->position().y();
131 aZ = genvtx->position().z();
132 aT = genvtx->position().t();
135 fVertex =
new HepMC::FourVector();
137 LogInfo(
"MatchVtx")<<
" setting vertex "<<
" aX "<<aX<<
" aY "<<aY<<
" aZ "<<aZ<<
" aT "<<aT<<endl;
153 aX = input->begin()->position().x() +
vtxOffset[0];
154 aY = input->begin()->position().y() +
vtxOffset[1];
155 aZ = input->begin()->position().z() +
vtxOffset[2];
158 fVertex->set(10.0*aX,10.0*aY,10.0*aZ,0.0);
173 <<
"Signal HepMCProduct is not compatible for embedding - it's vertex is already smeared." T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
virtual HepMC::FourVector * getRecVertex(edm::Event &)
bool getByToken(EDGetToken token, Handle< PROD > &result) const
std::vector< double > vtxOffset
#define DEFINE_FWK_MODULE(type)
bool exists(std::string const ¶meterName) const
checks if a parameter exists
MixEvtVtxGenerator(const edm::ParameterSet &)
void produce(edm::Event &, const edm::EventSetup &) override
virtual HepMC::FourVector * getVertex(edm::Event &)
static std::string const input
edm::EDGetTokenT< CrossingFrame< HepMCProduct > > cfLabel
edm::EDGetTokenT< reco::VertexCollection > hiLabel
edm::EDGetTokenT< HepMCProduct > signalLabel
const HepMC::GenEvent * GetEvent() const
T const * product() const
HepMC::FourVector * fVertex
bool isVtxGenApplied() const
~MixEvtVtxGenerator() override