diff --git a/NPAnalysis/10He_Riken/Analysis b/NPAnalysis/10He_Riken/Analysis index 75f4cb005797b9560b71bcab202eac2dbc49b5fb..592ab93c584150d90ec51a9f190d63e0e5f2bfa5 100755 Binary files a/NPAnalysis/10He_Riken/Analysis and b/NPAnalysis/10He_Riken/Analysis differ diff --git a/NPAnalysis/10He_Riken/include/ObjectManager.hh b/NPAnalysis/10He_Riken/include/ObjectManager.hh index 5657cc8c3fdea74b3af5aaa02515548b9eeb5ec0..1ab104dbca5e056560ffb6817dff20c3d12d574d 100644 --- a/NPAnalysis/10He_Riken/include/ObjectManager.hh +++ b/NPAnalysis/10He_Riken/include/ObjectManager.hh @@ -107,12 +107,35 @@ namespace ENERGYLOSS { -// // 3He Energy Loss -// EnergyLoss He3TargetWind = EnergyLoss ( "He3_Mylar.G4table" , -// 10000 ); + // 3He Energy Loss + EnergyLoss He3TargetWind = EnergyLoss ( "He3_Mylar.G4table" , + 10000 ); + + EnergyLoss He3TargetGaz = EnergyLoss ( "He3_D2.G4table" , + 10000 ); + + EnergyLoss He3StripAl = EnergyLoss ( "3He_Al.txt" , + 10000 , + 1 , + 3 ); + + EnergyLoss He3StripSi = EnergyLoss ( "3He_Si.txt" , + 10000 , + 1 , + 3 ); + + + +// // 3He Energy Loss +// EnergyLoss He3TargetWind = EnergyLoss ( "3He_Mylar.txt" , +// 10000 , +// 1 , +// 3 ); // -// EnergyLoss He3TargetGaz = EnergyLoss ( "He3_D2.G4table" , -// 10000 ); +// EnergyLoss He3TargetGaz = EnergyLoss ( "3He_D2gaz_1b_26K.txt" , +// 10000 , +// 1 , +// 3 ); // // EnergyLoss He3StripAl = EnergyLoss ( "3He_Al.txt" , // 10000 , @@ -124,29 +147,6 @@ namespace ENERGYLOSS // 1 , // 3 ); - - - // 3He Energy Loss - EnergyLoss He3TargetWind = EnergyLoss ( "3He_Mylar.txt" , - 10000 , - 1 , - 3 ); - - EnergyLoss He3TargetGaz = EnergyLoss ( "3He_D2gaz_1b_26K.txt" , - 10000 , - 1 , - 3 ); - - EnergyLoss He3StripAl = EnergyLoss ( "3He_Al.txt" , - 10000 , - 1 , - 3 ); - - EnergyLoss He3StripSi = EnergyLoss ( "3He_Si.txt" , - 10000 , - 1 , - 3 ); - // proton Energy Loss EnergyLoss protonTargetWind = EnergyLoss ( "proton_Mylar.txt" , diff --git a/NPAnalysis/10He_Riken/src/Analysis.cc b/NPAnalysis/10He_Riken/src/Analysis.cc index 6051ef9c3be91100f033786a0192e4edd8c37ab3..ed1a372c4b79fa6f9a43e552785d8beb9bd4eb98 100644 --- a/NPAnalysis/10He_Riken/src/Analysis.cc +++ b/NPAnalysis/10He_Riken/src/Analysis.cc @@ -138,7 +138,7 @@ int main(int argc,char** argv) if(M2 -> GetPositionOfInteraction(hit).Z() > 0) { if( M2 -> CsI_E[hit] == 0 && M2 -> Si_E[hit] > 0) - { + { ELab[hit] = M2 -> Si_E[hit] ; ELab[hit]= He3StripAl.EvaluateInitialEnergy( ELab[hit] , // Energy of the detected particle diff --git a/NPLib/Tools/NPEnergyLoss.cxx b/NPLib/Tools/NPEnergyLoss.cxx index cd3be4860ae1c5c0f9c69a5e832014dd32bf9c57..6285a02477045bc726fc3ccc8bf6059010bc5018 100644 --- a/NPLib/Tools/NPEnergyLoss.cxx +++ b/NPLib/Tools/NPEnergyLoss.cxx @@ -71,58 +71,58 @@ EnergyLoss::EnergyLoss(string Path , int NumberOfSlice=100 , int LiseColumn , i //If LiseColumn is set to 0 File type is expected to be from SRIM or Geant4 if (LiseColumn == 0) { - // Opening dE/dX file + // Opening dE/dX file - ifstream TableFile ; - TableFile.open(Path.c_str()) ; + ifstream TableFile ; + TableFile.open(Path.c_str()) ; - if ( !TableFile ) - { - cout << "Failed to open file " << Path << endl; - return; - } - - /* else - { - // Reading Data - double energy, nuclear, electronic; - string unit, dummy; - - while ( TableFile >> energy >> unit - >> electronic >> nuclear - >> dummy >> dummy >> dummy - >> dummy >> dummy >> dummy ) - { - if ( unit == "keV" ) energy = energy*keV ; - if ( unit == "MeV" ) energy = energy*MeV ; - if ( unit == "GeV" ) energy = energy*GeV ; - fEnergy .push_back ( energy ) ; - fdEdX_Nuclear .push_back ( nuclear ) ; - fdEdX_Electronic .push_back ( electronic ) ; - fdEdX_Total .push_back ( nuclear + electronic ) ; - } - - // Close File - TableFile.close(); - }*/ - - else - { - // Reading Data - double energy, total; - string dummy; - //skipped first line - getline(TableFile,dummy); - while ( TableFile >> energy) - { - fEnergy .push_back ( energy*MeV ) ; - TableFile >> total; - fdEdX_Total .push_back ( total*MeV/um ) ; - } - - // Close File - TableFile.close(); - } + if ( !TableFile ) + { + cout << "Failed to open file " << Path << endl; + return; + } + else + { + cout << "Reading Energy Loss File: " << Path << endl ; + // Reading Data + double energy, total; + string dummy; + //skipped first line + getline(TableFile,dummy); + while ( TableFile >> energy) + { + fEnergy.push_back ( energy*MeV ) ; + TableFile >> total; + fdEdX_Total.push_back ( total*MeV/micrometer ) ; + } + + // Close File + TableFile.close(); + } + /* else + { + // Reading Data + double energy, nuclear, electronic; + string unit, dummy; + + while ( TableFile >> energy >> unit + >> electronic >> nuclear + >> dummy >> dummy >> dummy + >> dummy >> dummy >> dummy ) + { + if ( unit == "keV" ) energy = energy*keV ; + if ( unit == "MeV" ) energy = energy*MeV ; + if ( unit == "GeV" ) energy = energy*GeV ; + fEnergy .push_back ( energy ) ; + fdEdX_Nuclear .push_back ( nuclear ) ; + fdEdX_Electronic .push_back ( electronic ) ; + fdEdX_Total .push_back ( nuclear + electronic ) ; + } + + // Close File + TableFile.close(); + }*/ + } @@ -141,7 +141,8 @@ EnergyLoss::EnergyLoss(string Path , int NumberOfSlice=100 , int LiseColumn , i } else - { cout << "Reading Energy Loss File: " << Path << endl ; + { + cout << "Reading Energy Loss File: " << Path << endl ; // Reading Data double energy=0, energyloss=0; string dummy; @@ -226,10 +227,8 @@ double EnergyLoss::EvaluateTotalLoss(double Energy) const return -1000; } - Interpolator* s = new Interpolator( fEnergy , fdEdX_Total ) ; - double val = s->Eval(Energy) ; - - delete s ; + double val = fInter->Eval(Energy) ; + return val ; } @@ -267,17 +266,17 @@ double EnergyLoss::Slow( double Energy , // Energy of the detected particle } delete s ; - return slow ; + return slow ; } //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... -double EnergyLoss::EvaluateInitialEnergy( double Energy , // Energy of the detected particle - double TargetThickness , // Target Thickness at 0 degree - double Angle ) // Particle Angle - const +double EnergyLoss::EvaluateInitialEnergy( double Energy , // Energy of the detected particle + double TargetThickness , // Target Thickness at 0 degree + double Angle ) // Particle Angle + const { // Lise file are given in MeV/u - // For SRIM file fNumberOfMass = 1 whatever is the nucleus, file are given in MeV + // For SRIM and geant4 file fNumberOfMass = 1 whatever is the nucleus, file are given in MeV Energy = Energy / (double) fNumberOfMass ; if (Angle > halfpi) Angle = pi-Angle ; @@ -288,7 +287,7 @@ double EnergyLoss::EvaluateInitialEnergy( double Energy , // Energy of the de for (int i = 0; i < fNumberOfSlice ; i++) { double de = fInter->Eval(Energy) * SliceThickness ; - Energy += de/fNumberOfMass ; + Energy += de/fNumberOfMass ; } return (Energy*fNumberOfMass) ; diff --git a/NPSimulation/src/EventGeneratorTransfertToResonance.cc b/NPSimulation/src/EventGeneratorTransfertToResonance.cc index 2317f87b46dd7c557bf08742b6c3ca504cff7701..06e8d7de224b836008e544cb366405389235aa49 100644 --- a/NPSimulation/src/EventGeneratorTransfertToResonance.cc +++ b/NPSimulation/src/EventGeneratorTransfertToResonance.cc @@ -376,6 +376,11 @@ while(ReadingStatus){ //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... void EventGeneratorTransfertToResonance::GenerateEvent(G4Event* anEvent , G4ParticleGun* particleGun) { + + G4int LightZx = m_Reaction->GetNucleus3()->GetZ() ; + G4int LightAx = m_Reaction->GetNucleus3()->GetA() ; + m_Target->WriteDEDXTable(G4ParticleTable::GetParticleTable()->GetIon(LightZx,LightAx, 0.) ,0, 550); + // Clear contents of Precedent event (now stored in ROOTOutput) m_InitConditions->Clear(); diff --git a/NPSimulation/src/Target.cc b/NPSimulation/src/Target.cc index b9e382610e6ea7e917e5992287c6008860af40ba..122bbe8bf06c9e69ad45939b3cbe61ddc2d1962b 100644 --- a/NPSimulation/src/Target.cc +++ b/NPSimulation/src/Target.cc @@ -568,11 +568,8 @@ void Target::CalculateBeamInteraction( double MeanPosX, double SigmaPosX, double G4double de = dedx * EffectiveTargetThicknessBeforeInteraction / m_TargetNbLayers; IncidentBeamEnergy -= de; } - } - } - else { G4EmCalculator emCalculator; @@ -593,7 +590,6 @@ void Target::CalculateBeamInteraction( double MeanPosX, double SigmaPosX, double G4double de = dedx * EffectiveTargetThicknessBeforeInteraction / m_TargetNbLayers; IncidentBeamEnergy -= de; } - } FinalBeamEnergy=IncidentBeamEnergy; @@ -637,10 +633,10 @@ void Target::WriteDEDXTable(G4ParticleDefinition* Particle ,G4double Emin,G4doub G4EmCalculator emCalculator; - for (G4double E=Emin*MeV; E < Emax*MeV; E+=(Emax-Emin)*MeV/10000.) + for (G4double E=Emin; E < Emax; E+=(Emax-Emin)/10000.) { G4double dedx = emCalculator.ComputeTotalDEDX(E, Particle, m_TargetMaterial); - File << E/MeV << "\t" << dedx/(MeV/um) << endl ; + File << E/MeV << "\t" << dedx/(MeV/micrometer) << endl ; } File.close(); @@ -652,13 +648,15 @@ void Target::WriteDEDXTable(G4ParticleDefinition* Particle ,G4double Emin,G4doub File << "Table from Geant4 generate using NPSimulation \t " << "Particle: " << Particle->GetParticleName() << "\tMaterial: " << m_WindowsMaterial->GetName() << endl ; - for (G4double E=Emin*MeV; E < Emax*MeV; E+=(Emax-Emin)*MeV/10000.) + for (G4double E=Emin; E < Emax; E+=(Emax-Emin)/10000.) { - G4double dedx = emCalculator.ComputeTotalDEDX(E, Particle, m_WindowsMaterial); - File << E/MeV << "\t" << dedx/(MeV/um) << endl ; +// G4double dedx = emCalculator.ComputeTotalDEDX(E, Particle, m_WindowsMaterial); + G4double dedx = emCalculator.ComputeDEDX( E, Particle , + "ionIoni", m_WindowsMaterial); +cout << dedx<<endl ; + File << E/MeV << "\t" << dedx/(MeV/micrometer) << endl ; } } - - File.close(); + }