CMS 3D CMS Logo

List of all members | Static Public Member Functions
DetGroupMerger Class Reference

#include <DetGroupMerger.h>

Static Public Member Functions

static void addSameLevel (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 (std::vector< DetGroup > &&one, std::vector< DetGroup > &&two, std::vector< DetGroup > &result)
 
static void orderAndMergeTwoLevels (std::vector< DetGroup > &&one, std::vector< DetGroup > &&two, std::vector< DetGroup > &result, int firstIndex, int firstCrossed)
 

Detailed Description

Definition at line 7 of file DetGroupMerger.h.

Member Function Documentation

◆ addSameLevel()

void DetGroupMerger::addSameLevel ( std::vector< DetGroup > &&  gvec,
std::vector< DetGroup > &  result 
)
static

Definition at line 47 of file DetGroupMerger.cc.

47  {
48  for (auto&& ig : gvec) {
49  int gSize = ig.indexSize();
50  int index = ig.index(); // at which level it should be inserted
51  bool found = false;
52  for (vector<DetGroup>::iterator ires = result.begin(); ires != result.end(); ires++) {
53  int resSize = ires->indexSize();
54  if (gSize != resSize) {
55  LogDebug("TkDetLayers") << "DetGroupMerger::addSameLevel called with groups of different index sizes";
56  // throw something appropriate...or handle it properly (may happen in petals?)
57  }
58 
59  int resIndex = ires->index();
60  if (index == resIndex) {
61  ires->insert(ires->end(), ig.begin(), ig.end()); // insert in group with same index
62  found = true;
63  break;
64  } else if (index < resIndex) {
65  // result has no group at index level yet
66  result.insert(ires, ig); // insert a new group, invalidates the iterator ires
67  found = true;
68  break;
69  }
70  } // end of loop over result groups
71  if (!found)
72  result.insert(result.end(), ig); // in case the ig index is bigger than any in result
73  }
74 }

References newFWLiteAna::found, ires, LogDebug, and mps_fire::result.

Referenced by CompatibleDetToGroupAdder::add(), and Phase2EndcapLayer::groupedCompatibleDetsV().

◆ doubleIndexSize()

void DetGroupMerger::doubleIndexSize ( std::vector< DetGroup > &  vec)
static

Definition at line 76 of file DetGroupMerger.cc.

76  {
77  int indSize = vec.front().indexSize();
78  for (vector<DetGroup>::iterator i = vec.begin(); i != vec.end(); i++) {
79  i->setIndexSize(2 * indSize);
80  }
81 }

References mps_fire::i.

◆ incrementAndDoubleSize()

void DetGroupMerger::incrementAndDoubleSize ( std::vector< DetGroup > &  vec)
static

Definition at line 83 of file DetGroupMerger.cc.

83  {
84  int indSize = vec.front().indexSize();
85  for (vector<DetGroup>::iterator i = vec.begin(); i != vec.end(); i++) {
86  i->incrementIndex(indSize);
87  }
88 }

References mps_fire::i.

◆ mergeTwoLevels()

void DetGroupMerger::mergeTwoLevels ( std::vector< DetGroup > &&  one,
std::vector< DetGroup > &&  two,
std::vector< DetGroup > &  result 
)
static

Definition at line 31 of file DetGroupMerger.cc.

31  {
32  result.reserve(one.size() + two.size());
33 
34  int indSize1 = one.front().indexSize();
35  int indSize2 = two.front().indexSize();
36 
37  for (auto&& dg : one) {
38  result.push_back(std::move(dg));
39  result.back().setIndexSize(indSize1 + indSize2);
40  }
41  for (auto&& dg : two) {
42  result.push_back(std::move(dg));
43  result.back().incrementIndex(indSize1);
44  }
45 }

References eostools::move(), SiPixelPI::one, mps_fire::result, and SiPixelPI::two.

◆ orderAndMergeTwoLevels()

void DetGroupMerger::orderAndMergeTwoLevels ( std::vector< DetGroup > &&  one,
std::vector< DetGroup > &&  two,
std::vector< DetGroup > &  result,
int  firstIndex,
int  firstCrossed 
)
static
mps_fire.i
i
Definition: mps_fire.py:428
SiPixelPI::one
Definition: SiPixelPayloadInspectorHelper.h:39
newFWLiteAna.found
found
Definition: newFWLiteAna.py:118
ires
int ires[2]
Definition: CascadeWrapper.h:19
DetGroupMerger::doubleIndexSize
static void doubleIndexSize(std::vector< DetGroup > &vec)
Definition: DetGroupMerger.cc:76
LogDebug
#define LogDebug(id)
Definition: MessageLogger.h:233
DetGroupMerger::mergeTwoLevels
static void mergeTwoLevels(std::vector< DetGroup > &&one, std::vector< DetGroup > &&two, std::vector< DetGroup > &result)
Definition: DetGroupMerger.cc:31
DetGroupMerger::incrementAndDoubleSize
static void incrementAndDoubleSize(std::vector< DetGroup > &vec)
Definition: DetGroupMerger.cc:83
SiPixelPI::two
Definition: SiPixelPayloadInspectorHelper.h:39
eostools.move
def move(src, dest)
Definition: eostools.py:511
AlignmentPI::index
index
Definition: AlignmentPayloadInspectorHelper.h:46
mps_fire.result
result
Definition: mps_fire.py:311