1 #ifndef HI_MixEvtVtxGenerator_H
2 #define HI_MixEvtVtxGenerator_H
46 virtual HepMC::FourVector* getVertex(
edm::Event&);
47 virtual HepMC::FourVector* getRecVertex(
edm::Event&);
67 : fVertex(0), boost_(0),
68 signalLabel(pset.getParameter<edm::
InputTag>(
"signalLabel")),
69 hiLabel(pset.getParameter<edm::
InputTag>(
"heavyIonLabel")),
70 useRecVertex(pset.exists(
"useRecVertex")?pset.getParameter<bool>(
"useRecVertex"):
false)
73 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 &)
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 HepMC::FourVector * getVertex(edm::Event &)
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
virtual void produce(edm::Event &, const edm::EventSetup &)
virtual ~MixEvtVtxGenerator()