ATLAS Offline Software
Public Member Functions | Public Attributes | List of all members
BichselData Struct Reference

#include <BichselData.h>

Collaboration diagram for BichselData:

Public Member Functions

bool empty () const
 
size_t size () const
 
double lastBetaGammaValue () const
 
void addNewLogBetaGamma (double logBetaGamma)
 
void addEntry (double logBetaGamma, double logCollisionEnergy, double logIntegratedCrossSection)
 
void updateAfterLastEntry ()
 
std::pair< int, int > getBetaGammaIndices (double BetaGammaLog10) const
 
double interpolateCollisionEnergy (std::pair< int, int > indices_BetaGammaLog10, double IntXLog10) const
 
double interpolateCollisionEnergy (double BetaGammaLog10, double IntXLog10) const
 
double interpolateCrossSection (std::pair< int, int > indices_BetaGammaLog10, double BetaGammaLog10) const
 
double interpolateCrossSection (double BetaGammaLog10) const
 

Public Attributes

std::vector< double > logBetaGammaVector
 
std::vector< std::vector< double > > logCollisionEnergyVectorOfVector
 
std::vector< std::vector< double > > logIntegratedCrossSectionsVectorOfVector
 
std::vector< double > logHighestCrossSectionsVector
 

Detailed Description

Definition at line 14 of file BichselData.h.

Member Function Documentation

◆ addEntry()

void BichselData::addEntry ( double  logBetaGamma,
double  logCollisionEnergy,
double  logIntegratedCrossSection 
)

Definition at line 34 of file BichselData.cxx.

34  {
35  if (empty() or (lastBetaGammaValue() != logBetaGamma)) { // a new BetaGamma
36  addNewLogBetaGamma(logBetaGamma);
37  }
38  logCollisionEnergyVectorOfVector.back().push_back(logCollisionEnergy);
39  logIntegratedCrossSectionsVectorOfVector.back().push_back(logIntegratedCrossSection);
40 }

◆ addNewLogBetaGamma()

void BichselData::addNewLogBetaGamma ( double  logBetaGamma)

Definition at line 22 of file BichselData.cxx.

22  {
23 
24  if (not empty()) {
26  }
27  logBetaGammaVector.push_back(logBetaGamma);
28  //insert empty arrays
29  logCollisionEnergyVectorOfVector.emplace_back();
31 }

◆ empty()

bool BichselData::empty ( ) const
inline

Definition at line 22 of file BichselData.h.

22 { return logBetaGammaVector.empty();}

◆ getBetaGammaIndices()

std::pair< int, int > BichselData::getBetaGammaIndices ( double  BetaGammaLog10) const

Definition at line 51 of file BichselData.cxx.

51  {
52  std::pair<int, int> indices_BetaGammaLog10;
53  if (empty()) return {-1,-1};
54  if (BetaGammaLog10 > logBetaGammaVector.back()) { // last one is used because when beta-gamma is very large,
55  // energy deposition behavior is very similar
56  indices_BetaGammaLog10.first = logBetaGammaVector.size() - 1;
57  indices_BetaGammaLog10.second = logBetaGammaVector.size() - 1;
58  } else {
59  indices_BetaGammaLog10 =PixelDigitization::fastSearch(logBetaGammaVector, BetaGammaLog10);
60  }
61 
62  return indices_BetaGammaLog10;
63 }

◆ interpolateCollisionEnergy() [1/2]

double BichselData::interpolateCollisionEnergy ( double  BetaGammaLog10,
double  IntXLog10 
) const

Definition at line 108 of file BichselData.cxx.

108  {
109  std::pair<int, int> indices_BetaGammaLog10 = getBetaGammaIndices(BetaGammaLog10);
110  return interpolateCollisionEnergy(indices_BetaGammaLog10, IntXLog10);
111 }

◆ interpolateCollisionEnergy() [2/2]

double BichselData::interpolateCollisionEnergy ( std::pair< int, int >  indices_BetaGammaLog10,
double  IntXLog10 
) const

Definition at line 73 of file BichselData.cxx.

73  {
74  if ((indices_BetaGammaLog10.first == -1) && (indices_BetaGammaLog10.second == -1)) return -1.;
75  if (empty()) return -1.;
76 
77 
78  // BetaGammaLog10_2 then
79  std::pair<int, int> indices_IntXLog10_x2 =
80  PixelDigitization::fastSearch(logIntegratedCrossSectionsVectorOfVector[indices_BetaGammaLog10.second], IntXLog10);
81  if (indices_IntXLog10_x2.first < 0) {
82  return -1;
83  }
84  if (indices_IntXLog10_x2.second < 0) {
85  return -1;
86  }
87 
88  double y21 = logIntegratedCrossSectionsVectorOfVector.at(indices_BetaGammaLog10.second).at(indices_IntXLog10_x2.first);
89  double y22 = logIntegratedCrossSectionsVectorOfVector.at(indices_BetaGammaLog10.second).at(indices_IntXLog10_x2.second);
90  const auto diff = y22 - y21;
91  if (diff<1e-300){
92  //these are the same value
93  return -1;
94  }
95  double Est_x2 =
96  ((y22 - IntXLog10) *
97  logCollisionEnergyVectorOfVector[indices_BetaGammaLog10.second][indices_IntXLog10_x2.first] +
98  (IntXLog10 - y21) *
99  logCollisionEnergyVectorOfVector[indices_BetaGammaLog10.second][indices_IntXLog10_x2.second]) / diff;
100  double Est = std::clamp(Est_x2,-300.,300.);
101  return std::pow(10., Est);
102 }

