From 003e8f78c2fb9d111ca6efc2594eca0dbdfbe9fc Mon Sep 17 00:00:00 2001
From: "theodore.efremov" <theodore.efremov@cea.fr>
Date: Thu, 7 Nov 2024 16:34:07 +0100
Subject: [PATCH] Test for de_e with p2p

---
 .../2024/macro/chio/CalibrationChio/ICCorr.C  | 19 ++++++++-----------
 .../chio/CalibrationChio/SplineChioP2P.C      | 16 ++++++++--------
 2 files changed, 16 insertions(+), 19 deletions(-)

diff --git a/Projects/AlPhaPha/2024/macro/chio/CalibrationChio/ICCorr.C b/Projects/AlPhaPha/2024/macro/chio/CalibrationChio/ICCorr.C
index 6aa528b6f..7497d41b1 100644
--- a/Projects/AlPhaPha/2024/macro/chio/CalibrationChio/ICCorr.C
+++ b/Projects/AlPhaPha/2024/macro/chio/CalibrationChio/ICCorr.C
@@ -44,7 +44,7 @@ void ICCorr() {
 
 
   // Filling the input histo 
-  int NSegment = 11 ;
+  int NSegment = 5 ;
   vector<TH2F*> hICseg_ICprev, hICX,hICY ,hICseg_ICprevX,hICseg_ICprevY, hICcorr;
   for(int seg=0; seg<NSegment; seg++){
     
@@ -84,10 +84,9 @@ void ICCorr() {
 	for (int i = 0; i < SplineCount  ; i++) {
 		int seg = int((i-2)/2 +1 );
 
-		cout << " i "  <<  i <<  " seg  "<< seg << endl;
-		if (i < 2){ 
-			spline_X.at(0) = (TSpline3 *)fSpline->Get("fspline_IC1/IC0_X");
-			spline_Y.at(0) = (TSpline3 *)fSpline->Get("fspline_IC1/IC0_Y");
+		if (i < 2){
+			spline_X.at(0) = (TSpline3 *)fSpline->Get("fspline_IC1_IC0_X");
+			spline_Y.at(0) = (TSpline3 *)fSpline->Get("fspline_IC1_IC0_Y");
 		}
 
 		else if ( i>=2 && i<4){ 
@@ -95,13 +94,12 @@ void ICCorr() {
 			spline_Y.at(1) = (TSpline3 *)fSpline->Get("fsplineIC1_Y");
 		}
 		else if (seg >=2 && (i%2 == 0) ) {
-			spline_X.at(seg) = (TSpline3 *)fSpline->Get(Form("fspline_IC%d/IC%d_X",seg,seg-1));
+			spline_X.at(seg) = (TSpline3 *)fSpline->Get(Form("fspline_IC%d_IC%d_X",seg,seg-1));
 		}
 		else if (seg >=2 && !(i%2 == 0) ) {	
-			spline_Y.at(seg) = (TSpline3 *)fSpline->Get(Form("fspline_IC%d/IC%d_Y",seg,seg-1));
+			spline_Y.at(seg) = (TSpline3 *)fSpline->Get(Form("fspline_IC%d_IC%d_Y",seg,seg-1));
 		}
 	} //End loop on histogram
-		cout << spline_Y[0]->Eval(3)<< endl;
 		//===========================================================================================================
 		//                                 get fit
 		//===========================================================================================================
@@ -128,7 +126,7 @@ void ICCorr() {
 		chain->GetEntry(e);
 
 
-		vector<double> ICcorr_Y(11), ICcorr_X(11); // the [0] element of spline is the
+		vector<double> ICcorr_Y(5), ICcorr_X(11); // the [0] element of spline is the
 																							 // correction on the first
 																							 // segment of ic
 		for (int seg = 0; seg < ICcorr_Y.size()  ; seg++) {
@@ -142,7 +140,6 @@ void ICCorr() {
 				//cout << ICcorr_Y.at(0) << "  " << IC->fIC_raw[0]<< endl;
 			}
 			else if (seg > 1) {
-				cout << "bug " <<seg << endl;
 				double temp =  IC->fIC_raw[seg]/ICcorr_Y.at(seg-1) * spline_Y.at(seg)->Eval(0)/ spline_Y.at(seg)->Eval(FF_IC_Y);
 				ICcorr_Y.at(seg) = ICcorr_Y.at(seg-1) * temp;
 			}
@@ -159,7 +156,7 @@ void ICCorr() {
 		for (int seg = 0 ;  seg < sizeof(IC->fIC_raw)/sizeof(IC->fIC_raw[0]) ; seg++ ){
 			if (seg >4){
 				E += IC->fIC_raw[seg] ;
-				Ecorr += ICcorr_Y.at(seg) ;
+				//Ecorr += ICcorr_Y.at(seg) ;
 			}
 		}
 
diff --git a/Projects/AlPhaPha/2024/macro/chio/CalibrationChio/SplineChioP2P.C b/Projects/AlPhaPha/2024/macro/chio/CalibrationChio/SplineChioP2P.C
index e1be9a258..6cb779075 100644
--- a/Projects/AlPhaPha/2024/macro/chio/CalibrationChio/SplineChioP2P.C
+++ b/Projects/AlPhaPha/2024/macro/chio/CalibrationChio/SplineChioP2P.C
@@ -70,14 +70,14 @@ void SplineChioP2P() {
 
       // X Spline
       SplineICurrent.push_back(MakeSpline(hIC[seg][0] , NCallSpline, XMin[2] , XMax[2], YMin[2], YMax[2]));
-      if (seg == 0)  SplineICurrent.at(0)->SetName(Form("fspline_IC%d/IC%d_X",seg+1,seg));
-      else if (seg != 0) SplineICurrent.at(0)->SetName(Form("fspline_IC%d/IC%d_X",seg,seg-1));
+      if (seg == 0)  SplineICurrent.at(0)->SetName(Form("fspline_IC%d_IC%d_X",seg+1,seg));
+      else if (seg != 0) SplineICurrent.at(0)->SetName(Form("fspline_IC%d_IC%d_X",seg,seg-1));
       NCallSpline+=1;
 
       // Y Spline
       SplineICurrent.push_back(MakeSpline(hIC[seg][1] , NCallSpline, XMin[3] , XMax[3], YMin[3], YMax[3]));
-      if (seg == 0)  SplineICurrent.at(1)->SetName(Form("fspline_IC%d/IC%d_Y",seg+1,seg));
-      else if (seg != 0)SplineICurrent.at(1)->SetName(Form("fspline_IC%d/IC%d_Y",seg,seg-1));
+      if (seg == 0)  SplineICurrent.at(1)->SetName(Form("fspline_IC%d_IC%d_Y",seg+1,seg));
+      else if (seg != 0)SplineICurrent.at(1)->SetName(Form("fspline_IC%d_IC%d_Y",seg,seg-1));
       NCallSpline+=1;
 
       //push vector into memory
@@ -177,8 +177,8 @@ vector<TH2F*> HistoFillerIC(int segment, vector<vector<TSpline3*>> Spline_All_IC
   //																	Beginning loop on entries
   //===========================================================================================================
 
-  // int Nentries = chain->GetEntries();
-  int Nentries = 100000;
+   int Nentries = chain->GetEntries();
+  //int Nentries = 100000;
   auto start = std::chrono::high_resolution_clock::now();
   for (int e = 0; e < Nentries; e++) {
 
@@ -318,8 +318,8 @@ vector<vector<TH2F*>>HistoFillerICcorr(int segment, vector<vector<TSpline3*>> Sp
   //																	Beginning loop on entries
   //===========================================================================================================
 
-  // int Nentries = chain->GetEntries();
-  int Nentries = 100000;
+   int Nentries = chain->GetEntries();
+  //int Nentries = 100000;
   auto start = std::chrono::high_resolution_clock::now();
   for (int e = 0; e < Nentries; e++) {
 
-- 
GitLab