From fad386bc50cebf4b3c1fb62ff0258ea1008a79fc Mon Sep 17 00:00:00 2001
From: Adrien Matta <matta@lpccaen.in2p3.fr>
Date: Fri, 15 Apr 2022 10:16:32 +0200
Subject: [PATCH] * Fixing SuperX3 back strip

---
 Inputs/EventGenerator/alpha.source         |  10 +-
 NPLib/Core/NPVDetector.h                   | 166 +++++++++++----------
 NPSimulation/Detectors/SuperX3/SuperX3.cc  |  12 +-
 Projects/Strasse/reaction/C12_p2p.reaction |   2 +-
 Projects/SuperX3/SuperX3.detector          |   8 +-
 5 files changed, 103 insertions(+), 95 deletions(-)

diff --git a/Inputs/EventGenerator/alpha.source b/Inputs/EventGenerator/alpha.source
index e374754a7..c84b2c8ea 100644
--- a/Inputs/EventGenerator/alpha.source
+++ b/Inputs/EventGenerator/alpha.source
@@ -4,13 +4,13 @@
 %      Energy are given in MeV , Position in mm      % 
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 Isotropic
- EnergyLow= 0.5 MeV
- EnergyHigh= 0.5 MeV
- HalfOpenAngleMin= 25 deg
- HalfOpenAngleMax= 65 deg
+ EnergyLow= 5 MeV
+ EnergyHigh= 5 MeV
+ HalfOpenAngleMin= 0 deg
+ HalfOpenAngleMax= 180 deg
  x0= 0 mm
  y0= 0 mm
- z0= 0 mm
+ z0= -150 mm
  Particle= alpha
  ExcitationEnergy= 0 MeV
 
diff --git a/NPLib/Core/NPVDetector.h b/NPLib/Core/NPVDetector.h
index 415950273..a023fc317 100644
--- a/NPLib/Core/NPVDetector.h
+++ b/NPLib/Core/NPVDetector.h
@@ -22,99 +22,107 @@
  *---------------------------------------------------------------------------*
  * Comment:                                                                  *
  *   See MUST2 array for exemple of VDetector derived class                  *
- *                                                                           *  
+ *                                                                           *
  *   Adding Fill Spectra Method to fill control Histogramm                   *
  *****************************************************************************/
 
 // ROOT
-#include "TH1.h"
 #include "TCanvas.h"
-// STL 
+#include "TH1.h"
+// STL
+#include <map>
 #include <string>
 #include <vector>
-#include <map>
 
 // NPL
-#include "NPInputParser.h"
 #include "NPCore.h"
+#include "NPInputParser.h"
 
 namespace NPL {
 
-  class VDetector{
-    public:
-
-      //  Default Constructor and destructor
-      VDetector()   ;
-      virtual ~VDetector()   ;
-
-      //  Read stream at ConfigFile to pick-up parameters of detector (Position,...) using Token
-      virtual void ReadConfiguration(NPL::InputParser) {} ;
-
-      //  Add Parameter to the CalibrationManger
-      virtual void AddParameterToCalibrationManager() {} ;      
-
-      //  Activated associated Branches and link it to the private member DetectorData address
-      //  In this method mother Branches (Detector) AND daughter leaf (fDetector_parameter) have to be activated
-      virtual void InitializeRootInputRaw() {} ;
-
-      //  Activated associated Branches and link it to the private member DetectorPhysics address
-      //  In this method mother Branches (Detector) AND daughter leaf (parameter) have to be activated
-      virtual void InitializeRootInputPhysics() {} ;
-
-      //  Create associated branches and associated private member DetectorPhysics address
-      virtual void InitializeRootOutput() {} ;
-
-      //  This method is called at each event read from the Input Tree. Aime is to build treat Raw dat in order to extract physical parameter. 
-      virtual void BuildPhysicalEvent() {} ;
-
-      //  Same as above, but only the simplest event and/or simple method are used (low multiplicity, faster algorythm but less efficient ...).
-      //  This method aimed to be used for analysis performed during experiment, when speed is requiered.
-      //  NB: This method can eventually be the same as BuildPhysicalEvent.
-      virtual void BuildSimplePhysicalEvent() {} ;
-
-      //  Those two method all to clear the Event Physics or Data
-      virtual void ClearEventPhysics() {} ;
-      virtual void ClearEventData() {} ;
-
-      // Method related to the TSpectra classes, aimed at providing a framework for online applications
-      // Instantiate the Spectra class and the histogramm throught it
-      virtual void InitSpectra() {};
-      // Fill the spectra hold by the spectra class
-      virtual void FillSpectra()  {};
-      // Write the spectra to a file
-      virtual void WriteSpectra()  {};
-      // Used for Online mainly, perform check on the histo and for example change their color if issues are found
-      virtual void CheckSpectra() {};
-      // Used for Online only, clear all the spectra hold by the Spectra class
-      virtual void ClearSpectra() {};
-      // Used for Online only, get all the spectra hold by the Spectra class
-      virtual  std::map< std::string , TH1*> GetSpectra() {std::map< std::string, TH1* > x; return x;};
-      // Used for Online only, get all the canvases
-      virtual std::vector<TCanvas*> GetCanvas(){std::vector<TCanvas*> x ; return x;};
-      // Used for interoperability with other framework
-      virtual void SetRawDataPointer(void*) {};
-      
-    private:   //   The list below is here to help you building your own detector
-      /*
-      //   GRU and Simulated Tree output are made of Data Object wich contain all the RAW parameter output by Detectors during an experiment.
-      //   You need to add a pointer to those kind of object in order to received data from the Tree at each getEntry call. Just replace Detector
-      //   by your Detector name, like Must2Data for Must2
-
-      DetectorData* EventData   ;
-
-      //   Position of detector: An array which held geometric information of detector, such as Strip position,...
-      //   Dimension must be suited for your need
-
-      vector< vector <double > >   DetectorPosition   ;
-
-      //   Calibration are passed to the EventPhysics Object, so you don't need to store them here
-
-      nothing   noCalibration   ;
-
-*/
-  ClassDef(VDetector,1) 
+  class VDetector {
+   public:
+    //  Default Constructor and destructor
+    VDetector();
+    virtual ~VDetector();
+
+    //  Read stream at ConfigFile to pick-up parameters of detector (Position,...) using Token
+    virtual void ReadConfiguration(NPL::InputParser){};
+
+    //  Add Parameter to the CalibrationManger
+    virtual void AddParameterToCalibrationManager(){};
+
+    //  Activated associated Branches and link it to the private member DetectorData address
+    //  In this method mother Branches (Detector) AND daughter leaf (fDetector_parameter) have to be activated
+    virtual void InitializeRootInputRaw(){};
+
+    //  Activated associated Branches and link it to the private member DetectorPhysics address
+    //  In this method mother Branches (Detector) AND daughter leaf (parameter) have to be activated
+    virtual void InitializeRootInputPhysics(){};
+
+    //  Create associated branches and associated private member DetectorPhysics address
+    virtual void InitializeRootOutput(){};
+
+    //  This method is called at each event read from the Input Tree. Aime is to build treat Raw dat in order to extract
+    //  physical parameter.
+    virtual void BuildPhysicalEvent(){};
+
+    //  Same as above, but only the simplest event and/or simple method are used (low multiplicity, faster algorythm but
+    //  less efficient ...). This method aimed to be used for analysis performed during experiment, when speed is
+    //  requiered. NB: This method can eventually be the same as BuildPhysicalEvent.
+    virtual void BuildSimplePhysicalEvent(){};
+
+    //  Those two method all to clear the Event Physics or Data
+    virtual void ClearEventPhysics(){};
+    virtual void ClearEventData(){};
+
+    // Method related to the TSpectra classes, aimed at providing a framework for online applications
+    // Instantiate the Spectra class and the histogramm throught it
+    virtual void InitSpectra(){};
+    // Fill the spectra hold by the spectra class
+    virtual void FillSpectra(){};
+    // Write the spectra to a file
+    virtual void WriteSpectra(){};
+    // Used for Online mainly, perform check on the histo and for example change their color if issues are found
+    virtual void CheckSpectra(){};
+    // Used for Online only, clear all the spectra hold by the Spectra class
+    virtual void ClearSpectra(){};
+    // Used for Online only, get all the spectra hold by the Spectra class
+    virtual std::map<std::string, TH1*> GetSpectra() {
+      std::map<std::string, TH1*> x;
+      return x;
+    };
+    // Used for Online only, get all the canvases
+    virtual std::vector<TCanvas*> GetCanvas() {
+      std::vector<TCanvas*> x;
+      return x;
+    };
+    // Used for interoperability with other framework
+    virtual void SetRawDataPointer(void*){};
+
+   private: //   The list below is here to help you building your own detector
+            /*
+            //   GRU and Simulated Tree output are made of Data Object wich contain all the RAW parameter output by Detectors
+            during an experiment.
+            //   You need to add a pointer to those kind of object in order to received data from the Tree at each getEntry
+            call. Just replace Detector
+            //   by your Detector name, like Must2Data for Must2
+        
+            DetectorData* EventData   ;
+        
+            //   Position of detector: An array which held geometric information of detector, such as Strip position,...
+            //   Dimension must be suited for your need
+        
+            vector< vector <double > >   DetectorPosition   ;
+        
+            //   Calibration are passed to the EventPhysics Object, so you don't need to store them here
+        
+            nothing   noCalibration   ;
+        
+      */
+    ClassDef(VDetector, 1)
   };
 
-}
+} // namespace NPL
 
 #endif
diff --git a/NPSimulation/Detectors/SuperX3/SuperX3.cc b/NPSimulation/Detectors/SuperX3/SuperX3.cc
index d129a6b0f..8484e8bce 100644
--- a/NPSimulation/Detectors/SuperX3/SuperX3.cc
+++ b/NPSimulation/Detectors/SuperX3/SuperX3.cc
@@ -311,12 +311,12 @@ void SuperX3::ReadSensitive(const G4Event*) {
     m_Event->SetDownE(det, strip, energy);
     m_Event->SetDownT(det, strip, time);
   }
-  auto sizeBack = backstrip->GetWidthMult();
+  auto sizeBack = backstrip->GetLengthMult();
   for (unsigned int i = 0; i < sizeBack; i++) {
-    double energy = backstrip->GetEnergyWidth(i);
-    double time = backstrip->GetTimeWidth(i);
-    int det = backstrip->GetDetectorWidth(i);
-    int strip = backstrip->GetStripWidth(i);
+    double energy = backstrip->GetEnergyLength(i);
+    double time = backstrip->GetTimeLength(i);
+    int det = backstrip->GetDetectorLength(i);
+    int strip = backstrip->GetStripLength(i);
     m_Event->SetBackE(det, strip, energy);
     m_Event->SetBackT(det, strip, time);
   }
@@ -340,7 +340,7 @@ void SuperX3::InitializeScorers() {
   G4VPrimitiveScorer* resistivestrip =
       new DSSDScorers::PS_Resistive("resistivestrip", 1, SiliconFaceLength, SiliconFaceWidth, NbStrips);
   G4VPrimitiveScorer* backstrip =
-      new DSSDScorers::PS_Rectangle("backstrip", 1, SiliconFaceLength, 1, SiliconFaceWidth, 4);
+      new DSSDScorers::PS_Rectangle("backstrip", 1, SiliconFaceLength, SiliconFaceWidth, 4, 1);
 
   G4VPrimitiveScorer* interaction = new InteractionScorers::PS_Interactions("Interaction", ms_InterCoord, 0);
   //... resistive ends......
diff --git a/Projects/Strasse/reaction/C12_p2p.reaction b/Projects/Strasse/reaction/C12_p2p.reaction
index 2da7ec347..35905b5ae 100755
--- a/Projects/Strasse/reaction/C12_p2p.reaction
+++ b/Projects/Strasse/reaction/C12_p2p.reaction
@@ -11,7 +11,7 @@ Beam
   MeanPhiY= 0 deg
   MeanX= 0 mm
   MeanY= 0 mm
-
+  ZEmission= 0mm
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 QFSReaction
  Beam= 12C
diff --git a/Projects/SuperX3/SuperX3.detector b/Projects/SuperX3/SuperX3.detector
index 3b716d6de..2614df266 100644
--- a/Projects/SuperX3/SuperX3.detector
+++ b/Projects/SuperX3/SuperX3.detector
@@ -1,6 +1,6 @@
 %%%%%%%
 Target
- THICKNESS= 1 micrometer
+ THICKNESS= 0.1 micrometer
  ANGLE= 0 deg
  RADIUS= 15 mm
  MATERIAL= CD2 
@@ -11,9 +11,9 @@ Target
 
 %%%%%%% Detector 1 %%%%%%% 		
 SuperX3
- THETA= 150
- PHI= 0
- R= 150
+ THETA= 0 deg
+ PHI= 0 deg
+ R= 150 mm
  BETA= 0 0 0
  VIS= all					
 
-- 
GitLab