#include "TFile.h" #include "TCanvas.h" #include "TStyle.h" #include "TH1.h" #include "TH2.h" #include "TH3.h" #include "TGaxis.h" #include "TRandom.h" #include "TLegend.h" #include "TPaveStats.h" #include "TGraph.h" #include "TSystem.h" #include "TTree.h" #include "TTreePlayer.h" #include "TF1.h" #include "TCut.h" #include "TPaletteAxis.h" #include "stdio.h" #include "stdlib.h" #include "string.h" #include "TLatex.h" void depenetxt() { double DepEne; //Released energy int entry=1; gSystem->mkdir(TString::Format("simulazione" ), kTRUE); TGaxis::SetMaxDigits(3); FILE * infile=fopen("B1/B1-build/DepositedEnergyData.txt", "r"); if(infile==NULL) { printf("Error opening file"); exit(1); } TCanvas *c0 = new TCanvas("c0","c0",1280,1024); //c0->SetRightMargin(0.21); int num=57; c0->SetLogy(); TH1F *hysto = new TH1F("hysto","DepositedEnergy",2500,0.,2500); // while( fscanf(infile,"%lf",&DepEne)==1) { // std::cout << "entry = " << entry << "\t Dep Ene = " << DepEne << std::endl; entry=entry+1; hysto->Fill(DepEne); } hysto->SetTitle(""); gStyle->SetTitleFontSize(0.08); hysto->GetXaxis()->SetTitle("Energy (keV)"); hysto->GetYaxis()->SetTitle("Counts"); hysto->GetYaxis()->SetTitleSize(40); hysto->GetYaxis()->SetTitleFont(43); hysto->GetYaxis()->SetTitleOffset(1); hysto->GetYaxis()->SetLabelFont(43); hysto->GetYaxis()->SetLabelSize(40); hysto->GetXaxis()->SetTitleSize(40); hysto->GetXaxis()->SetTitleFont(43); hysto->GetXaxis()->SetTitleOffset(1.1); hysto->GetXaxis()->SetLabelFont(43); hysto->GetXaxis()->SetLabelSize(40); // hysto->SetMinimum(1.e-1); //hysto->SetMaximum(1.e2); hysto->SetStats(0); hysto->Draw(""); gPad->Update(); gPad->Update(); /*TPaveStats *statshysto = (TPaveStats*)hysto->GetListOfFunctions()->FindObject("stats"); statshysto->SetTextColor(kBlue); statshysto->SetX1NDC(0.70); statshysto->SetX2NDC(0.85); statshysto->SetY1NDC(0.825); statshysto->SetY2NDC(0.975); statshysto->Draw();*/ gPad->Update(); c0->Print("simulazione/DepositedEnergytxt.png"); }