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 33 of file BichselData.cxx.

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

◆ addNewLogBetaGamma()

void BichselData::addNewLogBetaGamma ( double  logBetaGamma)

Definition at line 22 of file BichselData.cxx.

22  {
23  const std::vector<double> emptyArray;
24  if (not empty()) {
26  }
27  logBetaGammaVector.push_back(logBetaGamma);
28  logCollisionEnergyVectorOfVector.push_back(emptyArray);
29  logIntegratedCrossSectionsVectorOfVector.push_back(emptyArray);
30 }

◆ 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 50 of file BichselData.cxx.

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

◆ interpolateCollisionEnergy() [1/2]

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

Definition at line 107 of file BichselData.cxx.

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

◆ interpolateCollisionEnergy() [2/2]

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

Definition at line 72 of file BichselData.cxx.

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

◆ interpolateCrossSection() [1/2]

double BichselData::interpolateCrossSection ( double  BetaGammaLog10) const

Definition at line 149 of file BichselData.cxx.

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

◆ interpolateCrossSection() [2/2]

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

Definition at line 116 of file BichselData.cxx.

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

◆ 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 41 of file BichselData.cxx.

41  {
43 }

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:116
BichselData::getBetaGammaIndices
std::pair< int, int > getBetaGammaIndices(double BetaGammaLog10) const
Definition: BichselData.cxx:50
conifer::pow
constexpr int pow(int x)
Definition: conifer.h:20
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:72
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