diff --git a/Examples/Example1/ShowResults.C b/Examples/Example1/ShowResults.C
index 3c8f9dfa9bdf91acea8e3538dee8f460449ab6a3..e398a21e2ce991aaae28b74d4fd7907a4755cffa 100644
--- a/Examples/Example1/ShowResults.C
+++ b/Examples/Example1/ShowResults.C
@@ -56,7 +56,7 @@ void ShowResults(){
     
     NPL::Reaction r("11Li(d,3He)10He@553");
     vector<string> v={"8He","n","n"};
-    r.GetNucleus4()->DefineMassByThreshold(v);
+    r.GetParticle4()->DefineMassByThreshold(v);
 
     r.SetExcitationHeavy(1.4);
     TGraph* Kine = r.GetKinematicLine3();
diff --git a/Inputs/EventGenerator/Example1.reaction b/Inputs/EventGenerator/Example1.reaction
index 4eb8f8ee2fa5c39f0b4f555f9b8372cda2d276c8..5499998ae758489830a68620ec5703dcae62933d 100644
--- a/Inputs/EventGenerator/Example1.reaction
+++ b/Inputs/EventGenerator/Example1.reaction
@@ -18,9 +18,13 @@ Beam
  %YPhiYProfilePath=
 
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-DefineNucleus 10He
+%% This is useful to redefine the reference mass of resonnance
+%% without this block the g.s. of the system is taken as the 
+%% first resonant state (~1.4MeV) in nutab
+DefineParticle 10He
  SubPart= 8He n n
  BindingEnergy= 0 MeV
+
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 TwoBodyReaction
  Beam= 11Li
diff --git a/NPLib/Core/NPXmlParser.cxx b/NPLib/Core/NPXmlParser.cxx
index 48b858e0cbdb61f62a2d3999aaaad3a1ebbb3a06..d44367a45f652b1fc5dc36ca2c2113ea1980d4e6 100644
--- a/NPLib/Core/NPXmlParser.cxx
+++ b/NPLib/Core/NPXmlParser.cxx
@@ -116,7 +116,7 @@ void XmlParser::LoadNode(TXMLEngine* xml, XMLNodePointer_t node, Int_t level){
       m_blocks[name].push_back(b);
       child = xml->GetNext(child);
     }  
-    std::cout << " XML file loaded for " <<m_blocks.size() << " detectors" << std::endl;
+    std::cout << " -> XML file loaded for " <<m_blocks.size() << " detectors" << std::endl;
   }
 }
 
diff --git a/NPLib/Detectors/ComptonTelescope/TComptonTelescopeData.cxx b/NPLib/Detectors/ComptonTelescope/TComptonTelescopeData.cxx
index 309aff8b89adaf5c14fcb1b0f16ece67056e8871..68afa5c29ce98b8256b5c0aa50b12367a1d521d1 100644
--- a/NPLib/Detectors/ComptonTelescope/TComptonTelescopeData.cxx
+++ b/NPLib/Detectors/ComptonTelescope/TComptonTelescopeData.cxx
@@ -13,7 +13,7 @@
  *---------------------------------------------------------------------------*
  * Decription:                                                               *
  *  This class holds the raw data for a Compton telescope prototype made of  *
- *  a silicon tracker detector and a LaBr3 calorimeter                       *
+ *  a silicon tracker detector and a calorimeter                       *
  *                                                                           *
  *---------------------------------------------------------------------------*
  * Comment:                                                                  *
diff --git a/NPLib/Detectors/ComptonTelescope/TComptonTelescopeData.h b/NPLib/Detectors/ComptonTelescope/TComptonTelescopeData.h
index 84e2256b7fe83432d04200bf6b1bf5c76537a5c1..87dd9b7701ba772f60c7b1f49070f0cd157fb28e 100644
--- a/NPLib/Detectors/ComptonTelescope/TComptonTelescopeData.h
+++ b/NPLib/Detectors/ComptonTelescope/TComptonTelescopeData.h
@@ -15,7 +15,7 @@
  *---------------------------------------------------------------------------*
  * Decription:                                                               *
  *  This class holds the raw data for a Compton telescope prototype made of  *
- *  a silicon tracker detector and a LaBr3 calorimeter                       *
+ *  a silicon tracker detector and a calorimeter                       *
  *                                                                           *
  *---------------------------------------------------------------------------*
  * Comment:                                                                  *
@@ -130,7 +130,7 @@ class TComptonTelescopeData : public TObject {
       Double_t   GetCTTrackerBackEEnergy(const Int_t i)        const {return fCT_Tracker_BackE_Energy[i];}
       // (Y,T)
       UShort_t   GetCTTrackerBackTMult()                       const {return fCT_Tracker_BackT_TowerNbr.size();}
-      UShort_t   GetCTrackerTBackTTowerNbr(const Int_t i)      const {return fCT_Tracker_BackT_TowerNbr[i];}
+      UShort_t   GetCTTrackerBackTTowerNbr(const Int_t i)      const {return fCT_Tracker_BackT_TowerNbr[i];}
       UShort_t   GetCTTrackerBackTDetectorNbr(const Int_t i)   const {return fCT_Tracker_BackT_DetectorNbr[i];}
       UShort_t   GetCTTrackerBackTStripNbr(const Int_t i)      const {return fCT_Tracker_BackT_StripNbr[i];}
       Double_t   GetCTTrackerBackTTime(const Int_t i)          const {return fCT_Tracker_BackT_Time[i];}
diff --git a/NPLib/Detectors/ComptonTelescope/TComptonTelescopePhysics.cxx b/NPLib/Detectors/ComptonTelescope/TComptonTelescopePhysics.cxx
index 3e35f010b0e9648cb8b62fb34100117f45341957..3b71a906830dbe4cff8f409011a59c6661298710 100644
--- a/NPLib/Detectors/ComptonTelescope/TComptonTelescopePhysics.cxx
+++ b/NPLib/Detectors/ComptonTelescope/TComptonTelescopePhysics.cxx
@@ -55,10 +55,12 @@ TComptonTelescopePhysics::TComptonTelescopePhysics()
   m_StripFront_E_Threshold(0),
   m_StripBack_E_RAW_Threshold(0),
   m_StripBack_E_Threshold(0),
-  m_Calorimeter_E_RAW_Threshold(0),
+  m_Calorimeter_E_RAW_Threshold(0), // Before pedestal subtraction (ADC)
+  m_Calorimeter_E_Threshold(0), // After pedestal subtraction (ADC)
   m_Take_E_Front(true), // p-side
   m_NumberOfDetectors(0),
-  m_NumberOfStrips(32)
+  m_NumberOfStrips(32),
+  m_NPixels(64)
 {
   EventMultiplicity   = 0;
 }
@@ -87,7 +89,7 @@ void TComptonTelescopePhysics::BuildSimplePhysicalEvent()
       Double_t Front_E = m_PreTreatedData->GetCTTrackerFrontEEnergy(couple[i].X());
       Double_t Back_E  = m_PreTreatedData->GetCTTrackerBackEEnergy(couple[i].Y());
 
-      // Fill TComptonTelescopePhysics private members
+      // Fill TComptonTelescopePhysics members
       DetectorNumber.push_back(N);
       StripFront_E.push_back(Front_E);
       StripBack_E.push_back(Back_E);
@@ -97,10 +99,23 @@ void TComptonTelescopePhysics::BuildSimplePhysicalEvent()
       else
         Strip_E.push_back(Back_E);
 
+      //Strip_T = ?
+
       Strip_Front.push_back(Front);
       Strip_Back.push_back(Back);
     }
   }
