ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
InnerDetector
InDetConditions
TRT_ConditionsData
TRT_ConditionsData
ActiveFraction.h
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3
*/
4
5
#ifndef ACTIVEFRACTION_H
6
#define ACTIVEFRACTION_H
7
8
#include "
AthenaKernel/CLASS_DEF.h
"
9
#include "
AthenaKernel/CondCont.h
"
10
#include <cmath>
11
#include <vector>
12
13
#ifndef M_PI
14
#define M_PI 3.141592653589793238462643383279502884197
15
#endif
16
namespace
TRTCond
{
17
// eta,phi binned map of the active straw fraction
18
class
ActiveFraction
{
19
public
:
20
ActiveFraction
();
21
virtual
~ActiveFraction
(){};
22
int
findEtaBin
(
float
eta
)
const
;
23
int
findPhiBin
(
float
phi
)
const
;
24
float
getActiveFraction
(
float
eta
,
float
phi
)
const
;
25
const
std::vector<std::pair<float,float>>&
getEtaBins
( )
const
;
26
const
std::vector<std::pair<float,float>>&
getPhiBins
( )
const
;
27
void
setActiveFraction
(
unsigned
int
etaBin,
unsigned
int
phiBin,
float
value);
28
29
private
:
30
int
m_nBinsPhi
;
31
std::vector<std::pair<float,float> >
m_etaBins
;
32
std::vector<std::pair<float,float> >
m_phiBins
;
33
std::vector<std::vector<float> >
m_activeFracTable
;
// [etaBin,phiBin]
34
};
35
inline
ActiveFraction::ActiveFraction
() {
36
m_nBinsPhi
=96;
37
m_etaBins
.emplace_back( -2.1,-1.75);
38
m_etaBins
.emplace_back( -1.75,-1.3 );
39
m_etaBins
.emplace_back( -1.3,-1.07 );
40
m_etaBins
.emplace_back( -1.07,-0.65 );
41
m_etaBins
.emplace_back( -0.65,-0.1 );
42
m_etaBins
.emplace_back( -0.1,0. );
43
m_etaBins
.emplace_back( 0.,0.1 );
44
m_etaBins
.emplace_back( 0.1,0.65 );
45
m_etaBins
.emplace_back( 0.65,1.07 );
46
m_etaBins
.emplace_back( 1.07,1.3 );
47
m_etaBins
.emplace_back( 1.3,1.75 );
48
m_etaBins
.emplace_back( 1.75,2.1 );
49
float
phiEdgeLow = -1. *
M_PI
;
50
float
deltaPhi
= 2. *
M_PI
/ (1. *
m_nBinsPhi
) ;
51
for
(
int
i = 0; i <
m_nBinsPhi
; ++i ) {
52
m_phiBins
.push_back( std::make_pair( phiEdgeLow + i*
deltaPhi
, phiEdgeLow + (i+1)*
deltaPhi
) );
53
}
54
// Initialize the table with 1.'s
55
std::vector<float> dummyPhiVec(
m_phiBins
.size(), 1. );
56
std::vector<std::vector<float> > dummyTable(
m_etaBins
.size(), dummyPhiVec );
57
m_activeFracTable
= std::move(dummyTable);
58
}
59
60
inline
int
ActiveFraction::findEtaBin
(
float
eta
)
const
{
61
int
etaBin = 0;
62
for
( ; etaBin < (int)
m_etaBins
.size(); ++etaBin ) {
63
std::pair<float,float> theBin =
m_etaBins
.at(etaBin);
64
if
(
eta
> theBin.first &&
eta
<= theBin.second )
break
;
65
}
66
if
( etaBin == (
int
)
m_etaBins
.size() )
return
-1;
67
68
return
etaBin;
69
}
70
71
inline
int
ActiveFraction::findPhiBin
(
float
phi
)
const
{
72
int
phiBin = 0;
73
for
( ; phiBin < (int)
m_phiBins
.size(); ++phiBin ) {
74
std::pair<float,float> theBin =
m_phiBins
.at(phiBin);
75
if
(
phi
> theBin.first &&
phi
<= theBin.second )
break
;
76
}
77
if
( phiBin == (
int
)
m_phiBins
.size() )
return
-1;
78
return
phiBin;
79
}
80
81
inline
float
ActiveFraction::getActiveFraction
(
float
eta
,
float
phi
)
const
{
82
83
84
int
etaBin =
findEtaBin
(
eta
);
85
if
( etaBin < 0 )
return
1.;
86
int
phiBin =
findPhiBin
(
phi
);
87
if
( phiBin < 0 )
return
1.;
88
return
m_activeFracTable
[etaBin][phiBin];
89
}
90
inline
void
ActiveFraction::setActiveFraction
(
unsigned
int
etaBin,
unsigned
int
phiBin,
float
value) {
91
92
m_activeFracTable
[etaBin][phiBin] = value;
93
}
94
95
inline
const
std::vector<std::pair<float,float>>&
ActiveFraction::getEtaBins
( )
const
{
96
return
m_etaBins
;
97
}
98
99
inline
const
std::vector<std::pair<float,float>>&
ActiveFraction::getPhiBins
( )
const
{
100
return
m_phiBins
;
101
}
102
103
}
104
105
CLASS_DEF
(
TRTCond::ActiveFraction
,69272917,1)
106
CONDCONT_DEF
(
TRTCond
::ActiveFraction,85974973);
107
#endif
M_PI
#define M_PI
Definition
ActiveFraction.h:14
eta
Scalar eta() const
pseudorapidity method
Definition
AmgMatrixBasePlugin.h:83
deltaPhi
Scalar deltaPhi(const MatrixBase< Derived > &vec) const
Definition
AmgMatrixBasePlugin.h:112
phi
Scalar phi() const
phi method
Definition
AmgMatrixBasePlugin.h:67
CondCont.h
Hold mappings of ranges to condition objects.
CONDCONT_DEF
#define CONDCONT_DEF(...)
Definition
CondCont.h:1413
CLASS_DEF.h
macros to associate a CLID to a type
CLASS_DEF
#define CLASS_DEF(NAME, CID, VERSION)
associate a clid and a version to a type eg
Definition
Control/AthenaKernel/AthenaKernel/CLASS_DEF.h:67
TRTCond::ActiveFraction
Definition
ActiveFraction.h:18
TRTCond::ActiveFraction::m_phiBins
std::vector< std::pair< float, float > > m_phiBins
Definition
ActiveFraction.h:32
TRTCond::ActiveFraction::getActiveFraction
float getActiveFraction(float eta, float phi) const
Definition
ActiveFraction.h:81
TRTCond::ActiveFraction::findEtaBin
int findEtaBin(float eta) const
Definition
ActiveFraction.h:60
TRTCond::ActiveFraction::getEtaBins
const std::vector< std::pair< float, float > > & getEtaBins() const
Definition
ActiveFraction.h:95
TRTCond::ActiveFraction::m_nBinsPhi
int m_nBinsPhi
Definition
ActiveFraction.h:30
TRTCond::ActiveFraction::~ActiveFraction
virtual ~ActiveFraction()
Definition
ActiveFraction.h:21
TRTCond::ActiveFraction::m_activeFracTable
std::vector< std::vector< float > > m_activeFracTable
Definition
ActiveFraction.h:33
TRTCond::ActiveFraction::findPhiBin
int findPhiBin(float phi) const
Definition
ActiveFraction.h:71
TRTCond::ActiveFraction::ActiveFraction
ActiveFraction()
Definition
ActiveFraction.h:35
TRTCond::ActiveFraction::m_etaBins
std::vector< std::pair< float, float > > m_etaBins
Definition
ActiveFraction.h:31
TRTCond::ActiveFraction::setActiveFraction
void setActiveFraction(unsigned int etaBin, unsigned int phiBin, float value)
Definition
ActiveFraction.h:90
TRTCond::ActiveFraction::getPhiBins
const std::vector< std::pair< float, float > > & getPhiBins() const
Definition
ActiveFraction.h:99
TRTCond
Definition
BasicRtRelation.cxx:8
Generated on
for ATLAS Offline Software by
1.17.0