#include <DetGroupMerger.h>
Static Public Member Functions | |
static void | addSameLevel (const std::vector< DetGroup > &gvec, std::vector< DetGroup > &result) |
static void | doubleIndexSize (std::vector< DetGroup > &vec) |
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 | orderAndMergeTwoLevels (const std::vector< DetGroup > &one, const std::vector< DetGroup > &two, std::vector< DetGroup > &result, int firstIndex, int firstCrossed) |
Definition at line 6 of file DetGroupMerger.h.
void DetGroupMerger::addSameLevel | ( | const std::vector< DetGroup > & | gvec, |
std::vector< DetGroup > & | result | ||
) | [static] |
Definition at line 52 of file DetGroupMerger.cc.
References newFWLiteAna::found, getHLTprescales::index, and LogDebug.
{ for (vector<DetGroup>::const_iterator ig=gvec.begin(); ig != gvec.end(); ig++) { int gSize = ig->indexSize(); int index = ig->index(); // at which level it should be inserted bool found = false; for (vector<DetGroup>::iterator ires=result.begin(); ires!=result.end(); ires++) { int resSize = ires->indexSize(); if (gSize != resSize) { LogDebug("TkDetLayers") << "DetGroupMerger::addSameLevel called with groups of different index sizes"; // throw something appropriate...or handle it properly (may happen in petals?) } int resIndex = ires->index(); if (index == resIndex) { ires->insert(ires->end(), ig->begin(), ig->end()); // insert in group with same index found = true; break; } else if (index < resIndex) { // result has no group at index level yet result.insert( ires, *ig); // insert a new group, invalidates the iterator ires found = true; break; } } // end of loop over result groups if (!found) result.insert( result.end(), *ig); // in case the ig index is bigger than any in result } }
void DetGroupMerger::doubleIndexSize | ( | std::vector< DetGroup > & | vec | ) | [static] |
void DetGroupMerger::incrementAndDoubleSize | ( | std::vector< DetGroup > & | vec | ) | [static] |
void DetGroupMerger::mergeTwoLevels | ( | const std::vector< DetGroup > & | one, |
const std::vector< DetGroup > & | two, | ||
std::vector< DetGroup > & | result | ||
) | [static] |
Definition at line 34 of file DetGroupMerger.cc.
{ result.reserve( one.size() + two.size()); int indSize1 = one.front().indexSize(); int indSize2 = two.front().indexSize(); for (vector<DetGroup>::const_iterator i=one.begin(); i!=one.end(); i++) { result.push_back(*i); result.back().setIndexSize(indSize1+indSize2); } for (vector<DetGroup>::const_iterator j=two.begin(); j!=two.end(); j++) { result.push_back(*j); result.back().incrementIndex(indSize1); } }
void DetGroupMerger::orderAndMergeTwoLevels | ( | const std::vector< DetGroup > & | one, |
const std::vector< DetGroup > & | two, | ||
std::vector< DetGroup > & | result, | ||
int | firstIndex, | ||
int | firstCrossed | ||
) | [static] |
Definition at line 8 of file DetGroupMerger.cc.
Referenced by TIDRing::groupedCompatibleDetsV(), TIBLayer::groupedCompatibleDetsV(), TOBRod::groupedCompatibleDetsV(), PixelForwardLayer::groupedCompatibleDetsV(), TOBLayer::groupedCompatibleDetsV(), TECLayer::groupedCompatibleDetsV(), PixelBlade::groupedCompatibleDetsV(), GeometricSearchDet::groupedCompatibleDetsV(), CompositeTECPetal::groupedCompatibleDetsV(), CompositeTECWedge::groupedCompatibleDetsV(), and PixelBarrelLayer::groupedCompatibleDetsV().
{ if (one.empty() && two.empty()) return; if (one.empty()) { result = two; if (firstIndex == firstCrossed) incrementAndDoubleSize(result); else doubleIndexSize(result); } else if (two.empty()) { result = one; if (firstIndex == firstCrossed) doubleIndexSize(result); else incrementAndDoubleSize(result); } else { // both are not empty if (firstIndex == firstCrossed) mergeTwoLevels( one, two,result); else mergeTwoLevels( two, one, result); } }