diff --git a/NPLib/Detectors/Catana/TCatanaData.h b/NPLib/Detectors/Catana/TCatanaData.h index 529a320ea70a661f845270e1c42c61ced6c52686..9604e296babd9c007e8233fe10152dda71888418 100644 --- a/NPLib/Detectors/Catana/TCatanaData.h +++ b/NPLib/Detectors/Catana/TCatanaData.h @@ -18,7 +18,7 @@ * * *---------------------------------------------------------------------------* * Comment: * - * * + * * * * *****************************************************************************/ @@ -31,74 +31,70 @@ using namespace std; class TCatanaData : public TObject { ////////////////////////////////////////////////////////////// - // data members are hold into vectors in order + // data members are hold into vectors in order // to allow multiplicity treatment - private: - // Energy - vector<UShort_t> fCatana_E_DetectorNbr; - vector<Double_t> fCatana_Energy; - - // Time - vector<UShort_t> fCatana_T_DetectorNbr; - vector<Double_t> fCatana_Time; + private: + // Energy + vector<UShort_t> fCatana_E_DetectorNbr; + vector<Double_t> fCatana_Energy; + // Time + vector<UShort_t> fCatana_T_DetectorNbr; + vector<Double_t> fCatana_Time; ////////////////////////////////////////////////////////////// // Constructor and destructor - public: - TCatanaData(); - ~TCatanaData(); - + public: + TCatanaData(); + ~TCatanaData(); ////////////////////////////////////////////////////////////// // Inherited from TObject and overriden to avoid warnings - public: - void Clear(); - void Clear(const Option_t*) {}; - void Dump() const; - + public: + void Clear(); + void Clear(const Option_t*){}; + void Dump() const; ////////////////////////////////////////////////////////////// // Getters and Setters - // Prefer inline declaration to avoid unnecessary called of + // Prefer inline declaration to avoid unnecessary called of // frequently used methods // add //! to avoid ROOT creating dictionnary for the methods - public: - ////////////////////// SETTERS //////////////////////// - // Energy - inline void SetEnergy(const UShort_t& DetNbr,const Double_t& Energy){ - fCatana_E_DetectorNbr.push_back(DetNbr); - fCatana_Energy.push_back(Energy); - };//! - - // Time - inline void SetTime(const UShort_t& DetNbr,const Double_t& Time) { - fCatana_T_DetectorNbr.push_back(DetNbr); - fCatana_Time.push_back(Time); - };//! - - - ////////////////////// GETTERS //////////////////////// - // Energy - inline UShort_t GetMultEnergy() const - {return fCatana_E_DetectorNbr.size();} - inline UShort_t GetE_DetectorNbr(const unsigned int &i) const - {return fCatana_E_DetectorNbr[i];}//! - inline Double_t Get_Energy(const unsigned int &i) const - {return fCatana_Energy[i];}//! - - // Time - inline UShort_t GetMultTime() const - {return fCatana_T_DetectorNbr.size();} - inline UShort_t GetT_DetectorNbr(const unsigned int &i) const - {return fCatana_T_DetectorNbr[i];}//! - inline Double_t Get_Time(const unsigned int &i) const - {return fCatana_Time[i];}//! - + public: + ////////////////////// SETTERS //////////////////////// + // Energy + inline void SetEnergy(const UShort_t& DetNbr, const Double_t& Energy) { + fCatana_E_DetectorNbr.push_back(DetNbr); + fCatana_Energy.push_back(Energy); + }; //! + + // Time + inline void SetTime(const UShort_t& DetNbr, const Double_t& Time) { + fCatana_T_DetectorNbr.push_back(DetNbr); + fCatana_Time.push_back(Time); + }; //! + + ////////////////////// GETTERS //////////////////////// + // Energy + inline UShort_t GetMultEnergy() const { return fCatana_E_DetectorNbr.size(); } + inline UShort_t GetE_DetectorNbr(const unsigned int& i) const { return fCatana_E_DetectorNbr[i]; } //! + inline Double_t Get_Energy(const unsigned int& i) const { return fCatana_Energy[i]; } //! + + // Time + inline UShort_t GetMultTime() const { return fCatana_T_DetectorNbr.size(); } + inline UShort_t GetT_DetectorNbr(const unsigned int& i) const { return fCatana_T_DetectorNbr[i]; } //! + inline Double_t Get_Time(const unsigned int& i) const { return fCatana_Time[i]; } //! + + // For Catana simulation analysis of s027 purpose + vector<UShort_t> Get_Catana_E_DetectorNbr() { return fCatana_E_DetectorNbr; }; + vector<Double_t> Get_Catana_Energy() { return fCatana_Energy; }; + // Time + vector<UShort_t> Get_Catana_T_DetectorNbr() { return fCatana_T_DetectorNbr; }; + vector<Double_t> Get_Catana_Time() { return fCatana_Time; }; ////////////////////////////////////////////////////////////// // Required for ROOT dictionnary - ClassDef(TCatanaData,1) // CatanaData structure + ClassDef(TCatanaData, 1) // CatanaData structure }; #endif diff --git a/NPLib/Physics/NPParticle.cxx b/NPLib/Physics/NPParticle.cxx index 72849bcaec006191de63d34a58c85266eea5fea0..733e3a8731e8f2f8fdc59ad578007bb6e98895bf 100644 --- a/NPLib/Physics/NPParticle.cxx +++ b/NPLib/Physics/NPParticle.cxx @@ -302,6 +302,42 @@ Particle::~Particle() { } + +//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... +TGraph* Particle::GetStableNuclei() +{ + TGraph* gStableNuclei = new TGraph(); + ifstream inFile; + string Path = getenv("NPTOOL") ; + string FileName = Path + "/NPLib/Physics/nubtab16.asc"; + inFile.open(FileName.c_str()); + + // reading the file + string line, s_name; + size_t space; + int i_stable = 1; + if (inFile.is_open()) { + while (!inFile.eof()) { + getline(inFile,line); + + if(line.size()>72){ + s_name = line.substr(11,7); + space = s_name.find_first_of(" "); + s_name.resize(space); + + Extract(line.data()); + if(fLifeTime==-1){ + gStableNuclei->SetPoint(i_stable,fAtomicWeight-fCharge,fCharge); + i_stable++; + } + } + } + } + else cout << "Unable to open file nuclear data base file " << FileName << endl; + + return gStableNuclei; +} + //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... void Particle::Extract(string line){ // name of the isotope diff --git a/NPLib/Physics/NPParticle.h b/NPLib/Physics/NPParticle.h index e1aa9dd41a15db086eda13737fa02e8ff2759cd4..1ead42c8ae5d07e95dea2a1be16fc48e8d0b6741 100644 --- a/NPLib/Physics/NPParticle.h +++ b/NPLib/Physics/NPParticle.h @@ -24,6 +24,7 @@ *****************************************************************************/ // ROOT headers #include "TLorentzVector.h" +#include "TGraph.h" // NPTOOL headers #include "NPGlobalSystemOfUnits.h" @@ -155,6 +156,7 @@ namespace NPL { void DefineMassByThreshold(const vector<NPL::Particle>& N); // Define the mass as the sum of the mass of the particle defined in N public: + TGraph* GetStableNuclei(); double GetSn() const; double GetSp() const; double GetS2n() const; diff --git a/NPLib/Physics/TInteractionCoordinates.h b/NPLib/Physics/TInteractionCoordinates.h index 0867793c216680a6d41bd5afac53abab79ccd6c9..c7828f66534570b41066fcbcb1b853b2279e8e01 100644 --- a/NPLib/Physics/TInteractionCoordinates.h +++ b/NPLib/Physics/TInteractionCoordinates.h @@ -11,7 +11,7 @@ * Original Author: N. de Sereville contact address: deserevi@ipno.in2p3.fr * * * * Creation Date : 10/06/09 * - * Last update : 01/09/2021 Valerian Alcindor adding particle name to * + * Last update : 01/09/2021 Valerian Alcindor adding particle name to * * interaction coordinate for easier g4 analysis simulation * *---------------------------------------------------------------------------* * Decription: This class mainly records the coordinates of interaction * @@ -24,130 +24,136 @@ * * *****************************************************************************/ - - #include "NPFunction.h" -#include <vector> #include "TObject.h" #include <iostream> +#include <vector> -using namespace std ; - - -class TInteractionCoordinates : public TObject{ - private: - // TrackID or index for correlations - vector<int> fDetected_Index; - // Detected particle properties (before interactions in the target) - // Energy and Time - vector<double> fDetected_Energy; - vector<double> fDetected_Time; - // Vertex of interaction - vector<double> fDetected_Position_X; - vector<double> fDetected_Position_Y; - vector<double> fDetected_Position_Z; - // Particle angles - vector<double> fDetected_Angle_Theta; - vector<double> fDetected_Angle_Phi; - // Particle characteristics - vector<std::string> fDetected_Particle_Name; - vector<int> fDetected_A; - vector<int> fDetected_Z; - vector<double> fDetected_Mass; - vector<int> fDetected_Charge; - vector<double> fDetected_Brho; - - public: - TInteractionCoordinates(); - virtual ~TInteractionCoordinates(); - - void Clear(); - void Clear(const Option_t*) {}; - void Dump() const; - - - void SetInteraction(const double& Energy, const double&Time, const double& PositionX, const double& PositionY, const double& PositionZ,const double& Theta, const double& Phi){ - fDetected_Energy.push_back(Energy); - fDetected_Time.push_back(Time); - fDetected_Position_X.push_back(PositionX); - fDetected_Position_Y.push_back(PositionY); - fDetected_Position_Z.push_back(PositionZ); - fDetected_Angle_Theta.push_back(Theta); - fDetected_Angle_Phi.push_back(Phi); - } - - void SetInteraction(const int& Index, const double& Energy, const double&Time, const double& PositionX, const double& PositionY, const double& PositionZ,const double& Theta, const double& Phi){ - fDetected_Index.push_back(Index); - fDetected_Energy.push_back(Energy); - fDetected_Time.push_back(Time); - fDetected_Position_X.push_back(PositionX); - fDetected_Position_Y.push_back(PositionY); - fDetected_Position_Z.push_back(PositionZ); - fDetected_Angle_Theta.push_back(Theta); - fDetected_Angle_Phi.push_back(Phi); - } - - void SetInteraction(const int& Index, const double& Energy, const double&Time, const double& PositionX, const double& PositionY, const double& PositionZ,const double& Theta, const double& Phi, const std::string &ParticleName, const int &A, const int &Z, const double &Mass, const int &Charge, const double &Brho){ - fDetected_Index.push_back(Index); - fDetected_Energy.push_back(Energy); - fDetected_Time.push_back(Time); - fDetected_Position_X.push_back(PositionX); - fDetected_Position_Y.push_back(PositionY); - fDetected_Position_Z.push_back(PositionZ); - fDetected_Angle_Theta.push_back(Theta); - fDetected_Angle_Phi.push_back(Phi); - if(ParticleName != "e-" && ParticleName != "e+") - fDetected_Particle_Name.push_back(NPL::ChangeNameFromG4Standard(ParticleName)); - else - fDetected_Particle_Name.push_back(ParticleName); - fDetected_A.push_back(A); - fDetected_Z.push_back(Z); - fDetected_Mass.push_back(Mass); - fDetected_Charge.push_back(Charge); - fDetected_Brho.push_back(Brho); - } - - ///////////////////// SETTERS //////////////////////// - // Incident particle properties (before interactions in the target) - // Vertex of interaction - void SetDetectedPositionX(const double& PositionX) {fDetected_Position_X.push_back(PositionX);}//! - void SetDetectedPositionY(const double& PositionY) {fDetected_Position_Y.push_back(PositionY);}//! - void SetDetectedPositionZ(const double& PositionZ) {fDetected_Position_Z.push_back(PositionZ);}//! - // Incident particle angles - void SetDetectedAngleTheta(const double& AngleTheta) {fDetected_Angle_Theta.push_back(AngleTheta);}//! - void SetDetectedAnglePhi(const double& AnglePhi) {fDetected_Angle_Phi.push_back(AnglePhi);}//! - - void SetDetectedParticleName(const std::string& ParticleName) {fDetected_Particle_Name.push_back(ParticleName);}//! - void SetDetectedA(const int& A) {fDetected_A.push_back(A);}//! - void SetDetectedZ(const int& Z) {fDetected_Z.push_back(Z);}//! - void SetDetectedMass(const double& Mass) {fDetected_Mass.push_back(Mass);}//! - void SetDetectedCharge(const int& Charge) {fDetected_Charge.push_back(Charge);}//! - void SetDetectedBrho(const double& Brho) {fDetected_Brho.push_back(Brho);}//! - - ///////////////////// GETTERS //////////////////////// - // Number of interactions (multiplicity) - int GetDetectedMultiplicity() const {return fDetected_Position_X.size();} - // Incident particle properties (before interactions in the target) - // Energy and Time - double GetEnergy(const int& i) const {return fDetected_Energy[i];}//! - double GetTime(const int& i) const {return fDetected_Time[i];}//! - // Vertex of interaction - double GetDetectedPositionX(const int& i) const {return fDetected_Position_X[i];}//! - double GetDetectedPositionY(const int& i) const {return fDetected_Position_Y[i];}//! - double GetDetectedPositionZ(const int& i) const {return fDetected_Position_Z[i];}//! - // Incident particle angles - double GetDetectedAngleTheta(const int& i) const {return fDetected_Angle_Theta[i];}//! - double GetDetectedAnglePhi(const int& i) const {return fDetected_Angle_Phi[i];}//! - - std::string GetParticleName(const int& i) const {return fDetected_Particle_Name[i];}//! - - int GetA(const int& i) const {return fDetected_A[i];}//! - int GetZ(const int& i) const {return fDetected_Z[i];}//! - double GetMass(const int& i) const {return fDetected_Mass[i];}//! - int GetCharge(const int& i) const {return fDetected_Charge[i];}//! - double GetBrho(const int& i) const {return fDetected_Brho[i];}//! - - ClassDef(TInteractionCoordinates, 2) // InteractionCoordinates structure +using namespace std; + +class TInteractionCoordinates : public TObject { + private: + // TrackID or index for correlations + vector<int> fDetected_Index; + // Detected particle properties (before interactions in the target) + // Energy and Time + vector<double> fDetected_Energy; + vector<double> fDetected_Time; + // Vertex of interaction + vector<double> fDetected_Position_X; + vector<double> fDetected_Position_Y; + vector<double> fDetected_Position_Z; + // Particle angles + vector<double> fDetected_Angle_Theta; + vector<double> fDetected_Angle_Phi; + // Particle characteristics + vector<std::string> fDetected_Particle_Name; + vector<int> fDetected_A; + vector<int> fDetected_Z; + vector<double> fDetected_Mass; + vector<int> fDetected_Charge; + vector<double> fDetected_Brho; + + public: + TInteractionCoordinates(); + virtual ~TInteractionCoordinates(); + + void Clear(); + void Clear(const Option_t*){}; + void Dump() const; + + void SetInteraction(const double& Energy, const double& Time, const double& PositionX, const double& PositionY, + const double& PositionZ, const double& Theta, const double& Phi) { + fDetected_Energy.push_back(Energy); + fDetected_Time.push_back(Time); + fDetected_Position_X.push_back(PositionX); + fDetected_Position_Y.push_back(PositionY); + fDetected_Position_Z.push_back(PositionZ); + fDetected_Angle_Theta.push_back(Theta); + fDetected_Angle_Phi.push_back(Phi); + } + + void SetInteraction(const int& Index, const double& Energy, const double& Time, const double& PositionX, + const double& PositionY, const double& PositionZ, const double& Theta, const double& Phi) { + fDetected_Index.push_back(Index); + fDetected_Energy.push_back(Energy); + fDetected_Time.push_back(Time); + fDetected_Position_X.push_back(PositionX); + fDetected_Position_Y.push_back(PositionY); + fDetected_Position_Z.push_back(PositionZ); + fDetected_Angle_Theta.push_back(Theta); + fDetected_Angle_Phi.push_back(Phi); + } + + void SetInteraction(const int& Index, const double& Energy, const double& Time, const double& PositionX, + const double& PositionY, const double& PositionZ, const double& Theta, const double& Phi, + const std::string& ParticleName, const int& A, const int& Z, const double& Mass, + const int& Charge, const double& Brho) { + fDetected_Index.push_back(Index); + fDetected_Energy.push_back(Energy); + fDetected_Time.push_back(Time); + fDetected_Position_X.push_back(PositionX); + fDetected_Position_Y.push_back(PositionY); + fDetected_Position_Z.push_back(PositionZ); + fDetected_Angle_Theta.push_back(Theta); + fDetected_Angle_Phi.push_back(Phi); + if (ParticleName != "e-" && ParticleName != "e+") + fDetected_Particle_Name.push_back(NPL::ChangeNameFromG4Standard(ParticleName)); + else + fDetected_Particle_Name.push_back(ParticleName); + fDetected_A.push_back(A); + fDetected_Z.push_back(Z); + fDetected_Mass.push_back(Mass); + fDetected_Charge.push_back(Charge); + fDetected_Brho.push_back(Brho); + } + + ///////////////////// SETTERS //////////////////////// + // Incident particle properties (before interactions in the target) + // Vertex of interaction + void SetDetectedPositionX(const double& PositionX) { fDetected_Position_X.push_back(PositionX); } //! + void SetDetectedPositionY(const double& PositionY) { fDetected_Position_Y.push_back(PositionY); } //! + void SetDetectedPositionZ(const double& PositionZ) { fDetected_Position_Z.push_back(PositionZ); } //! + // Incident particle angles + void SetDetectedAngleTheta(const double& AngleTheta) { fDetected_Angle_Theta.push_back(AngleTheta); } //! + void SetDetectedAnglePhi(const double& AnglePhi) { fDetected_Angle_Phi.push_back(AnglePhi); } //! + + void SetDetectedParticleName(const std::string& ParticleName) { fDetected_Particle_Name.push_back(ParticleName); } //! + void SetDetectedA(const int& A) { fDetected_A.push_back(A); } //! + void SetDetectedZ(const int& Z) { fDetected_Z.push_back(Z); } //! + void SetDetectedMass(const double& Mass) { fDetected_Mass.push_back(Mass); } //! + void SetDetectedCharge(const int& Charge) { fDetected_Charge.push_back(Charge); } //! + void SetDetectedBrho(const double& Brho) { fDetected_Brho.push_back(Brho); } //! + + ///////////////////// GETTERS //////////////////////// + // Number of interactions (multiplicity) + int GetDetectedMultiplicity() const { return fDetected_Position_X.size(); } + // Incident particle properties (before interactions in the target) + // Energy and Time + double GetEnergy(const int& i) const { return fDetected_Energy[i]; } //! + double GetTime(const int& i) const { return fDetected_Time[i]; } //! + // Vertex of interaction + double GetDetectedPositionX(const int& i) const { return fDetected_Position_X[i]; } //! + double GetDetectedPositionY(const int& i) const { return fDetected_Position_Y[i]; } //! + double GetDetectedPositionZ(const int& i) const { return fDetected_Position_Z[i]; } //! + // Incident particle angles + double GetDetectedAngleTheta(const int& i) const { return fDetected_Angle_Theta[i]; } //! + double GetDetectedAnglePhi(const int& i) const { return fDetected_Angle_Phi[i]; } //! + + std::string GetParticleName(const int& i) const { return fDetected_Particle_Name[i]; } //! + + int GetA(const int& i) const { return fDetected_A[i]; } //! + int GetZ(const int& i) const { return fDetected_Z[i]; } //! + double GetMass(const int& i) const { return fDetected_Mass[i]; } //! + int GetCharge(const int& i) const { return fDetected_Charge[i]; } //! + double GetBrho(const int& i) const { return fDetected_Brho[i]; } //! + + // Vertex of interaction + vector<double> GetDetected_Position_X() { return fDetected_Position_X; }; + vector<double> GetDetected_Position_Y() { return fDetected_Position_Y; }; + vector<double> GetDetected_Position_Z() { return fDetected_Position_Z; }; + + ClassDef(TInteractionCoordinates, 2) // InteractionCoordinates structure }; #endif