From 6899bd7ded973ca6394b375b0f9fb133b0e89968 Mon Sep 17 00:00:00 2001
From: Morfouace <morfouac@ipno.in2p3.fr>
Date: Fri, 20 Jan 2017 14:57:17 -0500
Subject: [PATCH] * Updating AnnularS4

---
 Inputs/DetectorConfiguration/hira.detector    |  4 +-
 Inputs/EventGenerator/46Ar_pd.reaction        | 33 ++++++------
 .../Detectors/AnnularS4/TAnnularS4Physics.cxx | 54 ++++++++++++++++++-
 NPLib/Detectors/AnnularS4/TAnnularS4Physics.h | 16 +++++-
 NPSimulation/Detectors/Hira/Hira.hh           |  6 +--
 Projects/Hira10/Analysis.cxx                  |  2 +-
 6 files changed, 90 insertions(+), 25 deletions(-)

diff --git a/Inputs/DetectorConfiguration/hira.detector b/Inputs/DetectorConfiguration/hira.detector
index 6d6fde406..e1430473f 100755
--- a/Inputs/DetectorConfiguration/hira.detector
+++ b/Inputs/DetectorConfiguration/hira.detector
@@ -6,10 +6,10 @@ GeneralTarget
 % Radius in mm
 % Temperature in K, Pressure in bar
 Target
- THICKNESS= 12.5
+ THICKNESS= 25
  ANGLE= 0
  RADIUS=	10
- MATERIAL= CD2
+ MATERIAL= CH2
  X= 0
  Y= 0
  Z= 0
diff --git a/Inputs/EventGenerator/46Ar_pd.reaction b/Inputs/EventGenerator/46Ar_pd.reaction
index d54ca9f6c..f6c0e8030 100644
--- a/Inputs/EventGenerator/46Ar_pd.reaction
+++ b/Inputs/EventGenerator/46Ar_pd.reaction
@@ -1,28 +1,29 @@
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-%%%%%%%%%  Reaction file for 46Ar(p,d)45Ar reaction  %%%%%%%%%
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 Beam
-  Particle= 46Ar
-  Energy= 3220
-  SigmaEnergy= 14
- SigmaX= 2
- SigmaY= 2
- SigmaThetaX= 0 
- SigmaPhiY= 0
-  MeanThetaX= 0
-  MeanPhiY= 0
-  MeanX= 0
-  MeanY= 0
+ Particle= 46Ar
+ Energy= 3236
+ SigmaEnergy= 0
+ SigmaThetaX= 0.
+ SigmaPhiY= 0.
+ SigmaX= 0
+ SigmaY= 0
+ MeanThetaX= 0
+ MeanPhiY= 0
+ MeanX= 0
+ MeanY= 0
+
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
 TwoBodyReaction
  Beam= 46Ar
  Target= 1H
  Light= 2H
  Heavy= 45Ar
- ExcitationEnergyHeavy= 0.542
  ExcitationEnergyLight= 0.0
-  CrossSectionPath= flat.txt CS
+ ExcitationEnergyHeavy= 0.0
+ CrossSectionPath= flat.txt CS
  ShootLight= 1
  ShootHeavy= 0
+  
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+    
 
diff --git a/NPLib/Detectors/AnnularS4/TAnnularS4Physics.cxx b/NPLib/Detectors/AnnularS4/TAnnularS4Physics.cxx
index 1b33c7b95..1353debf8 100644
--- a/NPLib/Detectors/AnnularS4/TAnnularS4Physics.cxx
+++ b/NPLib/Detectors/AnnularS4/TAnnularS4Physics.cxx
@@ -55,18 +55,68 @@ m_NumberOfDetectors(0) {
 
 ///////////////////////////////////////////////////////////////////////////
 /// A usefull method to bundle all operation to add a detector
-void TAnnularS4Physics::AddDetector(TVector3 ){
+void TAnnularS4Physics::AddDetector(TVector3 Position){
     // In That simple case nothing is done
     // Typically for more complex detector one would calculate the relevant
     // positions (stripped silicon) or angles (gamma array)
+    
+    double R_Min = 5;
+    double R_Max = 65;
+    
+    double Phi_Min = 0  ;
+    double Phi_Max = 360;
+    
+    int NumberOfRingStrip = 128 ;
+    int NumberOfSector = 128 ;
+    int Ring_NumberOfQuadrant = 1 ;
+    
+    double StripPitchSector = (Phi_Max-Phi_Min)/NumberOfSector ; //radial strip spacing in deg
+    double StripPitchRing = (R_Max-R_Min)/NumberOfRingStrip  ; // ring strip spacing in mm
+    
+    
     m_NumberOfDetectors++;
+    
+    double X = Position.X();
+    double Y = Position.Y();
+    double Z = Position.Z();
+    TVector3 Strip_1_1 = TVector3(0,0,Z);
+    TVector3 StripCenter;
+    
+    vector<double> v_Theta;
+    v_Theta.clear();
+    for(int i=0; i<NumberOfRingStrip; i++){
+        StripCenter = TVector3(R_Min+(i+0.5)*StripPitchRing,0,Z);
+        v_Theta.push_back(StripCenter.Theta());
+    }
+    m_ThetaAngleOfRingStrip.push_back(v_Theta);
+    for(int s=0; s<NumberOfSector; s++){
+        double PhiAngle = s*StripPitchSector;
+        m_PhiAngleOfSector.push_back(PhiAngle*M_PI/180);
+        //cout << PhiAngle << endl;
+    }
+
+    return;
+}
+
+///////////////////////////////////////////////////////////////////////////
+TVector3 TAnnularS4Physics::GetPositionOfInteraction(const int i) const{
+    TVector3 Position;
+    
+    double R = GetR(DetectorNumber[i]);
+    double Theta = GetTheta(DetectorNumber[i], StripNbr[i]);
+    double Phi = GetPhi(SectorNbr[i]);
+    
+    Position = TVector3(R*tan(Theta)*cos(Phi),R*tan(Theta)*sin(Phi),R);
+    
+    return(Position) ;
+    
 }
 
 ///////////////////////////////////////////////////////////////////////////
 void TAnnularS4Physics::AddDetector(double R, double Theta, double Phi){
     // Compute the TVector3 corresponding
     TVector3 Pos(R*sin(Theta)*cos(Phi),R*sin(Theta)*sin(Phi),R*cos(Theta));
-    // Call the cartesian method
+    m_R.push_back(R);
     AddDetector(Pos);
 }
 
diff --git a/NPLib/Detectors/AnnularS4/TAnnularS4Physics.h b/NPLib/Detectors/AnnularS4/TAnnularS4Physics.h
index 2d2b41e43..5aad96189 100644
--- a/NPLib/Detectors/AnnularS4/TAnnularS4Physics.h
+++ b/NPLib/Detectors/AnnularS4/TAnnularS4Physics.h
@@ -70,7 +70,7 @@ class TAnnularS4Physics : public TObject, public NPL::VDetector {
     vector<double>  Time;
 
   /// A usefull method to bundle all operation to add a detector
-  void AddDetector(TVector3 POS);
+  void AddDetector(TVector3 Position);
   void AddDetector(double R, double Theta, double Phi);
   
   //////////////////////////////////////////////////////////////
@@ -145,11 +145,25 @@ class TAnnularS4Physics : public TObject, public NPL::VDetector {
     // needed for online analysis for example
     void SetRawDataPointer(TAnnularS4Data* rawDataPointer) {m_EventData = rawDataPointer;}
     
+    // Return the position of interaction in S4
+    TVector3 GetPositionOfInteraction(const int i) const;
+    
+    double GetR(const int N)                                const{return m_R[N];}
+    double GetTheta(const int N, const int RingStrip)       const{return m_ThetaAngleOfRingStrip[N][RingStrip-1];}
+    double GetPhi(const int Sector)                         const {return m_PhiAngleOfSector[Sector-1];}
+    
   // objects are not written in the TTree
   private:
     TAnnularS4Data*         m_EventData;        //!
     TAnnularS4Data*         m_PreTreatedData;   //!
     TAnnularS4Physics*      m_EventPhysics;     //!
+    
+    vector<double>          m_R; //!
+    vector<vector<double>>  m_ThetaAngleOfRingStrip; //!
+    vector<double>          m_PhiAngleOfSector; //!
+    
+    
+
 
   // getters for raw and pre-treated data object
   public:
diff --git a/NPSimulation/Detectors/Hira/Hira.hh b/NPSimulation/Detectors/Hira/Hira.hh
index bd4ed7f0c..b90c16ba4 100644
--- a/NPSimulation/Detectors/Hira/Hira.hh
+++ b/NPSimulation/Detectors/Hira/Hira.hh
@@ -50,8 +50,8 @@ namespace HIRA
     // Resolution
     const G4double ResoTime         = 0.212765957;      // = 500ps                 //   Unit is  ns/2.35
     const G4double ResoCsI      	= 0.200/2.35;       // = 250 kev of resolution //   Unit is MeV/2.35
-    const G4double ResoThickSi  	= 0.065/2.35;       // = 120keV of Resolution   //   Unit is MeV/2.35
-    const G4double ResoThinSi       = 0.050/2.35;       // = 80keV of Resolution   //   Unit is MeV/2.35
+    const G4double ResoThickSi  	= 0.080/2.35;       // = 120keV of Resolution   //   Unit is MeV/2.35
+    const G4double ResoThinSi       = 0.060/2.35;       // = 80keV of Resolution   //   Unit is MeV/2.35
     
     const G4double EnergyThreshold = 0.;//100*keV;
     
@@ -233,4 +233,4 @@ public:
     static NPS::VDetector* Construct();
     
 };
-#endif
\ No newline at end of file
+#endif
diff --git a/Projects/Hira10/Analysis.cxx b/Projects/Hira10/Analysis.cxx
index d0ab7b29f..8f5f4de70 100644
--- a/Projects/Hira10/Analysis.cxx
+++ b/Projects/Hira10/Analysis.cxx
@@ -36,7 +36,7 @@ Analysis::~Analysis(){
 
 ////////////////////////////////////////////////////////////////////////////////
 void Analysis::Init(){
-    Hira = (THiraPhysics*) m_DetectorManager->GetDetector("HIRAArray");
+    Hira = (THiraPhysics*) m_DetectorManager->GetDetector("HiraTelescope");
     InitialConditions=new TInitialConditions();
     InitOutputBranch();
     InitInputBranch();
-- 
GitLab