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