IAP GITLAB

Skip to content
Snippets Groups Projects
Commit 3c9b9106 authored by Felix Riehn's avatar Felix Riehn
Browse files

added decay configuration routines, turned on decay for sibyll interaction

parent b92396ee
No related branches found
No related tags found
1 merge request!28Sibyll
...@@ -43,6 +43,35 @@ class ProcessSplit : public corsika::process::BaseProcess<ProcessSplit> { ...@@ -43,6 +43,35 @@ class ProcessSplit : public corsika::process::BaseProcess<ProcessSplit> {
public: public:
ProcessSplit() {} ProcessSplit() {}
void setTrackedParticlesStable() const {
/*
Sibyll is hadronic generator
only hadrons decay
*/
// set particles unstable
corsika::process::sibyll::setHadronsUnstable();
// make tracked particles stable
std::cout << "ProcessSplit: setting tracked hadrons stable.." << std::endl;
setup::Stack ds;
ds.NewParticle().SetPID(Code::PiPlus);
ds.NewParticle().SetPID(Code::PiMinus);
ds.NewParticle().SetPID(Code::KPlus);
ds.NewParticle().SetPID(Code::KMinus);
ds.NewParticle().SetPID(Code::K0Long);
ds.NewParticle().SetPID(Code::K0Short);
for (auto& p : ds) {
int s_id = process::sibyll::ConvertToSibyllRaw(p.GetPID());
// set particle stable by setting table value negative
// cout << "ProcessSplit: doDiscrete: setting " << p.GetPID() << "(" << s_id << ")"
// << " stable in Sibyll .." << endl;
s_csydec_.idb[s_id - 1] = (-1) * abs( s_csydec_.idb[s_id - 1] );
p.Delete();
}
}
template <typename Particle> template <typename Particle>
double MinStepLength(Particle& p, setup::Trajectory&) const { double MinStepLength(Particle& p, setup::Trajectory&) const {
...@@ -211,7 +240,8 @@ public: ...@@ -211,7 +240,8 @@ public:
// running sibyll, filling stack // running sibyll, filling stack
sibyll_( kBeam, kTarget, sqs); sibyll_( kBeam, kTarget, sqs);
// running decays // running decays
//decsib_(); setTrackedParticlesStable();
decsib_();
// print final state // print final state
int print_unit = 6; int print_unit = 6;
sib_list_( print_unit ); sib_list_( print_unit );
...@@ -228,6 +258,9 @@ public: ...@@ -228,6 +258,9 @@ public:
super_stupid::MomentumVector Ptot_final(rootCS, {0.0_newton_second, 0.0_newton_second, 0.0_newton_second}); super_stupid::MomentumVector Ptot_final(rootCS, {0.0_newton_second, 0.0_newton_second, 0.0_newton_second});
for (auto &psib: ss){ for (auto &psib: ss){
++i; ++i;
// skip particles that have decayed in Sibyll
if( abs(s_plist_.llist[ i ]) > 100 ) continue;
//transform energy to lab. frame, primitve //transform energy to lab. frame, primitve
// compute beta_vec * p_vec // compute beta_vec * p_vec
// arbitrary Lorentz transformation based on sibyll routines // arbitrary Lorentz transformation based on sibyll routines
...@@ -300,29 +333,10 @@ public: ...@@ -300,29 +333,10 @@ public:
// initialize Sibyll // initialize Sibyll
sibyll_ini_(); sibyll_ini_();
// set particles stable / unstable setTrackedParticlesStable();
// use stack to loop over particles
setup::Stack ds;
ds.NewParticle().SetPID(Code::Proton);
ds.NewParticle().SetPID(Code::Neutron);
ds.NewParticle().SetPID(Code::PiPlus);
ds.NewParticle().SetPID(Code::PiMinus);
ds.NewParticle().SetPID(Code::Pi0);
ds.NewParticle().SetPID(Code::KPlus);
ds.NewParticle().SetPID(Code::KMinus);
ds.NewParticle().SetPID(Code::K0Long);
ds.NewParticle().SetPID(Code::K0Short);
for (auto& p : ds) {
int s_id = process::sibyll::ConvertToSibyllRaw(p.GetPID());
// set particle stable by setting table value negative
cout << "ProcessSplit: Init: setting " << p.GetPID() << "(" << s_id << ")"
<< " stable in Sibyll .." << endl;
s_csydec_.idb[s_id] = -s_csydec_.idb[s_id - 1];
p.Delete();
}
} }
int GetCount() { return fCount; } int GetCount() { return fCount; }
private: private:
......
...@@ -12,62 +12,107 @@ namespace corsika::process { ...@@ -12,62 +12,107 @@ namespace corsika::process {
namespace sibyll { namespace sibyll {
class ProcessDecay : public corsika::process::BaseProcess<ProcessDecay> {
public: void setHadronsUnstable(){
ProcessDecay() {} // name? also makes EM particles stable
void Init() {}
// loop over all particles in sibyll
template <typename Particle> // should be changed to loop over human readable list
double MinStepLength(Particle& p, setup::Trajectory&) const { // i.e. corsika::particles::ListOfParticles()
EnergyType E = p.GetEnergy(); std::cout << "Sibyll: setting hadrons unstable.." << std::endl;
MassType m = corsika::particles::GetMass(p.GetPID()); // make ALL particles unstable, then set EM stable
// env.GetDensity(); for(auto &p: corsika2sibyll){
const MassDensityType density = 1.25e-3 * kilogram / ( 1_cm * 1_cm * 1_cm ); //std::cout << (int)p << std::endl;
const int sibCode = (int)p;
// skip unknown and antiparticles
if( sibCode< 1) continue;
//std::cout << "Sibyll: Decay: setting " << ConvertFromSibyll( static_cast<SibyllCode> ( sibCode ) ) << " unstable" << std::endl;
s_csydec_.idb[ sibCode - 1 ] = abs( s_csydec_.idb[ sibCode - 1 ] );
//std::cout << "decay table value: " << s_csydec_.idb[ sibCode - 1 ] << std::endl;
}
// set Leptons and Proton and Neutron stable
// use stack to loop over particles
setup::Stack ds;
ds.NewParticle().SetPID(corsika::particles::Code::Proton);
ds.NewParticle().SetPID(corsika::particles::Code::Neutron);
ds.NewParticle().SetPID(corsika::particles::Code::Electron);
ds.NewParticle().SetPID(corsika::particles::Code::Positron);
ds.NewParticle().SetPID(corsika::particles::Code::NuE);
ds.NewParticle().SetPID(corsika::particles::Code::NuEBar);
ds.NewParticle().SetPID(corsika::particles::Code::MuMinus);
ds.NewParticle().SetPID(corsika::particles::Code::MuPlus);
ds.NewParticle().SetPID(corsika::particles::Code::NuMu);
ds.NewParticle().SetPID(corsika::particles::Code::NuMuBar);
for (auto& p : ds) {
int s_id = process::sibyll::ConvertToSibyllRaw(p.GetPID());
// set particle stable by setting table value negative
// cout << "Sibyll: setting " << p.GetPID() << "(" << s_id << ")"
// << " stable in Sibyll .." << endl;
s_csydec_.idb[ s_id - 1 ] = (-1) * abs(s_csydec_.idb[ s_id - 1 ]);
p.Delete();
}
}
const double gamma = E / m / constants::cSquared; class ProcessDecay : public corsika::process::BaseProcess<ProcessDecay> {
// lifetimes not implemented yet public:
TimeType t0; ProcessDecay() {}
switch( p.GetPID() ){ void Init() {
case corsika::particles::Code::PiPlus : //setHadronsUnstable();
t0 = 2.6e-8 * 1_s; }
break;
case corsika::particles::Code::PiMinus :
t0 = 2.6e-8 * 1_s;
break;
case corsika::particles::Code::KPlus : void setAllStable(){
t0 = 1.e-5 * 1_s; // name? also makes EM particles stable
break;
// loop over all particles in sibyll
// should be changed to loop over human readable list
// i.e. corsika::particles::ListOfParticles()
for(auto &p: corsika2sibyll){
//std::cout << (int)p << std::endl;
const int sibCode = (int)p;
// skip unknown and antiparticles
if( sibCode< 1) continue;
std::cout << "Sibyll: Decay: setting " << ConvertFromSibyll( static_cast<SibyllCode> ( sibCode ) ) << " stable" << std::endl;
s_csydec_.idb[ sibCode - 1 ] = -1 * abs( s_csydec_.idb[ sibCode - 1 ] );
std::cout << "decay table value: " << s_csydec_.idb[ sibCode - 1 ] << std::endl;
}
}
case corsika::particles::Code::KMinus : friend void setHadronsUnstable();
t0 = 1.e-5 * 1_s;
break;
default: template <typename Particle>
t0 = 1.e8 * 1_s; double MinStepLength(Particle& p, setup::Trajectory&) const {
break; EnergyType E = p.GetEnergy();
} MassType m = corsika::particles::GetMass(p.GetPID());
cout << "ProcessDecay: MinStep: t0: " << t0 << endl; // env.GetDensity();
cout << "ProcessDecay: MinStep: gamma: " << gamma << endl;
cout << "ProcessDecay: MinStep: density: " << density << endl; const MassDensityType density = 1.25e-3 * kilogram / ( 1_cm * 1_cm * 1_cm );
// return as column density
const double x0 = density * t0 * gamma * constants::c / kilogram * 1_cm * 1_cm;
cout << "ProcessDecay: MinStep: x0: " << x0 << endl;
return x0;
}
template <typename Particle, typename Stack>
void DoDiscrete(Particle& p, Stack& s) const {
} const double gamma = E / m / constants::cSquared;
template <typename Particle, typename Stack>
EProcessReturn DoContinuous(Particle&, setup::Trajectory&, Stack&) const {
return EProcessReturn::eOk;
}
}; TimeType t0 = GetLifetime( p.GetPID() );
cout << "ProcessDecay: MinStep: t0: " << t0 << endl;
cout << "ProcessDecay: MinStep: gamma: " << gamma << endl;
cout << "ProcessDecay: MinStep: density: " << density << endl;
// return as column density
const double x0 = density * t0 * gamma * constants::c / kilogram * 1_cm * 1_cm;
cout << "ProcessDecay: MinStep: x0: " << x0 << endl;
return x0;
}
template <typename Particle, typename Stack>
void DoDiscrete(Particle& p, Stack& s) const {
}
template <typename Particle, typename Stack>
EProcessReturn DoContinuous(Particle&, setup::Trajectory&, Stack&) const {
return EProcessReturn::eOk;
}
};
} }
} }
......
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