Is it possible to extract peak gamma photon count and show it on the terminal?


please guide me.

Hi,

If you mean looping over the bins and printing the central value of the bin with most entries, yes it should be very easy: did you try to do so?

Cheers,
D

Sir, I got The X-axis value. How do I get the y-axis value?
‘’’
root [10] tree->Draw(“crystal_edep_score”, “crystal_edep_cell == 5”);
root [11] TFile *file = TFile::Open(“scoring.root”);
root [12] TTree tree = (TTree)file->Get(“crystal_edep”);
root [13] tree->Draw(“crystal_edep_score>>hist(100)”);
Info in TCanvas::MakeDefCanvas: created default TCanvas with name c1
root [14] TH1F hist = (TH1F)gDirectory->Get(“hist”);
root [15] Int_t maxBin = hist->GetMaximumBin();
root [16] Double_t maxBinCenter = hist->GetBinCenter(maxBin);
root [17] std::cout << "The central value of the bin with the most entries is: " << maxBinCenter << std::endl;
The central value of the bin with the most entries is: 0.6588
root [18]
‘’’

Thank you So much, @Danilo Sir. It’s Working now.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.