CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
GenLumiInfoProduct.cc
Go to the documentation of this file.
1 #include <iostream>
2 #include <algorithm>
3 
5 
7 
8 using namespace edm;
9 using namespace std;
10 
11 
13 { return (lhs.process() < rhs.process()); }
14 
16 { bool condition = (lhs.process() != rhs.process()) ||
17  (lhs.lheXSec() != rhs.lheXSec());
18  return condition;
19 }
20 
22 {
23  bool condition=
24  (lhs.process() == rhs.process() && lhs.lheXSec() == rhs.lheXSec()
25  && lhs.nPassPos() == rhs.nPassPos() && lhs.nPassNeg() == rhs.nPassNeg()
26  && lhs.nTotalPos() == rhs.nTotalPos() && lhs.nTotalNeg() == rhs.nTotalNeg()
27  && lhs.tried() == rhs.tried() && lhs.selected() == rhs.selected()
28  && lhs.killed() == rhs.killed() && lhs.accepted() == rhs.accepted()
29  && lhs.acceptedBr() == rhs.acceptedBr());
30  return condition;
31 }
32 
33 const bool operator !=(const GenLumiInfoProduct& lhs, const GenLumiInfoProduct& rhs)
34 {
35  std::vector<GenLumiInfoProduct::ProcessInfo> lhsVector = lhs.getProcessInfos();
36  std::vector<GenLumiInfoProduct::ProcessInfo> rhsVector = rhs.getProcessInfos();
37  std::sort(lhsVector.begin(),lhsVector.end());
38  std::sort(rhsVector.begin(),rhsVector.end());
39  unsigned int lhssize=lhsVector.size();
40  unsigned int rhssize=rhsVector.size();
41  bool condition= (lhs.getHEPIDWTUP() != rhs.getHEPIDWTUP()) ||
42  (lhssize != rhssize);
43  bool fail=false;
44  if(!condition)
45  {
46  for(unsigned int i=0; i<lhssize; i++){
47  if(lhsVector[i] != rhsVector[i])
48  {
49  fail=true;
50  break;
51  }
52 
53  }
54 
55  }
56  return (condition || fail);
57 
58 }
59 
60 
61 const bool operator ==(const GenLumiInfoProduct& lhs, const GenLumiInfoProduct& rhs)
62 {
63  std::vector<GenLumiInfoProduct::ProcessInfo> lhsVector = lhs.getProcessInfos();
64  std::vector<GenLumiInfoProduct::ProcessInfo> rhsVector = rhs.getProcessInfos();
65  std::sort(lhsVector.begin(),lhsVector.end());
66  std::sort(rhsVector.begin(),rhsVector.end());
67  unsigned int lhssize=lhsVector.size();
68  unsigned int rhssize=rhsVector.size();
69 
70  bool condition= (lhs.getHEPIDWTUP() == rhs.getHEPIDWTUP()) &&
71  (lhssize == rhssize);
72  unsigned int passCounts=-999;
73  if(condition)
74  {
75  for(unsigned int i=0; i<lhssize; i++){
76  if(lhsVector[i] == rhsVector[i])
77  passCounts++;
78  }
79  }
80  return (condition && (passCounts==lhssize));
81 
82 }
83 
84 
86  hepidwtup_(-1)
87 {
88  internalProcesses_.clear();
89 
90 }
91 
93  hepidwtup_(id)
94 {
95  internalProcesses_.clear();
96 }
97 
99  hepidwtup_(other.hepidwtup_),
100  internalProcesses_(other.internalProcesses_)
101 {
102 }
103 
105 {
106 }
107 
109 {
110  if ( (*this) != other)
111  {
112 
113  edm::LogWarning("GenLumiInfoProduct|ProductsNotMergeable")
114  << "You are merging runs with different cross-sections"
115  "The resulting cross-section will not be consistent." << std::endl;
116 
117  return false;
118  }
119  for(unsigned int i=0; i < internalProcesses_.size(); i++)
120  {
121  internalProcesses_[i].addOthers(other.getProcessInfos()[i]);
122 
123  }
124 
125  return true;
126 }
127 
129 {
130  return ((*this) == other);
131 }
132 
133 
135 {
136 
137  unsigned int lhssize=getProcessInfos().size();
138  unsigned int rhssize=other.getProcessInfos().size();
139  return ( (getHEPIDWTUP() == other.getHEPIDWTUP()) &&
140  (lhssize == rhssize));
141 
142 }
143 
bool operator<(DetSet< T > const &x, DetSet< T > const &y)
Definition: DetSet.h:91
const std::vector< ProcessInfo > & getProcessInfos() const
int i
Definition: DBlmapReader.cc:9
bool operator!=(debugging_allocator< X > const &, debugging_allocator< Y > const &)
bool operator==(debugging_allocator< X > const &, debugging_allocator< Y > const &)
virtual bool samePhysics(const GenLumiInfoProduct &other) const
virtual bool isProductEqual(const GenLumiInfoProduct &other) const
virtual bool mergeProduct(const GenLumiInfoProduct &other)
std::vector< ProcessInfo > internalProcesses_
const int getHEPIDWTUP() const