1 #ifndef HI_MixEvtVtxGenerator_H
2 #define HI_MixEvtVtxGenerator_H
44 virtual HepMC::FourVector* getVertex(
edm::Event&);
45 virtual HepMC::FourVector* getRecVertex(
edm::Event&);
65 : fVertex(0), boost_(0),
66 useRecVertex(pset.exists(
"useRecVertex")?pset.getParameter<bool>(
"useRecVertex"):
false)
69 produces<bool>(
"matchedVertex");
94 HepMC::GenVertex* genvtx = 0;
95 const HepMC::GenEvent* inev = 0;
104 cout<<
"Less than 2 sub-events, mixing seems to have failed!"<<endl;
108 cout<<
"Input does not have smeared vertex!"<<endl;
116 inev = input->GetEvent();
119 genvtx = inev->signal_process_vertex();
122 HepMC::GenEvent::particle_const_iterator
pt=inev->particles_begin();
123 HepMC::GenEvent::particle_const_iterator ptend=inev->particles_end();
124 while(!genvtx || ( genvtx->particles_in_size() == 1 && pt != ptend ) ){
126 if(pt == ptend)
cout<<
"End reached, No Gen Vertex!"<<endl;
127 genvtx = (*pt)->production_vertex();
133 aX = genvtx->position().x();
134 aY = genvtx->position().y();
135 aZ = genvtx->position().z();
136 aT = genvtx->position().t();
139 fVertex =
new HepMC::FourVector();
158 aX = input->begin()->position().x() +
vtxOffset[0];
159 aY = input->begin()->position().y() +
vtxOffset[1];
160 aZ = input->begin()->position().z() +
vtxOffset[2];
178 fVertex->set(10.0*aX,10.0*aY,10.0*aZ,0.0);
202 auto_ptr<bool> NewProduct(
new bool(
true)) ;
203 evt.
put( NewProduct ,
"matchedVertex") ;
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
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 &)
virtual void produce(edm::Event &, const edm::EventSetup &) override
virtual HepMC::FourVector * getVertex(edm::Event &)
static std::string const input
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
edm::EDGetTokenT< CrossingFrame< HepMCProduct > > cfLabel
edm::EDGetTokenT< reco::VertexCollection > hiLabel
edm::EDGetTokenT< HepMCProduct > signalLabel
const HepMC::GenEvent * GetEvent() const
HepMC::FourVector * fVertex
bool isVtxGenApplied() const
T const * product() const
virtual ~MixEvtVtxGenerator()
volatile std::atomic< bool > shutdown_flag false