#include #include #include #include #include #include #include "TH1.h" #include "TH2.h" #include "TFile.h" #include "TBranch.h" #include "TTree.h" #include "TCanvas.h" #include "TF1.h" #include "TGraph.h" #include "TGraphQQ.h" #include "TCanvas.h" #include "TStyle.h" #include "TMath.h" int main() { int n = 51; int n2 = 11; TTree * TreeM; TBranch * Ener; string file_name1 = "ExN02_"; string file_name2 = "keV.root"; int energy = 500; TFile * graphs = new TFile("graphs.root", "RECREATE"); for(int j = 0; jGet("TreeM"); counts[i] = TreeM->GetEntries("(sqrt((X-18)*(X-18)+Z*Z) < 0.4) && PID==11"); energy_arr[i] = energy2; file->Close(); energy2 = energy2 + 2; } TGraph *grph = new TGraph(n,energy_arr,counts); grph->GetYaxis()->SetTitle("Counts"); grph->GetXaxis()->SetTitle("Kinetic Energy for B-field [keV]"); grph->SetMarkerStyle(21); grph->SetMarkerColor(2); grph->SetMarkerSize(.5); grph->Write(); energy = energy + 10; } graphs->Close(); return 0; }