PhotosEvent.cxx

00001 #include <vector>
00002 #include "PhotosParticle.h"
00003 #include "PhotosBranch.h"
00004 #include "PhotosEvent.h"
00005 #include "Log.h"
00006 using std::vector;
00007 
00008 namespace Photospp
00009 {
00010 
00011 PhotosEvent::~PhotosEvent()
00012 {
00013         while(m_branch_points.size()!=0)
00014         {
00015                 PhotosBranch *temp = m_branch_points.back();
00016                 m_branch_points.pop_back();
00017                 delete temp;
00018         }
00019 }
00020 
00021 void PhotosEvent::process()
00022 {
00023         //print();
00024         vector<PhotosParticle*> particles = filterParticles( getParticleList() );
00025         m_branch_points = PhotosBranch::createBranches(particles);
00026 
00027         for(int i=0;i<(int)m_branch_points.size();i++)
00028                 m_branch_points.at(i)->process();
00029         //print();
00030 }
00031 
00032 vector<PhotosParticle *> PhotosEvent::filterParticles(vector<PhotosParticle *> particles)
00033 {
00034         vector<PhotosParticle *> filtered;
00035         for(int i=0;i<(int)particles.size();i++)
00036         {
00037                 PhotosParticle *p = particles.at(i);
00038                 if(!p) continue;
00039 
00040                 //check that the particle decays
00041                 if(p->getStatus()==PhotosParticle::STABLE) continue;
00042 
00043                 //check for self decays
00044                 vector<PhotosParticle *> daughters = p->getDaughters();
00045                 int j=0;
00046                 for(j=0;j<(int)daughters.size();j++)
00047                         if(daughters.at(j)->getPdgID()==p->getPdgID()) break;
00048                 if(j!=(int)daughters.size()) continue;
00049 
00050                 Log::Debug(2)<<"Passed particle filter"<<endl;
00051                 filtered.push_back(p);
00052         }
00053         return filtered;
00054 }
00055 
00056 } // namespace Photospp
Generated on Sun Oct 20 20:23:56 2013 for C++InterfacetoPHOTOS by  doxygen 1.6.3