ATLAS Offline Software
PairBuilder.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3 */
4 
13 #include "PairBuilder.h"
14 
16 {
17 }
18 PairBuilder ::~ PairBuilder()
19 {
20 
21 }
22 
23 void PairBuilder ::inputx(const int xstrip){
24  bool xValueInserted = m_xvalues.insert(xstrip).second;
25  if ((not m_yvalues.empty()) and xValueInserted) formNewPairsWithX(xstrip);
26 }
27 void PairBuilder ::inputy(const int ystrip){
28  bool yValueInserted = m_yvalues.insert(ystrip).second;
29  if ((not m_xvalues.empty()) and yValueInserted) formNewPairsWithY(ystrip);
30 }
31 void PairBuilder ::inputxy(const int xystrip){
32  bool xValueInserted = m_xvalues.insert(xystrip).second;
33  bool yValueInserted = m_yvalues.insert(xystrip).second;
34  if ((not m_xvalues.empty()) and (not m_yvalues.empty()) and xValueInserted and yValueInserted) {
35  formNewPairsWithX(xystrip);
36  formNewPairsWithY(xystrip);
37  }
38 }
40  return m_pairs.size();
41 }
43  return m_pairs;
44 }
45 float PairBuilder::weight() const {
46  return 1.0/numberOfPairs();
47 }
49  return m_pairs.at(indx);
50 }
51 
52 int PairBuilder::xOfPairAt(const int indx) const {
53  return pairAtIndex(indx).first;
54 }
55 
56 int PairBuilder::yOfPairAt(const int indx) const {
57  return pairAtIndex(indx).second;
58 }
59 
61  IntSet::iterator pthisY;
62  for(pthisY = m_yvalues.begin(); pthisY != m_yvalues.end(); ++pthisY) {
63  m_pairs.push_back(XYPair(xval,*pthisY));
64  }
65 }
67  IntSet::iterator pthisX;
68  for(pthisX = m_xvalues.begin(); pthisX != m_xvalues.end(); ++pthisX) {
69  m_pairs.push_back(XYPair(*pthisX, yval));
70  }
71 }
72 
73 std::ostream & operator<< (std::ostream &os, const PairBuilder &e) {
74  int arrSize = e.numberOfPairs();
75  for(int i=0; i<arrSize;++i){
76  os << "( " << e.xOfPairAt(i) << ", " << e.yOfPairAt(i) << " )" << std::endl;
77  }
78  return os;
79 }
xAOD::iterator
JetConstituentVector::iterator iterator
Definition: JetConstituentVector.cxx:68
PairBuilder::PairVector
std::vector< XYPair > PairVector
Definition: PairBuilder.h:36
PairBuilder::formNewPairsWithY
void formNewPairsWithY(const int yval)
Definition: PairBuilder.cxx:66
operator<<
std::ostream & operator<<(std::ostream &os, const PairBuilder &e)
Overloaded "operator <<" for output of PairBuilder objects.
Definition: PairBuilder.cxx:73
PairBuilder::pairs
const PairVector & pairs() const
Return the pairs as a vector of pairs of integers.
Definition: PairBuilder.cxx:42
PairBuilder::PairBuilder
PairBuilder()
Definition: PairBuilder.cxx:15
PairBuilder
Class to build pairs of XY values.
Definition: PairBuilder.h:30
PairBuilder::weight
float weight() const
Return the 'weight', = 1/(number of pairs)
Definition: PairBuilder.cxx:45
PairBuilder::m_yvalues
IntSet m_yvalues
Definition: PairBuilder.h:61
PairBuilder::XYPair
std::pair< int, int > XYPair
Definition: PairBuilder.h:35
PairBuilder::yOfPairAt
int yOfPairAt(const int indx) const
Return the Y value of a specific pair.
Definition: PairBuilder.cxx:56
PairBuilder::inputx
void inputx(const int xstrip)
Input a new x value.
Definition: PairBuilder.cxx:23
lumiFormat.i
int i
Definition: lumiFormat.py:92
PairBuilder::formNewPairsWithX
void formNewPairsWithX(const int xval)
Definition: PairBuilder.cxx:60
plotting.yearwise_efficiency.yval
float yval
Definition: yearwise_efficiency.py:43
PairBuilder::xOfPairAt
int xOfPairAt(const int indx) const
Return the X value of a specific pair.
Definition: PairBuilder.cxx:52
plotting.yearwise_efficiency.xval
float xval
Definition: yearwise_efficiency.py:42
ReadFromCoolCompare.os
os
Definition: ReadFromCoolCompare.py:231
PairBuilder::numberOfPairs
int numberOfPairs() const
Return the number of XY pairs made.
Definition: PairBuilder.cxx:39
DiTauMassTools::MaxHistStrategyV2::e
e
Definition: PhysicsAnalysis/TauID/DiTauMassTools/DiTauMassTools/HelperFunctions.h:26
PairBuilder::inputxy
void inputxy(const int ystrip)
Input a new y value.
Definition: PairBuilder.cxx:31
PairBuilder::inputy
void inputy(const int ystrip)
Input a new y value.
Definition: PairBuilder.cxx:27
PairBuilder::m_xvalues
IntSet m_xvalues
use sets to avoid duplicate values
Definition: PairBuilder.h:63
PairBuilder.h
PairBuilder::m_pairs
PairVector m_pairs
Vector to hold the pairs produced.
Definition: PairBuilder.h:66
PairBuilder::pairAtIndex
XYPair pairAtIndex(const int indx) const
Return a specific XY pair at some vector index.
Definition: PairBuilder.cxx:48