ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
TileCalorimeter
TileMonitoring
src
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
12
13
#include "
PairBuilder.h
"
14
15
PairBuilder :: PairBuilder()
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
}
39
int
PairBuilder::numberOfPairs
()
const
{
40
return
m_pairs
.size();
41
}
42
const
PairBuilder::PairVector
&
PairBuilder::pairs
()
const
{
43
return
m_pairs
;
44
}
45
float
PairBuilder::weight
()
const
{
46
return
1.0/
numberOfPairs
();
47
}
48
PairBuilder::XYPair
PairBuilder::pairAtIndex
(
const
int
indx)
const
{
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
60
void
PairBuilder::formNewPairsWithX
(
const
int
xval){
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
}
66
void
PairBuilder::formNewPairsWithY
(
const
int
yval){
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
}
operator<<
std::ostream & operator<<(std::ostream &os, const PairBuilder &e)
Overloaded "operator <<" for output of PairBuilder objects.
Definition
PairBuilder.cxx:73
PairBuilder.h
Contains class declaration for PairBuilder, and overloaded "operator <<" for output of same.
PairBuilder
Class to build pairs of XY values.
Definition
PairBuilder.h:30
PairBuilder::xOfPairAt
int xOfPairAt(const int indx) const
Return the X value of a specific pair.
Definition
PairBuilder.cxx:52
PairBuilder::m_yvalues
IntSet m_yvalues
Definition
PairBuilder.h:61
PairBuilder::formNewPairsWithY
void formNewPairsWithY(const int yval)
Definition
PairBuilder.cxx:66
PairBuilder::numberOfPairs
int numberOfPairs() const
Return the number of XY pairs made.
Definition
PairBuilder.cxx:39
PairBuilder::pairs
const PairVector & pairs() const
Return the pairs as a vector of pairs of integers.
Definition
PairBuilder.cxx:42
PairBuilder::weight
float weight() const
Return the 'weight', = 1/(number of pairs).
Definition
PairBuilder.cxx:45
PairBuilder::yOfPairAt
int yOfPairAt(const int indx) const
Return the Y value of a specific pair.
Definition
PairBuilder.cxx:56
PairBuilder::PairVector
std::vector< XYPair > PairVector
Definition
PairBuilder.h:36
PairBuilder::formNewPairsWithX
void formNewPairsWithX(const int xval)
Definition
PairBuilder.cxx:60
PairBuilder::m_pairs
PairVector m_pairs
Vector to hold the pairs produced.
Definition
PairBuilder.h:66
PairBuilder::XYPair
std::pair< int, int > XYPair
Definition
PairBuilder.h:35
PairBuilder::pairAtIndex
XYPair pairAtIndex(const int indx) const
Return a specific XY pair at some vector index.
Definition
PairBuilder.cxx:48
PairBuilder::m_xvalues
IntSet m_xvalues
use sets to avoid duplicate values
Definition
PairBuilder.h:63
Generated on
for ATLAS Offline Software by
1.17.0