23 if (
id==0)
return true;
27 if (
id==-9000)
return true;
31 const int abs_id = std::abs(
id);
32 if (abs_id<=5 && abs_id>0)
return true;
36 const int abs_id = std::abs(
id);
37 if (abs_id<=6 && abs_id>0)
return true;
41 const int abs_id = std::abs(
id);
42 if (abs_id==2 || abs_id==4 || abs_id==6)
return true;
46 const int abs_id = std::abs(
id);
47 if (abs_id==1 || abs_id==3 || abs_id==5)
return true;
51 if (std::abs(
id)==6)
return true;
55 if (std::abs(
id)==15)
return true;
59 if (std::abs(
id)==21)
return true;
63 const int abs_id = std::abs(
id);
64 if (abs_id==11 || abs_id==13 || abs_id==15)
return true;
68 const int abs_id = std::abs(
id);
69 if (abs_id==12 || abs_id==14 || abs_id==16)
return true;
73 if (std::abs(
id)==22)
return true;
77 if (std::abs(
id)==23)
return true;
81 if (std::abs(
id)==24)
return true;
85 if (std::abs(
id)==25)
return true;
89 const std::vector<int>& idlist,
90 const std::vector<
bool(*)(
const int)>& testlist,
91 std::vector<int>& ordering,
95 if (testlist.size() != idlist.size()){
MELAerr <<
"PDGHelpers::orderParticles: List of ids and list of their tests do not have the same size!" << std::endl;
return; }
96 for (std::vector<
bool(*)(
const int)>::const_iterator it_test=testlist.cbegin(); it_test!=testlist.cend(); it_test++){
97 bool testFilled=
false;
98 for (
unsigned int ipart=0; ipart<idlist.size(); ipart++){
99 bool isAvailable=
true;
100 for (
int const& ord:ordering){
101 if (ord==(
int)ipart){ isAvailable=
false;
break; }
103 if (!isAvailable)
continue;
104 int tested = idlist.at(ipart);
106 if ((*it_test)(tested)){
107 ordering.push_back(tested);
111 if (!testFilled && allowUnknown){
112 for (
unsigned int ipart=0; ipart<idlist.size(); ipart++){
113 bool isAvailable=
true;
114 for (
int const& ord:ordering){
115 if (ord==(
int) ipart){ isAvailable=
false;
break; }
117 if (!isAvailable)
continue;
118 int tested = idlist.at(ipart);
120 if ((*it_test)(tested)){
121 ordering.push_back(tested);
126 if (!testFilled)
break;
128 if (idlist.size()!=ordering.size()) ordering.clear();
131 const std::vector<int>& ids,
132 std::vector<std::vector<int>>& ordering,
133 bool* hasUnknownParticles
136 if (hasUnknownParticles) *hasUnknownParticles=
false;
138 for (
unsigned int ipart=0; ipart<ids.size(); ipart++){
139 int const& id_part = ids.at(ipart);
142 for (
auto& ord:ordering){
143 if (ord.at(0)==id_part){ ord.push_back(ipart); grouped=
true;
break; }
145 if (!grouped){ std::vector<int> newgroup; newgroup.push_back(ipart); ordering.push_back(newgroup); }
147 bool firstUnknown=
true;
148 for (
unsigned int ipart=0; ipart<ids.size(); ipart++){
149 int const& id_part = ids.at(ipart);
151 if (hasUnknownParticles!=0) *hasUnknownParticles=
true;
153 std::vector<int> newgroup; newgroup.push_back(ipart); ordering.push_back(newgroup);
156 else ordering.at(ordering.size()-1).push_back(id_part);
160 const std::vector<int>& ids,
161 std::vector<std::pair<int, int>>& ordering,
166 std::vector<std::vector<int>> grouping;
167 bool hasUnknown=
false;
170 for (
auto const& group:grouping){
171 unsigned int group_rep = group.at(0);
172 if (group_rep>=ids.size()){
MELAerr <<
"PDGHelpers::pairIdenticalParticles: Group " << group <<
" has a representative location >=ids.size (" << ids.size() <<
")!" << std::endl;
continue; }
173 int group_flag = ids.at(group_rep);
175 unsigned int npairs = group.size()/2;
176 bool isOdd=(group.size() % 2 == 1);
178 for (
unsigned int ip=0; ip<npairs; ip++){
179 if (isOdd && ip==npairs-1) ordering.push_back(std::pair<int, int>(group.at(2*ip), -1));
180 else ordering.push_back(std::pair<int, int>(group.at(2*ip), group.at(2*ip+1)));
185 for (
auto const& group:grouping){
186 unsigned int group_rep = group.at(0);
187 if (group_rep>=ids.size()){
MELAerr <<
"PDGHelpers::pairIdenticalParticles: Group " << group <<
" has a representative location >=ids.size (" << ids.size() <<
")!" << std::endl;
continue; }
188 int group_flag = ids.at(group_rep);
191 for (
int const& pos:group){
194 for (
auto& order:ordering){
201 if (paired)
continue;
203 ordering.push_back(std::pair<int, int>(pos, -1));
210 bool hasNonJet=
false;
211 for (std::vector<int>::const_iterator it_first=ids.cbegin(); it_first!=ids.cend(); it_first++){
212 int const& id_first = *it_first;
215 if (hasNonJet){ result =
false;
break; }
218 for (std::vector<int>::const_iterator it_second=it_first; it_second!=ids.cend(); it_second++){
219 int const& id_second = *it_second;
221 if (hasNonJet){ result =
false;
break; }
224 if (id_first!=id_second){ result =
false;
break; }
236 int ids[2]={ idfirst, idsecond };
237 int ids_jhu[2]={ -9000, -9000 };
240 if (useAHcoupl) zahswitch = *useAHcoupl;
244 if (hel) heleff = *hel;
249 if (pSt==0)
return 1;
250 else if (pSt==1 || pSt==23)
return 1;
251 else if (pSt==21)
return -1;
252 else if (pSt==22 || pSt==62)
return 2;
254 MELAerr <<
"Unknown Pythia particle status: " << pSt << std::endl;