Helper function to update a container with information from another one.
108{
109 std::size_t origSize = contToUpdate->
size();
110
111
112 std::vector<std::size_t> otherIndexMap(otherCont->
size());
113
114
115 for (std::size_t i = 0; i < otherCont->
size(); ++i) {
117
118
119 bool foundEBKToUpdate{false};
120 for (std::size_t j = 0; j < contToUpdate->
size(); ++j) {
122
125 otherIndexMap[i] = j;
126 foundEBKToUpdate = true;
127 break;
128 }
129 }
130 if (!foundEBKToUpdate) {
135 std::size_t ebIdx = newEBK->
index();
136 otherIndexMap[
i] = ebIdx;
137 }
138 }
139
140
141 for (std::size_t i = origSize;
i < contToUpdate->
size(); ++
i) {
143
144
148 *contToUpdate,
149 *otherCont,
150 otherIndexMap);
152 }
153
154
155 std::vector<xAOD::CutBookkeeper *> newChildren;
156 for ( std::size_t oldIdx = 0; oldIdx < ebkToModify->
nChildren(); ++oldIdx) {
158 newChildren.push_back(resolveLink(oldEBK,
159 *contToUpdate,
160 *otherCont,
161 otherIndexMap));
162 }
164
165
166 std::vector<xAOD::CutBookkeeper *> newOthers;
167 for (std::size_t oldIdx = 0; oldIdx < ebkToModify->
nUsedOthers(); ++oldIdx) {
169 newOthers.push_back(resolveLink(oldEBK,
170 *contToUpdate,
171 *otherCont,
172 otherIndexMap));
173 }
175
176
177 std::vector<xAOD::CutBookkeeper*> newSiblings;
178 for (std::size_t oldIdx = 0; oldIdx < ebkToModify->
nSiblings(); ++oldIdx) {
180 newSiblings.push_back(resolveLink(oldEBK,
181 *contToUpdate,
182 *otherCont,
183 otherIndexMap));
184 }
186 }
187}
const T * at(size_type n) const
Access an element, as an rvalue.
value_type push_back(value_type pElem)
Add an element to the end of the collection.
void makePrivateStore()
Create a new (empty) private store for this object.
bool usingPrivateStore() const
Test to see if this object is currently using a private store.
void releasePrivateStore()
Release and free any private store associated with this object.
size_t index() const
Return the index of this element within its container.
std::size_t nSiblings() const
Check if this CutBookkeeper has siblings.
void setPayload(const Payload &payload)
Set the whole payload object (which contains all counters) in one go.
const xAOD::CutBookkeeper_v1 * usedOther(std::size_t i) const
Get the usedOther at position i.
bool isEqualTo(const CutBookkeeper_v1 *eb) const
Test for the equality of this CutBookkeeper with another one.
std::size_t nChildren() const
Get the number of children CutBookkeepers of this CutBookkeeper.
const xAOD::CutBookkeeper_v1 * parent() const
Get the parent CutBookkeeper.
void setUsedOthers(const std::vector< CutBookkeeper_v1 * > &usedOthers)
Set all CutBookkeeper that are used by this one in one go.
const xAOD::CutBookkeeper_v1 * child(std::size_t i) const
Get the child at position i.
void setParent(const CutBookkeeper_v1 *parentEB)
Set the parent CutBookkeeper of this CutBookkeeper.
Payload payload() const
Get the whole payload object (which contains all counters) in one go.
const xAOD::CutBookkeeper_v1 * sibling(std::size_t i) const
Get the sibling number i.
void setChildren(const std::vector< CutBookkeeper_v1 * > &childrenEB)
Set all children of this CutBookkeeper in one go.
void setSiblings(const std::vector< CutBookkeeper_v1 * > &siblings)
Set all CutBookkeeper that are siblings to this one in one go.
std::size_t nUsedOthers() const
Check if this CutBookkeeper has used others.
bool hasParent() const
Check if there is a parent CutBookkeeper of this CutBookkeeper.