52 {
53
54
58 return StatusCode::FAILURE;
59 }
60
62
63 bool from2Collections(false);
66 SG::ReadHandle<xAOD::IParticleContainer> particleHdl2{
m_containerName2, ctx};
67 particles2=particleHdl2.
cptr();
68 from2Collections = true;
69 }
70
71
75 unsigned int nEntries2 = entries2.size();
76
77
78 if (!from2Collections) {
79 if ( (
particles->size() != nEntries) || (
particles->size() != nEntries2) || (nEntries!=nEntries2) ) {
80 ATH_MSG_ERROR(
"Branch sizes incompatible - returning zero. Check your selection strings.");
82 return StatusCode::FAILURE;
83 }
84 }
85 if (from2Collections) {
86 if ( (
particles->size() != nEntries) || (particles2->
size() != nEntries2) ) {
87 ATH_MSG_ERROR(
"Branch sizes incompatible - returning zero. Check your selection strings.");
89 return StatusCode::FAILURE;
90 }
91 }
92
93
94 unsigned int outerIt, innerIt;
95 std::vector<std::pair<int, int> >
pairs;
96
97 if (!from2Collections) {
98 for (outerIt=0; outerIt<
nEntries; ++outerIt) {
99 for (innerIt=outerIt+1; innerIt<
nEntries; ++innerIt) {
100 pairs.push_back({
static_cast<int>(outerIt),
static_cast<int>(innerIt)});
101 }
102 }
103
104 for (const auto & [first, second]: pairs) {
105 if ( (
entries[first]==1 && entries2[second]==1) || (entries2[first]==1 &&
entries[second]==1) ) {
107 ((*particles)[second])->p4().Vect(),
111 }
112 }
113 }
114
115
116 if (from2Collections) {
117 for (outerIt=0; outerIt<
nEntries; ++outerIt) {
118 if (
entries[outerIt]==0)
continue;
119 for (innerIt=0; innerIt<nEntries2; ++innerIt) {
120 if (entries2[innerIt]==0) continue;
121 pairs.push_back({
static_cast<int>(outerIt),
static_cast<int>(innerIt)});
122 }
123 }
124
125 for (const auto & [first, second]: pairs) {
127 ((*particles2)[second])->p4().Vect(),
131 }
132 }
133
134 return StatusCode::SUCCESS;
135
136 }
#define ATH_MSG_WARNING(x)
size_type size() const noexcept
Returns the number of elements in the collection.
const_pointer_type cptr()
Dereference the pointer.
@ kInvariantMassToolParser1
@ kInvariantMassToolParser2
DataVector< IParticle > IParticleContainer
Simple convenience declaration of IParticleContainer.