From 4d52d468e1cb1e2421f57dcb870779c3fbac72e7 Mon Sep 17 00:00:00 2001
From: meyanne <anneclairemeyer@yahoo.fr>
Date: Fri, 26 Feb 2021 13:22:46 +0100
Subject: [PATCH] ComptonTelescope (DSSSD): DecodeD and online_dssd
 modifications: - online_dssd: delete setters at the beginning to use
 TComptonTelescopeData setters directly in main()              cleaning to
 keep only dsssd treatment - DecodeD: decode root tree here in
 decodeEventFinal() (instead of in online_dssd)            add new variables
 and getters

Fix loading library problem in ExtractRawHisto (dsssd calibration)

Add calibration files
---
 .../ComptonTelescope/TComptonTelescopeData.h  |   8 +-
 .../TComptonTelescopePhysics.cxx              |   2 +-
 .../ExtractRawHisto_DSSSD_E.C                 |   3 +-
 .../ComptonTelescope/online/calibrations.txt  |   2 +-
 .../DSSSD_D1_Calibration_run10_newCal.txt     |  64 +++
 .../DSSSD_calibration_withPed_pol3_ok.txt     |  63 +++
 .../online/configs/ConfigComptonTelescope.dat |   4 +-
 .../ComptonTelescope/online/src/DecodeD.cpp   |  64 +++
 .../ComptonTelescope/online/src/DecodeD.h     |  15 +
 .../online/src/online_dsssd.cpp               | 465 ++----------------
 10 files changed, 245 insertions(+), 445 deletions(-)
 create mode 100644 Projects/ComptonTelescope/online/calibrations/DSSSD_D1_Calibration_run10_newCal.txt
 create mode 100644 Projects/ComptonTelescope/online/calibrations/DSSSD_calibration_withPed_pol3_ok.txt

