From d094ac165e0f38a59611085fa0c8b718005ef5b6 Mon Sep 17 00:00:00 2001
From: Hugo Jacob <hugojacob57@gmail.com>
Date: Wed, 11 Oct 2023 17:52:54 +0200
Subject: [PATCH] Modified Analysis of E805

---
 Projects/E805/Analysis.cxx                    | 178 ++++++++++++++++--
 Projects/E805/Analysis.h                      |  35 ++++
 .../DetectorConfiguration/MUST2_E805.detector |  22 +++
 3 files changed, 220 insertions(+), 15 deletions(-)

diff --git a/Projects/E805/Analysis.cxx b/Projects/E805/Analysis.cxx
index 1dde6158a..0ed9df108 100755
--- a/Projects/E805/Analysis.cxx
+++ b/Projects/E805/Analysis.cxx
@@ -35,7 +35,7 @@ Analysis::~Analysis(){
 void Analysis::Init(){
   InitInputBranch();
   InitOutputBranch();
-  //CATS = (TCATSPhysics*)  m_DetectorManager -> GetDetector("CATSDetector");
+  CATS = (TCATSPhysics*)  m_DetectorManager -> GetDetector("CATSDetector");
   M2 = (TMust2Physics*)  m_DetectorManager -> GetDetector("M2Telescope");
    
   reaction->ReadConfigurationFile(NPOptionManager::getInstance()->GetReactionFile());
@@ -61,12 +61,56 @@ void Analysis::Init(){
 
 bool Analysis::UnallocateBeforeBuild(){
   // std::cout << "test unallocate" << std::endl;
-  //GATCONFMASTER = **GATCONFMASTER_;
-  //return (GATCONFMASTER > 0); 
-  return true;
+  GATCONFMASTER = **GATCONFMASTER_;
+  return (GATCONFMASTER > 0); 
+  //return true;
 }
 
 bool Analysis::UnallocateBeforeTreat(){
+  for(int i = 0; i < 10; i++){
+  PlasticRaw[i] = (*PlasticRaw_   )[i];
+  PlasticRawTS[i] = (*PlasticRaw_TS_)[i];
+  }
+  
+  for(int i = 0; i < 6; i++){
+  IC_ZDDRaw[i] =  (*IC_ZDDRaw_)[i];
+  IC_ZDDRawTS[i] =  (*IC_ZDDRaw_TS_)[i];
+  }
+  
+  TAC_CATS_PL = **TAC_CATS_PL_;
+  TAC_CATS_PLTS = **TAC_CATS_PL_TS_;
+  
+  TAC_CATS_HF = **TAC_CATS_HF_;
+  TAC_CATS_HFTS = **TAC_CATS_HF_TS_;
+  
+  TAC_CATS_EXOGAM = **TAC_CATS_EXOGAM_;
+  TAC_CATS_EXOGAMTS = **TAC_CATS_EXOGAM_TS_;
+  
+  TAC_MMG_CATS2 = **TAC_MMG_CATS2_;
+  TAC_MMG_CATS2TS = **TAC_MMG_CATS2_TS_;
+  
+  TAC_MMG_CATS1 = **TAC_MMG_CATS1_;
+  TAC_MMG_CATS1TS = **TAC_MMG_CATS1_TS_;
+  
+  TAC_MMG_EXOGAM = **TAC_MMG_EXOGAM_;
+  TAC_MMG_EXOGAMTS = **TAC_MMG_EXOGAM_TS_;
+  
+  TAC_CATS1_CATS2 = **TAC_CATS1_CATS2_;
+  TAC_CATS1_CATS2TS = **TAC_CATS1_CATS2_TS_;
+  
+  TAC_D4_CATS1 =**TAC_D4_CATS1_;
+  TAC_D4_CATS1 =**TAC_D4_CATS1_TS_;
+  
+  TAC_PL_1 = **TAC_PL_1_;
+  TAC_PL_1TS = **TAC_PL_1_TS_;
+  TAC_PL_2 = **TAC_PL_2_;
+  TAC_PL_2TS = **TAC_PL_2_TS_;
+  TAC_PL_3 = **TAC_PL_3_;
+  TAC_PL_3TS = **TAC_PL_3_TS_;
+  TAC_PL_4 = **TAC_PL_4_;
+  TAC_PL_4TS = **TAC_PL_4_TS_;
+  TAC_PL_5 = **TAC_PL_5_;
+  TAC_PL_5TS = **TAC_PL_5_TS_;
   return true;
 }
 
@@ -82,8 +126,10 @@ void Analysis::TreatEvent(){
     //  std::cout << "Analysis test " << M2->CsI_E[0] << " " << M2->CsI_E.size() << " " << "\n \n";
 
     ReInit();
+    // std::cout << CATS->PositionX.size() << std::endl;
     //////////////////// MUST2 Part ////////////////////
     int M2_size = M2->Si_E.size();
+    if(CATS->PositionX.size() == 2 && CATS->PositionY.size() == 2){
     for(unsigned int countMust2 = 0 ; countMust2 < M2_size ; countMust2++){
       M2_TelescopeM++;
       // MUST2
@@ -93,11 +139,12 @@ void Analysis::TreatEvent(){
       ThetaM2Surface = 0;
       ThetaNormalTarget = 0;
       
-      //BeamImpact = TVector3(Xf,Yf,0); 
-      BeamImpact = TVector3(0,0,0); 
+      BeamImpact = TVector3(CATS->PositionOnTargetX,CATS->PositionOnTargetY,0); 
+      // BeamImpact = TVector3(0,0,0); 
       
-      //BeamDirection = TVector3(CATS2_X - CATS1_X,CATS2_Y - CATS1_Y,497);
-      BeamDirection = TVector3(0,0,1);
+      BeamDirection = TVector3(CATS->PositionX[1] - CATS->PositionX[0],CATS->PositionY[1] - CATS->PositionY[0],CATS->PositionZ[1] - CATS->PositionZ[0]);
+      // std::cout << CATS->PositionX[0] - CATS->PositionX[1] << " " << CATS->PositionY[0] - CATS->PositionY[1] << " " << CATS->PositionZ[0] - CATS->PositionZ[1] << std::endl;
+      // BeamDirection = TVector3(0,0,1);
       
       TVector3 HitDirection = M2 -> GetPositionOfInteraction(countMust2) - BeamImpact ;
       M2_ThetaLab.push_back(HitDirection.Angle( BeamDirection ));
@@ -111,21 +158,21 @@ void Analysis::TreatEvent(){
       ThetaNormalTarget = HitDirection.Angle( TVector3(0,0,1) ) ;
 
       // Part 2 : Impact Energy
-      Si_E_M2 = 0;
-      CsI_E_M2 = 0;
       int CristalNb = M2->CsI_N[countMust2];
 
       Si_E_M2 = M2->Si_E[countMust2];
       CsI_E_M2= M2->CsI_E[countMust2];
-      if(CsI_E_M2 > 0)
-      std::cout << "Analysis" << CsI_E_M2 << " " << M2->CsI_E.size() << " " << CristalNb << "\n \n";
+      // if(CsI_E_M2 > 0)
+      // std::cout << "Analysis " << CsI_E_M2 << " " << M2->CsI_E.size() << " " << CristalNb << "\n \n";
       for(unsigned int i = 0; i < ParticleType.size(); i++){
         Energy[ParticleType[i]] = 0;
+        CsI_Energy[ParticleType[i]] = 0;
 
       if(CsI_E_M2>8192 ){
         // The energy in CsI is calculate form dE/dx Table because
-        Energy[ParticleType[i]] =  Cal->ApplyCalibration(ParticleType[i]+"MUST2/T"+NPL::itoa(TelescopeNumber)+"_CsI"+NPL::itoa(CristalNb)+"_E",CsI_E_M2);
-        std::cout << Energy[ParticleType[i]] << "\n";
+        CsI_Energy[ParticleType[i]] =  Cal->ApplyCalibration("MUST2/"+ParticleType[i]+"_T"+NPL::itoa(TelescopeNumber)+"_CsI"+NPL::itoa(CristalNb)+"_E",CsI_E_M2);
+        Energy[ParticleType[i]] = CsI_Energy[ParticleType[i]];
+        //std::cout << ParticleType[i]+"MUST2/T"+NPL::itoa(TelescopeNumber)+"_CsI"+NPL::itoa(CristalNb)+"_E" << " " <<  Energy[ParticleType[i]] << "\n";
         //Energy = LightAl.EvaluateInitialEnergy( Energy ,0.4*micrometer , ThetaM2Surface);
         //Energy+=Si_E_M2;
       }
@@ -147,6 +194,12 @@ void Analysis::TreatEvent(){
       M2_Ex_d.push_back(reaction->ReconstructRelativistic( Energy["deuteron"] , M2_ThetaLab[countMust2] ));
       M2_Ex_t.push_back(reaction->ReconstructRelativistic( Energy["triton"] , M2_ThetaLab[countMust2] ));
       M2_Ex_a.push_back(reaction->ReconstructRelativistic( Energy["alpha"] , M2_ThetaLab[countMust2] ));
+      
+      M2_CsI_E_p.push_back(CsI_Energy["proton"]);
+      M2_CsI_E_d.push_back(CsI_Energy["deuteron"]);
+      M2_CsI_E_t.push_back(CsI_Energy["triton"]);
+      M2_CsI_E_a.push_back(CsI_Energy["alpha"]);
+      
       M2_ThetaLab[countMust2]=M2_ThetaLab[countMust2]/deg;
 
       // Part 4 : Theta CM Calculation
@@ -156,6 +209,7 @@ void Analysis::TreatEvent(){
       //  std::cout << "Test :" << proton_cut[TelescopeNumber] << " \n";
       //  
     }//end loop MUST2
+    }
 
   
   //for(unsigned int countMust2 = 0 ; countMust2 < M2->Si_E.size() ; countMust2++){
@@ -184,6 +238,10 @@ void Analysis::TreatEvent(){
 
 void Analysis::InitOutputBranch() {
   RootOutput::getInstance()->GetTree()->Branch("M2_TelescopeM",&M2_TelescopeM,"M2_TelescopeM/s");
+  RootOutput::getInstance()->GetTree()->Branch("M2_CsI_E_p",&M2_CsI_E_p);
+  RootOutput::getInstance()->GetTree()->Branch("M2_CsI_E_d",&M2_CsI_E_d);
+  RootOutput::getInstance()->GetTree()->Branch("M2_CsI_E_t",&M2_CsI_E_t);
+  RootOutput::getInstance()->GetTree()->Branch("M2_CsI_E_a",&M2_CsI_E_a);
   RootOutput::getInstance()->GetTree()->Branch("M2_Ex_p",&M2_Ex_p);
   RootOutput::getInstance()->GetTree()->Branch("M2_Ex_d",&M2_Ex_d);
   RootOutput::getInstance()->GetTree()->Branch("M2_Ex_t",&M2_Ex_t);
@@ -201,6 +259,46 @@ void Analysis::InitOutputBranch() {
   RootOutput::getInstance()->GetTree()->Branch("M2_ECsI_from_deltaE",&M2_ECsI_from_deltaE);
   RootOutput::getInstance()->GetTree()->Branch("GATCONF",&GATCONFMASTER);
   
+  RootOutput:: getInstance()->GetTree()->Branch("TAC_CATS_PL",&TAC_CATS_PL,"TAC_CATS_PL/s");
+  RootOutput:: getInstance()->GetTree()->Branch("TAC_CATS_PLTS",&TAC_CATS_PLTS,"TAC_CATS_PLTS/l");
+  
+  RootOutput:: getInstance()->GetTree()->Branch("TAC_CATS_HF",&TAC_CATS_HF,"TAC_CATS_HF/s");
+  RootOutput:: getInstance()->GetTree()->Branch("TAC_CATS_HFTS",&TAC_CATS_HFTS,"TAC_CATS_HFTS/l");
+  
+  RootOutput:: getInstance()->GetTree()->Branch("TAC_CATS_EXOGAM",&TAC_CATS_EXOGAM,"TAC_CATS_EXOGAM/s");
+  RootOutput:: getInstance()->GetTree()->Branch("TAC_CATS_EXOGAMTS",&TAC_CATS_EXOGAMTS,"TAC_CATS_EXOGAMTS/l");
+  
+  RootOutput:: getInstance()->GetTree()->Branch("TAC_MMG_CATS2",&TAC_MMG_CATS2,"TAC_MMG_CATS2/s");
+  RootOutput:: getInstance()->GetTree()->Branch("TAC_MMG_CATS2TS",&TAC_MMG_CATS2TS,"TAC_MMG_CATS2TS/l");
+  
+  RootOutput:: getInstance()->GetTree()->Branch("TAC_MMG_CATS1",&TAC_MMG_CATS1,"TAC_MMG_CATS1/s");
+  RootOutput:: getInstance()->GetTree()->Branch("TAC_MMG_CATS1TS",&TAC_MMG_CATS1TS,"TAC_MMG_CATS1TS/l");
+  
+  RootOutput:: getInstance()->GetTree()->Branch("TAC_MMG_EXOGAM",&TAC_MMG_EXOGAM,"TAC_MMG_EXOGAM/s");
+  RootOutput:: getInstance()->GetTree()->Branch("TAC_MMG_EXOGAMTS",&TAC_MMG_EXOGAMTS,"TAC_MMG_EXOGAMTS/l");
+  
+  RootOutput:: getInstance()->GetTree()->Branch("TAC_CATS1_CATS2",&TAC_CATS1_CATS2,"TAC_CATS1_CATS2/s");
+  RootOutput:: getInstance()->GetTree()->Branch("TAC_CATS1_CATS2TS",&TAC_CATS1_CATS2TS,"TAC_CATS1_CATS2TS/l");
+  
+  RootOutput:: getInstance()->GetTree()->Branch("TAC_D4_CATS1",&TAC_D4_CATS1,"TAC_D4_CATS1/s");
+  RootOutput:: getInstance()->GetTree()->Branch("TAC_D4_CATS1TS",&TAC_D4_CATS1TS,"TAC_D4_CATS1TS/l");
+  
+  RootOutput:: getInstance()->GetTree()->Branch("TAC_PL_1",&TAC_PL_1,"TAC_PL_1/s");
+  RootOutput:: getInstance()->GetTree()->Branch("TAC_PL_1TS",&TAC_PL_1TS,"TAC_PL_1TS/l");
+  RootOutput:: getInstance()->GetTree()->Branch("TAC_PL_2",&TAC_PL_2,"TAC_PL_2/s");
+  RootOutput:: getInstance()->GetTree()->Branch("TAC_PL_2TS",&TAC_PL_2TS,"TAC_PL_2TS/l");
+  RootOutput:: getInstance()->GetTree()->Branch("TAC_PL_3",&TAC_PL_3,"TAC_PL_3/s");
+  RootOutput:: getInstance()->GetTree()->Branch("TAC_PL_3TS",&TAC_PL_3TS,"TAC_PL_3TS/l");
+  RootOutput:: getInstance()->GetTree()->Branch("TAC_PL_4",&TAC_PL_4,"TAC_PL_4/s");
+  RootOutput:: getInstance()->GetTree()->Branch("TAC_PL_4TS",&TAC_PL_4TS,"TAC_PL_4TS/l");
+  RootOutput:: getInstance()->GetTree()->Branch("TAC_PL_5",&TAC_PL_5,"TAC_PL_5/s");
+  RootOutput:: getInstance()->GetTree()->Branch("TAC_PL_5TS",&TAC_PL_5TS,"TAC_PL_5TS/l");
+  RootOutput:: getInstance()->GetTree()->Branch("PlasticRaw",PlasticRaw,"PlasticRaw[10]/s");
+  RootOutput:: getInstance()->GetTree()->Branch("PlasticRawTS",PlasticRawTS,"PlasticRawTS[10]/l");
+  
+  RootOutput:: getInstance()->GetTree()->Branch("IC_ZDDRaw",IC_ZDDRaw,"IC_ZDDRaw[6]/s");
+  RootOutput:: getInstance()->GetTree()->Branch("IC_ZDDRawTS",IC_ZDDRawTS,"IC_ZDDRawTS[6]/l");
+  
 }
 
 void Analysis::UnallocateVariables(){
@@ -208,13 +306,57 @@ void Analysis::UnallocateVariables(){
 
 void Analysis::InitInputBranch(){
   TTreeReader* inputTreeReader = RootInput::getInstance()->GetTreeReader();
-  // GATCONFMASTER_ = new TTreeReaderValue<unsigned short>(*inputTreeReader,"GATCONFMASTER");
+   GATCONFMASTER_ = new TTreeReaderValue<unsigned short>(*inputTreeReader,"GATCONFMASTER");
   //DATATRIG_CATS_ = new TTreeReaderValue<unsigned short>(*inputTreeReader,"DATATRIG_CATS");
+  PlasticRaw_   = new TTreeReaderArray<UShort_t>(*inputTreeReader,"PlasticRaw");
+  PlasticRaw_TS_ = new TTreeReaderArray<ULong64_t>(*inputTreeReader,"PlasticRawTS");
+  
+  IC_ZDDRaw_ = new TTreeReaderArray<UShort_t>(*inputTreeReader,"IC_ZDDRaw");
+  IC_ZDDRaw_TS_= new TTreeReaderArray<ULong64_t>(*inputTreeReader,"IC_ZDDRawTS");
+  
+  TAC_CATS_PL_= new TTreeReaderValue<UShort_t>(*inputTreeReader,"TAC_CATS_PL");
+  TAC_CATS_PL_TS_= new TTreeReaderValue<ULong64_t>(*inputTreeReader,"TAC_CATS_PLTS");
+  
+  TAC_CATS_HF_= new TTreeReaderValue<UShort_t>(*inputTreeReader,"TAC_CATS_HF");
+  TAC_CATS_HF_TS_= new TTreeReaderValue<ULong64_t>(*inputTreeReader,"TAC_CATS_HFTS");
+  
+  TAC_CATS_EXOGAM_= new TTreeReaderValue<UShort_t>(*inputTreeReader,"TAC_CATS_EXOGAM");
+  TAC_CATS_EXOGAM_TS_= new TTreeReaderValue<ULong64_t>(*inputTreeReader,"TAC_CATS_EXOGAMTS");
+  
+  TAC_MMG_CATS2_= new TTreeReaderValue<UShort_t>(*inputTreeReader,"TAC_MMG_CATS2");
+  TAC_MMG_CATS2_TS_= new TTreeReaderValue<ULong64_t>(*inputTreeReader,"TAC_MMG_CATS2TS");
+  
+  TAC_MMG_CATS1_= new TTreeReaderValue<UShort_t>(*inputTreeReader,"TAC_MMG_CATS1");
+  TAC_MMG_CATS1_TS_= new TTreeReaderValue<ULong64_t>(*inputTreeReader,"TAC_MMG_CATS1TS");
+  
+  TAC_MMG_EXOGAM_= new TTreeReaderValue<UShort_t>(*inputTreeReader,"TAC_MMG_EXOGAM");
+  TAC_MMG_EXOGAM_TS_= new TTreeReaderValue<ULong64_t>(*inputTreeReader,"TAC_MMG_EXOGAMTS");
+  
+  TAC_CATS1_CATS2_= new TTreeReaderValue<UShort_t>(*inputTreeReader,"TAC_CATS2_CATS1");
+  TAC_CATS1_CATS2_TS_= new TTreeReaderValue<ULong64_t>(*inputTreeReader,"TAC_CATS2_CATS1TS");
+  
+  TAC_D4_CATS1_= new TTreeReaderValue<UShort_t>(*inputTreeReader,"TAC_D4_CATS1");
+  TAC_D4_CATS1_TS_= new TTreeReaderValue<ULong64_t>(*inputTreeReader,"TAC_D4_CATS1TS");
+  
+  TAC_PL_1_= new TTreeReaderValue<UShort_t>(*inputTreeReader,"TAC_PL_1");
+  TAC_PL_1_TS_= new TTreeReaderValue<ULong64_t>(*inputTreeReader,"TAC_PL_1TS");
+  TAC_PL_2_= new TTreeReaderValue<UShort_t>(*inputTreeReader,"TAC_PL_2");
+  TAC_PL_2_TS_= new TTreeReaderValue<ULong64_t>(*inputTreeReader,"TAC_PL_2TS");
+  TAC_PL_3_= new TTreeReaderValue<UShort_t>(*inputTreeReader,"TAC_PL_3");
+  TAC_PL_3_TS_= new TTreeReaderValue<ULong64_t>(*inputTreeReader,"TAC_PL_3TS");
+  TAC_PL_4_= new TTreeReaderValue<UShort_t>(*inputTreeReader,"TAC_PL_4");
+  TAC_PL_4_TS_= new TTreeReaderValue<ULong64_t>(*inputTreeReader,"TAC_PL_4TS");
+  TAC_PL_5_= new TTreeReaderValue<UShort_t>(*inputTreeReader,"TAC_PL_5");
+  TAC_PL_5_TS_= new TTreeReaderValue<ULong64_t>(*inputTreeReader,"TAC_PL_5TS");
 }
 ////////////////////////////////////////////////////////////////////////////////
 
 void Analysis::ReInit(){
 
+  Energy.clear();
+  CsI_Energy.clear();
+  Si_E_M2 = -1000;
+  CsI_E_M2 = -1000;
   Theta_seg = -1000;
   Phi_seg = -1000;
   M2_TelescopeM= 0; 
@@ -222,6 +364,12 @@ void Analysis::ReInit(){
   M2_Ex_d.clear();
   M2_Ex_t.clear();
   M2_Ex_a.clear();
+  
+  M2_CsI_E_p.clear();
+  M2_CsI_E_d.clear();
+  M2_CsI_E_t.clear();
+  M2_CsI_E_a.clear();
+  
   M2_ECsI_from_deltaE.clear();
   //ExNoBeam=ExNoProto.clear();
   //EDC.clear();
diff --git a/Projects/E805/Analysis.h b/Projects/E805/Analysis.h
index f12284ee3..ccaa73730 100755
--- a/Projects/E805/Analysis.h
+++ b/Projects/E805/Analysis.h
@@ -91,6 +91,10 @@ class Analysis: public NPL::VAnalysis{
   std::vector<double> M2_Ex_d;
   std::vector<double> M2_Ex_t;
   std::vector<double> M2_Ex_a;
+  std::vector<double> M2_CsI_E_p;
+  std::vector<double> M2_CsI_E_d;
+  std::vector<double> M2_CsI_E_t;
+  std::vector<double> M2_CsI_E_a;
   std::vector<double> M2_ExNoBeam;
   std::vector<double> M2_ExNoProton;
   std::vector<double> M2_EDC;
@@ -185,7 +189,9 @@ class Analysis: public NPL::VAnalysis{
   unsigned long long DCRawTS[4];
   
   unsigned short PlasticRaw[10];
+  TTreeReaderArray<UShort_t>* PlasticRaw_;
   unsigned long long PlasticRawTS[10];
+  TTreeReaderArray<ULong64_t>* PlasticRaw_TS_;
   float PlasticCal[10];
   
   float PlasticEner[5];
@@ -197,43 +203,71 @@ class Analysis: public NPL::VAnalysis{
   float PlasticEner_tmp;
   
   unsigned short IC_ZDDRaw[6];
+  TTreeReaderArray<UShort_t>* IC_ZDDRaw_;
   unsigned long long IC_ZDDRawTS[6];
+  TTreeReaderArray<ULong64_t>* IC_ZDDRaw_TS_;
   float ICCal[4];
   
   unsigned short TAC_CATS_PL;
+  TTreeReaderValue<UShort_t>* TAC_CATS_PL_;
   unsigned long long TAC_CATS_PLTS;
+  TTreeReaderValue<ULong64_t>* TAC_CATS_PL_TS_;
   
   unsigned short TAC_CATS_HF;
+  TTreeReaderValue<UShort_t>* TAC_CATS_HF_;
   unsigned long long TAC_CATS_HFTS;
+  TTreeReaderValue<ULong64_t>* TAC_CATS_HF_TS_;
   
   unsigned short TAC_CATS_EXOGAM;
+  TTreeReaderValue<UShort_t>* TAC_CATS_EXOGAM_;
   unsigned long long TAC_CATS_EXOGAMTS;
+  TTreeReaderValue<ULong64_t>* TAC_CATS_EXOGAM_TS_;
   
   unsigned short TAC_MMG_CATS2;
+  TTreeReaderValue<UShort_t>* TAC_MMG_CATS2_;
   unsigned long long TAC_MMG_CATS2TS;
+  TTreeReaderValue<ULong64_t>* TAC_MMG_CATS2_TS_;
   
   unsigned short TAC_MMG_CATS1;
+  TTreeReaderValue<UShort_t>* TAC_MMG_CATS1_;
   unsigned long long TAC_MMG_CATS1TS;
+  TTreeReaderValue<ULong64_t>* TAC_MMG_CATS1_TS_;
   
   unsigned short TAC_MMG_EXOGAM;
+  TTreeReaderValue<UShort_t>* TAC_MMG_EXOGAM_;
   unsigned long long TAC_MMG_EXOGAMTS;
+  TTreeReaderValue<ULong64_t>* TAC_MMG_EXOGAM_TS_;
   
   unsigned short TAC_CATS1_CATS2;
+  TTreeReaderValue<UShort_t>* TAC_CATS1_CATS2_;
   unsigned long long TAC_CATS1_CATS2TS;
+  TTreeReaderValue<ULong64_t>* TAC_CATS1_CATS2_TS_;
   
   unsigned short TAC_D4_CATS1;
+  TTreeReaderValue<UShort_t>* TAC_D4_CATS1_;
   unsigned long long TAC_D4_CATS1TS;
+  TTreeReaderValue<ULong64_t>* TAC_D4_CATS1_TS_;
   
   unsigned short TAC_PL_1;
+  TTreeReaderValue<UShort_t>* TAC_PL_1_;
   unsigned long long TAC_PL_1TS;
+  TTreeReaderValue<ULong64_t>* TAC_PL_1_TS_;
   unsigned short TAC_PL_2;
+  TTreeReaderValue<UShort_t>* TAC_PL_2_;
   unsigned long long TAC_PL_2TS;
+  TTreeReaderValue<ULong64_t>* TAC_PL_2_TS_;
   unsigned short TAC_PL_3;
+  TTreeReaderValue<UShort_t>* TAC_PL_3_;
   unsigned long long TAC_PL_3TS;
+  TTreeReaderValue<ULong64_t>* TAC_PL_3_TS_;
   unsigned short TAC_PL_4;
+  TTreeReaderValue<UShort_t>* TAC_PL_4_;
   unsigned long long TAC_PL_4TS;
+  TTreeReaderValue<ULong64_t>* TAC_PL_4_TS_;
   unsigned short TAC_PL_5;
+  TTreeReaderValue<UShort_t>* TAC_PL_5_;
   unsigned long long TAC_PL_5TS;
+  TTreeReaderValue<ULong64_t>* TAC_PL_5_TS_;
   
   double xtarget;
   double ytarget;
@@ -246,6 +280,7 @@ class Analysis: public NPL::VAnalysis{
   double CsI_E_M2  ;
   std::vector<string> ParticleType{"proton","deuteron","triton","alpha"};
   std::map<TString, double> Energy ;
+  std::map<TString, double> CsI_Energy ;
   double BeamEnergy;
   double ThetaGDSurface ;
   
diff --git a/Projects/E805/DetectorConfiguration/MUST2_E805.detector b/Projects/E805/DetectorConfiguration/MUST2_E805.detector
index f00244eb4..a1ab2b27b 100644
--- a/Projects/E805/DetectorConfiguration/MUST2_E805.detector
+++ b/Projects/E805/DetectorConfiguration/MUST2_E805.detector
@@ -51,3 +51,25 @@ M2Telescope
  SILI= 0		
  CSI= 1		
  VIS= all  
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+CATSDetector
+ CATSNumber = 1
+ X1_Y1= 43.16  -42.26  -1587.1 mm
+ X28_Y1= -27.96  -42.26  -1587.1 mm
+ X1_Y28= 43.16  28.86  -1587.1 mm
+ X28_Y28= -27.96 28.86  -1587.1 mm
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+CATSDetector
+ CATSNumber = 2
+ X1_Y1= 33.66    -37.06   -1090.1 mm
+ X28_Y1= -37.46  -37.06   -1090.1 mm
+ X1_Y28= 33.66    34.06  -1090.1 mm 
+ X28_Y28= -37.46  34.06   -1090.1 mm
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+MASK
+ MaskNumber = 1
+ Z = -1732.1
+MASK
+ MaskNumber = 2
+ Z = -1235.1
-- 
GitLab