std::vector<double> Propagation::GetEtarget(Process &proc, const Particle &particle) const { std::vector<double> Etarget; double Etarget_tmp = 0; double smintmp = 0; double z_curr = particle.Getz(); double Energy = particle.GetEnergy(); int pType = particle.GetType(); double Eexp = smintmp/(4.0 * Energy); if (pType == 22) { proc.SetName(Process::PP); proc.SetLimits(); smintmp = proc.GetMin(); Eexp = std::max(proc.feps_inf,ElectronMass*ElectronMass/Energy); if (Eexp > proc.feps_sup) { // std::cout << proc.GetName() << " " << Eexp << " too big wrt " << proc.feps_sup << " , " << proc.feps_inf << " .. it should not interact!" << std::endl; Eexp = 0; Etarget.push_back(0);} else Etarget_tmp = ShootPhotonEnergyMC(Eexp, z_curr); Etarget.push_back(Etarget_tmp); proc.SetName(Process::DPP); proc.SetLimits(); smintmp = proc.GetMin(); Eexp = std::max(proc.feps_inf,2*ElectronMass*ElectronMass/Energy); if (Eexp > proc.feps_sup) { // std::cout << proc.GetName() << " " << Eexp << " too big wrt " << proc.feps_sup << " , " << proc.feps_inf << " .. it should not interact!" << std::endl; Eexp = 0; Etarget.push_back(0);} else Etarget_tmp = ShootPhotonEnergyMC(Eexp, z_curr); Etarget.push_back(Etarget_tmp); } else if (abs(pType) == 11) { proc.SetName(Process::ICS); proc.SetLimits(); smintmp = proc.GetMin(); Eexp = proc.feps_inf; Etarget_tmp = ShootPhotonEnergyMC(Eexp, z_curr); Etarget.push_back(Etarget_tmp); proc.SetName(Process::TPP); proc.SetLimits(); smintmp = proc.GetMin(); Eexp = std::max(proc.feps_inf,2*ElectronMass*ElectronMass/Energy); if (Eexp > proc.feps_sup) { // std::cout << proc.GetName() << " " << Eexp << " too big wrt " << proc.feps_sup << " , " << proc.feps_inf << " .. it should not interact!" << std::endl; Eexp = 0; Etarget.push_back(0);} else Etarget_tmp = ShootPhotonEnergyMC(Eexp, z_curr); Etarget.push_back(Etarget_tmp); } //end e/e else std::cerr << "something wrong in particle type ( " << pType << ". Propagation of photons and e+/e- is the only allowed.)" << std::endl; if (Etarget.size() != 2) { std::cout << "something wrong with the Etarget!! " << std::endl; exit(0); } return Etarget; }
double Propagation::ExtractMinDist(Process &proc, int type, double R, double R2, std::vector<double> &Etarget) const { double min_dist1 = 0; double min_dist2 = 0; Process proc1(proc); Process proc2(proc); double tmp_lambda1 = 0; double tmp_lambda2 = 0; Particle pt; pt.SetType(0); pt.Setz(proc.GetIncidentParticle().Getz()); if (type == 22) { if (Etarget[0]) { proc1.SetName(Process::PP); pt.SetEnergy(Etarget[0]); proc1.SetTargetParticle(pt); proc1.SetCMEnergy(); tmp_lambda1 = GetLambdaTab(proc1, Process::PP); min_dist1 = -tmp_lambda1 * log(R); } if (Etarget[1]) { pt.SetEnergy(Etarget[1]); proc2.SetTargetParticle(pt); proc2.SetCMEnergy(); tmp_lambda2 = GetLambdaTab(proc2, Process::DPP); min_dist2 = -tmp_lambda2 * log(R2); } #ifdef DEBUG_ELECA std::cerr << "comparing 2 mindists: " << min_dist1 << "(" << tmp_lambda1 << ") vs " << min_dist2 << " ( " << tmp_lambda2 << ") " << std::endl; #endif if (min_dist2 < min_dist1) { min_dist1 = min_dist2; proc.SetName(Process::DPP); pt.SetEnergy(Etarget[1]); proc.SetTargetParticle(pt); proc.SetCMEnergy(); } else { proc.SetName(Process::PP); pt.SetEnergy(Etarget[0]); proc.SetTargetParticle(pt); proc.SetCMEnergy(); } } //end if type 0 else if (abs(type) == 11) { proc1.SetName(Process::ICS); pt.SetEnergy(Etarget[0]); proc1.SetTargetParticle(pt); tmp_lambda1 = GetLambdaTab(proc1, Process::ICS); min_dist1 = -tmp_lambda1 * log(R); proc2.SetName(Process::TPP); pt.SetEnergy(Etarget[1]); proc2.SetTargetParticle(pt); tmp_lambda2 = GetLambdaTab(proc2, Process::TPP); min_dist2 = -tmp_lambda2 * log(R2); #ifdef DEBUG_ELECA std::cerr << "comparing 2 mindists: " << min_dist1 << "(" << tmp_lambda1 << ") vs " << min_dist2 << " ( " << tmp_lambda2 << ") " << std::endl; #endif if (min_dist2 < min_dist1) { min_dist1 = min_dist2; proc.SetName(Process::TPP); pt.SetEnergy(Etarget[1]); proc.SetTargetParticle(pt); proc.SetCMEnergy(); } else { proc.SetName(Process::ICS); pt.SetEnergy(Etarget[0]); proc.SetTargetParticle(pt); proc.SetCMEnergy(); } } //else e+/e- else std::cerr << "something wrong in particle type ( " << type << ". Propagation of photons and e+/e- is the only allowed.)" << std::endl; return min_dist1; }