CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Static Public Member Functions
DetGroupMerger Class Reference

#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)
 

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.

Referenced by CompatibleDetToGroupAdder::add().

52  {
53  for (vector<DetGroup>::const_iterator ig=gvec.begin(); ig != gvec.end(); ig++) {
54  int gSize = ig->indexSize();
55  int index = ig->index(); // at which level it should be inserted
56  bool found = false;
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";
61  // throw something appropriate...or handle it properly (may happen in petals?)
62  }
63 
64  int resIndex = ires->index();
65  if (index == resIndex) {
66  ires->insert(ires->end(), ig->begin(), ig->end()); // insert in group with same index
67  found = true;
68  break;
69  }
70  else if (index < resIndex) {
71  // result has no group at index level yet
72  result.insert( ires, *ig); // insert a new group, invalidates the iterator ires
73  found = true;
74  break;
75  }
76  } // end of loop over result groups
77  if (!found) result.insert( result.end(), *ig); // in case the ig index is bigger than any in result
78  }
79 }
#define LogDebug(id)
tuple result
Definition: query.py:137
void DetGroupMerger::doubleIndexSize ( std::vector< DetGroup > &  vec)
static

Definition at line 82 of file DetGroupMerger.cc.

References i.

82  {
83  int indSize = vec.front().indexSize();
84  for (vector<DetGroup>::iterator i=vec.begin(); i!=vec.end(); i++) {
85  i->setIndexSize( 2*indSize);
86  }
87 }
int i
Definition: DBlmapReader.cc:9
void DetGroupMerger::incrementAndDoubleSize ( std::vector< DetGroup > &  vec)
static

Definition at line 90 of file DetGroupMerger.cc.

References i.

90  {
91  int indSize = vec.front().indexSize();
92  for (vector<DetGroup>::iterator i=vec.begin(); i!=vec.end(); i++) {
93  i->incrementIndex( indSize);
94  }
95 }
int i
Definition: DBlmapReader.cc:9
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.

34  {
35 
36  result.reserve( one.size() + two.size());
37 
38  int indSize1 = one.front().indexSize();
39  int indSize2 = two.front().indexSize();
40 
41  for (vector<DetGroup>::const_iterator i=one.begin(); i!=one.end(); i++) {
42  result.push_back(*i);
43  result.back().setIndexSize(indSize1+indSize2);
44  }
45  for (vector<DetGroup>::const_iterator j=two.begin(); j!=two.end(); j++) {
46  result.push_back(*j);
47  result.back().incrementIndex(indSize1);
48  }
49 }
int i
Definition: DBlmapReader.cc:9
tuple result
Definition: query.py:137
int j
Definition: DBlmapReader.cc:9
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 PixelForwardLayer::groupedCompatibleDetsV(), TECLayer::groupedCompatibleDetsV(), TIBLayer::groupedCompatibleDetsV(), TOBLayer::groupedCompatibleDetsV(), TIDRing::groupedCompatibleDetsV(), CompositeTECWedge::groupedCompatibleDetsV(), TIBRing::groupedCompatibleDetsV(), CompositeTECPetal::groupedCompatibleDetsV(), PixelBarrelLayer::groupedCompatibleDetsV(), PixelBlade::groupedCompatibleDetsV(), and TOBRod::groupedCompatibleDetsV().

12  {
13  if (one.empty() && two.empty()) return;
14 
15 
16  if (one.empty()) {
17  result = two;
18  if (firstIndex == firstCrossed) incrementAndDoubleSize(result);
19  else doubleIndexSize(result);
20  }
21  else if (two.empty()) {
22  result = one;
23  if (firstIndex == firstCrossed) doubleIndexSize(result);
25  }
26  else { // both are not empty
27  if (firstIndex == firstCrossed) mergeTwoLevels( one, two,result);
28  else mergeTwoLevels( two, one, result);
29  }
30 }
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)
tuple result
Definition: query.py:137