diff --git a/NPLib/Detectors/ComptonTelescope/TComptonTelescopeData.h b/NPLib/Detectors/ComptonTelescope/TComptonTelescopeData.h
index 24c1712d5..ee25f5106 100644
--- a/NPLib/Detectors/ComptonTelescope/TComptonTelescopeData.h
+++ b/NPLib/Detectors/ComptonTelescope/TComptonTelescopeData.h
@@ -95,28 +95,28 @@ class TComptonTelescopeData : public TObject {
       void SetCTTrackerBackTStripNbr(const UShort_t StripNbr)     {fCT_Tracker_BackT_StripNbr.push_back(StripNbr);}
       void SetCTTrackerBackTTime(const Double_t Time)             {fCT_Tracker_BackT_Time.push_back(Time);}
       // set all Front E
-      void SetFrontE(const UShort_t& TowNbr, const UShort_t DetNbr, const UShort_t StripNbr, const Double_t Energy) {
+      void SetFrontE(const UShort_t TowNbr, const UShort_t DetNbr, const UShort_t StripNbr, const Double_t Energy) {
         SetCTTrackerFrontETowerNbr(TowNbr);
         SetCTTrackerFrontEDetectorNbr(DetNbr);
         SetCTTrackerFrontEStripNbr(StripNbr);
         SetCTTrackerFrontEEnergy(Energy);
       };
       // set all Back E
-      void SetBackE(const UShort_t& TowNbr, const UShort_t DetNbr, const UShort_t StripNbr, const Double_t Energy) {
+      void SetBackE(const UShort_t TowNbr, const UShort_t DetNbr, const UShort_t StripNbr, const Double_t Energy) {
         SetCTTrackerBackETowerNbr(TowNbr);
         SetCTTrackerBackEDetectorNbr(DetNbr);
         SetCTTrackerBackEStripNbr(StripNbr);
         SetCTTrackerBackEEnergy(Energy);
       };
       // set all Front T
-      void SetFrontT(const UShort_t& TowNbr, const UShort_t DetNbr, const UShort_t StripNbr, const Double_t Time) {
+      void SetFrontT(const UShort_t TowNbr, const UShort_t DetNbr, const UShort_t StripNbr, const Double_t Time) {
         SetCTTrackerFrontTTowerNbr(TowNbr);
         SetCTTrackerFrontTDetectorNbr(DetNbr);
         SetCTTrackerFrontTStripNbr(StripNbr);
         SetCTTrackerFrontTTime(Time);
       };
       // set all Back T
-      void SetBackT(const UShort_t& TowNbr, const UShort_t DetNbr, const UShort_t StripNbr, const Double_t Time) {
+      void SetBackT(const UShort_t TowNbr, const UShort_t DetNbr, const UShort_t StripNbr, const Double_t Time) {
         SetCTTrackerBackTTowerNbr(TowNbr);
         SetCTTrackerBackTDetectorNbr(DetNbr);
         SetCTTrackerBackTStripNbr(StripNbr);
diff --git a/NPLib/Detectors/ComptonTelescope/TComptonTelescopePhysics.cxx b/NPLib/Detectors/ComptonTelescope/TComptonTelescopePhysics.cxx
index 1ed02f369..012fc84f2 100644
--- a/NPLib/Detectors/ComptonTelescope/TComptonTelescopePhysics.cxx
+++ b/NPLib/Detectors/ComptonTelescope/TComptonTelescopePhysics.cxx
@@ -314,7 +314,7 @@ void TComptonTelescopePhysics::PreTreat()
   for (UShort_t i = 0; i < m_EventData->GetCTTrackerBackEMult(); ++i) {
     m_CounterEvt[4] = 1; // nb of events with at least one EB raw recorded
     m_CounterHit[3] += 1; // nb of hits with EB raw
-    //cout << "Raw: DetB = " << m_EventData->GetCTTrackerBackEDetectorNbr(i) << " ; stripB = " << m_EventData->GetCTTrackerBackEStripNbr(i) << " ; EB raw = " << m_EventData->GetCTTrackerFrontEEnergy(i) << endl;
+    //cout << "Raw: DetB = " << m_EventData->GetCTTrackerBackEDetectorNbr(i) << " ; stripB = " << m_EventData->GetCTTrackerBackEStripNbr(i) << " ; EB raw = " << m_EventData->GetCTTrackerBackEEnergy(i) << endl;
 
     if (m_EventData->GetCTTrackerBackEEnergy(i) > m_StripBack_E_RAW_Threshold && 
         IsValidChannel("Back", m_EventData->GetCTTrackerBackEDetectorNbr(i), m_EventData->GetCTTrackerBackEStripNbr(i))) {
diff --git a/Projects/ComptonTelescope/online/Calibration_DSSSD/ExtractRawHisto_DSSSD_E.C b/Projects/ComptonTelescope/online/Calibration_DSSSD/ExtractRawHisto_DSSSD_E.C
index 708200da8..f4b1f1a53 100644
--- a/Projects/ComptonTelescope/online/Calibration_DSSSD/ExtractRawHisto_DSSSD_E.C
+++ b/Projects/ComptonTelescope/online/Calibration_DSSSD/ExtractRawHisto_DSSSD_E.C
@@ -23,7 +23,8 @@ using namespace std;
 
 // custom headers
 #include "../src/DecodeD.h"
-#include "../src/DecodeD.cpp"
+
+R__LOAD_LIBRARY(../build/lib/libDecodeD.so)
 
 #define NBDETECTORS	1	
 #define	NBSTRIPS	32
diff --git a/Projects/ComptonTelescope/online/calibrations.txt b/Projects/ComptonTelescope/online/calibrations.txt
index 774e5b145..1fcb843fc 100644
--- a/Projects/ComptonTelescope/online/calibrations.txt
+++ b/Projects/ComptonTelescope/online/calibrations.txt
@@ -1,5 +1,5 @@
 CalibrationFilePath
-  ./calibrations/DSSSD_D1_Calibration.txt
+  ./calibrations/DSSSD_calibration_withPed_pol3_ok.txt
   ./calibrations/CeBr3_PED.txt
   ./calibrations/CeBr3_PED3.txt
   ./calibrations/CeBr3_PED4.txt
diff --git a/Projects/ComptonTelescope/online/calibrations/DSSSD_D1_Calibration_run10_newCal.txt b/Projects/ComptonTelescope/online/calibrations/DSSSD_D1_Calibration_run10_newCal.txt
new file mode 100644
index 000000000..1c837b040
--- /dev/null
+++ b/Projects/ComptonTelescope/online/calibrations/DSSSD_D1_Calibration_run10_newCal.txt
@@ -0,0 +1,64 @@
+COMPTONTELESCOPE_D1_STRIP_FRONT0_E	-0.118831	0.0020194	-1.23367e-06	5.4931e-10
+COMPTONTELESCOPE_D1_STRIP_FRONT1_E	-0.117704	0.00201443	-1.21246e-06	5.35478e-10
+COMPTONTELESCOPE_D1_STRIP_FRONT2_E	-0.118466	0.00201954	-1.21136e-06	5.31724e-10
+COMPTONTELESCOPE_D1_STRIP_FRONT3_E	-0.139276	0.00202641	-1.20937e-06	5.25946e-10
+COMPTONTELESCOPE_D1_STRIP_FRONT4_E	-0.131311	0.00203068	-1.24081e-06	5.48624e-10
+COMPTONTELESCOPE_D1_STRIP_FRONT5_E	-0.128764	0.00204466	-1.25583e-06	5.57268e-10
+COMPTONTELESCOPE_D1_STRIP_FRONT6_E	-0.136112	0.00202706	-1.20817e-06	5.28383e-10
+COMPTONTELESCOPE_D1_STRIP_FRONT7_E	-0.138073	0.0020399	-1.23153e-06	5.40859e-10
+COMPTONTELESCOPE_D1_STRIP_FRONT8_E	-0.120131	0.00203402	-1.25091e-06	5.53975e-10
+COMPTONTELESCOPE_D1_STRIP_FRONT9_E	-0.148054	0.00204507	-1.22883e-06	5.3334e-10
+COMPTONTELESCOPE_D1_STRIP_FRONT10_E	-0.133886	0.00202571	-1.22837e-06	5.413e-10
+COMPTONTELESCOPE_D1_STRIP_FRONT11_E	-0.135105	0.00203188	-1.22988e-06	5.41547e-10
+COMPTONTELESCOPE_D1_STRIP_FRONT12_E	-0.123442	0.00201981	-1.21728e-06	5.33728e-10
+COMPTONTELESCOPE_D1_STRIP_FRONT13_E	-0.131303	0.00202039	-1.20152e-06	5.24131e-10
+COMPTONTELESCOPE_D1_STRIP_FRONT14_E	-0.129354	0.00203541	-1.23392e-06	5.44566e-10
+COMPTONTELESCOPE_D1_STRIP_FRONT15_E	-0.131322	0.00202732	-1.23013e-06	5.44372e-10
+COMPTONTELESCOPE_D1_STRIP_FRONT16_E	-0.12703	0.00201901	-1.20971e-06	5.30598e-10
+COMPTONTELESCOPE_D1_STRIP_FRONT17_E	-0.128485	0.00203054	-1.22686e-06	5.41329e-10
+COMPTONTELESCOPE_D1_STRIP_FRONT18_E	-0.137729	0.00204346	-1.24308e-06	5.44544e-10
+COMPTONTELESCOPE_D1_STRIP_FRONT19_E	-0.136162	0.00201641	-1.20309e-06	5.26798e-10
+COMPTONTELESCOPE_D1_STRIP_FRONT20_E	-0.14267	0.00208544	-1.39404e-06	6.71016e-10
+COMPTONTELESCOPE_D1_STRIP_FRONT21_E	-44.4711	1.19468	-0.009927	2.62873e-05
+COMPTONTELESCOPE_D1_STRIP_FRONT22_E	-0.142797	0.00203497	-1.22033e-06	5.36205e-10
+COMPTONTELESCOPE_D1_STRIP_FRONT23_E	-0.129792	0.00202387	-1.22206e-06	5.37164e-10
+COMPTONTELESCOPE_D1_STRIP_FRONT24_E	-0.135854	0.00203543	-1.23018e-06	5.41652e-10
+COMPTONTELESCOPE_D1_STRIP_FRONT25_E	-0.151676	0.00203789	-1.21982e-06	5.28336e-10
+COMPTONTELESCOPE_D1_STRIP_FRONT26_E	-0.131928	0.0020564	-1.27458e-06	5.70852e-10
+COMPTONTELESCOPE_D1_STRIP_FRONT27_E	-0.135168	0.00203931	-1.2459e-06	5.55184e-10
+COMPTONTELESCOPE_D1_STRIP_FRONT28_E	-0.146183	0.00201397	-1.17254e-06	5.00034e-10
+COMPTONTELESCOPE_D1_STRIP_FRONT29_E	-0.146413	0.00204296	-1.22386e-06	5.32723e-10
+COMPTONTELESCOPE_D1_STRIP_FRONT30_E	-0.148404	0.00205827	-1.28524e-06	5.86852e-10
+COMPTONTELESCOPE_D1_STRIP_FRONT31_E	-0.152662	0.00202693	-1.19129e-06	5.13324e-10
+COMPTONTELESCOPE_D1_STRIP_BACK0_E	-0.0756831	0.00127577	2.21358e-07	-3.21543e-10
+COMPTONTELESCOPE_D1_STRIP_BACK1_E	-0.0842426	0.00129428	1.5664e-07	-2.69237e-10
+COMPTONTELESCOPE_D1_STRIP_BACK2_E	-0.0886519	0.00127173	2.27233e-07	-3.13794e-10
+COMPTONTELESCOPE_D1_STRIP_BACK3_E	-0.0655088	0.00126083	1.9293e-07	-2.81871e-10
+COMPTONTELESCOPE_D1_STRIP_BACK4_E	-0.0808209	0.00125791	2.49939e-07	-3.32252e-10
+COMPTONTELESCOPE_D1_STRIP_BACK5_E	-0.0980924	0.00128698	2.01868e-07	-2.96257e-10
+COMPTONTELESCOPE_D1_STRIP_BACK6_E	-0.0767718	0.00123853	2.6634e-07	-3.26085e-10
+COMPTONTELESCOPE_D1_STRIP_BACK7_E	-0.0879577	0.00129706	1.89326e-07	-2.97962e-10
+COMPTONTELESCOPE_D1_STRIP_BACK8_E	-0.0797696	0.00126691	2.25406e-07	-3.18143e-10
+COMPTONTELESCOPE_D1_STRIP_BACK9_E	-0.0858537	0.00126189	2.16585e-07	-2.91054e-10
+COMPTONTELESCOPE_D1_STRIP_BACK10_E	-0.076765	0.00125719	2.48247e-07	-3.30331e-10
+COMPTONTELESCOPE_D1_STRIP_BACK11_E	-0.0950688	0.00126866	2.14316e-07	-2.97996e-10
+COMPTONTELESCOPE_D1_STRIP_BACK12_E	-0.0741301	0.00124277	2.5883e-07	-3.31003e-10
+COMPTONTELESCOPE_D1_STRIP_BACK13_E	-0.0868071	0.00127055	2.25484e-07	-3.04522e-10
+COMPTONTELESCOPE_D1_STRIP_BACK14_E	-0.0748443	0.0012237	2.61351e-07	-3.17288e-10
+COMPTONTELESCOPE_D1_STRIP_BACK15_E	-0.0989367	0.0012918	2.0643e-07	-3.03368e-10
+COMPTONTELESCOPE_D1_STRIP_BACK16_E	-0.077611	0.00124008	2.39163e-07	-3.10812e-10
+COMPTONTELESCOPE_D1_STRIP_BACK17_E	-0.100867	0.00128439	1.71112e-07	-2.67333e-10
+COMPTONTELESCOPE_D1_STRIP_BACK18_E	-4.73406e+10	8.43153e+09	-3.06291e+08	3.1596e+06
+COMPTONTELESCOPE_D1_STRIP_BACK19_E	-0.102112	0.0012754	1.76688e-07	-2.66347e-10
+COMPTONTELESCOPE_D1_STRIP_BACK20_E	-0.0550878	0.0011879	3.48916e-07	-3.67882e-10
+COMPTONTELESCOPE_D1_STRIP_BACK21_E	-0.0923315	0.00128437	1.55178e-07	-2.52165e-10
+COMPTONTELESCOPE_D1_STRIP_BACK22_E	-2.83812e+06	309274	12321.2	-412.799
+COMPTONTELESCOPE_D1_STRIP_BACK23_E	-0.0865215	0.00123972	1.89224e-07	-2.46275e-10
+COMPTONTELESCOPE_D1_STRIP_BACK24_E	-0.0766027	0.00123733	2.56398e-07	-3.18655e-10
+COMPTONTELESCOPE_D1_STRIP_BACK25_E	-0.0962202	0.00128027	1.79482e-07	-2.70486e-10
+COMPTONTELESCOPE_D1_STRIP_BACK26_E	-0.077302	0.00124191	2.31401e-07	-3.00387e-10
+COMPTONTELESCOPE_D1_STRIP_BACK27_E	-0.0820358	0.0012664	1.75301e-07	-2.57849e-10
+COMPTONTELESCOPE_D1_STRIP_BACK28_E	-0.0700134	0.00123888	2.37705e-07	-3.03327e-10
+COMPTONTELESCOPE_D1_STRIP_BACK29_E	-0.0989287	0.00129228	1.26337e-07	-2.36442e-10
+COMPTONTELESCOPE_D1_STRIP_BACK30_E	-0.0585961	0.00127157	1.99286e-08	-8.74148e-11
+COMPTONTELESCOPE_D1_STRIP_BACK31_E	-0.0879277	0.00126399	1.94738e-07	-2.75574e-10
diff --git a/Projects/ComptonTelescope/online/calibrations/DSSSD_calibration_withPed_pol3_ok.txt b/Projects/ComptonTelescope/online/calibrations/DSSSD_calibration_withPed_pol3_ok.txt
new file mode 100644
index 000000000..c41de93a6
--- /dev/null
+++ b/Projects/ComptonTelescope/online/calibrations/DSSSD_calibration_withPed_pol3_ok.txt
@@ -0,0 +1,63 @@
+COMPTONTELESCOPE_D1_STRIP_FRONT0_E -0.103591 0.00202937 -1.31595e-06 5.76435e-10
+COMPTONTELESCOPE_D1_STRIP_FRONT2_E -0.104106 0.00202867 -1.3036e-06 5.63485e-10
+COMPTONTELESCOPE_D1_STRIP_FRONT3_E -0.098837 0.00204093 -1.33881e-06 5.92735e-10
+COMPTONTELESCOPE_D1_STRIP_FRONT4_E -0.108476 0.00202001 -1.29333e-06 5.58686e-10
+COMPTONTELESCOPE_D1_STRIP_FRONT5_E -0.116573 0.00204149 -1.3072e-06 5.66047e-10
+COMPTONTELESCOPE_D1_STRIP_FRONT6_E -0.110589 0.00203637 -1.31396e-06 5.69446e-10
+COMPTONTELESCOPE_D1_STRIP_FRONT7_E -0.100743 0.00202155 -1.30182e-06 5.67145e-10
+COMPTONTELESCOPE_D1_STRIP_FRONT8_E -0.11252 0.00202463 -1.29808e-06 5.60844e-10
+COMPTONTELESCOPE_D1_STRIP_FRONT9_E -0.117428 0.00203499 -1.30994e-06 5.66109e-10
+COMPTONTELESCOPE_D1_STRIP_FRONT10_E -0.103673 0.00201915 -1.30198e-06 5.66642e-10
+COMPTONTELESCOPE_D1_STRIP_FRONT11_E -0.0982859 0.00202634 -1.31844e-06 5.80249e-10
+COMPTONTELESCOPE_D1_STRIP_FRONT12_E -0.111208 0.00203441 -1.32057e-06 5.79307e-10
+COMPTONTELESCOPE_D1_STRIP_FRONT13_E -0.120281 0.00205225 -1.38071e-06 6.21937e-10
+COMPTONTELESCOPE_D1_STRIP_FRONT14_E -0.112119 0.00201441 -1.28253e-06 5.59917e-10
+COMPTONTELESCOPE_D1_STRIP_FRONT15_E -0.110662 0.00200685 -1.2735e-06 5.5227e-10
+COMPTONTELESCOPE_D1_STRIP_FRONT16_E -0.112664 0.00202289 -1.3004e-06 5.66877e-10
+COMPTONTELESCOPE_D1_STRIP_FRONT17_E -0.0983501 0.00201311 -1.29979e-06 5.70893e-10
+COMPTONTELESCOPE_D1_STRIP_FRONT18_E -0.0979195 0.00201749 -1.3067e-06 5.75613e-10
+COMPTONTELESCOPE_D1_STRIP_FRONT19_E -0.0983914 0.00201083 -1.30387e-06 5.74465e-10
+COMPTONTELESCOPE_D1_STRIP_FRONT20_E -0.102963 0.00200863 -1.291e-06 5.65941e-10
+COMPTONTELESCOPE_D1_STRIP_FRONT21_E -0.109975 0.00201758 -1.28779e-06 5.59236e-10
+COMPTONTELESCOPE_D1_STRIP_FRONT22_E -0.0973036 0.00200045 -1.26058e-06 5.4656e-10
+COMPTONTELESCOPE_D1_STRIP_FRONT23_E -0.102655 0.0020103 -1.2829e-06 5.58831e-10
+COMPTONTELESCOPE_D1_STRIP_FRONT24_E -0.104804 0.00201667 -1.29217e-06 5.56727e-10
+COMPTONTELESCOPE_D1_STRIP_FRONT25_E -0.112278 0.00202614 -1.29455e-06 5.61179e-10
+COMPTONTELESCOPE_D1_STRIP_FRONT26_E -0.109317 0.00203257 -1.31645e-06 5.77175e-10
+COMPTONTELESCOPE_D1_STRIP_FRONT27_E -0.0993002 0.00198848 -1.24093e-06 5.35279e-10
+COMPTONTELESCOPE_D1_STRIP_FRONT28_E -0.103218 0.00201509 -1.29301e-06 5.64033e-10
+COMPTONTELESCOPE_D1_STRIP_FRONT29_E -0.105567 0.00202778 -1.30333e-06 5.69012e-10
+COMPTONTELESCOPE_D1_STRIP_FRONT30_E -0.100864 0.00205314 -1.34556e-06 5.88846e-10
+COMPTONTELESCOPE_D1_STRIP_FRONT31_E -0.103062 0.00203463 -1.32007e-06 5.73146e-10
+COMPTONTELESCOPE_D1_STRIP_BACK0_E -0.0755551 0.0014027 -5.46295e-08 -1.535e-10
+COMPTONTELESCOPE_D1_STRIP_BACK1_E -0.0786639 0.00139894 -3.43811e-08 -1.62293e-10
+COMPTONTELESCOPE_D1_STRIP_BACK2_E -0.0725508 0.00142445 -1.13162e-07 -1.2294e-10
+COMPTONTELESCOPE_D1_STRIP_BACK3_E -0.0822847 0.00139653 -5.58348e-08 -1.36187e-10
+COMPTONTELESCOPE_D1_STRIP_BACK4_E -0.075355 0.00136454 1.60153e-08 -1.88892e-10
+COMPTONTELESCOPE_D1_STRIP_BACK5_E -0.070324 0.00139274 -8.41426e-08 -1.22293e-10
+COMPTONTELESCOPE_D1_STRIP_BACK6_E -0.0605549 0.00139064 -3.30817e-08 -1.69143e-10
+COMPTONTELESCOPE_D1_STRIP_BACK7_E -0.0666194 0.00138605 -3.82721e-08 -1.50997e-10
+COMPTONTELESCOPE_D1_STRIP_BACK8_E -0.0741552 0.00138275 -4.00449e-09 -1.84527e-10
+COMPTONTELESCOPE_D1_STRIP_BACK9_E -0.0814244 0.0013753 4.63623e-09 -1.83339e-10
+COMPTONTELESCOPE_D1_STRIP_BACK10_E -0.0616857 0.00136842 -1.39941e-08 -1.57991e-10
+COMPTONTELESCOPE_D1_STRIP_BACK11_E -0.0762645 0.00138761 -3.01102e-08 -1.6395e-10
+COMPTONTELESCOPE_D1_STRIP_BACK12_E -0.0720235 0.00135252 4.39851e-08 -2.05899e-10
+COMPTONTELESCOPE_D1_STRIP_BACK13_E -0.0639722 0.00137769 -3.1996e-08 -1.53898e-10
+COMPTONTELESCOPE_D1_STRIP_BACK14_E -0.0693841 0.00138182 -2.65063e-08 -1.66127e-10
+COMPTONTELESCOPE_D1_STRIP_BACK15_E -0.0693754 0.0013786 -4.02883e-08 -1.47366e-10
+COMPTONTELESCOPE_D1_STRIP_BACK16_E -0.0615302 0.00139044 -5.06176e-08 -1.57946e-10
+COMPTONTELESCOPE_D1_STRIP_BACK17_E -0.0839769 0.00143972 -1.94622e-07 -5.06432e-11
+COMPTONTELESCOPE_D1_STRIP_BACK18_E -0.0787552 0.00140747 -2.03952e-08 -1.92275e-10
+COMPTONTELESCOPE_D1_STRIP_BACK19_E -0.0819682 0.001425 -8.44234e-08 -1.43258e-10
+COMPTONTELESCOPE_D1_STRIP_BACK20_E -0.0741045 0.00140995 -9.66639e-08 -1.22825e-10
+COMPTONTELESCOPE_D1_STRIP_BACK21_E -0.0726507 0.0013651 1.71355e-09 -1.67266e-10
+COMPTONTELESCOPE_D1_STRIP_BACK22_E -0.06887 0.00135476 4.29449e-08 -2.08002e-10
+COMPTONTELESCOPE_D1_STRIP_BACK23_E -0.0734823 0.00139036 -4.69954e-08 -1.59962e-10
+COMPTONTELESCOPE_D1_STRIP_BACK24_E -0.0814692 0.00141153 -1.01568e-07 -1.19993e-10
+COMPTONTELESCOPE_D1_STRIP_BACK25_E -0.0679494 0.00137581 -6.86338e-08 -1.24906e-10
+COMPTONTELESCOPE_D1_STRIP_BACK26_E -0.0634414 0.00133637 8.83812e-08 -2.36871e-10
+COMPTONTELESCOPE_D1_STRIP_BACK27_E -0.0742368 0.00139765 -7.22661e-08 -1.30621e-10
+COMPTONTELESCOPE_D1_STRIP_BACK28_E -0.0682225 0.00136177 4.89513e-08 -2.09195e-10
+COMPTONTELESCOPE_D1_STRIP_BACK29_E -0.0681408 0.00138285 -5.04957e-08 -1.46424e-10
+COMPTONTELESCOPE_D1_STRIP_BACK30_E -0.0532481 0.00138162 -3.48193e-08 -1.54458e-10
+COMPTONTELESCOPE_D1_STRIP_BACK31_E -0.0611554 0.00136231 -1.85725e-08 -1.50171e-10
diff --git a/Projects/ComptonTelescope/online/configs/ConfigComptonTelescope.dat b/Projects/ComptonTelescope/online/configs/ConfigComptonTelescope.dat
index f70468ddd..380f07918 100644
--- a/Projects/ComptonTelescope/online/configs/ConfigComptonTelescope.dat
+++ b/Projects/ComptonTelescope/online/configs/ConfigComptonTelescope.dat
@@ -3,9 +3,7 @@ ConfigComptonTelescope
    ONLY_GOOD_COUPLE_WITH_MULTIPLICITY_ONE ON
    FRONT_BACK_ENERGY_MATCHING_SIGMA       0.006
    FRONT_BACK_ENERGY_MATCHING_NUMBER_OF_SIGMA  2
-   DISABLE_CHANNEL COMPTONTELESCOPE_D1_STRIP_FRONT21_E
-   DISABLE_CHANNEL COMPTONTELESCOPE_D1_STRIP_BACK18_E
-   DISABLE_CHANNEL COMPTONTELESCOPE_D1_STRIP_BACK22_E
+   DISABLE_CHANNEL COMPTONTELESCOPE_D1_STRIP_FRONT1_E
    STRIP_FRONT_E_RAW_THRESHOLD            0
    STRIP_BACK_E_RAW_THRESHOLD             0
    STRIP_FRONT_E_THRESHOLD                0.012
diff --git a/Projects/ComptonTelescope/online/src/DecodeD.cpp b/Projects/ComptonTelescope/online/src/DecodeD.cpp
index 0720db440..c22bb29bc 100644
--- a/Projects/ComptonTelescope/online/src/DecodeD.cpp
+++ b/Projects/ComptonTelescope/online/src/DecodeD.cpp
@@ -58,6 +58,31 @@ long int DecodeD::getLength()
   return length;
 }
 
+int DecodeD::getEventSize()
+{
+  return Energy.size();
+}
+
+int DecodeD::getFaceType(const int i)
+{
+  return FaceType[i];
+}
+
+int DecodeD::getDetNbr(const int i)
+{
+  return DetNbr[i];
+}
+
+int DecodeD::getStripNbr(const int i)
+{
+  return StripNbr[i];
+}
+
+double DecodeD::getEnergy(const int i)
+{
+  return Energy[i];
+}
+
 long int DecodeD::getTime()
 {
   return event.timestamp;
@@ -68,6 +93,37 @@ newframe_t* DecodeD::getEvent()
   return &event;
 }
 
+void DecodeD::decodeEventFinal()
+{
+  switch (datatype) {
+    case D_ROOT:
+      if (cursor < length) {
+        t1->GetEntry(cursor);
+        for (int i = 0; i < 2; i++) { // 2 faces
+          for (int j = 0; j < NBDETECTORS; j++) {
+            if (event.chip_data[i][j]) { // Test if data is present
+              for (int k = 0; k < NBSTRIPS; k++) {
+                FaceType.push_back(i);
+                DetNbr.push_back(j);
+                StripNbr.push_back(k);
+                Energy.push_back(event.sample[i][j][k]);
+                //cout << "Decode Face " << i << " det " << j << " strip " << k << " E " << event.sample[i][j][k] << endl;
+              } // end loop on strips
+            } // end Test
+          } // end loop on detectors
+        } // end loop on faces 
+
+        cursor++;
+      }
+      break;
+    case D_MFM:
+      break;
+    case D_NONE:
+      cout << "No data has been set to decode" << endl;
+  }
+}
+
+// should be deleted and replaced by decodeEventFinal after validation
 void DecodeD::decodeEvent()
 {
   switch (datatype) {
@@ -99,6 +155,14 @@ void DecodeD::decodeEvent()
   }
 }
 
+void DecodeD::Clear()
+{
+  FaceType.clear();
+  DetNbr.clear();
+  StripNbr.clear();
+  Energy.clear();
+}
+
 void DecodeD::Dump()
 {
   cout << "Datatype: " << datatype << " means ";
diff --git a/Projects/ComptonTelescope/online/src/DecodeD.h b/Projects/ComptonTelescope/online/src/DecodeD.h
index ef0c053d8..302917441 100644
--- a/Projects/ComptonTelescope/online/src/DecodeD.h
+++ b/Projects/ComptonTelescope/online/src/DecodeD.h
@@ -5,12 +5,16 @@
 #include <iostream>
 #include <fstream>
 #include <string>
+#include <vector>
 using namespace std;
 
 // Root headers
 #include "TFile.h"
 #include "TTree.h"
 
+#define NBDETECTORS 1
+#define NBSTRIPS  32
+
 enum Datatype {D_NONE = 0, D_ROOT, D_MFM};
 
 typedef struct {
@@ -59,6 +63,10 @@ class DecodeD
     uint32_t* timestamp;
 
     // For online data
+    vector<int> FaceType;
+    vector<int> DetNbr;
+    vector<int> StripNbr;
+    vector<double> Energy;
 
   public:
     DecodeD(bool v);
@@ -70,12 +78,19 @@ class DecodeD
 
     long int getCursor();
     long int getLength();
+    int getEventSize();
+    int getFaceType(const int i);
+    int getDetNbr(const int i);
+    int getStripNbr(const int i);
+    double getEnergy(const int i);
     long int getTime();
     newframe_t* getEvent();
     // One may add a few getters here and deprecate getEvent to avoid requiring the class user to know the newframe_t struct
     
     void decodeEvent();
+    void decodeEventFinal();
 
+    void Clear();
     void Dump();
 };
 
diff --git a/Projects/ComptonTelescope/online/src/online_dsssd.cpp b/Projects/ComptonTelescope/online/src/online_dsssd.cpp
index e4617e57f..2037fed54 100644
--- a/Projects/ComptonTelescope/online/src/online_dsssd.cpp
+++ b/Projects/ComptonTelescope/online/src/online_dsssd.cpp
@@ -6,20 +6,10 @@
 #include "TComptonTelescopePhysics.h"
 
 // root headers
-#include "TCutG.h"
-//#include "TH2.h"
 #include "TFile.h"
-#include "TCanvas.h"
 
 // custom headers
-#include "DecodeR.h"
 #include "DecodeD.h"
-#include "DecodeT.h"
-
-#define __TEST_ZONE__
-//#undef __TEST_ZONE__
-#define __USE_CUTG__
-#undef __USE_CUTG__
 
 // C++ headers
 #include <iostream>
@@ -27,110 +17,16 @@
 #include <string>
 using namespace std;
 
-////--//--// One-line setter for calorimeter //--//--//
-//
-//void setCTCalorimeter(TComptonTelescopeData* ccamData, DecodeR* D, const int pixelNumber)
-//{
-//  ccamData -> SetCTCalorimeter(1, 1, D->getPixelNumber(), D->getTime(), D->getData(), pixelNumber);
-///*  ccamData -> SetCTCalorimeterTTowerNbr( 1 );
-//  ccamData -> SetCTCalorimeterTDetectorNbr( 1 );//Triggered ASIC number
-//  ccamData -> SetCTCalorimeterTChannelNbr( D -> getPixelNumber() );//Pixel that triggered
-//  ccamData -> SetCTCalorimeterTTime( D -> getTime() );
-//  for (int i = 0; i < pixelNumber; ++i) {//Loop on pixels
-//    ccamData -> SetCTCalorimeterETowerNbr(1);
-//    ccamData -> SetCTCalorimeterEDetectorNbr( 1 );
-//    ccamData -> SetCTCalorimeterEChannelNbr( i );//PMT pixel number
-//    ccamData -> SetCTCalorimeterEEnergy( D -> getData()[i] );
-//  }//End of loop on pixels*/
-//}
-
-//--//--// One-line setter for DSSSD(s) //--//--//
-
-// One-line setter for the Front of one DSSD
-void setCTTrackerFront(TComptonTelescopeData* ccamData, newframe_t* event, int detNbr, int faceNbr, const int stripNumber)
-{
-  //detNbr and faceNbr are > 0
-  ccamData -> SetCTTrackerFrontTTowerNbr(1);
-  ccamData -> SetCTTrackerFrontTDetectorNbr(detNbr);
-  ccamData -> SetCTTrackerFrontTStripNbr(33);
-  ccamData -> SetCTTrackerFrontTTime(event->timestamp);
-  for (int k = 0; k < stripNumber; k++) {//Loop on strips
-    ccamData -> SetCTTrackerFrontETowerNbr(1);
-    ccamData -> SetCTTrackerFrontEDetectorNbr(detNbr);
-    ccamData -> SetCTTrackerFrontEStripNbr(k);
-    ccamData -> SetCTTrackerFrontEEnergy(event->sample[faceNbr-1][detNbr-1][k]);
-  }//End of loop on strips
-}
-
-// One-line setter for the Back of one DSSD
-void setCTTrackerBack(TComptonTelescopeData* ccamData, newframe_t* event, int detNbr, int faceNbr, const int stripNumber)
-{
-  ccamData -> SetCTTrackerBackTTowerNbr(1);
-  ccamData -> SetCTTrackerBackTDetectorNbr(detNbr);
-  ccamData -> SetCTTrackerBackTStripNbr(33);
-  ccamData -> SetCTTrackerBackTTime(event->timestamp);
-  for (int k = 0; k < stripNumber; k++) {//Loop on strips
-    ccamData -> SetCTTrackerBackETowerNbr(1);
-    ccamData -> SetCTTrackerBackEDetectorNbr(detNbr);
-    ccamData -> SetCTTrackerBackEStripNbr(k);
-    ccamData -> SetCTTrackerBackEEnergy(event->sample[faceNbr-1][detNbr-1][k]);
-  }//End of loop on strips
-}
-
-// One-line setter for DSSSD(s)
-void setCTTracker(TComptonTelescopeData* ccamData, newframe_t* event, vector<int>* nb_asic, vector<int>* chain, const int stripNumber)
-{
-  for (vector<int>::iterator itchain = chain->begin(); itchain != chain->end(); ++itchain) {//Iterates on 2 faces
-    for (vector<int>::iterator itasic = nb_asic->begin(); itasic != nb_asic->end(); ++itasic) {//Iterates on 1 DSSSD
-      if (event->chip_data[*itchain][*itasic]) { // Test if data is present
-        switch (*itchain) {
-          case 0://Assuming 0 is front - to be checked
-            setCTTrackerFront(ccamData, event, *itasic+1, *itchain+1, stripNumber);
-            break;
-          case 1://Assuming 1 is back - to be checked
-            setCTTrackerBack(ccamData, event, *itasic+1, *itchain+1, stripNumber);
-        }//End switch
-      }//End if
-    }//End for
-  }//End for
-}
-
 //--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//
 int main()
 {
-//  auto fout = new TFile("pipo.root", "recreate");
-//  auto bidim = new TH2F("bidim", "bidim", 2001, -1000, 1000, 2001, -1000, 1000);
-#ifdef __USE_CUTG__
-/*  TFile* fcut = new TFile("/disk/proto-data/data/coinc-si/CUT_Compton.root");
-  TCutG* mcut = (TCutG*) fcut -> Get("CUT_Compton");
-  fcut -> Close();
-  cout << fcut << endl;
-  cout << mcut << endl;
-  TCanvas* can = new TCanvas();
-  can->cd();
-  mcut->Draw();*/
-  TCutG *mcut = new TCutG("CUT_Compton",7);
-  mcut->SetVarX("Calor_E");
-  mcut->SetVarY("Half_Energy");
-  mcut->SetTitle("Graph");
-  mcut->SetFillStyle(1000);
-  mcut->SetPoint(0,526905.4,0.6145632);
-  mcut->SetPoint(1,526905.4,0.4996379);
-  mcut->SetPoint(2,592808,0.1947341);
-  mcut->SetPoint(3,629341,0.02586437);
-  mcut->SetPoint(4,627908.3,0.211152);
-  mcut->SetPoint(5,540157.6,0.5981453);
-  mcut->SetPoint(6,526905.4,0.6145632);
-#endif
 
   ///////////////////////////////////////////////////////////////////////////
   // configure option manager
 //   NPOptionManager::getInstance()->Destroy();
-#ifdef __TEST_ZONE__
-  string arg = "-D ./ComptonCAM.detector -C calibrations.txt -GH -E ./10He.reaction --circular";
-#else
+
+  //string arg = "-D ./ComptonCAM.detector -C calibrations.txt -GH -E ./10He.reaction --circular";
   string arg = "-D ./ComptonCAM.detector -C calibrations.txt -GH -E ./10He.reaction";
-#endif
   NPOptionManager::getInstance(arg);  
 
   // open ROOT output file
@@ -155,36 +51,44 @@ int main()
 
   // read data file/flux and fill ccamData object
   std::cout << "Reading data\n";
-  DecodeR* DR = new DecodeR(false); // Instantiates DecodeR object reading calorimeter data flux
-  DecodeT* DT = new DecodeT(false); // Instantiates DecodeT object reading trigger data flux
-  DecodeD* DD = new DecodeD(false); // Instantiates DecodeD object reading DSSSD(s) data flux
+  DecodeD* DD = new DecodeD(true); // Instantiates DecodeD object reading DSSSD(s) data flux
   newframe_t* event;
-  DD -> setTree("/disk/proto-data/data/20210210_run1/bb7_3309-7_cs137-20210210_11h05_coinc_run1_conv.root");
+  DD -> setTree("../data/20200128_10h44_bi207_conv.root");
+  //DD -> setTree("../data/bb7_3309-7_bi207_20210209_12h50_run10_conv.root");
   int dlen = DD -> getLength();
 
-  //Sets where to look for data in DSSSD root frames
-  vector <int> chain ({0, 1});//Two faces
-  vector <int> nb_asic ({0});//First DSSSD
-  
-  int i = 0;// ROSMAP files loop counter
-  int c = 0;// Event counter
-  int cc = 0;
-  // Set some constants
-  const int pixelNumber = 64;
-  const int stripNumber = 32;
-
-#ifdef __TEST_ZONE__
-
-  while (DD -> getCursor() < dlen)
+  while (DD -> getCursor() < 49970)
+    //while (DD -> getCursor() < dlen)
   {
-    DD -> decodeEvent();
+    // cout number of entries treated
+    if (DD -> getCursor() % 10000 == 0) {
+      cout << "\rEntry " << DD -> getCursor();
+      cout << flush;
+    }
+
+    // Decode event
+    DD->Clear();
+    DD->decodeEventFinal();
 
     // Clear raw and physics data
     m_NPDetectorManager->ClearEventPhysics();
     m_NPDetectorManager->ClearEventData();
 
     // Fill data
-    setCTTracker(ccamData, DD -> getEvent(), &nb_asic, &chain, stripNumber);
+    //cout << "event size " << DD->getEventSize() << endl;      
+    for (int i = 0; i < DD->getEventSize(); i++) {
+      //cout << i << endl;
+      if (DD -> getFaceType(i) == 0) { // front
+        ccamData->SetFrontE(1, DD->getDetNbr(i)+1, DD->getStripNbr(i), DD->getEnergy(i));
+        ccamData->SetFrontT(1, DD->getDetNbr(i)+1, 33, DD->getTime());
+        //cout << "face " << DD -> getFaceType(i) << " det " << DD->getDetNbr(i) << " strip " << DD->getStripNbr(i) << " E " << DD->getEnergy(i) << " T " << DD->getTime() << endl;      
+      }
+      else if (DD -> getFaceType(i) == 1) { // back
+        ccamData->SetBackE(1, DD->getDetNbr(i)+1, DD->getStripNbr(i), DD->getEnergy(i));
+        ccamData->SetBackT(1, DD->getDetNbr(i)+1, 33, DD->getTime());
+        //cout << "face " << DD -> getFaceType(i) << " det " << DD->getDetNbr(i) << " strip " << DD->getStripNbr(i) << " E " << DD->getEnergy(i) << " T " << DD->getTime() << endl;      
+      }
+    }
 
     // Build physical event
     m_NPDetectorManager->BuildPhysicalEvent();
@@ -196,126 +100,9 @@ int main()
     m_NPDetectorManager->CheckSpectraServer();
   }
 
-#else
-  // Open data files
-  ifstream iros, itrig;
-  cout << "Loading data files ";
-
-  itrig.open("/disk/proto-data/data/coinc-si/mfm_trigger_202102051141.raw", ios::binary);
-  itrig.seekg(0, ios::end);
-  int tlen = itrig.tellg();
-  itrig.seekg(0, ios::beg);
-  char* tbuff = new char[tlen];
-  itrig.read(tbuff, tlen);
-  itrig.close();
-  cout << "... ";
-
-  iros.open("/disk/proto-data/data/coinc-si/mfm_rdd_rosmap_04_mfm_rosmap_04_2021-02-05_10_41_46.raw.0001", ios::binary);
-  iros.seekg(0, ios::end);
-  int rlen = iros.tellg();
-  iros.seekg(0, ios::beg);
-  char* rbuff = new char[rlen];
-  iros.read(rbuff, rlen);
-  iros.close();
-  cout << "Done" << endl;
-
-//  for (int reset=-1000; reset<1001; reset++)
-//  {
-//  cout << reset << endl;
-  DT -> setRaw(tbuff);
-  DR -> setRaw(rbuff);
-  //DD -> rewind();
-
-  DR -> decodeBlobMFM();
-  DD -> decodeEvent();
-
-  int cr = -17;
-  int cd = 0;
-  c = 0;
-  i = 0;
-  int tr = DR -> getTime();
-  int td = DD -> getTime();
-//  int dt = 100;
-  while(DR -> getCursor() < rlen and DD -> getCursor() < dlen)
-  {
-//    cout << DR -> getTime() << " " << DD -> getTime() << endl; 
-    if (cr == cd) {
-      //if (abs(tr-td+55) < dt) {
-//      if (td-tr < 150 and tr-td < 10) { // That one is the real one
-      if (tr-td > 50 and tr-td < 1000) { // Same width, bad position
-        c++;
-        cout << cc << " " << c << "(" << cr << ", " << cd << ") : " << tr << " " << td << endl;
-        //DR -> Dump();
-        //DD -> Dump();
-        //bidim->Fill(reset, td-tr);
-
-        // Clear raw and physics data
-        m_NPDetectorManager->ClearEventPhysics();
-        m_NPDetectorManager->ClearEventData();
-
-        // Fill data
-        ccamData -> SetCTCalorimeter(1, 4, DR->getPixelNumber(), DR->getTime(), DR->getData(), pixelNumber);
-        setCTTracker(ccamData, DD -> getEvent(), &nb_asic, &chain, stripNumber);
-
-        // Build physical event
-        m_NPDetectorManager->BuildPhysicalEvent();
-
-        // Fill object in output ROOT file
-        if (ccamPhys->EventMultiplicity > 0) {
-#ifdef __USE_CUTG__
-          if (mcut->IsInside(ccamPhys->Calor_E[0], ccamPhys->Half_Energy[0])) {
-            //cout << "c" << endl;
-            cc++;
-            m_OutputTree->Fill();
-          }
-#else
-          m_OutputTree->Fill();
-          cc++;
-#endif
-        }
-        //cout << "c" << endl;
-
-        // check spectra
-        m_NPDetectorManager->CheckSpectraServer();
-        //cout << "d" << endl;
-      }
-      if (td < tr) {
-        DD -> decodeEvent();
-      } else {
-        DR -> decodeBlobMFM();
-      }
-    } else if (cr < cd) {
-      DR -> decodeBlobMFM();
-    } else {
-      DD -> decodeEvent();
-    }
-    if (DR -> getTime() < tr) {
-      cr++;
-    }
-    tr = DR -> getTime();
-    if (DD -> getTime() < td) {
-      cd ++;
-    }
-    td = DD -> getTime();
-  
-    i++;
-  
-  } // End of main loop
-//  }
-
-  delete DR;
-  delete DT;
-  delete DD;
-  delete [] rbuff;
-  delete [] tbuff;
-#endif
-
   // fill spectra
   m_NPDetectorManager -> WriteSpectra();
 
-//  fout->cd();
-//  bidim->Write();
-//  fout->Close();
 
   // Essential
 #if __cplusplus > 199711L && NPMULTITHREADING
@@ -326,195 +113,3 @@ int main()
   return 0;
 }
 
-
-/*
-  const bool loopForever = false;
-  //while (loopForever or i<12) // for Am data
-  while (loopForever or i<3) // for Bi data quick analysis
-  //while (loopForever or i<489) // for Bi data all events
-  { 
-    // Load a root file and setup DecodeD
-    //DD -> setTree("../data/20200128_11h58_am241_conv.root");
-    DD -> setTree("../data/bb7_3309-7_bi207_20210203_16h25_run8_conv.root");
-    int dlength = DD -> getLength();
-
-    //while (DD -> getCursor() < dlength and (loopForever or i<12))
-    while (DD -> getCursor() < dlength and (loopForever or i<3))
-    {
-      // Load a ROSMAP file
-      std::ifstream is;
-//      i = 1;
-      switch (i % 3) {
-        case 3: is.open("./mfm.bin", std::ios::binary); break;
-        case 4: is.open("./133Ba.bin", std::ios::binary); break;
-        case 5: is.open("./241Am.bin", std::ios::binary); break;
-        case 0: is.open("./207Bi.bin", std::ios::binary); break;
-        case 1: is.open("./241Am-1.bin", std::ios::binary); break;
-        case 2: is.open("./241Am-2.bin", std::ios::binary); break;
-      }
-      is.seekg (0, std::ios::end);
-      int length = is.tellg();
-      is.seekg (0, ios::beg);
-      char* buffer = new char [length];
-      is.read(buffer, length);
-      is.close();
-      i++;
-
-      // Setup DecodeR
-      DR -> setRaw(buffer);
-      DR -> decodeRawMFM(); // get rid of the first two (empty) events
-      DR -> decodeRawMFM();
-
-      // Loop on some events
-      while (DD -> getCursor() < dlength and DR -> getCursor() < length)
-      {
-        // Clear raw and physics data
-        m_NPDetectorManager->ClearEventPhysics();
-        m_NPDetectorManager->ClearEventData();
-
-        // Fill calorimeter data
-        DR -> decodeRawMFM();
-        setCTCalorimeter(ccamData, DR, pixelNumber);
-
-        // Fill DSSD data
-        DD -> decodeEvent();
-        event = DD -> getEvent();
-        setCTTracker(ccamData, event, &nb_asic, &chain, stripNumber);
-
-        // Build physical event
-        m_NPDetectorManager->BuildPhysicalEvent();
-
-        // Fill object in output ROOT file
-        m_OutputTree->Fill();
-
-        // check spectra
-        m_NPDetectorManager->CheckSpectraServer();
-
-        c++;
-        //usleep(100);//Simulated 10kHz count rate
-
-      }// End of loop on ROSMAP events
-
-    delete [] buffer;
-  
-    }// End of loop on DSSSD data
-
-  }// End of main loop
-
-  // fill spectra
-  m_NPDetectorManager->WriteSpectra();
-
-  // delete Decoders
-  delete DR;
-  delete DD;
-
-  // Essential
-  #if __cplusplus > 199711L && NPMULTITHREADING
-   m_NPDetectorManager->StopThread();
-  #endif
-  RootOutput::Destroy();
-
-  return 0;
-}
-
-*/
-
-
-
-
-/*
-    while (DD -> getCursor() < dlength)
-    {
-      // Clear raw and physics data
-      m_NPDetectorManager->ClearEventPhysics();
-      m_NPDetectorManager->ClearEventData();
-
-      //Read some data
-      DD -> decodeEvent();
-      event = DD -> getEvent();
-      //Fill TComptonTelescopeData here (if possible)
-      for (vector<int>::iterator itchain = chain.begin(); itchain != chain.end(); ++itchain) {//Iterates on 2 faces
-        for (vector<int>::iterator itasic = nb_asic.begin(); itasic != nb_asic.end(); ++itasic) {//Iterates on 1 DSSSD
-          if (event->chip_data[*itchain][*itasic]) { // Test if data is present
-            switch (*itchain) {
-              case 0://Assuming 0 is front - to be checked
-                ccamData -> SetCTTrackerFrontTTowerNbr(1);
-                ccamData -> SetCTTrackerFrontTDetectorNbr(*itasic+1);
-                ccamData -> SetCTTrackerFrontTStripNbr(33);
-                ccamData -> SetCTTrackerFrontTTime(event->timestamp);
-                for (int k = 0; k < stripNumber; k++) {//Loop on strips
-                  ccamData -> SetCTTrackerFrontETowerNbr(1);
-                  ccamData -> SetCTTrackerFrontEDetectorNbr(*itasic+1);
-                  ccamData -> SetCTTrackerFrontEStripNbr(k+1);
-                  ccamData -> SetCTTrackerFrontEEnergy(event->sample[*itchain][*itasic][k]);
-                }//End of loop on strips
-                break;
-              case 1://Assuming 1 is back - to be checked
-                ccamData -> SetCTTrackerBackTTowerNbr(1);
-                ccamData -> SetCTTrackerBackTDetectorNbr(*itasic+1);
-                ccamData -> SetCTTrackerBackTStripNbr(33);
-                ccamData -> SetCTTrackerBackTTime(event->timestamp);
-                for (int k = 0; k < stripNumber; k++) {//Loop on strips
-                  ccamData -> SetCTTrackerBackETowerNbr(1);
-                  ccamData -> SetCTTrackerBackEDetectorNbr(*itasic+1);
-                  ccamData -> SetCTTrackerBackEStripNbr(k+1);
-                  ccamData -> SetCTTrackerBackEEnergy(event->sample[*itchain][*itasic][k]);
-                }//End of loop on strips
-            }//End switch
-          }//End if
-        }//End for
-      }//End for
-
-      // Build physical event
-      m_NPDetectorManager->BuildPhysicalEvent();
-      //Fill output tree
-      m_OutputTree->Fill();
-      //check spectra
-      m_NPDetectorManager->CheckSpectraServer();
-
-      c++;
-
-    }//End while
-    cout << "Read " << c << " DSSSD events from file" << endl;
-
-    // Read from file
-    D -> setRaw(buffer);
-
-    D -> decodeRawMFM(); // get rid of the first two (empty) events
-    D -> decodeRawMFM();
-  
-    while (D -> getCursor() < length)
-    {
-       // Clear raw data and physics objects
-       m_NPDetectorManager->ClearEventPhysics();
-       m_NPDetectorManager->ClearEventData();
-  
-       // Read the actual data
-       D -> decodeRawMFM();
-       //D -> Dump();//Optionnal print
-  
-       // Set ccamData (a better way is envisionned)
-       for (int i = 0; i < pixelNumber; ++i) {
-         ccamData -> SetCTCalorimeterETowerNbr(1);
-         ccamData -> SetCTCalorimeterEDetectorNbr( 1 );
-         ccamData -> SetCTCalorimeterEChannelNbr( i );//PMT pixel number
-         ccamData -> SetCTCalorimeterEEnergy( D -> getData()[i] );
-       }
-       ccamData -> SetCTCalorimeterTTowerNbr( 1 );
-       ccamData -> SetCTCalorimeterTDetectorNbr( 1 );//Triggered ASIC number
-       ccamData -> SetCTCalorimeterTChannelNbr( D -> getPixelNumber() );//Pixel that triggered
-       ccamData -> SetCTCalorimeterTTime( D -> getTime() );
-  //     ccamData -> Dump();
-  
-       // Build physical event
-       m_NPDetectorManager->BuildPhysicalEvent();
-  
-       // Fill object in output ROOT file
-       m_OutputTree->Fill();
-  
-       // check spectra
-       m_NPDetectorManager->CheckSpectraServer();
-
-       c++;
-       usleep(100);//Simulated 10kHz count rate
-    }*/
-- 
GitLab