From 4385d584cfb9689f881b720554f7ff9a927fd6ba Mon Sep 17 00:00:00 2001 From: "theodore.efremov" <theodore.efremov@cea.fr> Date: Thu, 19 Dec 2024 16:29:26 +0100 Subject: [PATCH] Creation of link function between peaks --- .../macro/chio/XYCalibration/CutAutoDEE.C | 32 ++++++++++++++++--- 1 file changed, 28 insertions(+), 4 deletions(-) diff --git a/Projects/AlPhaPha/2024/macro/chio/XYCalibration/CutAutoDEE.C b/Projects/AlPhaPha/2024/macro/chio/XYCalibration/CutAutoDEE.C index 9c7f11b3a..1f71626af 100644 --- a/Projects/AlPhaPha/2024/macro/chio/XYCalibration/CutAutoDEE.C +++ b/Projects/AlPhaPha/2024/macro/chio/XYCalibration/CutAutoDEE.C @@ -65,13 +65,13 @@ void PeakFinder(vector<TSpectrum*> *sPeak , vector<int> *vPeak, TH2F *h, vector< for(int peaks = 0 ; peaks < nPeaks ; peaks++){ vector<Double_t> Position(2); Position.at(0) = (double(i) - double(step)/2.0) * h->GetXaxis()->GetBinWidth(4) ; //Retrieve E position - Position.at(1) = *PeakFinder->GetPositionX(); + Position.at(1) = PeakFinder->GetPositionX()[peaks]; LinePos->push_back(Position); } //Test - if (true && iter ==58){ + if (true && iter ==90){ // Draw the histogram TCanvas* c = new TCanvas(Form("c%d",i), Form("Histogram with Peaks%d",i), 800, 600); projY->Draw(); @@ -88,7 +88,7 @@ vector<vector<vector<Double_t>>> PeakLinker(vector<vector<Double_t>> *LinePos){ //Retrieve position of peaks for (int ipeak; ipeak<LinePos->size() ; ipeak ++){ X.push_back(LinePos->at(ipeak).at(0)); - Y.push_back(LinePos->at(ipeak).at(1)); + Y.push_back(LinePos->at(ipeak).at(1)); } // Start from the lowest position in Y @@ -104,7 +104,31 @@ vector<vector<vector<Double_t>>> PeakLinker(vector<vector<Double_t>> *LinePos){ //To do so we will get the peaks from the same X and get their distance in Y //This will be our threshold - } + //Create a sub set of data with only same X + vector<Double_t> YSub; + for (int index= 0 ; index < Y.size() ; index ++){ + if (X.at(index) == X.at(indexMin)){ + YSub.push_back(Y.at(index)); + + } + } + + for (int index=0 ; index < YSub.size(); index++){ + cout << " Ysub " << YSub.at(index) << endl; + } + //Sort the vec + sort(YSub.begin(),YSub.end()); + + Double_t Threshold = YSub.at(10) - YSub.at(9) ; + //cout << YSub.at(0) << " " << Y.at(indexMin) << endl; //it works + + + + for (int Point ; Point < Y.size() ; Point ++){ + // We will start with the first point + // We need to store all point that are linked together + } + } //end min Y return Res; } -- GitLab