From 4da9a82446ae669921f3c908c1d76c7d6af6a898 Mon Sep 17 00:00:00 2001 From: Morfouace <pierre.morfouace@cea.fr> Date: Sun, 11 Sep 2022 17:52:23 -0600 Subject: [PATCH] Updating Vendeta analysis and macro --- Projects/Vendeta/Analysis.cxx | 5 +- Projects/Vendeta/RunToTreat.txt | 10 +- Projects/Vendeta/macro/FillTOFHisto.C | 6 +- Projects/Vendeta/macro/FitTofGammaPeak.C | 26 +-- .../macro/PhysicsSpectra/FillFCSpectra.C | 202 +++++++++--------- .../macro/RawSpectra/FillRawFCSpectra.C | 2 +- .../Vendeta/macro/RawSpectra/FillRawPSD.C | 9 +- 7 files changed, 129 insertions(+), 131 deletions(-) diff --git a/Projects/Vendeta/Analysis.cxx b/Projects/Vendeta/Analysis.cxx index 4327cc51d..8acfff0d4 100644 --- a/Projects/Vendeta/Analysis.cxx +++ b/Projects/Vendeta/Analysis.cxx @@ -59,7 +59,10 @@ void Analysis::TreatEvent(){ //double GammaOffset[11] = {969.58, 969.11, 975.03, 974.75, 978.90, 978.16, 967.34, 977.2, 981.14, 983.04, 982.32}; // Run 59++ - double GammaOffset[11] = {969.28, 968.81, 987.43, 974.45, 994.30, 977.86, 980.25, 986.97, 996.30, 998.58, 997.12}; + // double GammaOffset[11] = {969.28, 968.81, 987.43, 974.45, 994.30, 977.86, 980.25, 986.97, 996.30, 998.58, 997.12}; + + //Run 85+- + double GammaOffset[11] = {981.25, 980.88, 988.35, 978.45, 997.40, 982.01, 992.7, 995.18, 995.27, 997.45, 993.0}; double incomingDT=0; diff --git a/Projects/Vendeta/RunToTreat.txt b/Projects/Vendeta/RunToTreat.txt index 123dcdd54..49d91dcdc 100644 --- a/Projects/Vendeta/RunToTreat.txt +++ b/Projects/Vendeta/RunToTreat.txt @@ -1,13 +1,5 @@ TTreeName RawTree RootFileName - /home/faster/fastertonptool/data/rootfiles/run61_*.root + /home/faster/fastertonptool/data/rootfiles/run86_*.root - %/home/faster/fastertonptool/data/rootfiles/u238_carbon_1.root - %/home/faster/fastertonptool/data/rootfiles/u238_carbon_2.root - %/home/faster/fastertonptool/data/rootfiles/u238_carbon_3.root - %/home/faster/fastertonptool/data/rootfiles/u238_carbon_2_1.root - %/home/faster/fastertonptool/data/rootfiles/u238_carbon_2_2.root - %/home/faster/fastertonptool/data/rootfiles/test_sampler_qdc_cf_2.root - %/home/faster/fastertonptool/data/rootfiles/test_sampler_qdc_cf_3.root - %/home/faster/fastertonptool/data/rootfiles/test_sampler_qdc_cf_4.root diff --git a/Projects/Vendeta/macro/FillTOFHisto.C b/Projects/Vendeta/macro/FillTOFHisto.C index 46d58177a..558383cc7 100644 --- a/Projects/Vendeta/macro/FillTOFHisto.C +++ b/Projects/Vendeta/macro/FillTOFHisto.C @@ -3,7 +3,7 @@ TChain* chain; int NumberOfDetectors= 72; int NumberOfAnodes= 11; int nentries=1e6; -int run=59; +int run=86; ///////////////////////////////////// void LoadRootFile(){ chain = new TChain("PhysicsTree"); @@ -68,7 +68,7 @@ void FillTOFHisto(){ chain->GetEntry(i); if(i%100000==0){ - cout << "\033[34m\r Processing tree..." << (double)i/nentries*100 << "\% done" << flush; + cout << setprecision(2) << "\033[34m\r Processing tree..." << (double)i/nentries*100 << "\% done" << flush; } if(FC_Anode_ID->size()>0){ @@ -81,7 +81,7 @@ void FillTOFHisto(){ // LG // int index_LG = (anode-1) + (LG_ID->at(j)-1)*NumberOfAnodes; double PSD = LG_Q2->at(j)/LG_Q1->at(j); - if(LG_ID->at(j)>0 && anode>0 && Fake==0){ + if(LG_ID->at(j)>0 && anode>0 && Fake==0 && LG_Q1->at(j)>2000){ hLG[index_LG]->Fill(LG_Tof->at(j)); } } diff --git a/Projects/Vendeta/macro/FitTofGammaPeak.C b/Projects/Vendeta/macro/FitTofGammaPeak.C index 16633c675..62d4967ac 100644 --- a/Projects/Vendeta/macro/FitTofGammaPeak.C +++ b/Projects/Vendeta/macro/FitTofGammaPeak.C @@ -3,9 +3,11 @@ TFile* ifile; int NumberOfDetectors=72; int NumberOfAnodes=11; int m_NumberOfGammaPeak=1; -int run=59; +int run=86; double PosGammaPeak = 3.2; +double sigma_anode[11]; + bool Finder(TH1F* h, Double_t *mean, Double_t *sigma); ///////////////////////////////////////////////////// @@ -25,16 +27,9 @@ void FitTofGammaPeak(){ TFile* orootfile = new TFile(Form("histo_tof_fitted_run%i.root",run),"recreate"); - /*for(int i=0; i<11; i++){ - TString canvas_name = Form("LG_Anode%i",i+1); - cLG[i] = new TCanvas(canvas_name,canvas_name,1800,1800); - cLG[i]->Divide(10,8); - - canvas_name = Form("HG_Anode%i",i+1); - cHG[i] = new TCanvas(canvas_name,canvas_name,1800,1800); - cHG[i]->Divide(10,8); - - }*/ + for(int i=0; i<NumberOfAnodes; i++){ + sigma_anode[i]=0; + } Double_t* mean = new Double_t[1]; Double_t* sigma = new Double_t[1]; @@ -58,6 +53,9 @@ void FitTofGammaPeak(){ if(Finder(h, mean, sigma)){ ofile << LG_token << " " << -mean[0]+PosGammaPeak << endl; gSigma_LG->SetPoint(countLG,countLG+1,sigma[0]); + + sigma_anode[j] += sigma[0]; + countLG++; h->Write(); } @@ -107,6 +105,10 @@ void FitTofGammaPeak(){ orootfile->Write(); orootfile->Close(); + for(int i=0; i<NumberOfAnodes; i++){ + cout << "Anode= " << i+1 << " / " << sigma_anode[i]/NumberOfDetectors << endl; + } + } @@ -141,6 +143,4 @@ bool Finder(TH1F* h, Double_t *mean, Double_t *sigma){ cout << "Warning. Number of peak different of " << m_NumberOfGammaPeak << " !! / nfound = " << nfound << endl; return false; } - - } diff --git a/Projects/Vendeta/macro/PhysicsSpectra/FillFCSpectra.C b/Projects/Vendeta/macro/PhysicsSpectra/FillFCSpectra.C index c29dd663c..9bbf02f7c 100644 --- a/Projects/Vendeta/macro/PhysicsSpectra/FillFCSpectra.C +++ b/Projects/Vendeta/macro/PhysicsSpectra/FillFCSpectra.C @@ -2,7 +2,7 @@ TChain* chain; int NumberOfAnodes= 11; int nentries=1e6; -int run= 61; +int run= 86; TH1F* hQ1[11]; TH1F* hQ2[11]; @@ -19,109 +19,111 @@ TH2F* hQ1_Anode; ///////////////////////////////////// void LoadRootFile(){ - chain = new TChain("PhysicsTree"); - chain->Add(Form("/home/faster/nptool/Outputs/Analysis/run%i.root",run)); + chain = new TChain("PhysicsTree"); + chain->Add(Form("/home/faster/nptool/Outputs/Analysis/run%i.root",run)); } ///////////////////////////////////// void FillFCSpectra(){ - LoadRootFile(); - nentries = chain->GetEntries(); - cout << "Number of entries: " << nentries << endl; - - TFile* ofile = new TFile(Form("histo_FC_run%i.root",run),"recreate"); - TH1F* hLG[791]; - TH1F* hHG[791]; - - - vector<double>* inToF = new vector<double>(); - vector<double>* inEnergy = new vector<double>(); - vector<double>* FC_Q1 = new vector<double>(); - vector<double>* FC_Q2 = new vector<double>(); - vector<double>* FC_Qmax = new vector<double>(); - vector<double>* FC_DT = new vector<double>(); - vector<int>* FC_Anode_ID = new vector<int>(); - vector<bool>* FC_FakeFission = new vector<bool>(); - - TFissionChamberPhysics* FC = new TFissionChamberPhysics(); - chain->SetBranchAddress("FissionChamber",&FC); - - chain->SetBranchAddress("inToF",&inToF); - chain->SetBranchAddress("inEnergy",&inEnergy); - chain->SetBranchAddress("FC_Q1",&FC_Q1); - chain->SetBranchAddress("FC_Q2",&FC_Q2); - chain->SetBranchAddress("FC_Qmax",&FC_Qmax); - chain->SetBranchAddress("FC_DT",&FC_DT); - chain->SetBranchAddress("FC_Anode_ID",&FC_Anode_ID); - chain->SetBranchAddress("FC_FakeFission",&FC_FakeFission); - - hinE = new TH1F("Incoming Energy","Incoming Energy",1000,0.5,10); - hinTof = new TH1F("Incoming Tof","Incoming Tof",14400,0,1800); - hinE_Anode = new TH2F("Incoming Energy per anode","Incoming Energy per anode",11,1,12,1000,0.5,10); - hinTof_Anode = new TH2F("Incoming Tof per anode","Incoming Tof per anode",11,1,12,14400,0,1800); - hQ1_Anode = new TH2F("Fission chamber total charge per anode","Fission chamber total charge per anode",11,1,12,500,0,100e3); - - for(int i=0; i<NumberOfAnodes; i++){ - TString histo_name = Form("Q1_Anode%i",i+1); - hQ1[i] = new TH1F(histo_name,histo_name,500,0,100e3); - - histo_name = Form("Q2_Anode%i",i+1); - hQ2[i] = new TH1F(histo_name,histo_name,500,0,20e3); - - histo_name = Form("Qmax_Anode%i",i+1); - hQmax[i] = new TH1F(histo_name,histo_name,500,0,10e3); - - histo_name = Form("Q2vsQ1_Anode%i",i+1); - hQ2vsQ1[i] = new TH2F(histo_name,histo_name,500,0,100e3,500,0,20e3); - - histo_name = Form("QmaxvsQ1_Anode%i",i+1); - hQmaxvsQ1[i] = new TH2F(histo_name,histo_name,500,0,100e3,500,0,10e3); - - histo_name = Form("hinTof_Q1_%d",i+1); - hinTof_Q1[i] = new TH2F(histo_name,histo_name,14400,0,1800,500,0,100e3); - - histo_name = Form("hinE_Q1_%d",i+1); - hinE_Q1[i] = new TH2F(histo_name,histo_name,10000,0.5,300,500,0,100e3); - } - - for(int i=0; i<nentries; i++){ - chain->GetEntry(i); - - if(i%100000==0){ - cout << "\033[34m\r Processing tree..." << (double)i/nentries*100 << "\% done" << flush; - } - - if(inToF->size()==1){ - double inT = inToF->at(0); - double inE = inEnergy->at(0); - - int anode = FC_Anode_ID->at(0); - if(anode>0){ - double q1 = FC_Q1->at(0); - double q2 = FC_Q2->at(0); - double qmax = FC_Qmax->at(0); - double DT = FC_DT->at(0); - bool FakeFission = FC_FakeFission->at(0); - if(inT>10 && inT<1790 && FakeFission==0 && DT>7e6 /*&& q1>10e3*/){ - hQ1[anode-1]->Fill(q1); - hQ2[anode-1]->Fill(q2); - hQmax[anode-1]->Fill(qmax); - hQ2vsQ1[anode-1]->Fill(q1,q2); - hQmaxvsQ1[anode-1]->Fill(q1,qmax); - hinE->Fill(inE); - hinTof->Fill(inT); - hinE_Anode->Fill(anode,inE); - hinTof_Anode->Fill(anode,inT); - hQ1_Anode->Fill(anode,q1); - hinTof_Q1[anode-1]->Fill(inT,q1); - hinE_Q1[anode-1]->Fill(inE,q1); - } - } - } - } - - ofile->Write(); - ofile->Close(); + LoadRootFile(); + nentries = chain->GetEntries(); + cout << "Number of entries: " << nentries << endl; + + TFile* ofile = new TFile(Form("histo_FC_run%i.root",run),"recreate"); + TH1F* hLG[791]; + TH1F* hHG[791]; + + + vector<double>* inToF = new vector<double>(); + vector<double>* inEnergy = new vector<double>(); + vector<double>* FC_Q1 = new vector<double>(); + vector<double>* FC_Q2 = new vector<double>(); + vector<double>* FC_Qmax = new vector<double>(); + vector<double>* FC_DT = new vector<double>(); + vector<int>* FC_Anode_ID = new vector<int>(); + vector<bool>* FC_FakeFission = new vector<bool>(); + + TFissionChamberPhysics* FC = new TFissionChamberPhysics(); + chain->SetBranchAddress("FissionChamber",&FC); + + chain->SetBranchAddress("inToF",&inToF); + chain->SetBranchAddress("inEnergy",&inEnergy); + chain->SetBranchAddress("FC_Q1",&FC_Q1); + chain->SetBranchAddress("FC_Q2",&FC_Q2); + chain->SetBranchAddress("FC_Qmax",&FC_Qmax); + chain->SetBranchAddress("FC_DT",&FC_DT); + chain->SetBranchAddress("FC_Anode_ID",&FC_Anode_ID); + chain->SetBranchAddress("FC_FakeFission",&FC_FakeFission); + + hinE = new TH1F("Incoming Energy","Incoming Energy",1000,0.5,10); + hinTof = new TH1F("Incoming Tof","Incoming Tof",14400,0,1800); + hinE_Anode = new TH2F("Incoming Energy per anode","Incoming Energy per anode",11,1,12,1000,0.5,10); + hinTof_Anode = new TH2F("Incoming Tof per anode","Incoming Tof per anode",11,1,12,14400,0,1800); + hQ1_Anode = new TH2F("Fission chamber total charge per anode","Fission chamber total charge per anode",11,1,12,500,0,100e3); + + for(int i=0; i<NumberOfAnodes; i++){ + TString histo_name = Form("Q1_Anode%i",i+1); + hQ1[i] = new TH1F(histo_name,histo_name,500,0,100e3); + + histo_name = Form("Q2_Anode%i",i+1); + hQ2[i] = new TH1F(histo_name,histo_name,500,0,20e3); + + histo_name = Form("Qmax_Anode%i",i+1); + hQmax[i] = new TH1F(histo_name,histo_name,500,0,10e3); + + histo_name = Form("Q2vsQ1_Anode%i",i+1); + hQ2vsQ1[i] = new TH2F(histo_name,histo_name,500,0,100e3,500,0,20e3); + + histo_name = Form("QmaxvsQ1_Anode%i",i+1); + hQmaxvsQ1[i] = new TH2F(histo_name,histo_name,500,0,100e3,500,0,10e3); + + histo_name = Form("hinTof_Q1_%d",i+1); + hinTof_Q1[i] = new TH2F(histo_name,histo_name,14400,0,1800,500,0,100e3); + + histo_name = Form("hinE_Q1_%d",i+1); + hinE_Q1[i] = new TH2F(histo_name,histo_name,2000,0.5,20,500,0,100e3); + } + + for(int i=0; i<nentries; i++){ + chain->GetEntry(i); + + if(i%100000==0){ + cout << "\033[34m\r Processing tree..." << (double)i/nentries*100 << "\% done" << flush; + } + + if(inToF->size()==1){ + double inT = inToF->at(0); + double inE = inEnergy->at(0); + + int anode = FC_Anode_ID->at(0); + if(anode>0){ + double q1 = FC_Q1->at(0); + double q2 = FC_Q2->at(0); + double qmax = FC_Qmax->at(0); + double DT = FC_DT->at(0); + bool FakeFission = FC_FakeFission->at(0); + if(inT>10 && inT<1790 && FakeFission==0 && DT>7e6 /*&& q1>10e3*/){ + hQ1[anode-1]->Fill(q1); + hQ2[anode-1]->Fill(q2); + hQmax[anode-1]->Fill(qmax); + hQ2vsQ1[anode-1]->Fill(q1,q2); + hQmaxvsQ1[anode-1]->Fill(q1,qmax); + if(q1>0){ + hinE->Fill(inE); + } + hinTof->Fill(inT); + hinE_Anode->Fill(anode,inE); + hinTof_Anode->Fill(anode,inT); + hQ1_Anode->Fill(anode,q1); + hinTof_Q1[anode-1]->Fill(inT,q1); + hinE_Q1[anode-1]->Fill(inE,q1); + } + } + } + } + + ofile->Write(); + ofile->Close(); } diff --git a/Projects/Vendeta/macro/RawSpectra/FillRawFCSpectra.C b/Projects/Vendeta/macro/RawSpectra/FillRawFCSpectra.C index 949d5c2de..91c209c22 100644 --- a/Projects/Vendeta/macro/RawSpectra/FillRawFCSpectra.C +++ b/Projects/Vendeta/macro/RawSpectra/FillRawFCSpectra.C @@ -2,7 +2,7 @@ TChain* chain; int NumberOfAnodes= 11; int nentries= 1e6; -int run = 59; +int run = 85; ////////////////////////////////////////////////// void OpenRootFile(){ diff --git a/Projects/Vendeta/macro/RawSpectra/FillRawPSD.C b/Projects/Vendeta/macro/RawSpectra/FillRawPSD.C index 0501d9f19..1e5d25a60 100644 --- a/Projects/Vendeta/macro/RawSpectra/FillRawPSD.C +++ b/Projects/Vendeta/macro/RawSpectra/FillRawPSD.C @@ -2,11 +2,12 @@ TChain* chain; int NumberOfDetectors= 72; int nentries=1e6; +int run=86; ////////////////////////////////////////////////// void OpenRootFile(){ chain = new TChain("RawTree"); - chain->Add("/home/faster/fastertonptool/data/rootfiles/run59_*.root"); + chain->Add(Form("/home/faster/fastertonptool/data/rootfiles/run%i_*.root",run)); } ////////////////////////////////////////////////// @@ -15,16 +16,16 @@ void FillRawPSD(){ nentries = chain->GetEntries(); cout << "Number of entries= " << nentries << endl; - TFile* ofile = new TFile("PSD_histo_run59.root","recreate"); + TFile* ofile = new TFile(Form("PSD_histo_run%i.root",run),"recreate"); TH2F* hLG[72]; TH2F* hHG[72]; TString histo_name; for(int i=0; i<NumberOfDetectors;i++){ histo_name = Form("hLG_det%i",i+1); - hLG[i] = new TH2F(histo_name,histo_name,500,0,500e3,500,0,1.1); + hLG[i] = new TH2F(histo_name,histo_name,100,0,50e3,250,0,1.1); histo_name = Form("hHG_det%i",i+1); - hHG[i] = new TH2F(histo_name,histo_name,500,0,900e3,500,0,1.1); + hHG[i] = new TH2F(histo_name,histo_name,100,0,50e3,250,0,1.1); } TVendetaData* Vendeta = new TVendetaData(); -- GitLab