CMS 3D CMS Logo

GenLumiInfoProduct.cc
Go to the documentation of this file.
1 #include <iostream>
2 #include <algorithm>
3 #include <map>
4 #include <utility>
5 
7 
9 
10 using namespace edm;
11 using namespace std;
12 
14  return (lhs.process() < rhs.process());
15 }
16 
18  bool condition = (lhs.process() != rhs.process()) || (lhs.lheXSec() != rhs.lheXSec());
19  return condition;
20 }
21 
23  bool condition =
24  (lhs.process() == rhs.process() && lhs.lheXSec() == rhs.lheXSec() && lhs.nPassPos() == rhs.nPassPos() &&
25  lhs.nPassNeg() == rhs.nPassNeg() && lhs.nTotalPos() == rhs.nTotalPos() && lhs.nTotalNeg() == rhs.nTotalNeg() &&
26  lhs.tried() == rhs.tried() && lhs.selected() == rhs.selected() && lhs.killed() == rhs.killed() &&
27  lhs.accepted() == rhs.accepted() && lhs.acceptedBr() == rhs.acceptedBr());
28  return condition;
29 }
30 
31 const bool operator!=(const GenLumiInfoProduct& lhs, const GenLumiInfoProduct& rhs) {
32  std::vector<GenLumiInfoProduct::ProcessInfo> lhsVector = lhs.getProcessInfos();
33  std::vector<GenLumiInfoProduct::ProcessInfo> rhsVector = rhs.getProcessInfos();
34  std::sort(lhsVector.begin(), lhsVector.end());
35  std::sort(rhsVector.begin(), rhsVector.end());
36  unsigned int lhssize = lhsVector.size();
37  unsigned int rhssize = rhsVector.size();
38  bool condition = (lhs.getHEPIDWTUP() != rhs.getHEPIDWTUP()) || (lhssize != rhssize);
39  bool fail = false;
40  if (!condition) {
41  for (unsigned int i = 0; i < lhssize; i++) {
42  if (lhsVector[i] != rhsVector[i]) {
43  fail = true;
44  break;
45  }
46  }
47  }
48  return (condition || fail);
49 }
50 
51 const bool operator==(const GenLumiInfoProduct& lhs, const GenLumiInfoProduct& rhs) {
52  std::vector<GenLumiInfoProduct::ProcessInfo> lhsVector = lhs.getProcessInfos();
53  std::vector<GenLumiInfoProduct::ProcessInfo> rhsVector = rhs.getProcessInfos();
54  std::sort(lhsVector.begin(), lhsVector.end());
55  std::sort(rhsVector.begin(), rhsVector.end());
56  unsigned int lhssize = lhsVector.size();
57  unsigned int rhssize = rhsVector.size();
58 
59  bool condition = (lhs.getHEPIDWTUP() == rhs.getHEPIDWTUP()) && (lhssize == rhssize);
60  unsigned int passCounts = 0;
61  if (condition) {
62  for (unsigned int i = 0; i < lhssize; i++) {
63  if (lhsVector[i] == rhsVector[i])
64  passCounts++;
65  }
66  }
67  return (condition && (passCounts == lhssize));
68 }
69 
71 
72 GenLumiInfoProduct::GenLumiInfoProduct(const int id) : hepidwtup_(id) { internalProcesses_.clear(); }
73 
75  : hepidwtup_(other.hepidwtup_), internalProcesses_(other.internalProcesses_) {}
76 
78 
80  std::map<int, ProcessInfo> processes;
81 
82  for (unsigned int i = 0; i < getProcessInfos().size(); i++) {
83  int id = getProcessInfos()[i].process();
85  x = getProcessInfos()[i];
86  }
87 
88  // the two GenLuminInfoProducts may not have the same number
89  // of processes
90  for (unsigned int i = 0; i < other.getProcessInfos().size(); i++) {
91  int id = other.getProcessInfos()[i].process();
93  if (x.lheXSec().value() > 0)
94  x.addOthers(other.getProcessInfos()[i]);
95  else
96  x = other.getProcessInfos()[i];
97  }
98 
99  internalProcesses_.resize(processes.size());
100  unsigned int i = 0;
101  for (std::map<int, ProcessInfo>::const_iterator iter = processes.begin(); iter != processes.end(); ++iter, i++)
102  internalProcesses_[i] = iter->second;
103  return true;
104 }
105 
107  std::swap(hepidwtup_, other.hepidwtup_);
108  internalProcesses_.swap(other.internalProcesses_);
109 }
110 
111 bool GenLumiInfoProduct::isProductEqual(GenLumiInfoProduct const& other) const { return ((*this) == other); }
mps_fire.i
i
Definition: mps_fire.py:428
MessageLogger.h
GenLumiInfoProduct::GenLumiInfoProduct
GenLumiInfoProduct()
Definition: GenLumiInfoProduct.cc:70
GenLumiInfoProduct::ProcessInfo::killed
const FinalStat & killed() const
Definition: GenLumiInfoProduct.h:102
edm
HLT enums.
Definition: AlignableModifier.h:19
GenLumiInfoProduct::~GenLumiInfoProduct
virtual ~GenLumiInfoProduct()
Definition: GenLumiInfoProduct.cc:77
GenLumiInfoProduct::ProcessInfo::lheXSec
const XSec & lheXSec() const
Definition: GenLumiInfoProduct.h:93
DDAxes::x
GenLumiInfoProduct::ProcessInfo::acceptedBr
const FinalStat & acceptedBr() const
Definition: GenLumiInfoProduct.h:104
edm::operator!=
bool operator!=(debugging_allocator< X > const &, debugging_allocator< Y > const &) noexcept
Definition: debugging_allocator.h:75
GenLumiInfoProduct::ProcessInfo::nPassPos
unsigned int nPassPos() const
Definition: GenLumiInfoProduct.h:95
std::swap
void swap(edm::DataFrameContainer &lhs, edm::DataFrameContainer &rhs)
Definition: DataFrameContainer.h:209
edm::operator==
bool operator==(debugging_allocator< X > const &, debugging_allocator< Y > const &) noexcept
Definition: debugging_allocator.h:72
GenLumiInfoProduct::ProcessInfo::nTotalPos
unsigned int nTotalPos() const
Definition: GenLumiInfoProduct.h:97
GenLumiInfoProduct::ProcessInfo
Definition: GenLumiInfoProduct.h:86
GenLumiInfoProduct::isProductEqual
virtual bool isProductEqual(const GenLumiInfoProduct &other) const
Definition: GenLumiInfoProduct.cc:111
GenLumiInfoProduct::getProcessInfos
const std::vector< ProcessInfo > & getProcessInfos() const
Definition: GenLumiInfoProduct.h:26
edm::operator<
bool operator<(DetSet< T > const &x, DetSet< T > const &y)
Definition: DetSet.h:89
trackingPlots.other
other
Definition: trackingPlots.py:1460
GenLumiInfoProduct::ProcessInfo::tried
const FinalStat & tried() const
Definition: GenLumiInfoProduct.h:100
GenLumiInfoProduct::hepidwtup_
int hepidwtup_
Definition: GenLumiInfoProduct.h:167
GenLumiInfoProduct::mergeProduct
virtual bool mergeProduct(const GenLumiInfoProduct &other)
Definition: GenLumiInfoProduct.cc:79
jetUpdater_cfi.sort
sort
Definition: jetUpdater_cfi.py:29
GenLumiInfoProduct::ProcessInfo::selected
const FinalStat & selected() const
Definition: GenLumiInfoProduct.h:101
GenLumiInfoProduct::swap
void swap(GenLumiInfoProduct &other)
Definition: GenLumiInfoProduct.cc:106
GenLumiInfoProduct
Definition: GenLumiInfoProduct.h:11
GenLumiInfoProduct::ProcessInfo::accepted
const FinalStat & accepted() const
Definition: GenLumiInfoProduct.h:103
GenLumiInfoProduct::ProcessInfo::nPassNeg
unsigned int nPassNeg() const
Definition: GenLumiInfoProduct.h:96
std
Definition: JetResolutionObject.h:76
GenLumiInfoProduct::ProcessInfo::nTotalNeg
unsigned int nTotalNeg() const
Definition: GenLumiInfoProduct.h:98
triggerObjects_cff.id
id
Definition: triggerObjects_cff.py:29
GenLumiInfoProduct::getHEPIDWTUP
const int getHEPIDWTUP() const
Definition: GenLumiInfoProduct.h:25
dqmiodatasetharvest.processes
processes
Definition: dqmiodatasetharvest.py:190
GenLumiInfoProduct::ProcessInfo::process
int process() const
Definition: GenLumiInfoProduct.h:92
GenLumiInfoProduct.h
GenLumiInfoProduct::internalProcesses_
std::vector< ProcessInfo > internalProcesses_
Definition: GenLumiInfoProduct.h:168