1 #include "HepMC/GenEvent.h"
2 #include "PhotosHepMCParticle.h"
21 m_particle = particle;
32 void PhotosHepMCParticle::clear(std::vector<PhotosParticle*> v){
60 if(!production_vertex){
66 vector<PhotosParticle*>::iterator mother_itr;
67 for(mother_itr = mothers.begin(); mother_itr != mothers.end();
74 Log::Fatal(
"PhotosHepMCParticle::setMothers(): Mother production_vertices point to difference places. Can not override. Please delete vertices first.",1);
91 m_daughters.push_back(daughter);
96 Log::Fatal(
"PhotosHepMCParticle::addDaughter(): This method assumes an end_vertex exists. Maybe you really want to use setDaughters.",2);
106 Log::Fatal(
"PhotosHepMCParticle::setDaughters(): New particle needs the event set before it's daughters can be added",3);
111 if(daughters.size()>0){
127 vector<PhotosParticle*>::iterator daughter_itr;
128 for(daughter_itr = daughters.begin(); daughter_itr != daughters.end();
136 Log::Fatal(
"PhotosHepMCParticle::setDaughters(): Daughter production_vertices point to difference places. Can not override. Please delete vertices first.",4);
155 for(;pcle_itr != pcle_itr_end; pcle_itr++){
164 if(m_daughters.size()==0&&m_particle->
end_vertex()){
171 for(;pcle_itr != pcle_itr_end; pcle_itr++){
185 m_decay_products.clear();
188 return m_decay_products;
190 std::vector<PhotosParticle*> daughters =
getDaughters();
193 m_decay_products.insert(m_decay_products.end(),daughters.begin(),daughters.end());
201 for(
unsigned int i=0;i<m_decay_products.size();i++)
203 std::vector<PhotosParticle*> daughters2 = m_decay_products[i]->getDaughters();
206 for(
unsigned int j=0;j<daughters2.size();j++)
209 for(
unsigned int k=0;k<m_decay_products.size();k++)
210 if( daughters2[j]->
getBarcode() == m_decay_products[k]->getBarcode() )
216 if(add) m_decay_products.push_back(daughters2[j]);
220 return m_decay_products;
230 double sumpx = 0, sumpy = 0, sumpz = 0, sume = 0;
236 sumpx += (*part1)->momentum().px();
237 sumpy += (*part1)->momentum().py();
238 sumpz += (*part1)->momentum().pz();
239 sume += (*part1)->momentum().e();
247 sumpx -= (*part2)->momentum().px();
248 sumpy -= (*part2)->momentum().py();
249 sumpz -= (*part2)->momentum().pz();
250 sume -= (*part2)->momentum().e();
254 Log::Warning()<<
"Momentum not conserved in the vertex:"<<endl;
277 return m_particle->
pdg_id();
281 return m_particle->
status();
290 int pdg_id,
int status,
double mass,
291 double px,
double py,
double pz,
double e){
301 m_created_particles.push_back(new_particle);
309 Log::Warning()<<
"PhotosHepMCParticle::createHistoryEntry(): particle without production vertex."<<endl;
322 Log::Error()<<
"PhotosHepMCParticle::createSelfDecayVertex: particle already has end vertex!"<<endl;
326 if(
getHepMC()->parent_event()==NULL)
328 Log::Error()<<
"PhotosHepMCParticle::createSelfDecayVertex: particle not in the HepMC event!"<<endl;
GenEvent * parent_event() const
pointer to the event that owns this particle
void set_generated_mass(const double &m)
define the actual generated mass
int pdg_id() const
particle ID
std::vector< HepMC::GenParticle * >::const_iterator particles_in_const_iterator
const iterator for incoming particles
void setMass(double mass)
void set_status(int status=0)
set decay status
bool checkMomentumConservation()
void print(std::ostream &ostr=std::cout) const
print vertex information
static bool isStatusCodeIgnored(int status)
void createSelfDecayVertex(PhotosParticle *out)
void add_particle_in(GenParticle *inparticle)
add incoming particle
int barcode() const
particle barcode
particles_out_const_iterator particles_out_const_end() const
end iteration of outgoing particles
std::vector< HepMC::GenParticle * >::const_iterator particles_out_const_iterator
const iterator for outgoing particles
double e() const
return E
void set_position(const FourVector &position=FourVector(0, 0, 0, 0))
set vertex position and time
double px() const
return px
GenVertex * production_vertex() const
pointer to the production vertex
GenVertex contains information about decay vertices.
void addDaughter(PhotosParticle *daughter)
PhotosHepMCParticle * createNewParticle(int pdg_id, int status, double mass, double px, double py, double pz, double e)
double pz() const
return pz
std::vector< PhotosParticle * > getMothers()
std::vector< PhotosParticle * > getDaughters()
void add_particle_out(GenParticle *outparticle)
add outgoing particle
particles_in_const_iterator particles_in_const_end() const
end iteration of incoming particles
bool add_vertex(GenVertex *vtx)
adds to evt and adopts
int status() const
HEPEVT decay status.
double generated_mass() const
mass as generated
void setStatus(int statu)
static double momentum_conservation_threshold
void setPdgID(int pdg_id)
HepMC::GenParticle * getHepMC()
particles_out_const_iterator particles_out_const_begin() const
begin iteration of outgoing particles
void set_momentum(const FourVector &vec4)
set standard 4 momentum
static void Fatal(string text, unsigned short int code=0)
const FourVector & position() const
vertex position and time
void print(std::ostream &ostr=std::cout) const
dump this particle's full info to ostr
void createHistoryEntry()
const FourVector & momentum() const
standard 4 momentum
FourVector is a simple representation of a physics 4 vector.
GenVertex * end_vertex() const
pointer to the decay vertex
void setMothers(std::vector< PhotosParticle * > mothers)
void set_pdg_id(int id)
set particle ID
static int historyEntriesStatus
static void RevertOutput()
double py() const
return py
void setDaughters(std::vector< PhotosParticle * > daughters)
particles_in_const_iterator particles_in_const_begin() const
begin iteration of incoming particles
std::vector< PhotosParticle * > getAllDecayProducts()
static void RedirectOutput(void(*func)(), ostream &where=*out)
The GenParticle class contains information about generated particles.