Belle II Software  release-06-00-14
PhotosEvent.cc
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  PhotosEvent::~PhotosEvent()
11  {
12  while (m_branch_points.size() != 0) {
13  PhotosBranch* temp = m_branch_points.back();
14  m_branch_points.pop_back();
15  delete temp;
16  }
17  }
18 
20  {
21  //print();
22  vector<PhotosParticle*> particles = filterParticles(getParticleList());
24 
25  for (int i = 0; i < (int)m_branch_points.size(); i++)
26  m_branch_points.at(i)->process();
27  //print();
28  }
29 
30  vector<PhotosParticle*> PhotosEvent::filterParticles(vector<PhotosParticle*> particles)
31  {
32  vector<PhotosParticle*> filtered;
33  for (int i = 0; i < (int)particles.size(); i++) {
34  PhotosParticle* p = particles.at(i);
35  if (!p) continue;
36 
37  //check that the particle decays
38  if (p->getStatus() == PhotosParticle::STABLE) continue;
39 
40  //check for self decays
41  vector<PhotosParticle*> daughters = p->getDaughters();
42  int j = 0;
43  for (j = 0; j < (int)daughters.size(); j++)
44  if (daughters.at(j)->getPdgID() == p->getPdgID()) break;
45  if (j != (int)daughters.size()) continue;
46 
47  Log::Debug(2) << "Passed particle filter" << endl;
48  filtered.push_back(p);
49  }
50  return filtered;
51  }
52 
53 } // namespace Photospp
Single branching point.
static ostream & Debug(unsigned short int code=0, bool count=true)
Four logging entries.
Definition: Log.cc:32
static vector< PhotosBranch * > createBranches(vector< PhotosParticle * > particles)
Create branches from particles list.
Definition: PhotosBranch.cc:93
void process()
Process event.
Definition: PhotosEvent.cc:19
virtual vector< PhotosParticle * > getParticleList()=0
Get an unfiltered list of particles from the event record.
vector< PhotosParticle * > filterParticles(vector< PhotosParticle * > particles)
Filter suppressed and invalid particles.
Definition: PhotosEvent.cc:30
vector< PhotosBranch * > m_branch_points
branch points which should be given to PHOTOS
Definition: PhotosEvent.h:42
static const int STABLE
Stable particle status.