diff --git a/src/ZddDetector.cxx b/src/ZddDetector.cxx
index 4326ba01a882aa1c545771b67797fd0e90184845..46663ba4bb17a5055e0f62923c035a6bf539a8c0 100644
--- a/src/ZddDetector.cxx
+++ b/src/ZddDetector.cxx
@@ -10,9 +10,11 @@ using namespace ROOT::Math;
 
 ////////////////////////////////////////////////////////////////////////////////
 ZddDetector::ZddDetector() {
+  std::cout << "////////////////////////////////////////////// test INIT ////////////////////////////////////////////////" << std::endl;
   m_RawData     = new zdd::ZddData();
   m_CalData     = new zdd::ZddData();
   m_PhysicsData = new zdd::ZddPhysics();
+  std::cout << "Adresse phy " << m_PhysicsData << std::endl;
   m_Cal.InitCalibration();
 }
 
@@ -116,8 +118,8 @@ void ZddDetector::BuildPhysicalEvent() {
 
   // match energy and time together
   Match_IC1();
-  if (m_PhysicsData->IC_Nbr.size() > 0)
-    Match_PL();
+  // if (m_PhysicsData->IC_Nbr.size() > 0)
+  Match_PL();
 
   Treat_Exo();
   // Treat_DC();
@@ -130,7 +132,6 @@ void ZddDetector::Treat_Exo() {
 
   unsigned int size = m_CalData->GetZDD_EXOMult();
   for(unsigned int i = 0 ; i < size ; i++){
-    // std::cout << "test treat" << std::endl;
     m_PhysicsData->Exo_Nbr.push_back(m_CalData->GetZDD_EXON(i));
     m_PhysicsData->Exo_E.push_back(m_CalData->GetZDD_EXOE(i));
     m_PhysicsData->Exo_TS.push_back(m_CalData->GetZDD_EXOTS(i));
@@ -380,8 +381,8 @@ void ZddDetector::InitializeDataInputRaw(
 ////////////////////////////////////////////////////////////////////////////////
 void ZddDetector::InitializeDataInputPhysics(
     std::shared_ptr<nptool::VDataInput> input) {
+  // input->Attach("zdd", "zdd::ZddData", &m_RawData);
   input->Attach("zdd", "zdd::ZddPhysics", &m_PhysicsData);
-  input->Attach("zdd", "zdd::ZddData", &m_RawData);
 }
 ////////////////////////////////////////////////////////////////////////////////
 void ZddDetector::InitializeDataOutputRaw(
@@ -391,7 +392,7 @@ void ZddDetector::InitializeDataOutputRaw(
 ////////////////////////////////////////////////////////////////////////////////
 void ZddDetector::InitializeDataOutputPhysics(
     std::shared_ptr<nptool::VDataOutput> output) {
-  output->Attach("zdd", "zdd::ZddData", &m_RawData);
+  // output->Attach("zdd", "zdd::ZddData", &m_RawData);
   output->Attach("zdd", "zdd::ZddPhysics", &m_PhysicsData);
 }
 
@@ -401,15 +402,19 @@ void ZddDetector::InitSpectra() {
 };
 ////////////////////////////////////////////////////////////////////////////////
 void ZddDetector::FillSpectra() {
-  m_Spectra->FillRaw();
-  m_Spectra->FillPhy();
+  auto app = nptool::Application::GetApplication();
+  
+  if(app->HasFlag("--input-raw"))
+    m_Spectra->FillRaw();
+  if(app->HasFlag("--input-phy"))
+    m_Spectra->FillPhy();
 };
 ////////////////////////////////////////////////////////////////////////////////
 void ZddDetector::WriteSpectra() {};
 ////////////////////////////////////////////////////////////////////////////////
 void ZddDetector::CheckSpectra() {};
 ////////////////////////////////////////////////////////////////////////////////
-void ZddDetector::ClearSpectra() { m_Spectra->Clear(); };
+void ZddDetector::ClearSpectra() { /*m_Spectra->Clear(); */};
 
 
 ////////////////////////////////////////////////////////////////////////////////
diff --git a/src/ZddDetector.h b/src/ZddDetector.h
index 555174e9233112d929d87efefef3e9e1b73a8cb8..0c2f933afb17b1aacbaefa56559277e67dd59892 100644
--- a/src/ZddDetector.h
+++ b/src/ZddDetector.h
@@ -6,6 +6,7 @@
 #include <vector>
 
 #include "Math/Vector3D.h"
+#include "NPApplication.h"
 #include "NPCalibrationManager.h"
 #include "NPVDetector.h"
 #include "ZddData.h"
diff --git a/src/ZddSpectra.cxx b/src/ZddSpectra.cxx
index 4077c2f5b6227c23b696b49fc8957e1647629fd5..c40b6b581aceed8567fee2b577f0672b5165a2d3 100644
--- a/src/ZddSpectra.cxx
+++ b/src/ZddSpectra.cxx
@@ -5,9 +5,10 @@ using namespace zdd;
 
 ////////////////////////////////////////////////////////////////////////////////
 ZddSpectra::ZddSpectra() {
+  auto app = nptool::Application::GetApplication();
   // Set Pointers:
   m_detector = std::dynamic_pointer_cast<ZddDetector>(
-      nptool::Application::GetApplication()->GetDetector("zdd"));
+      app->GetDetector("zdd"));
 
   m_RawData     = m_detector->m_RawData;
   m_RawData->Clear();
@@ -16,14 +17,22 @@ ZddSpectra::ZddSpectra() {
   m_PhysicsData->Clear();
 
   // Declare Raw Spectra
-  for (auto map: m_detector->m_NumexoMap) {
-    std::string hist_name = "ZDD_" + map.second + "_Board_" + nptool::itoa(map.first/1000) + "_Channel_" + nptool::itoa(map.first%1000);
-    std::cout << "Hist name " << hist_name << std::endl;
-
-    m_raw_hist[map.second][map.first%1000] = new TH1F(hist_name.c_str(), hist_name.c_str(),
-        65536/4, 0, 65536);
+  if(app->HasFlag("--input-raw"))
+  {
+    for (auto map: m_detector->m_NumexoMap) {
+      std::string hist_name = "ZDD_" + map.second;
+      m_raw_channels[hist_name].push_back(map.first%1000);
+    }
+    for (auto map: m_raw_channels) {
+      std::string hist_name =  map.first;
+      std::cout << "Hist name " << hist_name << std::endl;
+      unsigned int channel_min = *std::min_element(map.second.begin(),map.second.end());
+      unsigned int channel_max = *std::max_element(map.second.begin(),map.second.end());
+      m_raw_hist[map.first] = new TH2F(hist_name.c_str(), hist_name.c_str(),
+         channel_max - channel_min +1, channel_min, channel_max+1, 65536/4, 0, 65536);
   }
-
+  }
+/*
   // Build Raw Canvases
   std::vector<TCanvas*> canvases;
 
@@ -73,49 +82,51 @@ ZddSpectra::ZddSpectra() {
       std::cout << "Initialized something that is not a ZDD : " << det.first << std::endl;
     }
   }
+  */
 
 
   ////////////////////////////////////////////////////////////////////////////////
   // phy histo
-
-  unsigned int ExoSize = 4;
-  for(unsigned int i = 0 ; i < ExoSize ; i++){
-    std::string hist_name = "ZDD_EXO_phy_" +  nptool::itoa(i); 
-    m_phy_hist[hist_name] = new TH1F(hist_name.c_str(), hist_name.c_str(),
-        5000, 0, 10000);
-  }
+  if(app->HasFlag("--input-phy"))
+  {
+    unsigned int ExoSize = 4;
+    std::string hist_name = "ZDD_EXO_Cal"; 
+    m_phy_hist[hist_name] = new TH2F(hist_name.c_str(), hist_name.c_str(),
+        ExoSize, 0, ExoSize, 5000, 0, 10000);
   
   // for(auto hist: m_raw_hist["EXO"]){
   //   std::string hist_name = "ZDD_EXO_phy_Channel_" + nptool::itoa(hist.first);
   //   std::cout << "Hist name " << hist_name << std::endl;
   //   m_phy_hist[hist_name] = new TH1F(hist_name.c_str(), hist_name.c_str(),
   //       5000, 0, 10000);
-  // }
     
 
-  std::string hist_name = "ZDD_EXO_All_phy";
+  hist_name = "ZDD_EXO_All";
   m_phy_hist[hist_name] = new TH1F(hist_name.c_str(), hist_name.c_str(),
         5000, 0, 10000);
   
-  hist_name = "ZDD_IC_E_PL_E_phy";
+  hist_name = "ZDD_ICSum_PLc";
   m_phy_hist[hist_name] = new TH2F(hist_name.c_str(), hist_name.c_str(),
         4000, 0, 60000, 2000,0,10000);
   
   unsigned int PlSize = 5;
-  for(unsigned int i = 0 ; i < PlSize ; i++){
-    std::string hist_name = "ZDD_PL_phy_" +  nptool::itoa(i); 
-    m_phy_hist[hist_name] = new TH1F(hist_name.c_str(), hist_name.c_str(),
-        5000, 0, 20000);
-  }
-  hist_name = "IC_phy_Sum";
+  hist_name = "ZDD_PL_Phy"; 
+  m_phy_hist[hist_name] = new TH2F(hist_name.c_str(), hist_name.c_str(),
+        PlSize, 0, PlSize, 5000, 0, 20000);
+  
+  hist_name = "IC_dE_dE";
+  m_phy_hist[hist_name] = new TH2F(hist_name.c_str(), hist_name.c_str(),
+        2000,0,2000,2000, 0, 2000);
+  
+  hist_name = "IC_PL_TSdiff";
   m_phy_hist[hist_name] = new TH1F(hist_name.c_str(), hist_name.c_str(),
-        3000, 0, 30000);
-
+        2400,-1200,1200);
+/*
   c_EXO = 1;
   auto cEXO_phy = new TCanvas("ZDD phy EXO");
   cEXO_phy->Divide(2,2);
   
-  c_PL = 1;
+c_PL = 1;
   auto cPL_phy = new TCanvas("ZDD phy PL");
   cPL_phy->Divide(3,2);
 
@@ -139,6 +150,8 @@ ZddSpectra::ZddSpectra() {
   auto cZDD_ID_phy = new TCanvas("ZDD ID IC_E PL_E");
   hist_name = "ZDD_IC_E_PL_E_phy";
   m_phy_hist[hist_name]->Draw("colz");
+  */
+  }
 }
 
 ////////////////////////////////////////////////////////////////////////////////
@@ -146,32 +159,43 @@ void ZddSpectra::FillPhy() {
   auto size_EXO = m_PhysicsData->Exo_E.size();
   for(unsigned int i = 0 ; i < size_EXO ; i++){
     if(m_PhysicsData->Exo_E[i]>0){
-    std::string hist_name = "ZDD_EXO_phy_" +  nptool::itoa(m_PhysicsData->Exo_Nbr[i]); 
-    m_phy_hist[hist_name]->Fill(m_PhysicsData->Exo_E[i]);
-    hist_name = "ZDD_EXO_All_phy";
+    std::string hist_name = "ZDD_EXO_Cal"; 
+    m_phy_hist[hist_name]->Fill(m_PhysicsData->Exo_Nbr[i], m_PhysicsData->Exo_E[i]);
+    hist_name = "ZDD_EXO_All";
     m_phy_hist[hist_name]->Fill(m_PhysicsData->Exo_E[i]);
     }
   }
   unsigned int size_PL = m_PhysicsData->PL_E.size();
-  std::set<int> tmp_IC_Nbr(m_PhysicsData->IC_Nbr.begin(), m_PhysicsData->IC_Nbr.end());
   for(unsigned int i = 0 ;i< size_PL ; i++){
     if(m_PhysicsData->PL_E[i]>0){
-      std::string hist_name = "ZDD_PL_phy_" +  nptool::itoa(m_PhysicsData->PL_Nbr[i]); 
-      m_phy_hist[hist_name]->Fill(m_PhysicsData->PL_E[i]);
+      std::string hist_name = "ZDD_PL_Phy"; 
+      m_phy_hist[hist_name]->Fill(m_PhysicsData->PL_Nbr[i],m_PhysicsData->PL_E[i]);
       if(m_PhysicsData->ICSum>0&&m_PhysicsData->PL_Nbr[i] == 2){
-        if(std::all_of(m_PhysicsData->IC_E.cbegin(), m_PhysicsData->IC_E.cend(), [](auto i){ return i > 0; }) && tmp_IC_Nbr.size() == 5){
-          std::string hist_name = "ZDD_IC_E_PL_E_phy";
+          hist_name ="ZDD_ICSum_PLc";
           m_phy_hist[hist_name]->Fill(m_PhysicsData->PL_E[i],m_PhysicsData->ICSum);
         }
       }
     }
-  }
-  if(m_PhysicsData->ICSum>0){
-    if(std::all_of(m_PhysicsData->IC_E.cbegin(), m_PhysicsData->IC_E.cend(), [](auto i){ return i > 0 ;}) && tmp_IC_Nbr.size() == 5){
-      std::string hist_name = "IC_phy_Sum"; 
-      m_phy_hist[hist_name]->Fill(m_PhysicsData->ICSum);
-    }
-  }
+  // unsigned int size_PL = m_PhysicsData->PL_E.size();
+  // std::set<int> tmp_IC_Nbr(m_PhysicsData->IC_Nbr.begin(), m_PhysicsData->IC_Nbr.end());
+  // for(unsigned int i = 0 ;i< size_PL ; i++){
+  //   if(m_PhysicsData->PL_E[i]>0){
+  //     std::string hist_name = "ZDD_PL_phy_" +  nptool::itoa(m_PhysicsData->PL_Nbr[i]); 
+  //     m_phy_hist[hist_name]->Fill(m_PhysicsData->PL_E[i]);
+  //     if(m_PhysicsData->ICSum>0&&m_PhysicsData->PL_Nbr[i] == 2){
+  //       if(std::all_of(m_PhysicsData->IC_E.cbegin(), m_PhysicsData->IC_E.cend(), [](auto i){ return i > 0; }) && tmp_IC_Nbr.size() == 5){
+  //         std::string hist_name = "ZDD_IC_E_PL_E_phy";
+  //         m_phy_hist[hist_name]->Fill(m_PhysicsData->PL_E[i],m_PhysicsData->ICSum);
+  //       }
+  //     }
+  //   }
+  // }
+  // if(m_PhysicsData->ICSum>0){
+  //   if(std::all_of(m_PhysicsData->IC_E.cbegin(), m_PhysicsData->IC_E.cend(), [](auto i){ return i > 0 ;}) && tmp_IC_Nbr.size() == 5){
+  //     std::string hist_name = "IC_phy_Sum"; 
+  //     m_phy_hist[hist_name]->Fill(m_PhysicsData->ICSum);
+  //   }
+  // }
 }
 
 ////////////////////////////////////////////////////////////////////////////////
@@ -179,31 +203,29 @@ void ZddSpectra::FillRaw() {
   auto size_IC =  m_RawData->GetZDD_ICMult();
   for (unsigned int i = 0; i < size_IC; i++) {
     if(m_RawData->GetZDD_ICE(i)>0)
-      m_raw_hist["IC"][m_RawData->GetZDD_ICN(i)]->Fill(m_RawData->GetZDD_ICE(i));
+      m_raw_hist["ZDD_IC"]->Fill(m_RawData->GetZDD_ICN(i), m_RawData->GetZDD_ICE(i));
   }
   auto size_PL =  m_RawData->GetZDD_PLMult();
   for (unsigned int i = 0; i < size_PL; i++) {
     if(m_RawData->GetZDD_PLE(i)>0)
-      m_raw_hist["PL"][m_RawData->GetZDD_PLN(i)]->Fill(m_RawData->GetZDD_PLE(i));
+      m_raw_hist["ZDD_PL"]->Fill(m_RawData->GetZDD_PLN(i), m_RawData->GetZDD_PLE(i));
   }
   auto size_DC =  m_RawData->GetZDD_DCMult();
   for (unsigned int i = 0; i < size_DC; i++) {
     if(m_RawData->GetZDD_DCE(i)>0)
-      m_raw_hist["DC"][m_RawData->GetZDD_DCN(i)]->Fill(m_RawData->GetZDD_DCE(i));
+      m_raw_hist["ZDD_DC"]->Fill(m_RawData->GetZDD_DCN(i), m_RawData->GetZDD_DCE(i));
   }
   auto size_EXO =  m_RawData->GetZDD_EXOMult();
   for (unsigned int i = 0; i < size_EXO; i++) {
     if(m_RawData->GetZDD_EXOE(i)>0)
-      m_raw_hist["EXO"][m_RawData->GetZDD_EXON(i)]->Fill(m_RawData->GetZDD_EXOE(i));
+      m_raw_hist["ZDD_EXO"]->Fill(m_RawData->GetZDD_EXON(i), m_RawData->GetZDD_EXOE(i));
   }
-
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 void ZddSpectra::Clear() {
   for (auto det : m_raw_hist)
-    for (auto hist : det.second)
-      hist.second->Reset();
+      det.second->Reset();
   for (auto hist : m_phy_hist)
     hist.second->Reset();
 }
diff --git a/src/ZddSpectra.h b/src/ZddSpectra.h
index cde97063ecc9e34c18679374b83674f84f85f66e..932a79d6b320ffb1613b9cece69cec5f20598c63 100644
--- a/src/ZddSpectra.h
+++ b/src/ZddSpectra.h
@@ -21,7 +21,8 @@ namespace zdd {
     std::shared_ptr<zdd::ZddDetector> m_detector;
     zdd::ZddData* m_RawData;
     zdd::ZddPhysics* m_PhysicsData;
-    std::map<std::string,std::map<unsigned int, TH1*>> m_raw_hist;
+    std::map<std::string,TH2*> m_raw_hist;
+    std::map<std::string,std::vector<unsigned int>> m_raw_channels;
     // std::map<std::string,std::map<unsigned int, TH1*>> m_phy_hist;
     std::map<std::string, TH1*> m_phy_hist;