PhotosEvent.cxx
1#include <vector>
2#include "PhotosParticle.h"
3#include "PhotosBranch.h"
4#include "PhotosEvent.h"
5#include "Log.h"
6using std::vector;
7
8namespace Photospp
9{
10
11PhotosEvent::~PhotosEvent()
12{
13 while(m_branch_points.size()!=0)
14 {
15 PhotosBranch *temp = m_branch_points.back();
16 m_branch_points.pop_back();
17 delete temp;
18 }
19}
20
22{
23 //print();
24 vector<PhotosParticle*> particles = filterParticles( getParticleList() );
26
27 for(int i=0;i<(int)m_branch_points.size();i++)
28 m_branch_points.at(i)->process();
29 //print();
30}
31
32vector<PhotosParticle *> PhotosEvent::filterParticles(vector<PhotosParticle *> particles)
33{
34 vector<PhotosParticle *> filtered;
35 for(int i=0;i<(int)particles.size();i++)
36 {
37 PhotosParticle *p = particles.at(i);
38 if(!p) continue;
39
40 //check that the particle decays
41 if(p->getStatus()==PhotosParticle::STABLE) continue;
42
43 //check for self decays
44 vector<PhotosParticle *> daughters = p->getDaughters();
45 int j=0;
46 for(j=0;j<(int)daughters.size();j++)
47 if(daughters.at(j)->getPdgID()==p->getPdgID()) break;
48 if(j!=(int)daughters.size()) continue;
49
50 Log::Debug(2)<<"Passed particle filter"<<endl;
51 filtered.push_back(p);
52 }
53 return filtered;
54}
55
56} // namespace Photospp
Single branching point.
static ostream & Debug(unsigned short int code=0, bool count=true)
Definition Log.cxx:33
static vector< PhotosBranch * > createBranches(vector< PhotosParticle * > particles)
virtual vector< PhotosParticle * > getParticleList()=0
vector< PhotosBranch * > m_branch_points
vector< PhotosParticle * > filterParticles(vector< PhotosParticle * > particles)
virtual std::vector< PhotosParticle * > getDaughters()=0
virtual int getPdgID()=0
virtual int getStatus()=0