9 const 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);
27 if (firstIndex == firstCrossed) mergeTwoLevels( one, two,result);
28 else mergeTwoLevels( two, one, result);
36 result.reserve( one.size() + two.size());
38 int indSize1 = one.front().indexSize();
39 int indSize2 = two.front().indexSize();
41 for (vector<DetGroup>::const_iterator
i=one.begin();
i!=one.end();
i++) {
43 result.back().setIndexSize(indSize1+indSize2);
45 for (vector<DetGroup>::const_iterator
j=two.begin();
j!=two.end();
j++) {
47 result.back().incrementIndex(indSize1);
53 for (vector<DetGroup>::const_iterator ig=gvec.begin(); ig != gvec.end(); ig++) {
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 orderAndMergeTwoLevels(const std::vector< DetGroup > &one, const std::vector< DetGroup > &two, std::vector< DetGroup > &result, int firstIndex, int firstCrossed)
static void incrementAndDoubleSize(std::vector< DetGroup > &vec)
static void mergeTwoLevels(const std::vector< DetGroup > &one, const std::vector< DetGroup > &two, std::vector< DetGroup > &result)
static void doubleIndexSize(std::vector< DetGroup > &vec)
static void addSameLevel(const std::vector< DetGroup > &gvec, std::vector< DetGroup > &result)