Skip to content
Snippets Groups Projects
Commit 93228dc6 authored by Theodore Efremov's avatar Theodore Efremov :hibiscus:
Browse files

[AlPhaPha] added checking gamma macro

parent ac45fb5c
No related branches found
No related tags found
No related merge requests found
Pipeline #395694 passed
#include <TCanvas.h>
#include <TChain.h>
#include <TFile.h>
#include <TH2.h>
#include <TStyle.h>
#include <chrono>
#include <iostream>
using namespace std;
void ExogamGamma(){
//===========================================================================================================
// Load Run & var
//===========================================================================================================
TChain *chain = new TChain("PhysicsTree");
chain->Add("../../../root/analysis/Run245.root");
chain->Add("../../../root/analysis/Run246.root");
chain->Add("../../../root/analysis/Run247.root");
chain->Add("../../../root/analysis/Run248.root");
chain->Add("../../../root/analysis/Run249.root");
chain->Add("../../../root/analysis/Run250.root");
chain->Add("../../../root/analysis/Run251.root");
chain->Add("../../../root/analysis/Run252.root");
double FF_Mass13, FF_Z, Exo_EDC_vamos;
int FPMW_Section;
chain->SetBranchStatus("Exo_EDC_vamos","true");
chain->SetBranchAddress("Exo_EDC_vamos",&Exo_EDC_vamos);
chain->SetBranchStatus("FPMW_Section","true");
chain->SetBranchAddress("FPMW_Section",&FPMW_Section);
chain->SetBranchStatus("FF_Z","true");
chain->SetBranchAddress("FF_Z",&FF_Z);
chain->SetBranchStatus("FF_Mass13","true");
chain->SetBranchAddress("FF_Mass13",&FF_Mass13);
TH2F *hGammaZr100 = new TH2F("hGammaZr100","hGammaZr100",20,0,20,1000,0,1000);
TH2F *hGammaZr98 = new TH2F("hGammaZr98","hGammaZr98",20,0,20,1000,0,1000);
TH2F *hGammaRu106 = new TH2F("hGammaRu106","hGammaRu106",20,0,20,1000,0,1000);
TH2F *hGammaRu108 = new TH2F("hGammaRu108","hGammaRu108",20,0,20,1000,0,1000);
//===========================================================================================================
// Event Loop
//===========================================================================================================
int Nentries = chain->GetEntries();
//int Nentries = 2000000;
auto start = chrono::high_resolution_clock::now();
for (int e = 0; e < Nentries; e++) {
if (e % 100000 == 0 && e > 0 ) {
auto now = chrono::high_resolution_clock::now();
chrono::duration<double> elapsed = now - start;
double avgTimePerIteration = elapsed.count() / e;
double timeLeft = avgTimePerIteration * (Nentries - e);
cout << "********** Estimated time left: " << int(timeLeft) << " seconds **********" << "\r" << flush;
}
chain->GetEntry(e);
auto Zr100 = (abs(FF_Z-40)<0.5 && abs(FF_Mass13-100)<0.5);
auto Zr98 = (abs(FF_Z-40)<0.5 && abs(FF_Mass13-98)<0.5);
auto Ru106 = (abs(FF_Z-44)<0.5 && abs(FF_Mass13-106)<0.5);
auto Ru108 = (abs(FF_Z-44)<0.5 && abs(FF_Mass13-108)<0.5);
if(Zr100){ hGammaZr100->Fill(FPMW_Section,Exo_EDC_vamos); }
if(Zr98) { hGammaZr98->Fill(FPMW_Section,Exo_EDC_vamos); }
if(Ru106){ hGammaRu106->Fill(FPMW_Section,Exo_EDC_vamos); }
if(Ru108){ hGammaRu108->Fill(FPMW_Section,Exo_EDC_vamos); }
}
//===========================================================================================================
// PLOT
//===========================================================================================================
gStyle->SetPalette(kRainBow);
TCanvas *c = new TCanvas("c","c",1000,1000);
c->Divide(2,2);
c->cd(1);
hGammaZr100->GetXaxis()->SetTitle("MW section");
hGammaZr100->GetYaxis()->SetTitle("E gamma");
hGammaZr100->Draw("colz");
c->cd(2);
hGammaZr98->GetXaxis()->SetTitle("MW section");
hGammaZr98->GetYaxis()->SetTitle("E gamma");
hGammaZr98->Draw("colz");
c->cd(3);
hGammaRu108->GetXaxis()->SetTitle("MW section");
hGammaRu108->GetYaxis()->SetTitle("E gamma");
hGammaRu108->Draw("colz");
c->cd(4);
hGammaRu106->GetXaxis()->SetTitle("MW section");
hGammaRu106->GetYaxis()->SetTitle("E gamma");
hGammaRu106->Draw("colz");
TFile *f = new TFile("Output/HistoGamma.root","recreate");
hGammaZr98->Write();
hGammaRu106->Write();
hGammaRu108->Write();
hGammaZr100->Write();
}
# Output
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment