From b38c6cfeec13ccf9bebe10f47c60d8f60d938a6e Mon Sep 17 00:00:00 2001
From: matta <matta@npt>
Date: Fri, 6 Nov 2009 02:27:13 +0000
Subject: [PATCH] * Updating NPLib read me

---
 Inputs/EventGenerator/10He.reaction   |  2 +-
 NPAnalysis/10He_Riken/src/Analysis.cc |  3 ++
 NPDocumentation/NPTool_UserGuide.tex  | 13 ++++--
 NPLib/Plastic/TPlasticPhysics.cxx     |  2 -
 NPLib/Plastic/TPlasticPhysics.h       |  1 -
 NPLib/README                          | 10 +++-
 NPLib/Tools/NPReaction.cxx            | 67 ++++++++++++---------------
 NPLib/Tools/NPReaction.h              | 52 ++++++++++++++++-----
 8 files changed, 93 insertions(+), 57 deletions(-)

diff --git a/Inputs/EventGenerator/10He.reaction b/Inputs/EventGenerator/10He.reaction
index 2c89aa85c..2c1407b0f 100644
--- a/Inputs/EventGenerator/10He.reaction
+++ b/Inputs/EventGenerator/10He.reaction
@@ -19,7 +19,7 @@ TransfertToResonance
 	ResonanceDecayA= 8
 	CrossSectionPath= 11Li(d,3He)10He.txt	
 	ShootLight= 1
-	ShootHeavy= 0
+	ShootHeavy= 1
 	ShootDecayProduct= 0
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 
diff --git a/NPAnalysis/10He_Riken/src/Analysis.cc b/NPAnalysis/10He_Riken/src/Analysis.cc
index fff2be80b..66d1094a2 100644
--- a/NPAnalysis/10He_Riken/src/Analysis.cc
+++ b/NPAnalysis/10He_Riken/src/Analysis.cc
@@ -107,6 +107,9 @@ int main(int argc,char** argv)
 			myDetector -> BuildPhysicalEvent()				;
 			////
 			
+			
+			
+			
 /*			// Target (from initial condition)
 			XTarget = Init->GetICPositionX(0);
 			YTarget = Init->GetICPositionY(0);
diff --git a/NPDocumentation/NPTool_UserGuide.tex b/NPDocumentation/NPTool_UserGuide.tex
index 5de778589..d5c3ee79f 100755
--- a/NPDocumentation/NPTool_UserGuide.tex
+++ b/NPDocumentation/NPTool_UserGuide.tex
@@ -38,9 +38,14 @@
 \chapter[NPTool]{NPTool}
 \section {Introduction}
 
-NPTool, Nuclear Physics Tool, aim to be a coherent set of programm usefull for Nuclear Physicist, especially those studying structure experimentally. Because each experiment is differents, people get used to exchange code and modified it to their needs. What NPT do is provinding an (try to be) universal framework so user can add their own functionnalities and share it with their collaborators. Geant4 and ROOT are now popular toolkit among the community, that's why NPTool use them widely and try to give a step by step process to use them efficiently.
+NPTool, Nuclear Physics Tool, aim to be a coherent set of programm usefull for Nuclear Physicist, especially those studying structure experimentally. 
+Because each experiment is differents, people get used to exchange code and modified it to their needs. 
+What NPT do is provinding an (try to be) universal framework so user can add their own functionnalities and share it with their collaborators. 
+Geant4 and ROOT are now popular toolkit among the community, that's why NPTool use them widely and try to give a step by step process to use them efficiently.
 
-In NPTool analysis and simulation are linked together. The proposed way of working is to generate an experiment like set of data and then annalysing with the future analysis code. Working this way help saving time by doing the biggest part of the analysis work in advance. It also help to understand what happen during analysis. 
+In NPTool analysis and simulation are linked together. The proposed way of working is to generate an experiment like set of data and then annalysing with the future analysis code. 
+Working this way help saving time by doing the biggest part of the analysis work in advance. 
+It also help to understand what happen during analysis. 
 
 				\begin{figure}[!htbp]
 					\centering
@@ -57,7 +62,9 @@ In NPTool analysis and simulation are linked together. The proposed way of worki
 				
 				
 \section{The directory layout}
-	NPTool come with a specific directory layout. The different make file and source are made to use this layout, using the environment variable. Here is the standard layout:
+	NPTool come with a specific directory layout. 
+	The different make file and source are made to use this layout, using the environment variable. 
+	Here is the standard layout:
 		\begin{itemize}
 			\item[-] NPLib : hold the libraries used both in NPA and NPS (NB: those librairies can be use in your own independant code if you need)
 			\item[-] NPSimulation : hold the NPSimulation code
diff --git a/NPLib/Plastic/TPlasticPhysics.cxx b/NPLib/Plastic/TPlasticPhysics.cxx
index 00ddd0bcf..093f1ee58 100644
--- a/NPLib/Plastic/TPlasticPhysics.cxx
+++ b/NPLib/Plastic/TPlasticPhysics.cxx
@@ -64,7 +64,6 @@ TPlasticPhysics::~TPlasticPhysics()
 void TPlasticPhysics::Clear()
 	{
 		DetectorNumber	.clear()	;
-		StripNumber			.clear()	;
 		Energy					.clear()	;
 		Time						.clear()	;
 	}
@@ -240,7 +239,6 @@ void TPlasticPhysics::BuildSimplePhysicalEvent()
 					{
 					
 						DetectorNumber	.push_back( EventData->GetPlasticNumber(i) )	;
-						StripNumber			.push_back( EventData->GetPlasticNumber(i)    )	;
 						
 						Energy					.push_back(
 							CalibrationManager::getInstance()->ApplyCalibration(	"Plastic/Detector" + itoa( EventData->GetPlasticNumber(i) ) +"_E",	
diff --git a/NPLib/Plastic/TPlasticPhysics.h b/NPLib/Plastic/TPlasticPhysics.h
index f1eedb765..a00c34437 100644
--- a/NPLib/Plastic/TPlasticPhysics.h
+++ b/NPLib/Plastic/TPlasticPhysics.h
@@ -43,7 +43,6 @@ class TPlasticPhysics : public TObject, public NPA::VDetector
 	public:	//	Calibrated Data
 
 		vector<UShort_t>	DetectorNumber	;
-		vector<UShort_t>	StripNumber			;
 		vector<Double_t>	Energy					;
 		vector<Double_t>	Time						;
 
diff --git a/NPLib/README b/NPLib/README
index f66fd6873..b6e12f885 100644
--- a/NPLib/README
+++ b/NPLib/README
@@ -70,7 +70,11 @@ VI) InteractionCoordinates
 	output TTree of the G4 simulation.
 
 VII) CalibrationManager
-
+	This directory includes one library:
+	libCalibrationManager.so
+		This folder contain the the class object for managing calibration file.
+	A caliration manager singleton is instantiate in NPAnalysis project.
+	 
 VIII) DummyDetector
 	This directory includes one library:
 		libDUMMYDetector.so
@@ -114,3 +118,7 @@ XI) GASPARD
 		obtained from NPSimulation. This library is *only* used by NPAnalysis.
 
 XII) VDetector
+		This directory includes one library:
+		libVDetector.so
+			VDetector is a virtual class used for analysis purpose. It comes with several standards method definition called in analysis programm automatically.
+			Those method need to be implemented for each detector inheritted from the VDetector class.
diff --git a/NPLib/Tools/NPReaction.cxx b/NPLib/Tools/NPReaction.cxx
index 1eaec349f..13121b3ec 100644
--- a/NPLib/Tools/NPReaction.cxx
+++ b/NPLib/Tools/NPReaction.cxx
@@ -62,6 +62,7 @@ Reaction::Reaction()
    fThetaCM    = 0;
    fExcitation = 0;
    fQValue     = 0;
+   initializePrecomputeVariable();
 }
 
 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 
@@ -113,6 +114,7 @@ void Reaction::SetEveryThing(string name1, string name2, string name3, string na
    CrossSectionSize = CrossSectionBuffer.size();
    CrossSection = new double[CrossSectionSize] ;
    for(int i = 0 ; i <CrossSectionSize ; i++ )	CrossSection[i] = CrossSectionBuffer[i];
+   initializePrecomputeVariable();
 }
 
 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 
@@ -136,33 +138,6 @@ void Reaction::KineRelativistic(double &ThetaLab3, double &EnergieLab3,
 // 2-body relativistic kinematics: direct + inverse
 // EnergieLab3,4 : lab energy in MeV of the 2 ejectiles
 // ThetaLab3,4   : angles in rad
-
-   double m1 = fNoy1->Mass();
-   double m2 = fNoy2->Mass();
-   double m3 = fNoy3->Mass();
-   double m4 = fNoy4->Mass() + fExcitation;
-
-   // center-of-mass velocity
-   double WtotLab = (fBeamEnergy + m1) + m2;
-   double P1 = sqrt(pow(fBeamEnergy,2) + 2*m1*fBeamEnergy);
-   double B = P1 / WtotLab;
-   double G = 1 / sqrt(1 - pow(B,2));
-
-   // total energy of the ejectiles in the center-of-mass
-   double W3cm = (pow(WtotLab,2) + pow(G,2)*(pow(m3,2) - pow(m4,2)))
-   		   / (2 * G * WtotLab);
-   double W4cm = (pow(WtotLab,2) + pow(G,2)*(pow(m4,2) - pow(m3,2)))
-   		   / (2 * G * WtotLab);
-
-   // velocity of the ejectiles in the center-of-mass
-   double beta3cm  = sqrt(1 - pow(m3,2)/pow(W3cm,2));
-   double beta4cm  = sqrt(1 - pow(m4,2)/pow(W4cm,2));
-//   double gamma3cm = 1 / sqrt(1 - pow(beta3cm,2));
-//   double gamma4cm = 1 / sqrt(1 - pow(beta4cm,2));
-
-   // Constants of the kinematics
-   double K3 = B / beta3cm;
-   double K4 = B / beta4cm;
    
    // case of inverse kinematics
    double theta = fThetaCM;
@@ -194,11 +169,6 @@ double Reaction::ReconstructRelativistic(double EnergyLab, double ThetaLab) cons
 		// EnergyLab in MeV
 		// ThetaLab in rad
 
-		double m1 = fNoy1->Mass()	;
-		double m2 = fNoy2->Mass()	;
-		double m3 = fNoy3->Mass()	;
-		double m4 = fNoy4->Mass()	;	
-
 		double P1 = sqrt(2*m1*fBeamEnergy+(fBeamEnergy*fBeamEnergy))	;
 		double P3 = sqrt(2*m3*EnergyLab+(EnergyLab*EnergyLab))			;
 		double P4 = sqrt(P1*P1+P3*P3-(2*P1*P3*cos(ThetaLab)))			;
@@ -234,11 +204,7 @@ double Reaction::ReconstructRelativistic(double EnergyLab, double ThetaLab) cons
 double  Reaction::EnergyLabToThetaCM( double EnergyLab , double ExcitationEnergy ) const
 	{
 		if(ExcitationEnergy == -500) ExcitationEnergy = fExcitation; 
-	
-		double m1 = fNoy1->Mass()				;
-		double m2 = fNoy2->Mass()				;
-		double m3 = fNoy3->Mass()				;
-		double m4 = (fNoy4->Mass()+ExcitationEnergy)	;
+
 		double E1 = (fBeamEnergy+m1)			;
 		double E3 = (EnergyLab+m3)				;
 		  
@@ -398,7 +364,34 @@ void Reaction::ReadConfigurationFile(string Path)
 	}
 	
 	
+void Reaction::initializePrecomputeVariable()
+	{
+		 m1 = fNoy1->Mass();
+		 m2 = fNoy2->Mass();
+		 m3 = fNoy3->Mass();
+		 m4 = fNoy4->Mass() + fExcitation;
+
+		// center-of-mass velocity
+		 WtotLab = (fBeamEnergy + m1) + m2;
+		 P1 = sqrt(pow(fBeamEnergy,2) + 2*m1*fBeamEnergy);
+		 B = P1 / WtotLab;
+		 G = 1 / sqrt(1 - pow(B,2));
+
+		// total energy of the ejectiles in the center-of-mass
+		 W3cm = (pow(WtotLab,2) + pow(G,2)*(pow(m3,2) - pow(m4,2)))
+			   / (2 * G * WtotLab);
+		 W4cm = (pow(WtotLab,2) + pow(G,2)*(pow(m4,2) - pow(m3,2)))
+			   / (2 * G * WtotLab);
+
+		// velocity of the ejectiles in the center-of-mass
+		 beta3cm  = sqrt(1 - pow(m3,2)/pow(W3cm,2));
+		 beta4cm  = sqrt(1 - pow(m4,2)/pow(W4cm,2));
+
+		// Constants of the kinematics
+		 K3 = B / beta3cm;
+		 K4 = B / beta4cm;
 	
+	}
 	
 	
 	
diff --git a/NPLib/Tools/NPReaction.h b/NPLib/Tools/NPReaction.h
index d8d638aea..20e1136b8 100644
--- a/NPLib/Tools/NPReaction.h
+++ b/NPLib/Tools/NPReaction.h
@@ -63,26 +63,54 @@ namespace NPL
 			double	 		fThetaCM			;	//	Center-of-mass angle in radian
 			double	 		fExcitation			;	//	Excitation energy in MeV
 			double*			CrossSection		;	//	Differential CrossSection
-			int				CrossSectionSize	;	//	Size of array containing Differention CrossSection
+			int					CrossSectionSize	;	//	Size of array containing Differention CrossSection
 		   
 		public:
 			// Getters and Setters
 			void				SetBeamEnergy		(double efais)	{fBeamEnergy = efais;}
 			void				SetThetaCM			(double angle)	{fThetaCM = angle;}
 			void				SetExcitation		(double exci)	{fExcitation = exci;}
-			double				GetBeamEnergy() 	const		 	{return fBeamEnergy;}
-			double				GetThetaCM() 		const 			{return fThetaCM;}
-			double				GetExcitation() 	const 			{return fExcitation;}
-			double				GetQValue() 		const 			{return fQValue;}
-			Nucleus*			GetNucleus1() 		const 			{return fNoy1;}
-			Nucleus*			GetNucleus2() 		const 			{return fNoy2;}
-			Nucleus*			GetNucleus3() 		const 			{return fNoy3;}
-			Nucleus*			GetNucleus4() 		const 			{return fNoy4;}  
-			double*				GetCrossSection()	const			{return CrossSection;} 
+			double			GetBeamEnergy() 	const		 	{return fBeamEnergy;}
+			double			GetThetaCM() 		const 			{return fThetaCM;}
+			double			GetExcitation() 	const 			{return fExcitation;}
+			double			GetQValue() 		const 			{return fQValue;}
+			Nucleus*		GetNucleus1() 		const 			{return fNoy1;}
+			Nucleus*		GetNucleus2() 		const 			{return fNoy2;}
+			Nucleus*		GetNucleus3() 		const 			{return fNoy3;}
+			Nucleus*		GetNucleus4() 		const 			{return fNoy4;}  
+			double*			GetCrossSection()	const			{return CrossSection;} 
 			int					GetCrossSectionSize()		const			{return CrossSectionSize;} 
 
-			//	Kinematics	//
-		   
+
+
+
+		private:	//	intern precompute variable
+			void initializePrecomputeVariable();
+			double m1 ;
+			double m2 ;
+			double m3 ;
+			double m4 ;
+
+			// center-of-mass velocity
+			double WtotLab ;
+			double P1 ;
+			double B ;
+			double G ;
+
+			// total energy of the ejectiles in the center-of-mass
+			double W3cm ;
+			double W4cm ;
+
+			// velocity of the ejectiles in the center-of-mass
+			double beta3cm  ;
+			double beta4cm  ;
+
+			// Constants of the kinematics
+			double K3 ;
+			double K4 ;
+
+			
+		 public:	//	Kinematics
 			//	Compute ThetaLab and EnergyLab for product of reaction
 			void		KineRelativistic(	double &ThetaLab3	, 
 										 	double &EnergieLab3	,
-- 
GitLab