9 vector<DetGroup>&& two,
10 std::vector<DetGroup>&
result,
13 if (
one.empty() && two.empty())
return;
18 if (firstIndex == firstCrossed) incrementAndDoubleSize(result);
19 else doubleIndexSize(result);
21 else if (two.empty()) {
23 if (firstIndex == firstCrossed) doubleIndexSize(result);
24 else incrementAndDoubleSize(result);
36 result.reserve(
one.size() + two.size());
38 int indSize1 =
one.front().indexSize();
39 int indSize2 = two.front().indexSize();
41 for (
auto && dg :
one) {
43 result.back().setIndexSize(indSize1+indSize2);
45 for (
auto && dg : two) {
47 result.back().incrementIndex(indSize1);
53 for (
auto && ig : gvec) {
54 int gSize = ig.indexSize();
55 int index = ig.index();
57 for (vector<DetGroup>::iterator
ires=result.begin();
ires!=result.end();
ires++) {
58 int resSize =
ires->indexSize();
59 if (gSize != resSize) {
60 LogDebug(
"TkDetLayers") <<
"DetGroupMerger::addSameLevel called with groups of different index sizes";
64 int resIndex =
ires->index();
65 if (index == resIndex) {
66 ires->insert(
ires->end(), ig.begin(), ig.end());
70 else if (index < resIndex) {
72 result.insert(
ires, ig);
77 if (!found) result.insert( result.end(), ig);
83 int indSize = vec.front().indexSize();
84 for (vector<DetGroup>::iterator
i=vec.begin();
i!=vec.end();
i++) {
85 i->setIndexSize( 2*indSize);
91 int indSize = vec.front().indexSize();
92 for (vector<DetGroup>::iterator
i=vec.begin();
i!=vec.end();
i++) {
93 i->incrementIndex( indSize);
static void incrementAndDoubleSize(std::vector< DetGroup > &vec)
static void mergeTwoLevels(std::vector< DetGroup > &&one, std::vector< DetGroup > &&two, std::vector< DetGroup > &result)
static void addSameLevel(std::vector< DetGroup > &&gvec, std::vector< DetGroup > &result)
static void doubleIndexSize(std::vector< DetGroup > &vec)
static void orderAndMergeTwoLevels(std::vector< DetGroup > &&one, std::vector< DetGroup > &&two, std::vector< DetGroup > &result, int firstIndex, int firstCrossed)