◆ interpolateCrossSection() [1/2]

double BichselData::interpolateCrossSection ( double  BetaGammaLog10) const

Definition at line 150 of file BichselData.cxx.

150  {
151  std::pair<int, int> indices_BetaGammaLog10 = getBetaGammaIndices(BetaGammaLog10);
152  return interpolateCrossSection(indices_BetaGammaLog10, BetaGammaLog10);
153 }

◆ interpolateCrossSection() [2/2]

double BichselData::interpolateCrossSection ( std::pair< int, int >  indices_BetaGammaLog10,
double  BetaGammaLog10 
) const

Definition at line 117 of file BichselData.cxx.

117  {
118  if (empty()) return -1;
119  if (indices_BetaGammaLog10.first < 0) {
120  return -1;
121  }
122  if (indices_BetaGammaLog10.second < 0) {
123  return -1;
124  }
125  if (indices_BetaGammaLog10.second == indices_BetaGammaLog10.first){ //either an exact value or the last one in the table
126  return std::pow(10., logHighestCrossSectionsVector.at(indices_BetaGammaLog10.first));
127  }
128  double BetaGammaLog10_1 = logBetaGammaVector.at(indices_BetaGammaLog10.first);
129  double BetaGammaLog10_2 = logBetaGammaVector.at(indices_BetaGammaLog10.second);
130 
131  // obtain estimation
132  double Est_1 = logHighestCrossSectionsVector.at(indices_BetaGammaLog10.first);
133  double Est_2 = logHighestCrossSectionsVector.at(indices_BetaGammaLog10.second);
134 
135  // final estimation
136  const auto diff=BetaGammaLog10_2 - BetaGammaLog10_1;
137  if (diff<1e-300){
138  return -1;
139  }
140  double Est = ((BetaGammaLog10_2 - BetaGammaLog10) * Est_1 + (BetaGammaLog10 - BetaGammaLog10_1) * Est_2) /diff;
141  Est = std::clamp(Est,-300.,300.);
142  return std::pow(10., Est);
143 
144 
145 }

◆ lastBetaGammaValue()

double BichselData::lastBetaGammaValue ( ) const

Definition at line 12 of file BichselData.cxx.

12  {
13  if (not logBetaGammaVector.empty()){
14  return logBetaGammaVector.back();
15  } else {
16  return std::numeric_limits<double>::quiet_NaN();
17  }
18 }

◆ size()

size_t BichselData::size ( ) const
inline

Definition at line 23 of file BichselData.h.

23 { return logBetaGammaVector.size();}

◆ updateAfterLastEntry()

void BichselData::updateAfterLastEntry ( )

Definition at line 42 of file BichselData.cxx.

42  {
44 }

Member Data Documentation

◆ logBetaGammaVector

std::vector<double> BichselData::logBetaGammaVector

Definition at line 16 of file BichselData.h.

◆ logCollisionEnergyVectorOfVector

std::vector<std::vector<double> > BichselData::logCollisionEnergyVectorOfVector

Definition at line 17 of file BichselData.h.

◆ logHighestCrossSectionsVector

std::vector<double> BichselData::logHighestCrossSectionsVector

Definition at line 19 of file BichselData.h.

◆ logIntegratedCrossSectionsVectorOfVector

std::vector<std::vector<double> > BichselData::logIntegratedCrossSectionsVectorOfVector

Definition at line 18 of file BichselData.h.


The documentation for this struct was generated from the following files:
AllowedVariables::e
e
Definition: AsgElectronSelectorTool.cxx:37
BichselData::interpolateCrossSection
double interpolateCrossSection(std::pair< int, int > indices_BetaGammaLog10, double BetaGammaLog10) const
Definition: BichselData.cxx:117
BichselData::getBetaGammaIndices
std::pair< int, int > getBetaGammaIndices(double BetaGammaLog10) const
Definition: BichselData.cxx:51
mc.diff
diff
Definition: mc.SFGenPy8_MuMu_DD.py:14
BichselData::logBetaGammaVector
std::vector< double > logBetaGammaVector
Definition: BichselData.h:16
BichselData::interpolateCollisionEnergy
double interpolateCollisionEnergy(std::pair< int, int > indices_BetaGammaLog10, double IntXLog10) const
Definition: BichselData.cxx:73
BichselData::logHighestCrossSectionsVector
std::vector< double > logHighestCrossSectionsVector
Definition: BichselData.h:19
BichselData::addNewLogBetaGamma
void addNewLogBetaGamma(double logBetaGamma)
Definition: BichselData.cxx:22
BichselData::logCollisionEnergyVectorOfVector
std::vector< std::vector< double > > logCollisionEnergyVectorOfVector
Definition: BichselData.h:17
BichselData::empty
bool empty() const
Definition: BichselData.h:22
PixelDigitization::fastSearch
std::pair< int, int > fastSearch(const std::vector< double > &vec, double item)
Definition: PixelDigitizationUtilities.cxx:73
BichselData::lastBetaGammaValue
double lastBetaGammaValue() const
Definition: BichselData.cxx:12
BichselData::logIntegratedCrossSectionsVectorOfVector
std::vector< std::vector< double > > logIntegratedCrossSectionsVectorOfVector
Definition: BichselData.h:18
pow
constexpr int pow(int base, int exp) noexcept
Definition: ap_fixedTest.cxx:15