diff --git a/NPLib/InitialConditions/TInitialConditions.h b/NPLib/InitialConditions/TInitialConditions.h index 7a0001e05d36eeaa187a07df0512925b7bec0de5..699a3a4e9d924ef615a566f1e0582b297d4ebd15 100644 --- a/NPLib/InitialConditions/TInitialConditions.h +++ b/NPLib/InitialConditions/TInitialConditions.h @@ -34,6 +34,29 @@ using namespace std ; class TInitialConditions : public TObject { private: + /* + // Incident beam parament + double fIC_Incident_Emittance_Phi; + double fIC_Incident_Emittance_Theta; + double fIC_Incident_Initial_Energy; + + // Beam status at the initial interaction point + double fIC_Interaction_Energy; + double fIC_Interaction_Position_X; + double fIC_Interaction_Position_Y; + double fIC_Interaction_Position_Z; + + // emmitted particle + vector<string> fIC_Particle_Name; + vector<string> fIC_Process_Name; + vector<double> fIC_ThetaCM; + vector<double> fIC_Kinetic_Energy; + vector<double> fIC_Momentum_Direction_X; + vector<double> fIC_Momentum_Direction_Y; + vector<double> fIC_Momentum_Direction_Z; + + */ + /* // Beam TLorentzVector fIC_Beam_LV; diff --git a/NPLib/Physics/NPBeam.cxx b/NPLib/Physics/NPBeam.cxx index 85ae58a0dc03d84bdc2f8610ba36d178cec5e502..56b62ced1bebd57de772f37225597e433a7f7c8a 100644 --- a/NPLib/Physics/NPBeam.cxx +++ b/NPLib/Physics/NPBeam.cxx @@ -42,8 +42,7 @@ using namespace NPL; //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... -Beam::Beam() -{ +Beam::Beam(){ fBeamNucleus = new Nucleus(); fEnergy = 0; fSigmaEnergy = -1 ; @@ -63,14 +62,14 @@ Beam::Beam() fTargetZ = 0 ; fVerboseLevel = NPOptionManager::getInstance()->GetVerboseLevel(); // case of user given distribution - fEnergyHist = new TH1F("EnergyHist","EnergyHist",1,0,1); - fXThetaXHist = new TH2F("XThetaXHis","XThetaXHis",1,0,1,1,0,1); - fYPhiYHist = new TH2F("YPhiYHist","YPhiYHist",1,0,1,1,0,1); + Global_BeamHistOffset++; + fEnergyHist = new TH1F(Form("EnergyHist%i",Global_BeamHistOffset),"EnergyHist",1,0,1); + fXThetaXHist = new TH2F(Form("XThetaXHis%i",Global_BeamHistOffset),"XThetaXHis",1,0,1,1,0,1); + fYPhiYHist = new TH2F(Form("YPhiYHist%i",Global_BeamHistOffset),"YPhiYHist",1,0,1,1,0,1); } //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... -Beam::~Beam() -{ +Beam::~Beam(){ delete fBeamNucleus ; delete fEnergyHist ; delete fXThetaXHist ; @@ -232,8 +231,10 @@ void Beam::ReadConfigurationFile(string Path){ /////////////////////////////////////////////////// // If no Beam Token and no comment, toggle out - else - {ReadingStatus = false; cout << "WARNING : Wrong Token Sequence: Getting out " << endl ;} + else{ + cout << "ERROR : Wrong Token Sequence: Getting out " << endl ; + exit(1); + } /////////////////////////////////////////////////// if( ( check_MeanX && check_MeanY && check_SigmaX && check_SigmaY && check_SigmaThetaX && check_SigmaPhiY && check_MeanThetaX && check_MeanPhiY) || ( check_XThetaXPath && check_YPhiYPath ) ){ @@ -250,10 +251,12 @@ void Beam::ReadConfigurationFile(string Path){ } } - if( !check_BeamName || !check_AllEnergy || !check_AllEnergy ) - {cout << "WARNING : Token Sequence Incomplete, Beam definition could not be Fonctionnal" << endl ;} + if( !check_BeamName || !check_AllEnergy || !check_AllEnergy ){ + cout << "ERROR : Token Sequence Incomplete, Beam definition could not be Fonctionnal" << endl ; + exit(1); + } - cout << "///////////////////////////////////////////////////" << endl << endl ; + if(fVerboseLevel==1) cout << "///////////////////////////////////////////////////" << endl << endl ; } //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... diff --git a/NPLib/Physics/NPBeam.h b/NPLib/Physics/NPBeam.h index e3180879923152c79d1f205da0491d7a9807a457..0e09f2cc12c5f9b08c51ac092b1d2b22b13ad47f 100755 --- a/NPLib/Physics/NPBeam.h +++ b/NPLib/Physics/NPBeam.h @@ -40,6 +40,9 @@ using namespace std; using namespace NPL; namespace NPL{ + // Needed to avoid warnig from multiple Th1 with same name + static int Global_BeamHistOffset=0; + class Beam{ public: // Constructors and Destructors diff --git a/NPLib/Physics/NPReaction.cxx b/NPLib/Physics/NPReaction.cxx index b7336b51bfbefafdb4a804a8f83591b6d07953ea..fc7ba53797187fcd4d41025bf1a0fc371a5e90d2 100644 --- a/NPLib/Physics/NPReaction.cxx +++ b/NPLib/Physics/NPReaction.cxx @@ -69,7 +69,9 @@ Reaction::Reaction(){ fQValue = 0; fVerboseLevel = NPOptionManager::getInstance()->GetVerboseLevel(); initializePrecomputeVariable(); - fCrossSectionHist = new TH1F("Reaction_CS","Reaction_CS",180,0,180); + // Needed to avoid warning at compilation, not very clean... + Global_BeamHistOffset=Global_BeamHistOffset; + fCrossSectionHist = new TH1F(Form("Reaction_CS%i",Global_ReactionHistOffset++),"Reaction_CS",180,0,180); fshoot3=true; fshoot4=true; } diff --git a/NPLib/Physics/NPReaction.h b/NPLib/Physics/NPReaction.h index 7e0e2537f2602044ccfce65ec40c1cd7d6ad7e6a..343c7d5e1b23a33d8f3f8088872025fa995e291e 100644 --- a/NPLib/Physics/NPReaction.h +++ b/NPLib/Physics/NPReaction.h @@ -50,6 +50,9 @@ using namespace std; namespace NPL{ + // Needed to avoid warnig from multiple Th1 with same name + static int Global_ReactionHistOffset=0; + class Reaction{ public: // Constructors and Destructors diff --git a/NPSimulation/src/EventGeneratorGammaDecay.cc b/NPSimulation/src/EventGeneratorGammaDecay.cc index 4d89308a56fefffda5f3a4dce97c60dfaf9ee41f..bb34fe49a8169f5709868da7aa2a6f8d9a69cb3a 100644 --- a/NPSimulation/src/EventGeneratorGammaDecay.cc +++ b/NPSimulation/src/EventGeneratorGammaDecay.cc @@ -30,6 +30,9 @@ // NPS #include "Particle.hh" +// NPL +#include "NPOptionManager.h" + // G4 headers including CLHEP headers // for generating random numbers #include "Randomize.hh" @@ -63,7 +66,9 @@ void EventGeneratorGammaDecay::ReadConfiguration(string Path, int Occurence){ bool check_BranchingRatio = false; bool check_CSPath = false ; bool check_created = false; - + + int VerboseLevel = NPOptionManager::getInstance()->GetVerboseLevel(); + ////////////////////////////////////////////////////////////////////////////////////////// ifstream InputFile; InputFile.open(Path.c_str()); @@ -80,7 +85,7 @@ void EventGeneratorGammaDecay::ReadConfiguration(string Path, int Occurence){ TokenOccurence++; if (TokenOccurence == Occurence) { ReadingStatusGammaDecay = true ; - G4cout << "///////////////////////////////////////// " << G4endl; + if(VerboseLevel==1) G4cout << "///////////////////////////////////////// " << G4endl; // Get the nuclei name LineStream.clear(); LineStream.str(LineBuffer); @@ -88,7 +93,7 @@ void EventGeneratorGammaDecay::ReadConfiguration(string Path, int Occurence){ DataBuffer.erase(); LineStream >> DataBuffer; m_NucleiName = DataBuffer ; - G4cout << "Gamma Decay for " << m_NucleiName << G4endl; + if(VerboseLevel==1) G4cout << "Gamma Decay for " << m_NucleiName << G4endl; } } @@ -102,7 +107,7 @@ void EventGeneratorGammaDecay::ReadConfiguration(string Path, int Occurence){ else if (DataBuffer == "Cascade") { CascadeStatus = true ; NumberOfCascade++; - G4cout << " Cascade " << NumberOfCascade << G4endl; + if(VerboseLevel==1) G4cout << " Cascade " << NumberOfCascade << G4endl; LineStream.clear(); LineStream.str(LineBuffer); @@ -134,22 +139,22 @@ void EventGeneratorGammaDecay::ReadConfiguration(string Path, int Occurence){ LineStream >> DataBuffer ; LineStream >> DataBuffer ; BranchingRatio = atof(DataBuffer.c_str()); - G4cout << " Branching Ratio: " << atof(DataBuffer.c_str()) << G4endl; + if(VerboseLevel==1) G4cout << " Branching Ratio: " << atof(DataBuffer.c_str()) << G4endl; } else if(DataBuffer == "Energies=") { check_E = true; - G4cout << " Energies: " ; + if(VerboseLevel==1) G4cout << " Energies: " ; LineStream.clear(); LineStream.str(LineBuffer); LineStream >> DataBuffer; while(LineStream >> DataBuffer){ E.push_back(atof(DataBuffer.c_str())); - G4cout << atof(DataBuffer.c_str()) << " "; + if(VerboseLevel==1)G4cout << atof(DataBuffer.c_str()) << " "; } - G4cout << G4endl; + if(VerboseLevel==1)G4cout << G4endl; } else if(DataBuffer == "DifferentialCrossSection="){ @@ -157,7 +162,7 @@ void EventGeneratorGammaDecay::ReadConfiguration(string Path, int Occurence){ LineStream.str(LineBuffer); LineStream >> DataBuffer >> DataBuffer ; CSPath = DataBuffer; - G4cout << " Cross Section Path: " << DataBuffer << G4endl; + if(VerboseLevel==1) G4cout << " Cross Section Path: " << DataBuffer << G4endl; check_CSPath = true; } @@ -184,7 +189,7 @@ void EventGeneratorGammaDecay::ReadConfiguration(string Path, int Occurence){ if(InputFile.eof()) {ReadingStatusGammaDecay=false;check_created=true;} } } - G4cout << "///////////////////////////////////////// " << G4endl; + if(VerboseLevel==1) G4cout << "///////////////////////////////////////// " << G4endl; InputFile.close(); PrepareCascade(); } @@ -362,14 +367,23 @@ void EventGeneratorGammaDecay::PrepareCascade(){ ifstream CSFile; CSFile.open( StandardPath.c_str() ); - if(CSFile.is_open()) cout << "Reading Cross Section File " << m_CrossSectionPath[i] << endl; - + if(CSFile.is_open()){ + if( NPOptionManager::getInstance()->GetVerboseLevel()==1) + cout << "Reading Cross Section File " << m_CrossSectionPath[i] << endl; + } + // In case the file is not found in the standard path, the programm try to interpret the file name as an absolute or relative file path. else{ CSFile.open( m_CrossSectionPath[i].c_str() ); - if(CSFile.is_open()) { cout << "Reading Cross Section File " << m_CrossSectionPath[i] << endl;} - - else {cout << "Cross Section File " << m_CrossSectionPath[i] << " not found" << endl;return;} + if(CSFile.is_open()){ + if( NPOptionManager::getInstance()->GetVerboseLevel()==1) + cout << "Reading Cross Section File " << m_CrossSectionPath[i] << endl; + } + + else { + cout << "EROOR : Cross Section File " << m_CrossSectionPath[i] << " not found" << endl; + exit(1); + } } double CSBuffer,AngleBuffer; diff --git a/NPSimulation/src/EventGeneratorParticleDecay.cc b/NPSimulation/src/EventGeneratorParticleDecay.cc index bd7b858a38a5b91bb105e8ceceaf14f388bc248b..336058d2e369ec59670dcff5368abaa79d9d5334 100644 --- a/NPSimulation/src/EventGeneratorParticleDecay.cc +++ b/NPSimulation/src/EventGeneratorParticleDecay.cc @@ -34,6 +34,7 @@ // NPL #include "NPNucleus.h" +#include "NPOptionManager.h" using namespace NPL; // ROOT @@ -68,6 +69,8 @@ void EventGeneratorParticleDecay::ReadConfiguration(string Path,int Occurence){ vector<bool> shoot; string CSPath = "TGenPhaseSpace"; + int VerboseLevel = NPOptionManager::getInstance()->GetVerboseLevel(); + ////////////////////////////////////////////////////////////////////////////////////////// ifstream InputFile; InputFile.open(Path.c_str()); @@ -86,7 +89,7 @@ void EventGeneratorParticleDecay::ReadConfiguration(string Path,int Occurence){ TokkenOccurence++; if(TokkenOccurence==Occurence){ ReadingStatusParticleDecay = true ; - G4cout << "///////////////////////////////////////// " << G4endl; + if(VerboseLevel==1) G4cout << "///////////////////////////////////////// " << G4endl; // Get the nuclei name LineStream.clear(); LineStream.str(LineBuffer); @@ -94,7 +97,7 @@ void EventGeneratorParticleDecay::ReadConfiguration(string Path,int Occurence){ DataBuffer.erase(); LineStream >> DataBuffer; m_MotherNucleiName = DataBuffer ; - G4cout << "Particle Decay for " << m_MotherNucleiName << G4endl; + if(VerboseLevel==1) G4cout << "Particle Decay for " << m_MotherNucleiName << G4endl; } } @@ -116,13 +119,13 @@ void EventGeneratorParticleDecay::ReadConfiguration(string Path,int Occurence){ getline(InputFile, LineBuffer); LineStream.clear(); LineStream.str(LineBuffer); - G4cout << " Daughter: " ; + if(VerboseLevel==1) G4cout << " Daughter: " ; while(LineStream >> DataBuffer){ DaughterName.push_back(DataBuffer); - G4cout << DataBuffer << " " ; + if(VerboseLevel==1)G4cout << DataBuffer << " " ; } - G4cout << G4endl; + if(VerboseLevel==1)G4cout << G4endl; } @@ -134,19 +137,19 @@ void EventGeneratorParticleDecay::ReadConfiguration(string Path,int Occurence){ getline(InputFile, LineBuffer); LineStream.clear(); LineStream.str(LineBuffer); - G4cout << " Excitation Energy: " ; + if(VerboseLevel==1) G4cout << " Excitation Energy: " ; while(LineStream >> DataBuffer){ ExcitationEnergy.push_back( atof(DataBuffer.c_str()) ); - G4cout << DataBuffer << " " ; + if(VerboseLevel==1) G4cout << DataBuffer << " " ; } - G4cout << G4endl; + if(VerboseLevel==1) G4cout << G4endl; } else if(DataBuffer == "DifferentialCrossSection=") { check_CrossSection = true; InputFile >> CSPath ; - G4cout << " Cross Section: " << CSPath << G4endl; + if(VerboseLevel==1) G4cout << " Cross Section: " << CSPath << G4endl; } else if(DataBuffer == "shoot=") { @@ -157,13 +160,13 @@ void EventGeneratorParticleDecay::ReadConfiguration(string Path,int Occurence){ getline(InputFile, LineBuffer); LineStream.clear(); LineStream.str(LineBuffer); - G4cout << " Shoot Particle: " ; + if(VerboseLevel==1) G4cout << " Shoot Particle: " ; while(LineStream >> DataBuffer){ shoot.push_back( atof(DataBuffer.c_str()) ); - G4cout << DataBuffer << " " ; + if(VerboseLevel==1)G4cout << DataBuffer << " " ; } - G4cout << G4endl; + if(VerboseLevel==1)G4cout << G4endl; } ////////////////////////////////////////////////////// @@ -182,7 +185,7 @@ void EventGeneratorParticleDecay::ReadConfiguration(string Path,int Occurence){ } } - G4cout << "///////////////////////////////////////// " << G4endl; + if(VerboseLevel==1) G4cout << "///////////////////////////////////////// " << G4endl; InputFile.close(); } @@ -375,12 +378,15 @@ void EventGeneratorParticleDecay::SetDecay(vector<string> DaughterName, vector<b ifstream CSFile; CSFile.open( StandardPath.c_str() ); - if(CSFile.is_open()) cout << "Reading Cross Section File " << m_DifferentialCrossSection << endl; - + if(CSFile.is_open() ){ + if(NPOptionManager::getInstance()->GetVerboseLevel()==1) + cout << "Reading Cross Section File " << m_DifferentialCrossSection << endl; + } // In case the file is not found in the standard path, the programm try to interpret the file name as an absolute or relative file path. else{ CSFile.open( m_DifferentialCrossSection.c_str() ); - if(CSFile.is_open()) { + if(CSFile.is_open()){ + if( NPOptionManager::getInstance()->GetVerboseLevel()==1) cout << "Reading Cross Section File " << m_DifferentialCrossSection << endl; }