8#include <analysis/ParticleCombiner/ParticleCombiner.h>
10#include <mdst/dataobjects/ECLCluster.h>
12#include <analysis/dataobjects/Particle.h>
13#include <analysis/dataobjects/ParticleList.h>
15#include <analysis/DecayDescriptor/DecayDescriptor.h>
16#include <analysis/utility/EvtPDLUtil.h>
18#include <framework/datastore/StoreArray.h>
19#include <framework/datastore/StoreObjPtr.h>
20#include <framework/gearbox/Const.h>
25#include <gtest/gtest.h>
28#include <Math/Vector4D.h>
35 class ParticleCombinerTest :
public ::testing::Test {
42 particles.registerInDataStore();
49 void TearDown()
override
55 TEST_F(ParticleCombinerTest, ListIndexGeneratorTest)
59 listIndexGenerator.
init(0);
60 EXPECT_FALSE(listIndexGenerator.
loadNext());
65 listIndexGenerator.
init(1);
66 EXPECT_TRUE(listIndexGenerator.
loadNext());
67 EXPECT_EQ(std::vector<ParticleList::EParticleType>({ ParticleList::c_FlavorSpecificParticle}),
69 EXPECT_FALSE(listIndexGenerator.
loadNext());
74 listIndexGenerator.
init(2);
75 EXPECT_TRUE(listIndexGenerator.
loadNext());
76 EXPECT_EQ(std::vector<ParticleList::EParticleType>({ ParticleList::c_FlavorSpecificParticle, ParticleList::c_FlavorSpecificParticle }),
78 EXPECT_TRUE(listIndexGenerator.
loadNext());
79 EXPECT_EQ(std::vector<ParticleList::EParticleType>({ ParticleList::c_SelfConjugatedParticle, ParticleList::c_FlavorSpecificParticle }),
81 EXPECT_TRUE(listIndexGenerator.
loadNext());
82 EXPECT_EQ(std::vector<ParticleList::EParticleType>({ ParticleList::c_FlavorSpecificParticle, ParticleList::c_SelfConjugatedParticle }),
84 EXPECT_FALSE(listIndexGenerator.
loadNext());
89 listIndexGenerator.
init(3);
90 EXPECT_TRUE(listIndexGenerator.
loadNext());
91 EXPECT_EQ(std::vector<ParticleList::EParticleType>({ ParticleList::c_FlavorSpecificParticle, ParticleList::c_FlavorSpecificParticle, ParticleList::c_FlavorSpecificParticle }),
93 EXPECT_TRUE(listIndexGenerator.
loadNext());
94 EXPECT_EQ(std::vector<ParticleList::EParticleType>({ ParticleList::c_SelfConjugatedParticle, ParticleList::c_FlavorSpecificParticle, ParticleList::c_FlavorSpecificParticle }),
96 EXPECT_TRUE(listIndexGenerator.
loadNext());
97 EXPECT_EQ(std::vector<ParticleList::EParticleType>({ ParticleList::c_FlavorSpecificParticle, ParticleList::c_SelfConjugatedParticle, ParticleList::c_FlavorSpecificParticle }),
99 EXPECT_TRUE(listIndexGenerator.
loadNext());
100 EXPECT_EQ(std::vector<ParticleList::EParticleType>({ ParticleList::c_SelfConjugatedParticle, ParticleList::c_SelfConjugatedParticle, ParticleList::c_FlavorSpecificParticle }),
102 EXPECT_TRUE(listIndexGenerator.
loadNext());
103 EXPECT_EQ(std::vector<ParticleList::EParticleType>({ ParticleList::c_FlavorSpecificParticle, ParticleList::c_FlavorSpecificParticle, ParticleList::c_SelfConjugatedParticle }),
105 EXPECT_TRUE(listIndexGenerator.
loadNext());
106 EXPECT_EQ(std::vector<ParticleList::EParticleType>({ ParticleList::c_SelfConjugatedParticle, ParticleList::c_FlavorSpecificParticle, ParticleList::c_SelfConjugatedParticle }),
108 EXPECT_TRUE(listIndexGenerator.
loadNext());
109 EXPECT_EQ(std::vector<ParticleList::EParticleType>({ ParticleList::c_FlavorSpecificParticle, ParticleList::c_SelfConjugatedParticle, ParticleList::c_SelfConjugatedParticle}),
111 EXPECT_FALSE(listIndexGenerator.
loadNext());
116 TEST_F(ParticleCombinerTest, particleIndexGeneratorTest)
120 particleIndexGenerator.
init(std::vector<unsigned int>({}));
121 EXPECT_FALSE(particleIndexGenerator.
loadNext());
126 particleIndexGenerator.
init(std::vector<unsigned int>({0}));
127 EXPECT_FALSE(particleIndexGenerator.
loadNext());
128 particleIndexGenerator.
init(std::vector<unsigned int>({3}));
129 EXPECT_TRUE(particleIndexGenerator.
loadNext());
130 EXPECT_EQ(std::vector<unsigned int>({0}), particleIndexGenerator.
getCurrentIndices());
131 EXPECT_TRUE(particleIndexGenerator.
loadNext());
132 EXPECT_EQ(std::vector<unsigned int>({1}), particleIndexGenerator.
getCurrentIndices());
133 EXPECT_TRUE(particleIndexGenerator.
loadNext());
134 EXPECT_EQ(std::vector<unsigned int>({2}), particleIndexGenerator.
getCurrentIndices());
135 EXPECT_FALSE(particleIndexGenerator.
loadNext());
140 particleIndexGenerator.
init(std::vector<unsigned int>({2, 0}));
141 EXPECT_FALSE(particleIndexGenerator.
loadNext());
143 particleIndexGenerator.
init(std::vector<unsigned int>({1, 3}));
144 EXPECT_TRUE(particleIndexGenerator.
loadNext());
145 EXPECT_EQ(std::vector<unsigned int>({0, 0}), particleIndexGenerator.
getCurrentIndices());
146 EXPECT_TRUE(particleIndexGenerator.
loadNext());
147 EXPECT_EQ(std::vector<unsigned int>({0, 1}), particleIndexGenerator.
getCurrentIndices());
148 EXPECT_TRUE(particleIndexGenerator.
loadNext());
149 EXPECT_EQ(std::vector<unsigned int>({0, 2}), particleIndexGenerator.
getCurrentIndices());
150 EXPECT_FALSE(particleIndexGenerator.
loadNext());
152 particleIndexGenerator.
init(std::vector<unsigned int>({2, 3}));
153 EXPECT_TRUE(particleIndexGenerator.
loadNext());
154 EXPECT_EQ(std::vector<unsigned int>({0, 0}), particleIndexGenerator.
getCurrentIndices());
155 EXPECT_TRUE(particleIndexGenerator.
loadNext());
156 EXPECT_EQ(std::vector<unsigned int>({1, 0}), particleIndexGenerator.
getCurrentIndices());
157 EXPECT_TRUE(particleIndexGenerator.
loadNext());
158 EXPECT_EQ(std::vector<unsigned int>({0, 1}), particleIndexGenerator.
getCurrentIndices());
159 EXPECT_TRUE(particleIndexGenerator.
loadNext());
160 EXPECT_EQ(std::vector<unsigned int>({1, 1}), particleIndexGenerator.
getCurrentIndices());
161 EXPECT_TRUE(particleIndexGenerator.
loadNext());
162 EXPECT_EQ(std::vector<unsigned int>({0, 2}), particleIndexGenerator.
getCurrentIndices());
163 EXPECT_TRUE(particleIndexGenerator.
loadNext());
164 EXPECT_EQ(std::vector<unsigned int>({1, 2}), particleIndexGenerator.
getCurrentIndices());
165 EXPECT_FALSE(particleIndexGenerator.
loadNext());
170 particleIndexGenerator.
init(std::vector<unsigned int>({2, 4, 3}));
171 EXPECT_TRUE(particleIndexGenerator.
loadNext());
172 EXPECT_EQ(std::vector<unsigned int>({0, 0, 0}), particleIndexGenerator.
getCurrentIndices());
173 EXPECT_TRUE(particleIndexGenerator.
loadNext());
174 EXPECT_EQ(std::vector<unsigned int>({1, 0, 0}), particleIndexGenerator.
getCurrentIndices());
175 EXPECT_TRUE(particleIndexGenerator.
loadNext());
176 EXPECT_EQ(std::vector<unsigned int>({0, 1, 0}), particleIndexGenerator.
getCurrentIndices());
177 EXPECT_TRUE(particleIndexGenerator.
loadNext());
178 EXPECT_EQ(std::vector<unsigned int>({1, 1, 0}), particleIndexGenerator.
getCurrentIndices());
179 EXPECT_TRUE(particleIndexGenerator.
loadNext());
180 EXPECT_EQ(std::vector<unsigned int>({0, 2, 0}), particleIndexGenerator.
getCurrentIndices());
181 EXPECT_TRUE(particleIndexGenerator.
loadNext());
182 EXPECT_EQ(std::vector<unsigned int>({1, 2, 0}), particleIndexGenerator.
getCurrentIndices());
183 EXPECT_TRUE(particleIndexGenerator.
loadNext());
184 EXPECT_EQ(std::vector<unsigned int>({0, 3, 0}), particleIndexGenerator.
getCurrentIndices());
185 EXPECT_TRUE(particleIndexGenerator.
loadNext());
186 EXPECT_EQ(std::vector<unsigned int>({1, 3, 0}), particleIndexGenerator.
getCurrentIndices());
187 EXPECT_TRUE(particleIndexGenerator.
loadNext());
188 EXPECT_EQ(std::vector<unsigned int>({0, 0, 1}), particleIndexGenerator.
getCurrentIndices());
189 EXPECT_TRUE(particleIndexGenerator.
loadNext());
190 EXPECT_EQ(std::vector<unsigned int>({1, 0, 1}), particleIndexGenerator.
getCurrentIndices());
191 EXPECT_TRUE(particleIndexGenerator.
loadNext());
192 EXPECT_EQ(std::vector<unsigned int>({0, 1, 1}), particleIndexGenerator.
getCurrentIndices());
193 EXPECT_TRUE(particleIndexGenerator.
loadNext());
194 EXPECT_EQ(std::vector<unsigned int>({1, 1, 1}), particleIndexGenerator.
getCurrentIndices());
195 EXPECT_TRUE(particleIndexGenerator.
loadNext());
196 EXPECT_EQ(std::vector<unsigned int>({0, 2, 1}), particleIndexGenerator.
getCurrentIndices());
197 EXPECT_TRUE(particleIndexGenerator.
loadNext());
198 EXPECT_EQ(std::vector<unsigned int>({1, 2, 1}), particleIndexGenerator.
getCurrentIndices());
199 EXPECT_TRUE(particleIndexGenerator.
loadNext());
200 EXPECT_EQ(std::vector<unsigned int>({0, 3, 1}), particleIndexGenerator.
getCurrentIndices());
201 EXPECT_TRUE(particleIndexGenerator.
loadNext());
202 EXPECT_EQ(std::vector<unsigned int>({1, 3, 1}), particleIndexGenerator.
getCurrentIndices());
203 EXPECT_TRUE(particleIndexGenerator.
loadNext());
204 EXPECT_EQ(std::vector<unsigned int>({0, 0, 2}), particleIndexGenerator.
getCurrentIndices());
205 EXPECT_TRUE(particleIndexGenerator.
loadNext());
206 EXPECT_EQ(std::vector<unsigned int>({1, 0, 2}), particleIndexGenerator.
getCurrentIndices());
207 EXPECT_TRUE(particleIndexGenerator.
loadNext());
208 EXPECT_EQ(std::vector<unsigned int>({0, 1, 2}), particleIndexGenerator.
getCurrentIndices());
209 EXPECT_TRUE(particleIndexGenerator.
loadNext());
210 EXPECT_EQ(std::vector<unsigned int>({1, 1, 2}), particleIndexGenerator.
getCurrentIndices());
211 EXPECT_TRUE(particleIndexGenerator.
loadNext());
212 EXPECT_EQ(std::vector<unsigned int>({0, 2, 2}), particleIndexGenerator.
getCurrentIndices());
213 EXPECT_TRUE(particleIndexGenerator.
loadNext());
214 EXPECT_EQ(std::vector<unsigned int>({1, 2, 2}), particleIndexGenerator.
getCurrentIndices());
215 EXPECT_TRUE(particleIndexGenerator.
loadNext());
216 EXPECT_EQ(std::vector<unsigned int>({0, 3, 2}), particleIndexGenerator.
getCurrentIndices());
217 EXPECT_TRUE(particleIndexGenerator.
loadNext());
218 EXPECT_EQ(std::vector<unsigned int>({1, 3, 2}), particleIndexGenerator.
getCurrentIndices());
219 EXPECT_FALSE(particleIndexGenerator.
loadNext());
226 class TestParticleList {
228 typedef std::tuple<Particle::EFlavorType, int, std::set<int>> MockParticle;
231 static std::string printable(
const MockParticle& m)
233 std::string s =
"MockParticle with PDG " + std::to_string(std::get<1>(m));
234 s +=
", type " + std::to_string(std::get<0>(m)) +
", daughter indices: ";
235 for (
int idx : std::get<2>(m))
236 s += std::to_string(idx) +
" ";
240 explicit TestParticleList(
const std::string& _decayString) : decayString(_decayString)
244 decaydescriptor.
init(decayString);
254 list.registerInDataStore();
257 if (not list.isValid())
259 list->initialize(pdgCode, listName);
261 if (not isSelfConjugatedParticle) {
265 antiList.registerInDataStore();
267 if (not antiList.isValid())
269 antiList->initialize(-pdgCode, antiListName);
270 list->bindAntiParticleList(*(antiList));
274 void addParticle(
unsigned int mdstSource)
278 Particle* part = particles.appendNew(ROOT::Math::PxPyPzEVector(), pdgCode,
280 list->addParticle(part);
283 void addAntiParticle(
unsigned int mdstSource)
287 Particle* part = particles.appendNew(ROOT::Math::PxPyPzEVector(), -pdgCode,
289 list->addParticle(part);
292 void addExpectedParticle(
Particle::EFlavorType flavourType,
int pdg_code, std::vector<int> daughter_indices)
294 expected_particles.emplace_back(flavourType, pdg_code, std::set<int>(daughter_indices.begin(),
295 daughter_indices.end()));
298 void addAndCheckParticlesFromGenerator()
307 std::vector<MockParticle> received_particles;
308 std::vector<Particle*> added_particles;
309 for (
unsigned int i = 0; i < expected_particles.size(); ++i) {
310 bool next = generator.loadNext();
313 const Particle& particle = generator.getCurrentParticle();
314 Particle* part = particles.appendNew(particle);
315 added_particles.push_back(part);
317 received_particles.emplace_back(part->
getFlavorType(), part->
getPDGCode(), std::set<int>(daughter_indices.begin(),
318 daughter_indices.end()));
321 EXPECT_FALSE(generator.loadNext());
323 for (
const auto& p : received_particles) {
324 EXPECT_EQ(std::count(expected_particles.begin(), expected_particles.end(), p), 1) <<
"check failed for " << printable(p);
327 for (
const auto& p : expected_particles) {
328 EXPECT_EQ(std::count(received_particles.begin(), received_particles.end(), p), 1) <<
"check failed for " << printable(p);
329 auto it = std::find(received_particles.begin(), received_particles.end(), p);
330 if (it != received_particles.end()) {
331 auto index = std::distance(received_particles.begin(), it);
332 list->addParticle(added_particles[index]);
343 EXPECT_LT(index, list->getListSize());
344 return list->getList(ParticleList::c_SelfConjugatedParticle)[index];
347 int operator+(
int index)
352 EXPECT_LT(index, list->getListSize());
353 return list->getList(ParticleList::c_FlavorSpecificParticle)[index];
356 int operator-(
int index)
361 EXPECT_LT(index, list->getListSize());
362 return list->getList(ParticleList::c_FlavorSpecificParticle)[index];
367 std::string decayString;
368 std::string listName;
369 std::string antiListName;
370 bool isSelfConjugatedParticle;
371 std::vector<MockParticle> expected_particles;
375 TEST_F(ParticleCombinerTest, DStar)
377 TestParticleList K(
"K+");
379 K.addAntiParticle(2);
380 K.addAntiParticle(3);
382 TestParticleList pi(
"pi+");
385 pi.addAntiParticle(6);
388 TestParticleList D0(
"D0 -> K- pi+");
394 D0.addAndCheckParticlesFromGenerator();
398 TestParticleList D0(
"D0 -> K- K+");
401 D0.addAndCheckParticlesFromGenerator();
404 TestParticleList D0(
"D0");
406 TestParticleList DS(
"D*+ -> D0 pi+");
419 DS.addAndCheckParticlesFromGenerator();
423 TEST_F(ParticleCombinerTest, RareBDecay)
425 TestParticleList e(
"e+");
427 e.addAntiParticle(2);
429 e.addAntiParticle(4);
431 TestParticleList gamma(
"gamma");
432 gamma.addParticle(5);
433 gamma.addParticle(6);
434 gamma.addParticle(7);
436 TestParticleList mu(
"mu+");
437 for (
int i = 0; i < 100; ++i) {
438 mu.addParticle(7 + 2 * i + 1);
439 mu.addAntiParticle(7 + 2 * i + 2);
443 TestParticleList BP(
"B+ -> e+");
448 BP.addAndCheckParticlesFromGenerator();
450 TestParticleList BP2(
"B+:eg -> e+ gamma");
451 for (
int j = 0; j < 3; ++j) {
457 BP2.addAndCheckParticlesFromGenerator();
460 TestParticleList Y(
"Upsilon(4S) -> B+ B-");
465 Y.addAndCheckParticlesFromGenerator();
468 TestParticleList Y2(
"Upsilon(4S):eg -> B+:eg B-");
469 for (
int j = 0; j < 3; ++j) {
480 Y2.addAndCheckParticlesFromGenerator();
485 TestParticleList BP(
"B+:mu -> mu+");
486 for (
int i = 0; i < 100; ++i) {
490 BP.addAndCheckParticlesFromGenerator();
493 TestParticleList BP(
"B+:mg -> mu+ gamma");
494 for (
int j = 0; j < 3; ++j) {
495 for (
int i = 0; i < 100; ++i) {
500 BP.addAndCheckParticlesFromGenerator();
505 TEST_F(ParticleCombinerTest, PsiTo2D0_to2MuPlus2MuMinus)
507 TestParticleList mu(
"mu+");
510 mu.addAntiParticle(3);
511 mu.addAntiParticle(4);
513 TestParticleList D0(
"D0 -> mu+ mu-");
518 D0.addAndCheckParticlesFromGenerator();
520 TestParticleList Psi(
"psi(3770) -> D0 anti-D0");
523 Psi.addAndCheckParticlesFromGenerator();
525 TestParticleList PsiMixed(
"psi(3770):mixeed -> D0 D0");
528 PsiMixed.addAndCheckParticlesFromGenerator();
532 TEST_F(ParticleCombinerTest, PsiToD0D0sig)
534 TestParticleList mu(
"mu+");
537 mu.addAntiParticle(3);
538 mu.addAntiParticle(4);
540 TestParticleList K(
"K+");
542 K.addAntiParticle(6);
543 TestParticleList pi(
"pi+");
545 pi.addAntiParticle(8);
547 TestParticleList D0(
"D0 -> mu+ mu-");
552 D0.addAndCheckParticlesFromGenerator();
554 TestParticleList D0sig(
"D0:sig -> K+ pi-");
557 D0sig.addAndCheckParticlesFromGenerator();
559 TestParticleList Psi(
"psi(3770) -> D0:sig anti-D0");
569 Psi.addAndCheckParticlesFromGenerator();
572 TEST_F(ParticleCombinerTest, InputListCollisions)
579 pipAll.registerInDataStore();
580 pimAll.registerInDataStore();
585 pipAll->initialize(211,
"pi+:all");
586 pimAll->initialize(-211,
"pi-:all");
587 pipAll->bindAntiParticleList(*(pimAll));
594 pipGood.registerInDataStore();
595 pimGood.registerInDataStore();
600 pipGood->initialize(211,
"pi+:good");
601 pimGood->initialize(-211,
"pi-:good");
602 pipGood->bindAntiParticleList(*(pimGood));
608 kpAll.registerInDataStore();
609 kmAll.registerInDataStore();
614 kpAll->initialize(321,
"K+:all");
615 kmAll->initialize(-321,
"K-:all");
616 kpAll->bindAntiParticleList(*(kmAll));
623 kpGood.registerInDataStore();
624 kmGood.registerInDataStore();
629 kpGood->initialize(321,
"K+:good");
630 kmGood->initialize(-321,
"K-:good");
631 kpGood->bindAntiParticleList(*(kmGood));
637 kpGood2.registerInDataStore();
638 kmGood2.registerInDataStore();
643 kpGood2->initialize(321,
"K+:good2");
644 kmGood2->initialize(-321,
"K-:good2");
645 kpGood2->bindAntiParticleList(*(kmGood2));
652 gamma_1.registerInDataStore();
653 gamma_2.registerInDataStore();
658 gamma_1->initialize(22,
"gamma:1");
659 gamma_2->initialize(22,
"gamma:2");
663 EXPECT_FALSE(comb1.inputListsCollide());
664 EXPECT_FALSE(comb1.inputListsCollide(std::make_pair(0, 1)));
667 EXPECT_TRUE(comb2.inputListsCollide());
668 EXPECT_TRUE(comb2.inputListsCollide(std::make_pair(0, 1)));
671 EXPECT_FALSE(comb3.inputListsCollide());
672 EXPECT_FALSE(comb3.inputListsCollide(std::make_pair(0, 1)));
673 EXPECT_FALSE(comb3.inputListsCollide(std::make_pair(0, 2)));
674 EXPECT_FALSE(comb3.inputListsCollide(std::make_pair(0, 3)));
675 EXPECT_FALSE(comb3.inputListsCollide(std::make_pair(1, 2)));
676 EXPECT_FALSE(comb3.inputListsCollide(std::make_pair(1, 3)));
677 EXPECT_FALSE(comb3.inputListsCollide(std::make_pair(2, 3)));
680 EXPECT_TRUE(comb4.inputListsCollide());
681 EXPECT_TRUE(comb4.inputListsCollide(std::make_pair(0, 1)));
682 EXPECT_FALSE(comb4.inputListsCollide(std::make_pair(0, 2)));
683 EXPECT_FALSE(comb4.inputListsCollide(std::make_pair(0, 3)));
684 EXPECT_FALSE(comb4.inputListsCollide(std::make_pair(1, 2)));
685 EXPECT_FALSE(comb4.inputListsCollide(std::make_pair(1, 3)));
686 EXPECT_TRUE(comb4.inputListsCollide(std::make_pair(2, 3)));
689 EXPECT_FALSE(comb5.inputListsCollide());
690 EXPECT_FALSE(comb5.inputListsCollide(std::make_pair(0, 1)));
691 EXPECT_FALSE(comb5.inputListsCollide(std::make_pair(0, 2)));
692 EXPECT_FALSE(comb5.inputListsCollide(std::make_pair(1, 2)));
695 EXPECT_TRUE(comb6.inputListsCollide());
696 EXPECT_FALSE(comb6.inputListsCollide(std::make_pair(0, 1)));
697 EXPECT_FALSE(comb6.inputListsCollide(std::make_pair(0, 2)));
698 EXPECT_TRUE(comb6.inputListsCollide(std::make_pair(1, 2)));
701 EXPECT_TRUE(comb7.inputListsCollide());
702 EXPECT_TRUE(comb7.inputListsCollide(std::make_pair(0, 1)));
703 EXPECT_TRUE(comb7.inputListsCollide(std::make_pair(0, 2)));
704 EXPECT_FALSE(comb7.inputListsCollide(std::make_pair(0, 3)));
705 EXPECT_FALSE(comb7.inputListsCollide(std::make_pair(0, 4)));
706 EXPECT_TRUE(comb7.inputListsCollide(std::make_pair(1, 2)));
707 EXPECT_FALSE(comb7.inputListsCollide(std::make_pair(1, 3)));
708 EXPECT_FALSE(comb7.inputListsCollide(std::make_pair(1, 4)));
709 EXPECT_FALSE(comb7.inputListsCollide(std::make_pair(2, 3)));
710 EXPECT_FALSE(comb7.inputListsCollide(std::make_pair(2, 4)));
711 EXPECT_TRUE(comb7.inputListsCollide(std::make_pair(3, 4)));
714 TEST_F(ParticleCombinerTest, ECLCombinationsTest)
737 eclGamma1->
setHypothesis(ECLCluster::EHypothesisBit::c_nPhotons);
741 eclGamma2->
setHypothesis(ECLCluster::EHypothesisBit::c_nPhotons);
745 eclGamma3->
setHypothesis(ECLCluster::EHypothesisBit::c_nPhotons);
749 eclGamma4->
setHypothesis(ECLCluster::EHypothesisBit::c_nPhotons);
753 eclKL->
setHypothesis(ECLCluster::EHypothesisBit::c_neutralHadron);
769 gamma.registerInDataStore();
770 klong.registerInDataStore();
771 vpho.registerInDataStore();
778 klong->initialize(
Const::Klong.getPDGCode(),
"K_L0:test");
780 vpho->initialize(10022,
"vpho:test");
782 gamma->addParticle(g_1);
783 gamma->addParticle(g_2);
784 gamma->addParticle(g_3);
785 gamma->addParticle(g_4);
787 klong->addParticle(KL);
791 auto isForbidden = [](std::vector<int> v) ->
bool {
792 if (std::find(v.begin(), v.end(), 3) != v.end())
793 if (std::find(v.begin(), v.end(), 4) != v.end())
799 EXPECT_EQ(4, gamma->getListSize());
800 EXPECT_EQ(1, klong->getListSize());
801 EXPECT_EQ(0, vpho->getListSize());
806 while (combiner3.loadNext()) {
807 const Particle& particle = combiner3.getCurrentParticle();
810 EXPECT_FALSE(isForbidden(indices));
812 particles.appendNew(particle);
813 int iparticle = particles.getEntries() - 1;
818 EXPECT_EQ(3, vpho->getListSize());
823 while (combiner2.loadNext()) {
824 const Particle& particle = combiner2.getCurrentParticle();
827 EXPECT_FALSE(isForbidden(indices));
829 particles.appendNew(particle);
830 int iparticle = particles.getEntries() - 1;
835 EXPECT_EQ(6, vpho->getListSize());
838 TEST_F(ParticleCombinerTest, FSPCopies)
847 eclGamma1->
setHypothesis(ECLCluster::EHypothesisBit::c_nPhotons);
851 eclGamma2->
setHypothesis(ECLCluster::EHypothesisBit::c_nPhotons);
855 eclGamma3->
setHypothesis(ECLCluster::EHypothesisBit::c_nPhotons);
859 eclGamma4->
setHypothesis(ECLCluster::EHypothesisBit::c_nPhotons);
863 eclKL->
setHypothesis(ECLCluster::EHypothesisBit::c_neutralHadron);
895 Particle::c_Track, 1));
897 Particle::c_Track, 2));
900 Particle::c_Track, 1));
902 Particle::c_Track, 2));
905 Particle::c_ECLCluster, 0));
907 Particle::c_ECLCluster, 1));
909 Particle::c_ECLCluster, 2));
911 Particle::c_ECLCluster, 3));
914 Particle::c_ECLCluster, 4));
918 Particle::c_ECLCluster,
921 Particle::c_ECLCluster,
924 Particle::c_ECLCluster,
932 pipAll.registerInDataStore();
933 pimAll.registerInDataStore();
938 pipAll->initialize(211,
"pi+:all");
939 pimAll->initialize(-211,
"pi-:all");
940 pipAll->bindAntiParticleList(*(pimAll));
947 pipGood.registerInDataStore();
948 pimGood.registerInDataStore();
953 pipGood->initialize(211,
"pi+:good");
954 pimGood->initialize(-211,
"pi-:good");
955 pipGood->bindAntiParticleList(*(pimGood));
961 kpAll.registerInDataStore();
962 kmAll.registerInDataStore();
967 kpAll->initialize(321,
"K+:all");
968 kmAll->initialize(-321,
"K-:all");
969 kpAll->bindAntiParticleList(*(kmAll));
976 kpGood.registerInDataStore();
977 kmGood.registerInDataStore();
982 kpGood->initialize(321,
"K+:good");
983 kmGood->initialize(-321,
"K-:good");
984 kpGood->bindAntiParticleList(*(kmGood));
990 kpGood2.registerInDataStore();
991 kmGood2.registerInDataStore();
996 kpGood2->initialize(321,
"K+:good2");
997 kmGood2->initialize(-321,
"K-:good2");
998 kpGood2->bindAntiParticleList(*(kmGood2));
1005 gamma_1.registerInDataStore();
1006 gamma_2.registerInDataStore();
1011 gamma_1->initialize(22,
"gamma:1");
1012 gamma_2->initialize(22,
"gamma:2");
1017 klong_1.registerInDataStore();
1021 klong_1->initialize(
Const::Klong.getPDGCode(),
"K_L0:1");
1024 pipAll->setEditable(
true);
1026 pipAll->addParticle(pip_1);
1027 pipAll->addParticle(pip_2);
1028 pipAll->addParticle(pip_3);
1030 pipAll->addParticle(pim_1);
1031 pipAll->addParticle(pim_2);
1032 pipAll->addParticle(pim_3);
1034 pipAll->setEditable(
false);
1036 kpAll->setEditable(
true);
1038 kpAll->addParticle(kp_1);
1039 kpAll->addParticle(kp_2);
1040 kpAll->addParticle(kp_3);
1042 kpAll->addParticle(km_1);
1043 kpAll->addParticle(km_2);
1044 kpAll->addParticle(km_3);
1046 kpAll->setEditable(
false);
1048 pipGood->addParticle(pip_1_copy);
1049 pipGood->addParticle(pim_1_copy);
1051 kpGood->addParticle(kp_1_copy);
1052 kpGood->addParticle(km_1_copy);
1054 kpGood2->addParticle(kp_1);
1055 kpGood2->addParticle(km_1);
1056 kpGood2->addParticle(kp_2);
1057 kpGood2->addParticle(km_2);
1058 kpGood2->addParticle(kp_3);
1059 kpGood2->addParticle(km_3);
1061 gamma_1->addParticle(g_1);
1062 gamma_1->addParticle(g_2);
1063 gamma_1->addParticle(g_3);
1065 gamma_2->addParticle(g_1_copy);
1066 gamma_2->addParticle(g_2_copy);
1067 gamma_2->addParticle(g_3_copy);
1068 gamma_2->addParticle(g_4);
1070 klong_1->addParticle(KL);
1073 EXPECT_EQ(6, pipAll->getListSize());
1074 EXPECT_EQ(6, pimAll->getListSize());
1075 EXPECT_EQ(6, kpAll->getListSize());
1076 EXPECT_EQ(6, kmAll->getListSize());
1077 EXPECT_EQ(2, pipGood->getListSize());
1078 EXPECT_EQ(2, kpGood->getListSize());
1079 EXPECT_EQ(3, gamma_1->getListSize());
1080 EXPECT_EQ(4, gamma_2->getListSize());
1081 EXPECT_EQ(1, klong_1->getListSize());
1084 ParticleGenerator comb7(
"D+:3 -> K-:all K+:good K-:good2 pi+:good pi+:all gamma:1 gamma:2");
1086 std::vector<StoreObjPtr<ParticleList>> comb7PLists;
1087 comb7PLists.push_back(kmAll);
1088 comb7PLists.push_back(kpGood);
1089 comb7PLists.push_back(kmGood2);
1090 comb7PLists.push_back(pipGood);
1091 comb7PLists.push_back(pipAll);
1092 comb7PLists.push_back(gamma_1);
1093 comb7PLists.push_back(gamma_2);
1096 for (
unsigned i = 0; i < comb7PLists.size(); i++) {
1098 std::vector<int> iAll;
1099 iAll.insert(iAll.begin(), (list_i->getList(ParticleList::c_FlavorSpecificParticle,
false)).begin(),
1100 (list_i->getList(ParticleList::c_FlavorSpecificParticle,
false)).end());
1101 iAll.insert(iAll.begin(), (list_i->getList(ParticleList::c_FlavorSpecificParticle,
true)).begin(),
1102 (list_i->getList(ParticleList::c_FlavorSpecificParticle,
true)).end());
1103 iAll.insert(iAll.begin(), (list_i->getList(ParticleList::c_SelfConjugatedParticle)).begin(),
1104 (list_i->getList(ParticleList::c_SelfConjugatedParticle)).end());
1106 for (
unsigned int j = i + 1; j < comb7PLists.size(); j++) {
1110 std::vector<int> jAll;
1111 jAll.insert(jAll.begin(), (list_j->getList(ParticleList::c_FlavorSpecificParticle,
false)).begin(),
1112 (list_j->getList(ParticleList::c_FlavorSpecificParticle,
false)).end());
1113 jAll.insert(jAll.begin(), (list_j->getList(ParticleList::c_FlavorSpecificParticle,
true)).begin(),
1114 (list_j->getList(ParticleList::c_FlavorSpecificParticle,
true)).end());
1115 jAll.insert(jAll.begin(), (list_j->getList(ParticleList::c_SelfConjugatedParticle)).begin(),
1116 (list_j->getList(ParticleList::c_SelfConjugatedParticle)).end());
1121 for (
int k : iAll) {
1122 for (
int m : jAll) {
1128 int iID = comb7.getUniqueID(k);
1129 int jID = comb7.getUniqueID(m);
1131 EXPECT_TRUE(iID > 0);
1132 EXPECT_TRUE(jID > 0);
1137 EXPECT_TRUE(iID == jID);
1139 EXPECT_FALSE(iID == jID);
1161 D02Kpi_1.registerInDataStore();
1162 anti_D02Kpi_1.registerInDataStore();
1163 D02Kpi_2.registerInDataStore();
1164 anti_D02Kpi_2.registerInDataStore();
1165 D02KK_1.registerInDataStore();
1166 anti_D02KK_1.registerInDataStore();
1167 D02KK_2.registerInDataStore();
1168 anti_D02KK_2.registerInDataStore();
1169 D02KK_3.registerInDataStore();
1170 anti_D02KK_3.registerInDataStore();
1171 D0KLg_1.registerInDataStore();
1172 D0KLg_2.registerInDataStore();
1173 anti_D0KLg_1.registerInDataStore();
1174 anti_D0KLg_2.registerInDataStore();
1178 anti_D02Kpi_1.create();
1179 D02Kpi_1->initialize(421,
"D0:kpi1");
1180 anti_D02Kpi_1->initialize(-421,
"anti-D0:kpi1");
1181 D02Kpi_1->bindAntiParticleList(*(anti_D02Kpi_1));
1184 anti_D02Kpi_2.create();
1185 D02Kpi_2->initialize(421,
"D0:kpi2");
1186 anti_D02Kpi_2->initialize(-421,
"anti-D0:kpi2");
1187 D02Kpi_2->bindAntiParticleList(*(anti_D02Kpi_2));
1190 anti_D02KK_1.create();
1191 D02KK_1->initialize(421,
"D0:kk1");
1192 anti_D02KK_1->initialize(-421,
"anti-D0:kk1");
1193 D02KK_1->bindAntiParticleList(*(anti_D02KK_1));
1196 anti_D02KK_2.create();
1197 D02KK_2->initialize(421,
"D0:kk2");
1198 anti_D02KK_2->initialize(-421,
"anti-D0:kk2");
1199 D02KK_2->bindAntiParticleList(*(anti_D02KK_2));
1202 anti_D02KK_3.create();
1203 D02KK_3->initialize(421,
"D0:kk3");
1204 anti_D02KK_3->initialize(-421,
"anti-D0:kk3");
1205 D02KK_3->bindAntiParticleList(*(anti_D02KK_3));
1209 anti_D0KLg_1.create();
1210 anti_D0KLg_2.create();
1211 D0KLg_1->initialize(421,
"D0:klg1");
1212 D0KLg_2->initialize(421,
"D0:klg2");
1213 anti_D0KLg_1->initialize(-421,
"anti-D0:klg1");
1214 anti_D0KLg_2->initialize(-421,
"anti-D0:klg2");
1215 D0KLg_1->bindAntiParticleList(*(anti_D0KLg_1));
1216 D0KLg_2->bindAntiParticleList(*(anti_D0KLg_2));
1219 combiner_D02Kpi_1.init();
1220 while (combiner_D02Kpi_1.loadNext()) {
1221 const Particle& particle = combiner_D02Kpi_1.getCurrentParticle();
1223 particles.appendNew(particle);
1224 int iparticle = particles.getEntries() - 1;
1228 EXPECT_EQ(18, D02Kpi_1->getListSize());
1229 EXPECT_EQ(9, D02Kpi_1->getNParticlesOfType(ParticleList::c_FlavorSpecificParticle));
1230 EXPECT_EQ(9, D02Kpi_1->getNParticlesOfType(ParticleList::c_FlavorSpecificParticle,
true));
1231 EXPECT_EQ(0, D02Kpi_1->getNParticlesOfType(ParticleList::c_SelfConjugatedParticle));
1234 combiner_D02Kpi_2.init();
1235 while (combiner_D02Kpi_2.loadNext()) {
1236 const Particle& particle = combiner_D02Kpi_2.getCurrentParticle();
1238 particles.appendNew(particle);
1239 int iparticle = particles.getEntries() - 1;
1243 EXPECT_EQ(6, D02Kpi_2->getListSize());
1244 EXPECT_EQ(3, D02Kpi_2->getNParticlesOfType(ParticleList::c_FlavorSpecificParticle));
1245 EXPECT_EQ(3, D02Kpi_2->getNParticlesOfType(ParticleList::c_FlavorSpecificParticle,
true));
1246 EXPECT_EQ(0, D02Kpi_2->getNParticlesOfType(ParticleList::c_SelfConjugatedParticle));
1249 combiner_D02KK_1.init();
1250 while (combiner_D02KK_1.loadNext()) {
1251 const Particle& particle = combiner_D02KK_1.getCurrentParticle();
1253 particles.appendNew(particle);
1254 int iparticle = particles.getEntries() - 1;
1258 EXPECT_EQ(9, D02KK_1->getListSize());
1259 EXPECT_EQ(0, D02KK_1->getNParticlesOfType(ParticleList::c_FlavorSpecificParticle));
1260 EXPECT_EQ(0, D02KK_1->getNParticlesOfType(ParticleList::c_FlavorSpecificParticle,
true));
1261 EXPECT_EQ(9, D02KK_1->getNParticlesOfType(ParticleList::c_SelfConjugatedParticle));
1262 EXPECT_EQ(9, D02KK_1->getNParticlesOfType(ParticleList::c_SelfConjugatedParticle,
true));
1265 combiner_D02KK_2.init();
1266 while (combiner_D02KK_2.loadNext()) {
1267 const Particle& particle = combiner_D02KK_2.getCurrentParticle();
1269 particles.appendNew(particle);
1270 int iparticle = particles.getEntries() - 1;
1274 EXPECT_EQ(5, D02KK_2->getListSize());
1275 EXPECT_EQ(0, D02KK_2->getNParticlesOfType(ParticleList::c_FlavorSpecificParticle));
1276 EXPECT_EQ(0, D02KK_2->getNParticlesOfType(ParticleList::c_FlavorSpecificParticle,
true));
1277 EXPECT_EQ(5, D02KK_2->getNParticlesOfType(ParticleList::c_SelfConjugatedParticle));
1278 EXPECT_EQ(5, D02KK_2->getNParticlesOfType(ParticleList::c_SelfConjugatedParticle,
true));
1281 combiner_D02KK_3.init();
1282 while (combiner_D02KK_3.loadNext()) {
1283 const Particle& particle = combiner_D02KK_3.getCurrentParticle();
1285 particles.appendNew(particle);
1286 int iparticle = particles.getEntries() - 1;
1290 EXPECT_EQ(9, D02KK_3->getListSize());
1291 EXPECT_EQ(0, D02KK_3->getNParticlesOfType(ParticleList::c_FlavorSpecificParticle));
1292 EXPECT_EQ(0, D02KK_3->getNParticlesOfType(ParticleList::c_FlavorSpecificParticle,
true));
1293 EXPECT_EQ(9, D02KK_3->getNParticlesOfType(ParticleList::c_SelfConjugatedParticle));
1294 EXPECT_EQ(9, D02KK_3->getNParticlesOfType(ParticleList::c_SelfConjugatedParticle,
true));
1299 combiner_D02KLg1.init();
1300 while (combiner_D02KLg1.loadNext()) {
1301 const Particle& particle = combiner_D02KLg1.getCurrentParticle();
1303 particles.appendNew(particle);
1304 int iparticle = particles.getEntries() - 1;
1308 EXPECT_EQ(3, D0KLg_1->getListSize());
1309 EXPECT_EQ(0, D0KLg_1->getNParticlesOfType(ParticleList::c_FlavorSpecificParticle));
1310 EXPECT_EQ(0, D0KLg_1->getNParticlesOfType(ParticleList::c_FlavorSpecificParticle,
true));
1311 EXPECT_EQ(3, D0KLg_1->getNParticlesOfType(ParticleList::c_SelfConjugatedParticle));
1313 combiner_D02KLg2.init();
1314 while (combiner_D02KLg2.loadNext()) {
1315 const Particle& particle = combiner_D02KLg2.getCurrentParticle();
1317 particles.appendNew(particle);
1318 int iparticle = particles.getEntries() - 1;
1322 EXPECT_EQ(3, D0KLg_2->getListSize());
1323 EXPECT_EQ(0, D0KLg_2->getNParticlesOfType(ParticleList::c_FlavorSpecificParticle));
1324 EXPECT_EQ(0, D0KLg_2->getNParticlesOfType(ParticleList::c_FlavorSpecificParticle,
true));
1325 EXPECT_EQ(3, D0KLg_2->getNParticlesOfType(ParticleList::c_SelfConjugatedParticle));
1334 DpKpipi_1.registerInDataStore();
1335 DmKpipi_1.registerInDataStore();
1336 DpKpipi_2.registerInDataStore();
1337 DmKpipi_2.registerInDataStore();
1345 DpKpipi_1->initialize(411,
"D+:kpipi1");
1346 DmKpipi_1->initialize(-411,
"D-:kpipi1");
1347 DpKpipi_1->bindAntiParticleList(*(DmKpipi_1));
1349 DpKpipi_2->initialize(411,
"D+:kpipi2");
1350 DmKpipi_2->initialize(-411,
"D-:kpipi2");
1351 DpKpipi_2->bindAntiParticleList(*(DmKpipi_2));
1355 combiner_DpKpipi_1.init();
1356 while (combiner_DpKpipi_1.loadNext()) {
1357 const Particle& particle = combiner_DpKpipi_1.getCurrentParticle();
1359 particles.appendNew(particle);
1360 int iparticle = particles.getEntries() - 1;
1364 EXPECT_EQ(18, DpKpipi_1->getListSize());
1365 EXPECT_EQ(9, DpKpipi_1->getNParticlesOfType(ParticleList::c_FlavorSpecificParticle));
1366 EXPECT_EQ(9, DpKpipi_1->getNParticlesOfType(ParticleList::c_FlavorSpecificParticle,
true));
1367 EXPECT_EQ(0, DpKpipi_1->getNParticlesOfType(ParticleList::c_SelfConjugatedParticle));
1370 combiner_DpKpipi_2.init();
1371 while (combiner_DpKpipi_2.loadNext()) {
1372 const Particle& particle = combiner_DpKpipi_2.getCurrentParticle();
1374 particles.appendNew(particle);
1375 int iparticle = particles.getEntries() - 1;
1379 EXPECT_EQ(12, DpKpipi_2->getListSize());
1380 EXPECT_EQ(6, DpKpipi_2->getNParticlesOfType(ParticleList::c_FlavorSpecificParticle));
1381 EXPECT_EQ(6, DpKpipi_2->getNParticlesOfType(ParticleList::c_FlavorSpecificParticle,
true));
1382 EXPECT_EQ(0, DpKpipi_2->getNParticlesOfType(ParticleList::c_SelfConjugatedParticle));
1390 DSTp_1.registerInDataStore();
1391 DSTm_1.registerInDataStore();
1392 DSTp_2.registerInDataStore();
1393 DSTm_2.registerInDataStore();
1401 DSTp_1->initialize(413,
"D*+:D0kpi1pi");
1402 DSTm_1->initialize(-413,
"D*-:D0kpi1pi");
1403 DSTp_1->bindAntiParticleList(*(DSTm_1));
1405 DSTp_2->initialize(413,
"D*+:D0kk2pi");
1406 DSTm_2->initialize(-413,
"D*-:D0kk2pi");
1407 DSTp_2->bindAntiParticleList(*(DSTm_2));
1411 combiner_DSTp_1.init();
1412 while (combiner_DSTp_1.loadNext()) {
1413 const Particle& particle = combiner_DSTp_1.getCurrentParticle();
1415 particles.appendNew(particle);
1416 int iparticle = particles.getEntries() - 1;
1420 EXPECT_EQ(12, DSTp_1->getListSize());
1421 EXPECT_EQ(6, DSTp_1->getNParticlesOfType(ParticleList::c_FlavorSpecificParticle));
1422 EXPECT_EQ(6, DSTp_1->getNParticlesOfType(ParticleList::c_FlavorSpecificParticle,
true));
1423 EXPECT_EQ(0, DSTp_1->getNParticlesOfType(ParticleList::c_SelfConjugatedParticle));
1426 combiner_DSTp_2.init();
1427 while (combiner_DSTp_2.loadNext()) {
1428 const Particle& particle = combiner_DSTp_2.getCurrentParticle();
1430 particles.appendNew(particle);
1431 int iparticle = particles.getEntries() - 1;
1435 EXPECT_EQ(4, DSTp_2->getListSize());
1436 EXPECT_EQ(2, DSTp_2->getNParticlesOfType(ParticleList::c_FlavorSpecificParticle));
1437 EXPECT_EQ(2, DSTp_2->getNParticlesOfType(ParticleList::c_FlavorSpecificParticle,
true));
1438 EXPECT_EQ(0, DSTp_2->getNParticlesOfType(ParticleList::c_SelfConjugatedParticle));
1443 pi0_1.registerInDataStore();
1448 pi0_1->initialize(111,
"pi0:1");
1452 combiner_pi0_1.init();
1453 while (combiner_pi0_1.loadNext()) {
1454 const Particle& particle = combiner_pi0_1.getCurrentParticle();
1456 particles.appendNew(particle);
1457 int iparticle = particles.getEntries() - 1;
1461 EXPECT_EQ(3, pi0_1->getListSize());
1462 EXPECT_EQ(0, pi0_1->getNParticlesOfType(ParticleList::c_FlavorSpecificParticle));
1463 EXPECT_EQ(0, pi0_1->getNParticlesOfType(ParticleList::c_FlavorSpecificParticle,
true));
1464 EXPECT_EQ(3, pi0_1->getNParticlesOfType(ParticleList::c_SelfConjugatedParticle));
1469 pi0_1copy.registerInDataStore();
1474 pi0_1copy->initialize(111,
"pi0:1");
1478 combiner_pi0_1copy.init();
1479 while (combiner_pi0_1copy.loadNext()) {
1480 const Particle& particle = combiner_pi0_1copy.getCurrentParticle();
1482 particles.appendNew(particle);
1483 int iparticle = particles.getEntries() - 1;
1491 pi0_2.registerInDataStore();
1496 pi0_2->initialize(111,
"pi0:2");
1500 combiner_pi0_2.init();
1501 while (combiner_pi0_2.loadNext()) {
1502 const Particle& particle = combiner_pi0_2.getCurrentParticle();
1504 particles.appendNew(particle);
1505 int iparticle = particles.getEntries() - 1;
1509 EXPECT_EQ(6, pi0_2->getListSize());
1510 EXPECT_EQ(0, pi0_2->getNParticlesOfType(ParticleList::c_FlavorSpecificParticle));
1511 EXPECT_EQ(0, pi0_2->getNParticlesOfType(ParticleList::c_FlavorSpecificParticle,
true));
1512 EXPECT_EQ(6, pi0_2->getNParticlesOfType(ParticleList::c_SelfConjugatedParticle));
1517 eta_1.registerInDataStore();
1522 eta_1->initialize(221,
"eta:1");
1526 combiner_eta_1.init();
1527 while (combiner_eta_1.loadNext()) {
1528 const Particle& particle = combiner_eta_1.getCurrentParticle();
1530 particles.appendNew(particle);
1531 int iparticle = particles.getEntries() - 1;
1535 EXPECT_EQ(6, eta_1->getListSize());
1536 EXPECT_EQ(0, eta_1->getNParticlesOfType(ParticleList::c_FlavorSpecificParticle));
1537 EXPECT_EQ(0, eta_1->getNParticlesOfType(ParticleList::c_FlavorSpecificParticle,
true));
1538 EXPECT_EQ(6, eta_1->getNParticlesOfType(ParticleList::c_SelfConjugatedParticle));
1543 eta_1copy.registerInDataStore();
1548 eta_1copy->initialize(221,
"eta:1copy");
1552 combiner_eta_1copy.init();
1553 while (combiner_eta_1copy.loadNext()) {
1554 const Particle& particle = combiner_eta_1copy.getCurrentParticle();
1556 particles.appendNew(particle);
1557 int iparticle = particles.getEntries() - 1;
1566 B0_1.registerInDataStore();
1567 aB0_1.registerInDataStore();
1573 B0_1->initialize(511,
"B0:1");
1574 aB0_1->initialize(-511,
"anti-B0:1");
1575 B0_1->bindAntiParticleList(*(aB0_1));
1578 combiner_B0_1.init();
1579 while (combiner_B0_1.loadNext()) {
1580 const Particle& particle = combiner_B0_1.getCurrentParticle();
1582 particles.appendNew(particle);
1583 int iparticle = particles.getEntries() - 1;
1587 EXPECT_EQ(3, B0_1->getListSize());
1588 EXPECT_EQ(0, B0_1->getNParticlesOfType(ParticleList::c_FlavorSpecificParticle));
1589 EXPECT_EQ(0, B0_1->getNParticlesOfType(ParticleList::c_FlavorSpecificParticle,
true));
1590 EXPECT_EQ(3, B0_1->getNParticlesOfType(ParticleList::c_SelfConjugatedParticle));
1591 EXPECT_EQ(3, aB0_1->getNParticlesOfType(ParticleList::c_SelfConjugatedParticle));
1597 B0_2.registerInDataStore();
1598 aB0_2.registerInDataStore();
1604 B0_2->initialize(511,
"B0:2");
1605 aB0_2->initialize(-511,
"anti-B0:2");
1606 B0_2->bindAntiParticleList(*(aB0_2));
1609 combiner_B0_2.init();
1610 while (combiner_B0_2.loadNext()) {
1611 const Particle& particle = combiner_B0_2.getCurrentParticle();
1613 particles.appendNew(particle);
1614 int iparticle = particles.getEntries() - 1;
1618 EXPECT_EQ(0, B0_2->getListSize());
1619 EXPECT_EQ(0, B0_2->getNParticlesOfType(ParticleList::c_FlavorSpecificParticle));
1620 EXPECT_EQ(0, B0_2->getNParticlesOfType(ParticleList::c_FlavorSpecificParticle,
true));
1621 EXPECT_EQ(0, B0_2->getNParticlesOfType(ParticleList::c_SelfConjugatedParticle));
1622 EXPECT_EQ(0, aB0_2->getNParticlesOfType(ParticleList::c_SelfConjugatedParticle));
1628 B0_3.registerInDataStore();
1629 aB0_3.registerInDataStore();
1635 B0_3->initialize(511,
"B0:3");
1636 aB0_3->initialize(-511,
"anti-B0:3");
1637 B0_3->bindAntiParticleList(*(aB0_3));
1640 combiner_B0_3.init();
1641 while (combiner_B0_3.loadNext()) {
1642 const Particle& particle = combiner_B0_3.getCurrentParticle();
1644 particles.appendNew(particle);
1645 int iparticle = particles.getEntries() - 1;
1649 EXPECT_EQ(3, B0_3->getListSize());
1650 EXPECT_EQ(0, B0_3->getNParticlesOfType(ParticleList::c_FlavorSpecificParticle));
1651 EXPECT_EQ(0, B0_3->getNParticlesOfType(ParticleList::c_FlavorSpecificParticle,
true));
1652 EXPECT_EQ(3, B0_3->getNParticlesOfType(ParticleList::c_SelfConjugatedParticle));
1653 EXPECT_EQ(3, aB0_3->getNParticlesOfType(ParticleList::c_SelfConjugatedParticle));
1659 B0_4.registerInDataStore();
1660 aB0_4.registerInDataStore();
1666 B0_4->initialize(511,
"B0:4");
1667 aB0_4->initialize(-511,
"anti-B0:4");
1668 B0_4->bindAntiParticleList(*(aB0_4));
1671 combiner_B0_4.init();
1672 while (combiner_B0_4.loadNext()) {
1673 const Particle& particle = combiner_B0_4.getCurrentParticle();
1675 particles.appendNew(particle);
1676 int iparticle = particles.getEntries() - 1;
1680 EXPECT_EQ(6, B0_4->getListSize());
1681 EXPECT_EQ(0, B0_4->getNParticlesOfType(ParticleList::c_FlavorSpecificParticle));
1682 EXPECT_EQ(0, B0_4->getNParticlesOfType(ParticleList::c_FlavorSpecificParticle,
true));
1683 EXPECT_EQ(6, B0_4->getNParticlesOfType(ParticleList::c_SelfConjugatedParticle));
1684 EXPECT_EQ(6, aB0_4->getNParticlesOfType(ParticleList::c_SelfConjugatedParticle));
static const ParticleType Klong
K^0_L particle.
static const ParticleType photon
photon particle
static DataStore & Instance()
Instance of singleton Store.
void setInitializeActive(bool active)
Setter for m_initializeActive.
void reset(EDurability durability)
Frees memory occupied by data store items and removes all objects from the map.
Represents a particle in the DecayDescriptor.
int getPDGCode() const
Return PDG code.
std::string getFullName() const
returns the full name of the particle full_name = name:label
std::string getLabel() const
The label of this particle, "default" returned, when no label set.
The DecayDescriptor stores information about a decay tree or parts of a decay tree.
bool init(const std::string &str)
Initialise the DecayDescriptor from given string.
const DecayDescriptorParticle * getMother() const
return mother.
void setConnectedRegionId(int crid)
Set connected region id.
void setClusterId(int clusterid)
Set cluster id.
void setHypothesis(EHypothesisBit hypothesis)
Set hypotheses.
ListIndexGenerator is a generator for all the combinations of the sublists (FlavorSpecificParticle = ...
ParticleGenerator is a generator for all the particles combined from the given ParticleLists.
ParticleIndexGenerator is a generator for all the combinations of the particle indices stored in the ...
Class to store reconstructed particles.
const std::vector< int > & getDaughterIndices() const
Returns a vector of store array indices of daughter particles.
bool isCopyOf(const Particle *oParticle, bool doDetailedComparison=false) const
Returns true if this Particle and oParticle are copies of each other.
EFlavorType getFlavorType() const
Returns flavor type of the decay (for FS particles: flavor type of particle)
int getPDGCode(void) const
Returns PDG code.
EFlavorType
describes flavor type, see getFlavorType().
@ c_Unflavored
Is its own antiparticle or we don't know whether it is a particle/antiparticle.
@ c_Flavored
Is either particle or antiparticle.
bool registerInDataStore(DataStore::EStoreFlags storeFlags=DataStore::c_WriteOut)
Register the object/array in the DataStore.
Accessor to arrays stored in the data store.
Type-safe access to single objects in the data store.
void init(const std::vector< unsigned int > &_sizes)
Initialises the generator to produce combinations with the given sizes of each particle list.
const std::vector< unsigned int > & getCurrentIndices() const
Returns theindices of the current loaded combination.
const std::vector< ParticleList::EParticleType > & getCurrentIndices() const
Returns the type of the sublist of the current loaded combination.
void init(unsigned int _numberOfLists)
Initialises the generator to produce the given type of sublist.
bool loadNext()
Loads the next combination.
B2Vector3< DataType > operator*(DataType a, const B2Vector3< DataType > &p)
non-memberfunction Scaling of 3-vectors with a real number
std::string antiParticleListName(int pdgCode, const std::string &label)
Returns the name of the anti-particle ParticleList for particles with given pdg code and with given l...
bool hasAntiParticle(int pdgCode)
Checks if the particle with given pdg code has an anti-particle or not.
Abstract base class for different kinds of events.