+  
+  // Calculate a corrected energy for the calorimeter
+  Calor_E = 0;
+/*  for (UShort_t i = 0; i < m_PreTreatedData->GetCTCalorimeterEMult(); ++i) {
+    Calor_E += fCalorimeter_E(m_PreTreatedData, i);//Apply calibration other than pedestal and sum anodes
+  }*/
+  for (UShort_t i = 0; i < m_EventData->GetCTCalorimeterEMult(); ++i) {
+    Calor_E += fCalorimeter_E(m_EventData, i);//Apply full calibration and sum anodes
+  }
+
+  //Calor_T = ?
 
   //   if (DetectorNumber.size() == 1) return;
 }
@@ -117,7 +132,7 @@ void TComptonTelescopePhysics::PreTreat()
   for (UShort_t i = 0; i < m_EventData->GetCTTrackerFrontEMult(); ++i) {
     if (m_EventData->GetCTTrackerFrontEEnergy(i) > m_StripFront_E_RAW_Threshold && 
         IsValidChannel("Front", m_EventData->GetCTTrackerFrontEDetectorNbr(i), m_EventData->GetCTTrackerFrontEStripNbr(i))) {
-      Double_t E = fStrip_Front_E(m_EventData, i);
+      Double_t E = fStrip_Front_E(m_EventData, i);//Calibration happens here
       if (E > m_StripFront_E_Threshold) {
         m_PreTreatedData->SetCTTrackerFrontETowerNbr(m_EventData->GetCTTrackerFrontETowerNbr(i));
         m_PreTreatedData->SetCTTrackerFrontEDetectorNbr(m_EventData->GetCTTrackerFrontEDetectorNbr(i));
@@ -131,7 +146,7 @@ void TComptonTelescopePhysics::PreTreat()
   for (UShort_t i = 0; i < m_EventData->GetCTTrackerBackEMult(); ++i) {
     if (m_EventData->GetCTTrackerBackEEnergy(i) > m_StripBack_E_RAW_Threshold && 
         IsValidChannel("Back", m_EventData->GetCTTrackerBackEDetectorNbr(i), m_EventData->GetCTTrackerBackEStripNbr(i))) {
-      Double_t E = fStrip_Back_E(m_EventData, i);
+      Double_t E = fStrip_Back_E(m_EventData, i);//Calibration happens here
       if (E > m_StripBack_E_Threshold) {
         m_PreTreatedData->SetCTTrackerBackETowerNbr(m_EventData->GetCTTrackerBackETowerNbr(i));
         m_PreTreatedData->SetCTTrackerBackEDetectorNbr( m_EventData->GetCTTrackerBackEDetectorNbr(i));
@@ -144,23 +159,40 @@ void TComptonTelescopePhysics::PreTreat()
   // DSSSD time information and calorimeter still have to be done...
   // Front, time
   for (UShort_t i = 0; i < m_EventData->GetCTTrackerFrontTMult(); ++i) {
-    //
+    m_PreTreatedData->SetCTTrackerFrontTTowerNbr(m_EventData->GetCTTrackerFrontTTowerNbr(i));
+    m_PreTreatedData->SetCTTrackerFrontTDetectorNbr(m_EventData->GetCTTrackerFrontTDetectorNbr(i));
+    m_PreTreatedData->SetCTTrackerFrontTStripNbr(m_EventData->GetCTTrackerFrontTStripNbr(i));
+    m_PreTreatedData->SetCTTrackerFrontTTime(m_EventData->GetCTTrackerFrontTTime(i));
+  }
+  // Back, time
+  for (UShort_t i = 0; i < m_EventData->GetCTTrackerBackTMult(); ++i) {
+    m_PreTreatedData->SetCTTrackerBackTTowerNbr(m_EventData->GetCTTrackerBackTTowerNbr(i));
+    m_PreTreatedData->SetCTTrackerBackTDetectorNbr(m_EventData->GetCTTrackerBackTDetectorNbr(i));
+    m_PreTreatedData->SetCTTrackerBackTStripNbr(m_EventData->GetCTTrackerBackTStripNbr(i));
+    m_PreTreatedData->SetCTTrackerBackTTime(m_EventData->GetCTTrackerBackTTime(i));
   }
 
   // Calorimeter
   // Energy
+
   for (UShort_t i = 0; i < m_EventData->GetCTCalorimeterEMult(); ++i) {
     if (m_EventData->GetCTCalorimeterEEnergy(i) > m_Calorimeter_E_RAW_Threshold) {
+      Double_t E = fCalorimeter_ped(m_EventData, i);//Calibration happens here (pedestal subtraction only)
+      if (E > m_Calorimeter_E_Threshold) {
         m_PreTreatedData->SetCTCalorimeterETowerNbr(m_EventData->GetCTCalorimeterETowerNbr(i));
         m_PreTreatedData->SetCTCalorimeterEDetectorNbr(m_EventData->GetCTCalorimeterEDetectorNbr(i));
         m_PreTreatedData->SetCTCalorimeterEChannelNbr(m_EventData->GetCTCalorimeterEChannelNbr(i));
-        m_PreTreatedData->SetCTCalorimeterEEnergy(m_EventData->GetCTCalorimeterEEnergy(i));
+        m_PreTreatedData->SetCTCalorimeterEEnergy(E);
+      }
     }
   }
   
   // Time
   for (UShort_t i = 0; i < m_EventData->GetCTCalorimeterTMult(); ++i) {
-    //
+    m_PreTreatedData->SetCTCalorimeterTTowerNbr(m_EventData->GetCTCalorimeterTTowerNbr(i));
+    m_PreTreatedData->SetCTCalorimeterTDetectorNbr(m_EventData->GetCTCalorimeterTDetectorNbr(i));
+    m_PreTreatedData->SetCTCalorimeterTChannelNbr(m_EventData->GetCTCalorimeterTChannelNbr(i));
+    m_PreTreatedData->SetCTCalorimeterTTime(m_EventData->GetCTCalorimeterTTime(i));
   }
 }
 
@@ -305,7 +337,7 @@ void TComptonTelescopePhysics::ReadAnalysisConfig()
         cout << "\t" << whatToDo << "\t" << DataBuffer << endl;
         Int_t Detector = atoi(DataBuffer.substr(2,1).c_str());
         Int_t channel = -1;
-        if (DataBuffer.compare(3,4,"FRONT") == 0) {
+        if (DataBuffer.compare(3,5,"FRONT") == 0) {
           channel = atoi(DataBuffer.substr(7).c_str());
           *(m_FrontChannelStatus[Detector-1].begin()+channel) = false;
         }
@@ -343,12 +375,24 @@ void TComptonTelescopePhysics::ReadAnalysisConfig()
         cout << whatToDo << " " << m_StripFront_E_Threshold << endl;
       }
 
-      else if (whatToDo=="STRIP_BACK_THRESHOLD") {
+      else if (whatToDo=="STRIP_BACK_E_THRESHOLD") {
         AnalysisConfigFile >> DataBuffer;
         m_StripBack_E_Threshold = atoi(DataBuffer.c_str());
         cout << whatToDo << " " << m_StripBack_E_Threshold << endl;
       }
 
+      else if (whatToDo=="CALORIMETER_E_RAW_THRESHOLD") {
+        AnalysisConfigFile >> DataBuffer;
+        m_Calorimeter_E_RAW_Threshold = atoi(DataBuffer.c_str());
+        cout << whatToDo << " " << m_Calorimeter_E_RAW_Threshold << endl;
+      }
+
+      else if (whatToDo=="CALORIMETER_E_THRESHOLD") {
+        AnalysisConfigFile >> DataBuffer;
+        m_Calorimeter_E_Threshold = atoi(DataBuffer.c_str());
+        cout << whatToDo << " " << m_Calorimeter_E_Threshold << endl;
+      }
+
       else {
         ReadingStatus = false;
       }
@@ -379,6 +423,10 @@ void TComptonTelescopePhysics::Clear()
   StripBack_T.clear();
   Strip_Front.clear();
   Strip_Back.clear();
+
+  // Calorimeter
+  Calor_E = 0;
+  Calor_T.clear();
 }
 
 
@@ -408,6 +456,7 @@ void TComptonTelescopePhysics::ReadConfiguration(NPL::InputParser parser){
       int    nbr_strip = blocks[i]->GetInt("NUMBER_STRIPS");
       double distance_cal = blocks[i]->GetDouble("DISTANCE_TRACKER_CALORIMETER","mm");
       double thickness_cal = blocks[i]->GetDouble("THICKNESS_CALORIMETER","mm");
+      int    npixels_cal = blocks[i]->GetInt("NPIXELS_CALORIMETER");
       int    tracker = blocks[i]->GetInt("TRACKER");
       int    calorimeter = blocks[i]->GetInt("CALORIMETER");
       int    vis= blocks[i]->GetInt("VIS");
@@ -439,6 +488,10 @@ void TComptonTelescopePhysics::AddParameterToCalibrationManager()
       Cal->AddParameter("COMPTONTELESCOPE", "D"+ NPL::itoa(i+1)+"_STRIP_BACK"+ NPL::itoa(j)+"_E",  "COMPTONTELESCOPE_D"+ NPL::itoa(i+1)+"_STRIP_BACK"+ NPL::itoa(j)+"_E");
       Cal->AddParameter("COMPTONTELESCOPE", "D"+ NPL::itoa(i+1)+"_STRIP_BACK"+ NPL::itoa(j)+"_T",  "COMPTONTELESCOPE_D"+ NPL::itoa(i+1)+"_STRIP_BACK"+ NPL::itoa(j)+"_T");
     }
+    for (int j = 0; j < m_NPixels; ++j) {
+      Cal->AddParameter("COMPTONTELESCOPE", "D"+ NPL::itoa(i+1)+"_CHANNEL"+ NPL::itoa(j)+"_E",  "COMPTONTELESCOPE_D"+ NPL::itoa(i+1)+"_CHANNEL"+ NPL::itoa(j)+"_E");
+      Cal->AddParameter("COMPTONTELESCOPE", "D"+ NPL::itoa(i+1)+"_CHANNEL"+ NPL::itoa(j)+"_E",  "COMPTONTELESCOPE_D"+ NPL::itoa(i+1)+"_CHANNEL"+ NPL::itoa(j)+"_PED");
+    }
   }
 
   return;  
@@ -617,6 +670,17 @@ namespace ComptonTelescope_LOCAL
   {
     return CalibrationManager::getInstance()->ApplyCalibration("COMPTONTELESCOPE/D" + NPL::itoa(m_EventData->GetCTTrackerBackEDetectorNbr(i)) + "_STRIP_BACK" + NPL::itoa(m_EventData->GetCTTrackerBackEStripNbr(i)) + "_E", m_EventData->GetCTTrackerBackEEnergy(i));
   }
+
+  //Calorimeter
+  Double_t fCalorimeter_ped(const TComptonTelescopeData* m_EventData, const int i)
+  {
+    return CalibrationManager::getInstance()->ApplyCalibration("COMPTONTELESCOPE/D" + NPL::itoa(m_EventData->GetCTCalorimeterEDetectorNbr(i)) + "_CHANNEL" + NPL::itoa(m_EventData->GetCTCalorimeterEChannelNbr(i)) + "_PED", m_EventData->GetCTCalorimeterEEnergy(i));
+  }
+
+  Double_t fCalorimeter_E(const TComptonTelescopeData* m_EventData, const int i)
+  {
+    return CalibrationManager::getInstance()->ApplyCalibration("COMPTONTELESCOPE/D" + NPL::itoa(m_EventData->GetCTCalorimeterEDetectorNbr(i)) + "_CHANNEL" + NPL::itoa(m_EventData->GetCTCalorimeterEChannelNbr(i)) + "_E", m_EventData->GetCTCalorimeterEEnergy(i));
+  }
 }
 
 
diff --git a/NPLib/Detectors/ComptonTelescope/TComptonTelescopePhysics.h b/NPLib/Detectors/ComptonTelescope/TComptonTelescopePhysics.h
index b63d0fcb07e25a81f28dcee584ffd123509d950b..d1d2cc8f9f691fb10eae89b55627c4a0cc400dd7 100644
--- a/NPLib/Detectors/ComptonTelescope/TComptonTelescopePhysics.h
+++ b/NPLib/Detectors/ComptonTelescope/TComptonTelescopePhysics.h
@@ -66,50 +66,53 @@ class TComptonTelescopePhysics : public TObject, public NPL::VDetector
       vector<double> StripBack_T;
       vector<int>    Strip_Front;
       vector<int>    Strip_Back;
+      // Calorimeter
+      double Calor_E;
+      vector<double> Calor_T;
    
 
    public:  // inherited from VDetector
-   // Read stream at ConfigFile to pick-up parameters of detector (Position,...) using Token
-   void ReadConfiguration(NPL::InputParser);
-
-   // Add parameters to the CalibrationManger
-   void AddParameterToCalibrationManager();
-
-   // Activate associated branches and link them to the private member object m_EventData
-   void InitializeRootInputRaw();
-
-   // Activate associated branches and link them to the private member m_EventPhysics
-   void InitializeRootInputPhysics();
-
-   // Create associated branches and associated private member m_EventPhysics 
-   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. 
-   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.
-   void BuildSimplePhysicalEvent();
-
-   // Same as above but for online analysis
-   void BuildOnlinePhysicalEvent()  {BuildPhysicalEvent();};
-
-   // Clear raw and physics data 
-   void ClearEventPhysics()   {Clear();}
-   void ClearEventData()      {m_EventData->Clear();}
-
-   // Methods related to the TW1Spectra classes
-   // Instantiate the TW1Spectra class and the histograms
-   void InitSpectra();
-   // Fill the spectra defined in TW1Spectra
-   void FillSpectra();
-   // Used for Online mainly, perform check on the histo and for example change their color if issues are found
-   void CheckSpectra();
-   // Used for Online only, clear all the spectra hold by the Spectra class
-   void ClearSpectra();
-   // Write Spectra to file
-   void WriteSpectra();
+      // Read stream at ConfigFile to pick-up parameters of detector (Position,...) using Token
+      void ReadConfiguration(NPL::InputParser);
+
+      // Add parameters to the CalibrationManger
+      void AddParameterToCalibrationManager();
+
+      // Activate associated branches and link them to the private member object m_EventData
+      void InitializeRootInputRaw();
+
+      // Activate associated branches and link them to the private member m_EventPhysics
+      void InitializeRootInputPhysics();
+
+      // Create associated branches and associated private member m_EventPhysics 
+      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. 
+      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.
+      void BuildSimplePhysicalEvent();
+
+      // Same as above but for online analysis
+      void BuildOnlinePhysicalEvent()  {BuildPhysicalEvent();};
+
+      // Clear raw and physics data 
+      void ClearEventPhysics()   {Clear();}
+      void ClearEventData()      {m_EventData->Clear();}
+
+      // Methods related to the TW1Spectra classes
+      // Instantiate the TW1Spectra class and the histograms
+      void InitSpectra();
+      // Fill the spectra defined in TW1Spectra
+      void FillSpectra();
+      // Used for Online mainly, perform check on the histo and for example change their color if issues are found
+      void CheckSpectra();
+      // Used for Online only, clear all the spectra hold by the Spectra class
+      void ClearSpectra();
+      // Write Spectra to file
+      void WriteSpectra();
    
 
    public:      //   Specific to ComptonTelescope Array
@@ -171,6 +174,7 @@ class TComptonTelescopePhysics : public TObject, public NPL::VDetector
       double m_StripBack_E_RAW_Threshold;    //!
       double m_StripBack_E_Threshold;        //!
       double m_Calorimeter_E_RAW_Threshold;
+      double m_Calorimeter_E_Threshold;
 
    public:  // methods used in event treatment 
       vector<TVector2> Match_Front_Back();
@@ -194,6 +198,9 @@ class TComptonTelescopePhysics : public TObject, public NPL::VDetector
       vector< vector < vector < double > > >   m_StripPositionY;  //!
       vector< vector < vector < double > > >   m_StripPositionZ;  //!
 
+  private:
+      int m_NPixels;
+
    private: // Spectra Class   
       TComptonTelescopeSpectra*      m_Spectra; //! 
 
@@ -217,6 +224,10 @@ namespace ComptonTelescope_LOCAL
    //   Back   
    double fStrip_Back_E(const TComptonTelescopeData* Data, const int i);
    double fStrip_Back_T(const TComptonTelescopeData* Data, const int i);
+
+   // Calorimeter
+   double fCalorimeter_E(const TComptonTelescopeData* Data, const int i);
+   double fCalorimeter_ped(const TComptonTelescopeData* Data, const int i);
 }
 
 
diff --git a/NPLib/Detectors/ComptonTelescope/TComptonTelescopeSpectra.cxx b/NPLib/Detectors/ComptonTelescope/TComptonTelescopeSpectra.cxx
index 7ec56aaa7900991336e621679027d803dbd42b38..c5f3482d4c98f37cdf06e8b7fdefcb7012f43c3a 100644
--- a/NPLib/Detectors/ComptonTelescope/TComptonTelescopeSpectra.cxx
+++ b/NPLib/Detectors/ComptonTelescope/TComptonTelescopeSpectra.cxx
@@ -44,7 +44,7 @@ TComptonTelescopeSpectra::TComptonTelescopeSpectra(){
   fNumberOfTelescope = 0;
   fStripX=32;
   fStripY=32;
-  fCrystalCsI=16;
+  fCalorimeterNPixels=64;
 }
 
 
@@ -62,7 +62,7 @@ TComptonTelescopeSpectra::TComptonTelescopeSpectra(unsigned int NumberOfTelescop
    fNumberOfTelescope = NumberOfTelescope;
    fStripX=32;
    fStripY=32;
-   fCrystalCsI=16;
+   fCalorimeterNPixels=64;
 
    InitRawSpectra();
    InitPreTreatedSpectra();
@@ -83,6 +83,7 @@ void TComptonTelescopeSpectra::InitRawSpectra()
 {
   string name;
   for (unsigned int i = 0; i < fNumberOfTelescope; i++) { // loop on number of detectors
+    // DSSD
     // FRONT_E_RAW
     name = "CT"+NPL::itoa(i+1)+"_FRONT_E_RAW";
     AddHisto2D(name, name, fStripX, 1, fStripX+1, 512, 0, 8192, "COMPTONTELESCOPE/RAW/FRONTE");
@@ -106,6 +107,10 @@ void TComptonTelescopeSpectra::InitRawSpectra()
     // BACK_RAW_MULT
     name = "CT"+NPL::itoa(i+1)+"_BACK_RAW_MULT";
     AddHisto1D(name, name, fStripX, 1, fStripX+1, "COMPTONTELESCOPE/RAW/MULT");
+
+    // CALORIMETER
+    name = "CT"+NPL::itoa(i+1)+"_CALOR_RAW_TRIGGER";
+    AddHisto1D(name, name, fCalorimeterNPixels, 1, fCalorimeterNPixels+1, "COMPTONTELESCOPE/RAW/CALORTRIGGER");
   } // end loop on number of detectors
 }
 
@@ -155,8 +160,18 @@ void TComptonTelescopeSpectra::InitPhysicsSpectra()
   // X-Y Energy Correlation
   for (unsigned int i = 0 ; i < fNumberOfTelescope ; i++) { // loop on number of detectors
     name = "CT"+NPL::itoa(i+1)+"_XY_COR";
-    AddHisto2D(name, name,500,0,50,500,0,50, "COMPTONTELESCOPE/PHY"); 
+    AddHisto2D(name, name,500,0,50,500,0,50, "COMPTONTELESCOPE/PHY");
+  }
+
+  // Calorimeter energy spectrum
+  for (unsigned int i = 0 ; i < fNumberOfTelescope ; i++) { // loop on number of detectors
+    name = "CT"+NPL::itoa(i+1)+"_CALOR_SPECTRUM";
+    AddHisto1D(name, name, 1000, 1, 2000, "COMPTONTELESCOPE/PHY");
   }
+
+  // Sum spectrum
+  name = "CT_SUM_SPECTRUM";
+  AddHisto1D(name, name, 1000, 1, 2000, "COMPTONTELESCOPE/PHY");
 }
 
 
@@ -172,8 +187,8 @@ void TComptonTelescopeSpectra::FillRawSpectra(TComptonTelescopeData* RawData)
     name = "CT"+NPL::itoa(RawData->GetCTTrackerFrontEDetectorNbr(i))+"_FRONT_E_RAW";
     family = "COMPTONTELESCOPE/RAW/FRONTE";
 
-    FillSpectra(family,name, 
-          RawData->GetCTTrackerFrontEStripNbr(i), 
+    FillSpectra(family,name,
+          RawData->GetCTTrackerFrontEStripNbr(i),
           RawData->GetCTTrackerFrontEEnergy(i));
   }
 
@@ -236,6 +251,13 @@ void TComptonTelescopeSpectra::FillRawSpectra(TComptonTelescopeData* RawData)
      FillSpectra(family,name
         ,myMULT[i]);
   }
+
+  // CALORIMETER TRIGGERS
+  for (unsigned int i = 0; i < RawData->GetCTCalorimeterTMult(); i++) {
+    name = "CT"+NPL::itoa(RawData->GetCTCalorimeterEDetectorNbr(i))+"_CALOR_RAW_TRIGGER";
+    family = "COMPTONTELESCOPE/RAW/CALORTRIGGER";
+    FillSpectra(family, name, RawData->GetCTCalorimeterTChannelNbr(i));
+  }
 }
 
 ////////////////////////////////////////////////////////////////////////////////
