IAP GITLAB

Skip to content
Snippets Groups Projects
Commit ba6d1703 authored by ralfulrich's avatar ralfulrich
Browse files

better method names

parent 0a2584c9
No related branches found
No related tags found
1 merge request!83Resolve "Add energy loss process"
Pipeline #393 passed
......@@ -290,7 +290,7 @@ int main() {
const int nuclA = 4;
const int nuclZ = int(nuclA / 2.15 + 0.7);
const HEPMassType mass = GetNucleusMass(nuclA, nuclZ);
const HEPEnergyType E0 = nuclA * 100_GeV;
const HEPEnergyType E0 = nuclA * 10_TeV;
double theta = 0.;
double phi = 0.;
......@@ -321,7 +321,8 @@ int main() {
EAS.Init();
EAS.Run();
cout << "Result: E0=" << E0 / 1_GeV << endl;
eLoss.PrintProfile(); // print longitudinal profile
cut.ShowResults();
const HEPEnergyType Efinal =
cut.GetCutEnergy() + cut.GetInvEnergy() + cut.GetEmEnergy();
......@@ -329,5 +330,4 @@ int main() {
<< "relative difference (%): " << (Efinal / E0 - 1) * 100 << endl;
cout << "total dEdX energy (GeV): " << eLoss.GetTotal() / 1_GeV << endl
<< "relative difference (%): " << eLoss.GetTotal() / E0 * 100 << endl;
eLoss.SaveSave();
}
......@@ -35,7 +35,9 @@ namespace corsika::process::EnergyLoss {
};
EnergyLoss::EnergyLoss()
: fEnergyLossTot(0_GeV) {}
: fEnergyLossTot(0_GeV)
, fdX(10_g / square(1_cm)) // profile binning
{}
/**
* PDG2018, passage of particles through matter
......@@ -190,8 +192,6 @@ namespace corsika::process::EnergyLoss {
using namespace corsika::geometry;
const GrammageType deltaX = 10_g / square(1_cm); // binning
CoordinateSystem const& rootCS =
RootCoordinateSystem::GetInstance().GetRootCoordinateSystem();
Point pos1(rootCS, 0_m, 0_m, 0_m);
......@@ -202,17 +202,21 @@ namespace corsika::process::EnergyLoss {
GrammageType const grammage =
p.GetNode()->GetModelProperties().IntegratedGrammage(t, t.GetLength());
const int bin = grammage / deltaX;
const int bin = grammage / fdX;
if (!fSave.count(bin)) { cout << "EnergyLoss new x bin " << bin << endl; }
fSave[bin] += -dE / 1_GeV;
// fill longitudinal profile
if (!fProfile.count(bin)) { cout << "EnergyLoss new x bin " << bin << endl; }
fProfile[bin] += -dE / 1_GeV;
return bin;
}
void EnergyLoss::SaveSave() {
void EnergyLoss::PrintProfile() const {
cout << "EnergyLoss Save " << endl;
for (auto v : fSave) { cout << v.first << " " << v.second << endl; }
cout << "EnergyLoss PrintProfile X-bin [g/cm2] dE/dX [GeV/g/cm2] " << endl;
double const deltaX = fdX / 1_g * square(1_cm);
for (auto v : fProfile) {
cout << v.first * deltaX << " " << v.second / deltaX << endl;
}
}
} // namespace corsika::process::EnergyLoss
......@@ -41,7 +41,7 @@ namespace corsika::process::EnergyLoss {
corsika::setup::Trajectory&);
corsika::units::si::HEPEnergyType GetTotal() const { return fEnergyLossTot; }
void SaveSave();
void PrintProfile() const;
private:
corsika::units::si::HEPEnergyType BetheBloch(
......@@ -52,7 +52,8 @@ namespace corsika::process::EnergyLoss {
const corsika::units::si::HEPEnergyType dE);
corsika::units::si::HEPEnergyType fEnergyLossTot;
std::map<int, double> fSave;
corsika::units::si::GrammageType fdX; // profile binning
std::map<int, double> fProfile; // longitudinal profile
};
} // namespace corsika::process::EnergyLoss
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment