From 02db1001ccd40de3e2a231076566384c9d33efdd Mon Sep 17 00:00:00 2001
From: adrien matta <matta@lpccaen.in2p3.fr>
Date: Fri, 24 Jul 2020 15:19:38 +0200
Subject: [PATCH] * Adding possibility to shift strasse barrel XYZ in analysis

---
 NPLib/Detectors/Strasse/TStrassePhysics.cxx | 12 ++++++++----
 NPLib/Detectors/Strasse/TStrassePhysics.h   |  4 ++--
 Projects/Strasse/Analysis.cxx               |  1 -
 3 files changed, 10 insertions(+), 7 deletions(-)

diff --git a/NPLib/Detectors/Strasse/TStrassePhysics.cxx b/NPLib/Detectors/Strasse/TStrassePhysics.cxx
index 0262a70c3..dcb5ddd6c 100644
--- a/NPLib/Detectors/Strasse/TStrassePhysics.cxx
+++ b/NPLib/Detectors/Strasse/TStrassePhysics.cxx
@@ -107,7 +107,7 @@ ClassImp(TStrassePhysics)
   }
 
 ///////////////////////////////////////////////////////////////////////////
-void TStrassePhysics::AddInnerDetector(double R, double Z, double Phi, double Shift){
+void TStrassePhysics::AddInnerDetector(double R, double Z, double Phi, double Shift, TVector3 Ref){
   m_NumberOfInnerDetectors++;
   double ActiveWidth  = Inner_Wafer_Width-2.*Inner_Wafer_GuardRing;
   double ActiveLength = Inner_Wafer_Length-Inner_Wafer_PADExternal-Inner_Wafer_PADInternal-2*Inner_Wafer_GuardRing;
@@ -118,6 +118,7 @@ void TStrassePhysics::AddInnerDetector(double R, double Z, double Phi, double Sh
   // Vector C position of detector face center
   TVector3 C(Shift,R,Z);// center of the whole detector, including PCB
   C.RotateZ(-Phi);
+  C+=Ref;
 
   // Vector W normal to detector face (pointing to the back)
   TVector3 W(0,1,0);
@@ -203,7 +204,7 @@ void TStrassePhysics::AddInnerDetector(double R, double Z, double Phi, double Sh
 }
 
 ///////////////////////////////////////////////////////////////////////////
-void TStrassePhysics::AddOuterDetector(double R, double Z, double Phi, double Shift){
+void TStrassePhysics::AddOuterDetector(double R, double Z, double Phi, double Shift, TVector3 Ref){
   m_NumberOfOuterDetectors++;
   double ActiveWidth  = Outer_Wafer_Width-2.*Outer_Wafer_GuardRing;
   double ActiveLength = Outer_Wafer_Length-Outer_Wafer_PADExternal-Outer_Wafer_PADInternal-2*Outer_Wafer_GuardRing;
@@ -214,6 +215,7 @@ void TStrassePhysics::AddOuterDetector(double R, double Z, double Phi, double Sh
   // Vector C position of detector face center
   TVector3 C(Shift,R,Z);// center of the whole detector, including PCB
   C.RotateZ(-Phi);
+  C+=Ref;
 
   // Vector W normal to detector face (pointing to the back)
   TVector3 W(0,1,0);
@@ -738,7 +740,8 @@ void TStrassePhysics::ReadConfiguration(NPL::InputParser parser) {
       double Z= blocks_inner[i]->GetDouble("Z","mm");
       double Phi = blocks_inner[i]->GetDouble("Phi","deg");
       double Shift = blocks_inner[i]->GetDouble("Shift","mm");
-      AddInnerDetector(R,Z,Phi,Shift);
+      TVector3 Ref = blocks_inner[i]->GetTVector3("Ref","mm");
+      AddInnerDetector(R,Z,Phi,Shift,Ref);
     }
     else{
       cout << "ERROR: check your input file formatting on " << i+1 << " inner block " <<endl;
@@ -760,7 +763,8 @@ void TStrassePhysics::ReadConfiguration(NPL::InputParser parser) {
       double Z= blocks_outer[i]->GetDouble("Z","mm");
       double Phi = blocks_outer[i]->GetDouble("Phi","deg");
       double Shift = blocks_outer[i]->GetDouble("Shift","mm");
-      AddOuterDetector(R,Z,Phi,Shift);
+      TVector3 Ref = blocks_inner[i]->GetTVector3("Ref","mm");
+      AddOuterDetector(R,Z,Phi,Shift,Ref);
     }
     else{
 
diff --git a/NPLib/Detectors/Strasse/TStrassePhysics.h b/NPLib/Detectors/Strasse/TStrassePhysics.h
index fb0f34902..a50c24a59 100644
--- a/NPLib/Detectors/Strasse/TStrassePhysics.h
+++ b/NPLib/Detectors/Strasse/TStrassePhysics.h
@@ -92,8 +92,8 @@ class TStrassePhysics : public TObject, public NPL::VDetector {
     void ReadConfiguration(NPL::InputParser);
 
     /// A usefull method to bundle all operation to add a detector
-    void AddInnerDetector(double R, double Z, double Phi,double Shift); 
-    void AddOuterDetector(double R, double Z, double Phi,double Shift); 
+    void AddInnerDetector(double R, double Z, double Phi,double Shift,TVector3 Ref); 
+    void AddOuterDetector(double R, double Z, double Phi,double Shift,TVector3 Ref); 
  
     // add parameters to the CalibrationManger
     void AddParameterToCalibrationManager();
diff --git a/Projects/Strasse/Analysis.cxx b/Projects/Strasse/Analysis.cxx
index 39d571973..9dce0cfd7 100644
--- a/Projects/Strasse/Analysis.cxx
+++ b/Projects/Strasse/Analysis.cxx
@@ -70,7 +70,6 @@ void Analysis::TreatEvent(){
     double deltaPhi = abs(Proton1.Phi()/deg-Proton2.Phi()/deg);
     double sumTheta = Proton1.Theta()/deg+Proton2.Theta()/deg;
     double OpeningAngle = Proton1.Angle(Proton2)/deg;
-   cout << OpeningAngle << endl;  
     // reject event that make no physical sense
     if(deltaPhi<170 && sumTheta<80){
       return;
-- 
GitLab