@@ -313,6 +335,32 @@ void TComptonTelescopeSpectra::FillPreTreatedSpectra(TComptonTelescopeData* PreT
 
 ////////////////////////////////////////////////////////////////////////////////
 void TComptonTelescopeSpectra::FillPhysicsSpectra(TComptonTelescopePhysics* Physics){
+  string name;
+  string family = "COMPTONTELESCOPE/PHY";
+
+  // X-Y Impact Matrix
+
+
+  // X-Y Energy correlation
+  for (unsigned int i = 0; i < fNumberOfTelescope; i++) {
+
+  }
+
+  // Calorimeters spectra
+  for (unsigned int i = 0; i < fNumberOfTelescope; i++) {
+    name = "CT"+NPL::itoa(i+1)+"_CALOR_SPECTRUM";
+    FillSpectra(family, name, Physics->Calor_E);
+  }
+
+  // Sum spectrum
+  name = "CT_SUM_SPECTRUM";
+  double energy = 0;
+  for (unsigned int i = 0; i < Physics->Strip_E.size(); i++) {
+    energy += Physics->Strip_E[i];
+  }
+  FillSpectra(family, name, Physics->Calor_E + energy);
+
+
 /*  string name;
   string family= "COMPTONTELESCOPE/PHY";
   // X-Y Impact Matrix
diff --git a/NPLib/Detectors/ComptonTelescope/TComptonTelescopeSpectra.h b/NPLib/Detectors/ComptonTelescope/TComptonTelescopeSpectra.h
index 5f0fbd8c44bd093c6fe7a4fa03a13f83f57c85f6..bbfe180c78ee69437a10d09b38c77373963c618d 100644
--- a/NPLib/Detectors/ComptonTelescope/TComptonTelescopeSpectra.h
+++ b/NPLib/Detectors/ComptonTelescope/TComptonTelescopeSpectra.h
@@ -53,7 +53,7 @@ class TComptonTelescopeSpectra:public VSpectra {
     unsigned int fNumberOfTelescope;
     unsigned int fStripX;
     unsigned int fStripY;
-    unsigned int fCrystalCsI;
+    unsigned int fCalorimeterNPixels;
 };
 
 #endif
diff --git a/NPLib/Detectors/Samurai/TSamuraiFDC2Physics.cxx b/NPLib/Detectors/Samurai/TSamuraiFDC2Physics.cxx
index bc40f716ac47a7c3f176e6cf741cec35befb71d6..aa1b5889cac81fedb75728bca85776845cf9f5b0 100644
--- a/NPLib/Detectors/Samurai/TSamuraiFDC2Physics.cxx
+++ b/NPLib/Detectors/Samurai/TSamuraiFDC2Physics.cxx
@@ -46,6 +46,8 @@ ClassImp(TSamuraiFDC2Physics)
     m_EventPhysics      = this ;
     //m_Spectra           = NULL;
     ToTThreshold = 180;
+    DriftLowThreshold=0.5;
+    DriftUpThreshold=9.5;
   }
 
 ///////////////////////////////////////////////////////////////////////////
@@ -62,13 +64,14 @@ void TSamuraiFDC2Physics::BuildPhysicalEvent(){
   static map<std::pair<unsigned int,double>, vector<double> > X ; 
   static map<std::pair<unsigned int,double>, vector<double> > Z ; 
   static map<std::pair<unsigned int,double>, vector<double> > R ; 
+  static int det,layer,wire;
   X.clear();Z.clear();R.clear();
   unsigned int size = Detector.size();
   for(unsigned int i = 0 ; i < size ; i++){
-    if(DriftLength[i]>0.1){
-      int det = Detector[i];
-      int layer = Layer[i];
-      int wire = Wire[i]; 
+    if( DriftLength[i] > DriftLowThreshold && DriftLength[i] < DriftUpThreshold){
+      det = Detector[i];
+      layer = Layer[i];
+      wire = Wire[i]; 
       SamuraiDCIndex idx(det,layer,wire);
       std::pair<unsigned int, double> p(det,Wire_Angle[idx]);
       X[p].push_back(Wire_X[idx]); 
@@ -81,16 +84,15 @@ void TSamuraiFDC2Physics::BuildPhysicalEvent(){
   static double X0,X100,a,b; // store the BuildTrack2D results
   static map<std::pair<unsigned int,double>, TVector3 > VX0 ;  
   static map<std::pair<unsigned int,double>, TVector3 > VX100 ;  
-  static map<std::pair<unsigned int,double>, int > MultPlane ;  
-  VX0.clear();VX100.clear();
+  static map<std::pair<unsigned int,double>, double > D ;// the minimum distance  
+  VX0.clear();VX100.clear(),D.clear();
   for(auto it = X.begin();it!=X.end();++it){
-    m_reconstruction.BuildTrack2D(X[it->first],Z[it->first],R[it->first],X0,X100,a,b); 
-    // very small a means track perpendicular to the chamber, what happen when there is pile up
-
+    D[it->first]=m_reconstruction.BuildTrack2D(X[it->first],Z[it->first],R[it->first],X0,X100,a,b); 
+    
+    // very large a means track perpendicular to the chamber, what happen when there is pile up
     if(abs(a)>1000)
       PileUp++;
 
-    MultPlane[it->first] = X[it->first].size() ;
     Mult+=X[it->first].size();
     // Position at z=0
     TVector3 P(X0,0,0);
@@ -102,20 +104,28 @@ void TSamuraiFDC2Physics::BuildPhysicalEvent(){
     VX100[it->first]=D;
 
   }
+
   // Reconstruct the central position (z=0) for each detector
   static map<unsigned int,vector<TVector3> > C ;  
-  C.clear();
+  static map<unsigned int,vector<double> > W ; // weight based on D  
+  C.clear(),W.clear();
   TVector3 P;
 
   for(auto it1 = VX0.begin();it1!=VX0.end();++it1){
     for(auto it2 = it1;it2!=VX0.end();++it2){
       if(it1!=it2 && it1->first.first==it2->first.first){// different plane, same detector
         m_reconstruction.ResolvePlane(it1->second,it1->first.second,it2->second,it2->first.second,P);
-        if(P.X()!=-10000)
+        
+        if(P.X()!=-10000){
           C[it1->first.first].push_back(P);
+          // Mean pos are weighted based on the the sum of distance from track
+          // to hit obtained during the minimisation
+          W[it1->first.first].push_back(1./(D[it1->first]+D[it2->first]));
+          }
       }
     }
   }
+
   // Reconstruct the position at z=100 for each detector
   static map<unsigned int,vector<TVector3> > C100 ;  
   C100.clear();
@@ -129,35 +139,51 @@ void TSamuraiFDC2Physics::BuildPhysicalEvent(){
       }
     }
   }
+
   // Build the Reference position by averaging all possible pair 
   size = C[2].size();
-  double PosX100,PosY100;
+  static double PosX100,PosY100,norm;
   if(size){
     PosX=0;
     PosY=0;
     PosX100=0;
     PosY100=0;
+    norm=0;
     for(unsigned int i = 0 ; i < size ; i++){
-      PosX+= C[2][i].X(); 
-      PosY+= C[2][i].Y(); 
-      PosX100+= C100[2][i].X(); 
-      PosY100+= C100[2][i].Y(); 
-    //       cout << C[2][i].X() << " (" << C[2][i].Y() << ") ";
+      PosX+= C[2][i].X()*W[2][i]; 
+      PosY+= C[2][i].Y()*W[2][i]; 
+      PosX100+= C100[2][i].X()*W[2][i]; 
+      PosY100+= C100[2][i].Y()*W[2][i]; 
+      norm+=W[2][i];
+      //        cout << C[2][i].X() << " (" << C[2][i].Y() << ") ";
     } 
-   // cout << endl;
+    // cout << endl;
     MultMean=size;
     // Mean position at Z=0
-    PosX=PosX/size; 
-    PosY=PosY/size; 
+    PosX=PosX/norm; 
+    PosY=PosY/norm; 
     // Mean position at Z=100
-    PosX100=PosX100/size; 
-    PosY100=PosY100/size; 
+    PosX100=PosX100/norm; 
+    PosY100=PosY100/norm; 
+
+    devX=0;
+    devY=0;
+    for(unsigned int i = 0 ; i < size ; i++){
+      devX+=W[2][i]*(C[2][i].X()-PosX)*(C[2][i].X()-PosX);
+      devY+=W[2][i]*(C[2][i].Y()-PosY)*(C[2][i].Y()-PosY);
+    }
+
+    devX=sqrt(devX/((size-1)*norm));
+    devY=sqrt(devY/((size-1)*norm));
+
     // Compute ThetaX, angle between the Direction vector projection in XZ with
     // the Z axis
-    ThetaX=atan((PosX100-PosX)/100.);
+    //ThetaX=atan((PosX100-PosX)/100.);
+    ThetaX = (PosX100-PosX)/100.;
     // Compute PhiY, angle between the Direction vector projection in YZ with
     // the Z axis
-    PhiY=atan((PosY100-PosY)/100.);
+    //PhiY=atan((PosY100-PosY)/100.);
+    PhiY=(PosY100-PosY)/100.;
     Dir=TVector3(PosX100-PosX,PosY100-PosY,100).Unit();
   }
 
@@ -260,6 +286,7 @@ void TSamuraiFDC2Physics::Clear(){
   PileUp=0;
   Mult=0;
   PosX=PosY=-10000;
+  devX=devY=-10000;
   DriftLength.clear();
   Detector.clear();
   Layer.clear();
diff --git a/NPLib/Detectors/Samurai/TSamuraiFDC2Physics.h b/NPLib/Detectors/Samurai/TSamuraiFDC2Physics.h
index fbb1ee4144cac18c4e8d4b647d2cf08649a193c7..ada81e7d65d6c893a616f46986782c74aa047e6c 100644
--- a/NPLib/Detectors/Samurai/TSamuraiFDC2Physics.h
+++ b/NPLib/Detectors/Samurai/TSamuraiFDC2Physics.h
@@ -99,6 +99,7 @@ class TSamuraiFDC2Physics : public TObject, public NPL::VDetector{
     double PosY;
     double ThetaX;
     double PhiY;
+    double devX,devY;
     TVector3 Dir;
     int Mult;
     int MultMean;
@@ -116,6 +117,10 @@ class TSamuraiFDC2Physics : public TObject, public NPL::VDetector{
   
   private: // Analysis
     double ToTThreshold;//! a ToT threshold to remove noise
+    // since the calibration is a sigmoid there quite a few event at the edge 
+    double DriftLowThreshold;//! Minimum Drift length to keep the hit 
+    double DriftUpThreshold;//! Maximum Drift length to keep the hit
+  
     void RemoveNoise();
     // Construct the 2D track and ref position at Z=0 and Z=100 based on X,Z and Radius provided
 
diff --git a/NPLib/TrackReconstruction/NPDCReconstruction.cxx b/NPLib/TrackReconstruction/NPDCReconstruction.cxx
index 29b633410fd572c2cd37c2a30a8fe3143b77a189..7f8337a24147ff9886d1c6dc6ee542cddaebd5cb 100644
--- a/NPLib/TrackReconstruction/NPDCReconstruction.cxx
+++ b/NPLib/TrackReconstruction/NPDCReconstruction.cxx
@@ -33,21 +33,22 @@ DCReconstruction::~DCReconstruction(){
   }
 
 ////////////////////////////////////////////////////////////////////////////////
-void DCReconstruction::BuildTrack2D(const vector<double>& X,const vector<double>& Z,const vector<double>& R,double& X0,double& X100,double& a, double& b ){
+double DCReconstruction::BuildTrack2D(const vector<double>& X,const vector<double>& Z,const vector<double>& R,double& X0,double& X100,double& a, double& b ){
   fitX=&X;
   fitZ=&Z;
   fitR=&R;
   // assume all X,Z,R of same size
-  unsigned int size = X.size();
+  size = X.size();
   // Define the starting point of the fit: a straight line passing through the 
   // the first and last wire
   // z = ax+b -> x=(z-b)/a
-  double ai = (Z[size-1]-Z[0])/(X[size-1]-R[size-1]-X[0]-R[0]);
-  double bi = Z[0]-ai*(X[0]+R[0]);
-  double parameter[2]={ai,bi};
+  ai = (Z[size-1]-Z[0])/(X[size-1]-R[size-1]-X[0]-R[0]);
+  bi = Z[0]-ai*(X[0]+R[0]);
+  parameter[0]=ai;
+  parameter[1]=bi;
   m_min->SetVariable(0,"a",parameter[0],1000);
   m_min->SetVariable(1,"b",parameter[1],1000);
-  m_min->SetTolerance(0.1);
+  m_min->SetTolerance(0.01);
 
   // Perform minimisation
   m_min->Minimize(); 
@@ -58,29 +59,29 @@ void DCReconstruction::BuildTrack2D(const vector<double>& X,const vector<double>
   b=xs[1];
   X0=-b/a;
   X100=(100-b)/a;
+  return m_min->MinValue() ;
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 void DCReconstruction::ResolvePlane(const TVector3& L,const double& ThetaU ,const TVector3& H, const double& ThetaV, TVector3& PosXY){
   // direction of U and V wire
-  TVector3 u = TVector3(0,1,0);
+  TVector3 u(0,1,0);
   u.RotateZ(ThetaU);
 
-  TVector3 v = TVector3(0,1,0);
+  TVector3 v(0,1,0);
   v.RotateZ(ThetaV);
 
 
   // Compute the coeff of the two line of vecotr u (v) going through H (L)
   // dv : y = av*x+bv
-  long double av = v.Y()/v.X();
-  long double bv = H.Y() - av*H.X();
+  av = v.Y()/v.X();
+  bv = H.Y() - av*H.X();
 
   // du : y = au*x+bu
-  long double au = u.Y()/u.X();
-  long double bu = L.Y() - au*L.X();
+  au = u.Y()/u.X();
+  bu = L.Y() - au*L.X();
 
   // We look for M(xM, yM) that intersect du and dv:
-  double xM,yM;
   if(!isinf(au) && !isinf(av)){ // au and av are not inf, i.e. not vertical line
     xM = (bv-bu)/(au-av);
     yM = au*xM+bu;
@@ -98,7 +99,7 @@ void DCReconstruction::ResolvePlane(const TVector3& L,const double& ThetaU ,cons
     yM=-10000;
   }
 
-  PosXY=TVector3(xM,yM,0);
+  PosXY.SetXYZ(xM,yM,0);
 
 }
 
@@ -107,12 +108,11 @@ void DCReconstruction::ResolvePlane(const TVector3& L,const double& ThetaU ,cons
 double DCReconstruction::SumD(const double* parameter ){
   unsigned int size = fitX->size();
   // Compute the sum P of the distance between the circle and the track
-  double P = 0;
-  double a = parameter[0];
-  double b = parameter[1];
-  double ab= a*b;
-  double a2=a*a;
-  double c,d,x,z,r;
+  P = 0;
+  a = parameter[0];
+  b = parameter[1];
+  ab= a*b;
+  a2=a*a;
 
   for(unsigned int i = 0 ; i < size ; i++){
     c = (*fitX)[i];
@@ -120,9 +120,10 @@ double DCReconstruction::SumD(const double* parameter ){
     r = (*fitR)[i];
     x = (a*d-ab+c)/(1+a2);
     z = a*x+b;
-    P+= abs( (x-c)*(x-c)+(z-d)*(z-d)-r*r)/r;
+    P+= sqrt(abs( (x-c)*(x-c)+(z-d)*(z-d)-r*r));
   }
-  return P;
+  // return normalized power
+  return P/size;
 
 }
 
diff --git a/NPLib/TrackReconstruction/NPDCReconstruction.h b/NPLib/TrackReconstruction/NPDCReconstruction.h
index 830feb6517ca6b313980848652c7cb089efc66f5..5659aaf2cbd3c30329472d3f779c45ee7e37f76d 100644
--- a/NPLib/TrackReconstruction/NPDCReconstruction.h
+++ b/NPLib/TrackReconstruction/NPDCReconstruction.h
@@ -39,23 +39,23 @@
 #include "Math/Minimizer.h"
 #include "Math/Functor.h"
 namespace NPL{
-  
+
   class DCReconstruction{
     public:
       DCReconstruction();
       ~DCReconstruction();
-    
+
     public:
-    // Build a track in 2D based on drift circle of Radius R and position X,Z
-    // return X0(X100) the X position at Z=0 (Z=100)
-    // return a and b the coeff of the 2D line
-    void BuildTrack2D(const std::vector<double>& X,const std::vector<double>& Z,const std::vector<double>& R,double& X0,double& X100,double& a, double& b );
-    
-    // Compute X and Y crossing coordinate of 2 plane of Wire
-    void ResolvePlane(const TVector3& L,const double& ThetaU ,const TVector3& H, const double& ThetaV, TVector3& PosXY);
-    
-    // Function used by the minimizer in BuildTrack2D
-    double SumD(const double* parameter );
+      // Build a track in 2D based on drift circle of Radius R and position X,Z
+      // return X0(X100) the X position at Z=0 (Z=100)
+      // return a and b the coeff of the 2D line
+      double BuildTrack2D(const std::vector<double>& X,const std::vector<double>& Z,const std::vector<double>& R,double& X0,double& X100,double& a, double& b );
+
+      // Compute X and Y crossing coordinate of 2 plane of Wire
+      void ResolvePlane(const TVector3& L,const double& ThetaU ,const TVector3& H, const double& ThetaV, TVector3& PosXY);
+
+      // Function used by the minimizer in BuildTrack2D
+      double SumD(const double* parameter );
 
     private: // private member used by SumD
       ROOT::Math::Minimizer* m_min;
@@ -63,7 +63,18 @@ namespace NPL{
       const std::vector<double>* fitX;
       const std::vector<double>* fitZ;
       const std::vector<double>* fitR;
-    };
-  }
+      // used by SumD
+      unsigned int size ;
+      double P,a,b,ab,a2,c,d,x,z,r;
+      // used by BuildTrack
+      double ai,bi;
+      double parameter[2];
+      // used by resolve plane
+      long double av,bv,au,bu;
+      double xM,yM;
+
+
+  };
+}
 
 #endif
diff --git a/NPSimulation/Process/FissionDecay.cc b/NPSimulation/Process/FissionDecay.cc
index 15b7ed586647e4d59c7e0be9a9d46971ab6b9407..7568dbf47346b6b91d655ef82e2a7f4c8be1838b 100644
--- a/NPSimulation/Process/FissionDecay.cc
+++ b/NPSimulation/Process/FissionDecay.cc
@@ -40,10 +40,11 @@ using namespace NPS;
 ////////////////////////////////////////////////////////////////////////////////
 FissionDecay::FissionDecay(G4String modelName,G4Region* envelope) :
   G4VFastSimulationModel(modelName, envelope) {
-    ReadConfiguration();
     m_PreviousEnergy=0 ;
     m_PreviousLength=0 ;
     m_FissionConditions = new TFissionConditions();
+    
+    ReadConfiguration();
     //AttachFissionConditions();
     //if(!RootOutput::getInstance()->GetTree()->FindBranch("FissionConditions"))
     //  RootOutput::getInstance()->GetTree()->Branch("FissionConditions", "TFissionConditions", &m_FissionConditions);
@@ -75,9 +76,9 @@ void FissionDecay::ReadConfiguration(){
     m_CompoundParticle = NPL::Particle(Mother);
     m_CompoundName = NPL::ChangeNameToG4Standard(Mother,true);
     AttachFissionConditions();
-    if(!RootOutput::getInstance()->GetTree()->FindBranch("FissionConditions"))
+    if(!RootOutput::getInstance()->GetTree()->FindBranch("FissionConditions")){
       RootOutput::getInstance()->GetTree()->Branch("FissionConditions", "TFissionConditions", &m_FissionConditions);
-
+    }
   }
 
 }
diff --git a/Outputs/Analysis/.gitignore b/Outputs/Analysis/.gitignore
index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..4ea40f8315d27f24d50e2c0f6ac12ea00b5542f6 100644
--- a/Outputs/Analysis/.gitignore
+++ b/Outputs/Analysis/.gitignore
@@ -0,0 +1 @@
+*.root
diff --git a/Outputs/Simulation/.gitignore b/Outputs/Simulation/.gitignore
index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..4ea40f8315d27f24d50e2c0f6ac12ea00b5542f6 100644
--- a/Outputs/Simulation/.gitignore
+++ b/Outputs/Simulation/.gitignore
@@ -0,0 +1 @@
+*.root
diff --git a/Projects/ComptonTelescope/calibrations.txt b/Projects/ComptonTelescope/calibrations.txt
index 9e3f54db5da90a6b3f7f55e70bcff4e8260db72f..97821d5d8bd7db027203aba58148e1dd5239c5e7 100644
--- a/Projects/ComptonTelescope/calibrations.txt
+++ b/Projects/ComptonTelescope/calibrations.txt
@@ -1,3 +1,5 @@
 CalibrationFilePath
   ./calibrations/COCOTE_PACI_Front.txt
   ./calibrations/COCOTE_PACI_Back.txt
+  ./calibrations/CeBr3_PED.txt
+  ./calibrations/CeBr3_E.txt
diff --git a/Projects/ComptonTelescope/configs/ConfigComptonTelescope.dat b/Projects/ComptonTelescope/configs/ConfigComptonTelescope.dat
index 33bf2d8897a850c0ddfa299301c9a04eefd9c274..779d82f4387761dbe0b0ab4a4796f838c7268748 100644
--- a/Projects/ComptonTelescope/configs/ConfigComptonTelescope.dat
+++ b/Projects/ComptonTelescope/configs/ConfigComptonTelescope.dat
@@ -6,3 +6,5 @@ ConfigComptonTelescope
    STRIP_BACK_E_RAW_THRESHOLD             300
    STRIP_FRONT_E_THRESHOLD                10
    STRIP_BACK_E_THRESHOLD                 10
+   CALORIMETER_E_RAW_THRESHOLD            0
+   CALORIMETER_E_THRESHOLD                0
diff --git a/Projects/ComptonTelescope/online/src/online.cpp b/Projects/ComptonTelescope/online/src/online.cpp
index d0303545c05f2add50e1fc8ca6f9eaa2034e174e..d9e764053027a1d0b249b102b6d6add8aed7cc49 100644
--- a/Projects/ComptonTelescope/online/src/online.cpp
+++ b/Projects/ComptonTelescope/online/src/online.cpp
@@ -29,7 +29,12 @@ int main()
   //   sprintf(arg,"-D ./ComptonCAM.detector -C calibrations.txt -GH -E Example2.reaction --circular");
   //   sprintf(arg,"-D ./ComptonCAM.detector -C calibrations.txt -GH -E ./10He.reaction --circular");
   //   string arg = "-D ./ComptonCAM.detector -C calibrations.txt -GH -E ./10He.reaction --circular";
+<<<<<<< HEAD
   string arg = "-D ./Example1.detector -GH -E Example1.reaction --circular";
+=======
+  
+  string arg = "-D ./Example1.detector -GH -E Example1.reaction -T  /scratch/rdc/FDC2.root RawTree";
+>>>>>>> f7daf77f0460ce69ba6db1a4d5d78ec8b22029f1
   NPOptionManager::getInstance(arg);  
 
   // ROOT output file name
@@ -39,13 +44,20 @@ int main()
   string detectorfileName = NPOptionManager::getInstance()->GetDetectorFile();
   cout << "detector file name from NPOptionManager: " << detectorfileName << "\n";
   NPL::DetectorManager* m_NPDetectorManager = new NPL::DetectorManager();
+<<<<<<< HEAD
 //  m_NPDetectorManager->ReadConfigurationFile(detectorfileName);
 
+=======
+  m_NPDetectorManager->ReadConfigurationFile(detectorfileName);
+  m_NPDetectorManager->InitializeRootOutput();
+  m_NPDetectorManager->InitializeRootInput();
+>>>>>>> f7daf77f0460ce69ba6db1a4d5d78ec8b22029f1
   // Essential!
   #if __cplusplus > 199711L && NPMULTITHREADING
    m_NPDetectorManager->StopThread();
   #endif
   RootOutput::Destroy();
+  RootInput::Destroy();
 
   ///////////////////////////////////////////////////////////////////////////
   // this part is commented for debugging purposes, but it works on its own
@@ -86,24 +98,24 @@ int main()
 
   while (D -> getCursor() < length)
   {
-  // Read the actual data
-  D -> decodeRawMFM();
-  //D -> Dump();//Optionnal print
-
-  // Set ccamData (a better way is envisionned)
-  for (int i=0; i<64; i++) {
-  ccamData -> SetCTCalorimeterTTowerNbr( 1 );
-  ccamData -> SetCTCalorimeterTDetectorNbr( 1 );//Triggered ASIC number
-  ccamData -> SetCTCalorimeterTChannelNbr( D -> getPixelNumber() );//ASIC's channel number
-  ccamData -> SetCTCalorimeterTTime( D -> getTime() );
-  ccamData -> SetCTCalorimeterETowerNbr(1);
-  ccamData -> SetCTCalorimeterEDetectorNbr( 1 );
-  ccamData -> SetCTCalorimeterEChannelNbr( i );//PMT pixel number
-  ccamData -> SetCTCalorimeterEEnergy( D -> getData()[i] );
-  }
-  ccamData -> Dump();
-  ccamData -> Clear();
-  c++;
+     // Read the actual data
+     D -> decodeRawMFM();
+     //D -> Dump();//Optionnal print
+
+     // Set ccamData (a better way is envisionned)
+     for (int i=0; i<64; i++) {
+       ccamData -> SetCTCalorimeterTTowerNbr( 1 );
+       ccamData -> SetCTCalorimeterTDetectorNbr( 1 );//Triggered ASIC number
+       ccamData -> SetCTCalorimeterTChannelNbr( D -> getPixelNumber() );//ASIC's channel number
+       ccamData -> SetCTCalorimeterTTime( D -> getTime() );
+       ccamData -> SetCTCalorimeterETowerNbr(1);
+       ccamData -> SetCTCalorimeterEDetectorNbr( 1 );
+       ccamData -> SetCTCalorimeterEChannelNbr( i );//PMT pixel number
+       ccamData -> SetCTCalorimeterEEnergy( D -> getData()[i] );
+     }
+     ccamData -> Dump();
+     ccamData -> Clear();
+     c++;
   }
   delete D;
   delete [] buffer;