CMS 3D CMS Logo

Static Public Member Functions

DetGroupMerger Class Reference

#include <DetGroupMerger.h>

List of all members.

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)

Detailed Description

Definition at line 6 of file DetGroupMerger.h.


Member Function Documentation

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]

Definition at line 82 of file DetGroupMerger.cc.

References i.

                                                      {
  int indSize = vec.front().indexSize();
  for (vector<DetGroup>::iterator i=vec.begin(); i!=vec.end(); i++) {
    i->setIndexSize( 2*indSize);
  }
}
void DetGroupMerger::incrementAndDoubleSize ( std::vector< DetGroup > &  vec) [static]

Definition at line 90 of file DetGroupMerger.cc.

References i.

                                                             {
  int indSize = vec.front().indexSize();
  for (vector<DetGroup>::iterator i=vec.begin(); i!=vec.end(); i++) {
    i->incrementIndex( indSize);
  }
}
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.

References i, and j.

                                                                                                                      {

  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]