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 signalLabel(pset.getParameter<edm::
InputTag>(
"signalLabel")),
67 hiLabel(pset.getParameter<edm::
InputTag>(
"heavyIonLabel")),
68 useRecVertex(pset.exists(
"useRecVertex")?pset.getParameter<bool>(
"useRecVertex"):
false)
71 produces<bool>(
"matchedVertex");
92 HepMC::GenVertex* genvtx = 0;
93 const HepMC::GenEvent* inev = 0;
102 cout<<
"Less than 2 sub-events, mixing seems to have failed!"<<endl;
106 cout<<
"Input does not have smeared vertex!"<<endl;
114 inev = input->GetEvent();
117 genvtx = inev->signal_process_vertex();
120 HepMC::GenEvent::particle_const_iterator
pt=inev->particles_begin();
121 HepMC::GenEvent::particle_const_iterator ptend=inev->particles_end();
122 while(!genvtx || ( genvtx->particles_in_size() == 1 && pt != ptend ) ){
124 if(pt == ptend)
cout<<
"End reached, No Gen Vertex!"<<endl;
125 genvtx = (*pt)->production_vertex();
131 aX = genvtx->position().x();
132 aY = genvtx->position().y();
133 aZ = genvtx->position().z();
134 aT = genvtx->position().t();
137 fVertex =
new HepMC::FourVector();
156 aX = input->begin()->position().x() +
vtxOffset[0];
157 aY = input->begin()->position().y() +
vtxOffset[1];
158 aZ = input->begin()->position().z() +
vtxOffset[2];
176 fVertex->set(10.0*aX,10.0*aY,10.0*aZ,0.0);
200 auto_ptr<bool> NewProduct(
new bool(
true)) ;
201 evt.
put( NewProduct ,
"matchedVertex") ;
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
virtual HepMC::FourVector * getRecVertex(edm::Event &)
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
edm::InputTag signalLabel
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
const HepMC::GenEvent * GetEvent() const
HepMC::FourVector * fVertex
bool isVtxGenApplied() const
T const * product() const
return(e1-e2)*(e1-e2)+dp *dp
virtual ~MixEvtVtxGenerator()
volatile std::atomic< bool > shutdown_flag false