StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
PhotosEvent.cxx
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 {
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() );
25  m_branch_points = PhotosBranch::createBranches(particles);
26 
27  for(int i=0;i<(int)m_branch_points.size();i++)
28  m_branch_points.at(i)->process();
29  //print();
30 }
31 
32 vector<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
static vector< PhotosBranch * > createBranches(vector< PhotosParticle * > particles)
virtual int getPdgID()=0
static const int STABLE
static ostream & Debug(unsigned short int code=0, bool count=true)
Definition: Log.cxx:33
virtual int getStatus()=0
virtual vector< PhotosParticle * > getParticleList()=0
Single branching point.
virtual std::vector< PhotosParticle * > getDaughters()=0