-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #15 from Jean1995/master
Include pairproduction of muons as a new process
- Loading branch information
Showing
24 changed files
with
2,337 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
|
||
#include <functional> | ||
|
||
#include "PROPOSAL/Constants.h" | ||
#include "PROPOSAL/crossection/MupairIntegral.h" | ||
#include "PROPOSAL/crossection/parametrization/MupairProduction.h" | ||
#include "PROPOSAL/medium/Medium.h" | ||
|
||
using namespace PROPOSAL; | ||
|
||
MupairIntegral::MupairIntegral(const MupairProduction& param) | ||
: CrossSectionIntegral(DynamicData::MuPair, param) | ||
{ | ||
} | ||
|
||
MupairIntegral::MupairIntegral(const MupairIntegral& mupair) | ||
: CrossSectionIntegral(mupair) | ||
{ | ||
} | ||
|
||
MupairIntegral::~MupairIntegral() {} | ||
|
||
// ----------------------------------------------------------------- // | ||
// Public methods | ||
// ----------------------------------------------------------------- // | ||
|
||
double MupairIntegral::CalculatedEdx(double energy) | ||
{ | ||
if (parametrization_->GetMultiplier() <= 0) | ||
{ | ||
return 0; | ||
} | ||
|
||
double sum = 0; | ||
|
||
for (int i = 0; i < parametrization_->GetMedium().GetNumComponents(); i++) | ||
{ | ||
parametrization_->SetCurrentComponent(i); | ||
Parametrization::IntegralLimits limits = parametrization_->GetIntegralLimits(energy); | ||
|
||
sum += dedx_integral_.Integrate( | ||
limits.vMin, | ||
limits.vUp, | ||
std::bind(&Parametrization::FunctionToDEdxIntegral, parametrization_, energy, std::placeholders::_1), | ||
4); | ||
} | ||
|
||
return energy * sum; | ||
} | ||
|
||
std::vector<Particle*> MupairIntegral::CalculateProducedParticles(double energy, double energy_loss, double rnd1, double rnd2){ | ||
|
||
//Create MuPair particles | ||
std::vector<Particle*> mupair; | ||
mupair.push_back(new Particle(MuMinusDef::Get())); | ||
mupair.push_back(new Particle(MuPlusDef::Get())); | ||
|
||
//Sample and assign energies | ||
double rho = parametrization_->Calculaterho(energy, energy_loss/energy, rnd1, rnd2); | ||
|
||
mupair[0]->SetEnergy(0.5*energy_loss*(1 + rho)); | ||
mupair[1]->SetEnergy(0.5*energy_loss*(1 - rho)); | ||
return mupair; | ||
|
||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,111 @@ | ||
|
||
#include <functional> | ||
|
||
#include "PROPOSAL/crossection/MupairIntegral.h" | ||
#include "PROPOSAL/crossection/MupairInterpolant.h" | ||
#include "PROPOSAL/crossection/parametrization/MupairProduction.h" | ||
|
||
#include "PROPOSAL/math/Interpolant.h" | ||
#include "PROPOSAL/math/InterpolantBuilder.h" | ||
|
||
#include "PROPOSAL/Constants.h" | ||
#include "PROPOSAL/Output.h" | ||
#include "PROPOSAL/methods.h" | ||
|
||
using namespace PROPOSAL; | ||
|
||
MupairInterpolant::MupairInterpolant(const MupairProduction& param, InterpolationDef def) | ||
: CrossSectionInterpolant(DynamicData::MuPair, param) | ||
{ | ||
// Use parent CrossSecition dNdx interpolation | ||
InitdNdxInerpolation(def); | ||
|
||
// --------------------------------------------------------------------- // | ||
// Builder for DEdx | ||
// --------------------------------------------------------------------- // | ||
|
||
Interpolant1DBuilder builder1d; | ||
Helper::InterpolantBuilderContainer builder_container; | ||
|
||
// Needed for CalculatedEdx integration | ||
MupairIntegral mupair(param); | ||
|
||
builder1d.SetMax(NUM1) | ||
.SetXMin(param.GetParticleDef().low) | ||
.SetXMax(BIGENERGY) | ||
.SetRomberg(def.order_of_interpolation) | ||
.SetRational(true) | ||
.SetRelative(false) | ||
.SetIsLog(true) | ||
.SetRombergY(def.order_of_interpolation) | ||
.SetRationalY(false) | ||
.SetRelativeY(false) | ||
.SetLogSubst(true) | ||
.SetFunction1D(std::bind(&CrossSection::CalculatedEdx, &mupair, std::placeholders::_1)); | ||
|
||
builder_container.push_back(std::make_pair(&builder1d, &dedx_interpolant_)); | ||
|
||
// --------------------------------------------------------------------- // | ||
// Builder for DE2dx | ||
// --------------------------------------------------------------------- // | ||
|
||
Interpolant1DBuilder builder_de2dx; | ||
Helper::InterpolantBuilderContainer builder_container_de2dx; | ||
|
||
builder_de2dx.SetMax(NUM2) | ||
.SetXMin(param.GetParticleDef().low) | ||
.SetXMax(BIGENERGY) | ||
.SetRomberg(def.order_of_interpolation) | ||
.SetRational(false) | ||
.SetRelative(false) | ||
.SetIsLog(true) | ||
.SetRombergY(def.order_of_interpolation) | ||
.SetRationalY(false) | ||
.SetRelativeY(false) | ||
.SetLogSubst(false) | ||
.SetFunction1D(std::bind(&CrossSection::CalculatedE2dx, &mupair, std::placeholders::_1)); | ||
|
||
builder_container_de2dx.push_back(std::make_pair(&builder_de2dx, &de2dx_interpolant_)); | ||
|
||
Helper::InitializeInterpolation("dEdx", builder_container, std::vector<Parametrization*>(1, parametrization_), def); | ||
Helper::InitializeInterpolation( | ||
"dE2dx", builder_container_de2dx, std::vector<Parametrization*>(1, parametrization_), def); | ||
} | ||
|
||
MupairInterpolant::MupairInterpolant(const MupairInterpolant& mupair) | ||
: CrossSectionInterpolant(mupair) | ||
{ | ||
} | ||
|
||
MupairInterpolant::~MupairInterpolant() {} | ||
|
||
// ----------------------------------------------------------------- // | ||
// Public methods | ||
// ----------------------------------------------------------------- // | ||
|
||
// ------------------------------------------------------------------------- // | ||
double MupairInterpolant::CalculatedEdx(double energy) | ||
{ | ||
if (parametrization_->GetMultiplier() <= 0) | ||
{ | ||
return 0; | ||
} | ||
|
||
return std::max(dedx_interpolant_->Interpolate(energy), 0.0); | ||
} | ||
|
||
std::vector<Particle*> MupairInterpolant::CalculateProducedParticles(double energy, double energy_loss, double rnd1, double rnd2){ | ||
|
||
//Create MuPair particles | ||
std::vector<Particle*> mupair; | ||
mupair.push_back(new Particle(MuMinusDef::Get())); | ||
mupair.push_back(new Particle(MuPlusDef::Get())); | ||
|
||
//Sample and assign energies | ||
double rho = parametrization_->Calculaterho(energy, energy_loss/energy, rnd1, rnd2); | ||
|
||
mupair[0]->SetEnergy(0.5*energy_loss*(1 + rho)); | ||
mupair[1]->SetEnergy(0.5*energy_loss*(1 - rho)); | ||
return mupair; | ||
|
||
} |
Oops, something went wrong.