Public Member Functions | |
virtual HepMC::FourVector * | getRecVertex (edm::Event &) |
virtual HepMC::FourVector * | getVertex (edm::Event &) |
MixEvtVtxGenerator (const edm::ParameterSet &) | |
virtual void | produce (edm::Event &, const edm::EventSetup &) |
virtual | ~MixEvtVtxGenerator () |
Protected Attributes | |
TMatrixD * | boost_ |
HepMC::FourVector * | fVertex |
Private Attributes | |
edm::InputTag | hiLabel |
edm::InputTag | signalLabel |
bool | useRecVertex |
std::vector< double > | vtxOffset |
Definition at line 35 of file MixEvtVtxGenerator.cc.
MixEvtVtxGenerator::MixEvtVtxGenerator | ( | const edm::ParameterSet & | pset | ) | [explicit] |
Definition at line 62 of file MixEvtVtxGenerator.cc.
References edm::ParameterSet::exists(), edm::ParameterSet::getParameter(), and vtxOffset.
: fVertex(0), boost_(0), signalLabel(pset.getParameter<edm::InputTag>("signalLabel")), hiLabel(pset.getParameter<edm::InputTag>("heavyIonLabel")), useRecVertex(pset.exists("useRecVertex")?pset.getParameter<bool>("useRecVertex"):false) { produces<bool>("matchedVertex"); vtxOffset.resize(3); if(pset.exists("vtxOffset")) vtxOffset=pset.getParameter< std::vector<double> >("vtxOffset"); }
MixEvtVtxGenerator::~MixEvtVtxGenerator | ( | ) | [virtual] |
HepMC::FourVector * MixEvtVtxGenerator::getRecVertex | ( | edm::Event & | evt | ) | [virtual] |
Definition at line 115 of file MixEvtVtxGenerator.cc.
References fVertex, edm::Event::getByLabel(), hiLabel, collect_tpl::input, and vtxOffset.
Referenced by produce().
{ Handle<reco::VertexCollection> input; evt.getByLabel(hiLabel,input); double aX,aY,aZ; aX = input->begin()->position().x() + vtxOffset[0]; aY = input->begin()->position().y() + vtxOffset[1]; aZ = input->begin()->position().z() + vtxOffset[2]; /* std::cout << "reco::Vertex = " << input->begin()->position().x() << ", " << input->begin()->position().y() << ", " << input->begin()->position().z() << std::endl; std::cout << "offset = " << vtxOffset[0] << ", " << vtxOffset[1] << ", " << vtxOffset[2] << std::endl; std::cout << "embedded GEN vertex = " << aX << ", " << aY << ", " << aZ << std::endl; */ if(!fVertex) fVertex = new HepMC::FourVector(); fVertex->set(10.0*aX,10.0*aY,10.0*aZ,0.0); // HepMC positions in mm (RECO in cm) return fVertex; }
HepMC::FourVector * MixEvtVtxGenerator::getVertex | ( | edm::Event & | evt | ) | [virtual] |
Definition at line 82 of file MixEvtVtxGenerator.cc.
References gather_cfg::cout, fVertex, edm::Event::getByLabel(), hiLabel, and collect_tpl::input.
Referenced by produce().
{ Handle<HepMCProduct> input; evt.getByLabel(hiLabel,input); const HepMC::GenEvent* inev = input->GetEvent(); HepMC::GenVertex* genvtx = inev->signal_process_vertex(); if(!genvtx){ cout<<"No Signal Process Vertex!"<<endl; HepMC::GenEvent::particle_const_iterator pt=inev->particles_begin(); HepMC::GenEvent::particle_const_iterator ptend=inev->particles_end(); while(!genvtx || ( genvtx->particles_in_size() == 1 && pt != ptend ) ){ if(!genvtx) cout<<"No Gen Vertex!"<<endl; if(pt == ptend) cout<<"End reached!"<<endl; genvtx = (*pt)->production_vertex(); ++pt; } } double aX,aY,aZ,aT; aX = genvtx->position().x(); aY = genvtx->position().y(); aZ = genvtx->position().z(); aT = genvtx->position().t(); if(!fVertex) fVertex = new HepMC::FourVector(); fVertex->set(aX,aY,aZ,aT); return fVertex; }
void MixEvtVtxGenerator::produce | ( | edm::Event & | evt, |
const edm::EventSetup & | |||
) | [virtual] |
Implements edm::EDProducer.
Definition at line 148 of file MixEvtVtxGenerator.cc.
References edm::Event::getByLabel(), getRecVertex(), getVertex(), edm::Event::put(), signalLabel, and useRecVertex.
{ Handle<HepMCProduct> HepMCEvt ; evt.getByLabel( signalLabel, HepMCEvt ) ; // generate new vertex & apply the shift // HepMCEvt->applyVtxGen( useRecVertex ? getRecVertex(evt) : getVertex(evt) ) ; // HepMCEvt->boostToLab( GetInvLorentzBoost(), "vertex" ); // HepMCEvt->boostToLab( GetInvLorentzBoost(), "momentum" ); // OK, create a (pseudo)product and put in into edm::Event // auto_ptr<bool> NewProduct(new bool(true)) ; evt.put( NewProduct ,"matchedVertex") ; return ; }
TMatrixD* MixEvtVtxGenerator::boost_ [protected] |
Definition at line 51 of file MixEvtVtxGenerator.cc.
Referenced by ~MixEvtVtxGenerator().
HepMC::FourVector* MixEvtVtxGenerator::fVertex [protected] |
Definition at line 50 of file MixEvtVtxGenerator.cc.
Referenced by getRecVertex(), getVertex(), and ~MixEvtVtxGenerator().
edm::InputTag MixEvtVtxGenerator::hiLabel [private] |
Definition at line 56 of file MixEvtVtxGenerator.cc.
Referenced by getRecVertex(), and getVertex().
edm::InputTag MixEvtVtxGenerator::signalLabel [private] |
Definition at line 55 of file MixEvtVtxGenerator.cc.
Referenced by produce().
bool MixEvtVtxGenerator::useRecVertex [private] |
Definition at line 57 of file MixEvtVtxGenerator.cc.
Referenced by produce().
std::vector<double> MixEvtVtxGenerator::vtxOffset [private] |
Definition at line 58 of file MixEvtVtxGenerator.cc.
Referenced by getRecVertex(), and MixEvtVtxGenerator().