3 #include "HEPEVT_struct.h"
4 #include "PhotosParticle.h"
5 #include "PhotosBranch.h"
25 }
else if (
daughters.at(0)->getMothers().size() == 1) {
29 mothers = p->findProductionMothers();
51 if (
suppression) Log::Warning() <<
"Branching ignored due to 4-momentum non conservation" << endl;
64 0)->getBarcode() : -1)) << endl;
80 vector<PhotosParticle*> ret =
mothers;
89 if (
mothers.size() > 0)
return mothers.at(0)->checkMomentumConservation();
95 Log::Debug(700) <<
"PhotosBranch::createBranches - filtering started" << endl;
96 list<PhotosParticle*> list(particles.begin(), particles.end());
97 vector<PhotosBranch*> branches;
101 std::list<PhotosParticle*>::iterator it;
102 for (it = list.begin(); it != list.end(); it++) {
106 Log::Debug(701) <<
" Forced: " << (*it)->getPdgID() <<
" (barcode: " << (*it)->getBarcode() <<
") with forcing status= "
109 branches.push_back(branch);
113 if (forcing_local == 2) {
119 vector<PhotosParticle*> tree = p->getDecayTree();
121 std::list<PhotosParticle*>::iterator it2;
122 for (it2 = list.begin(); it2 != list.end(); it2++) {
123 for (
int i = 0; i < (int)tree.size(); i++) {
124 if (tree.at(i)->getBarcode() == (*it2)->getBarcode()) {
126 branches.push_back(b);
129 it2 = list.erase(it2);
136 }
else delete branch;
142 while (!list.empty()) {
145 if (!particle_local)
continue;
149 if (!suppression_local) branches.push_back(branch);
152 ") with suppression status= " << suppression_local << endl;
154 if (suppression_local == 2) {
160 vector<PhotosParticle*> tree = p->getDecayTree();
162 std::list<PhotosParticle*>::iterator it;
163 for (it = list.begin(); it != list.end(); it++) {
164 for (
int i = 0; i < (int)tree.size(); i++) {
165 if (tree.at(i)->getBarcode() == (*it)->getBarcode()) {
179 vector<PhotosParticle*> mothers_local = branch->
getMothers();
180 for (
int i = 0; i < (int)mothers_local.size(); i++) {
182 if (m->getBarcode() == particle_local->
getBarcode())
continue;
183 std::list<PhotosParticle*>::iterator it;
184 for (it = list.begin(); it != list.end(); it++)
185 if (m->getBarcode() == (*it)->getBarcode()) {
204 if (
mothers.size() == 0)
return 0;
205 motherID =
mothers.at(0)->getPdgID();
210 for (
int j = 0; j < (int)
daughters.size(); j++) dID.push_back(
daughters[j]->getPdgID());
212 vector< vector<int> *>& patternList = *list;
215 for (
int j = 0; j < (int)patternList.size(); j++) {
217 if (motherID != (*patternList[j])[0])
continue;
220 vector<int>& pattern = *patternList[j];
221 bool fullMatch =
true;
222 for (
int k = 1; k < (int)pattern.size() - 1; k++) {
223 bool oneMatch =
false;
224 for (
int l = 0; l < (int)dID.size(); l++)
225 if (pattern[k] == dID[l]) { oneMatch =
true;
break; }
226 if (!oneMatch) { fullMatch =
false;
break; }
236 if (pattern.size() <= 2 || fullMatch)
237 return (pattern.back() == 1) ? 2 : 1;