Consider the attached histogram. How would one go about normalising the Y-axis into yield%. I guess I want to divide the data points on Y-axis by the total number of counts (entries). But is there a way to do it in ROOT?

{
// warning: due to a long-standing known bug in ROOT 6, all variables
// need to be defined right in the beginning of an "unnamed macro"
TFile *f;
TTree *t;
TH1D *h;
Double_t integral;
f = TFile::Open("myFile.root");
if ((!f) || f->IsZombie()) {delete f; return;} // just a precaution
f->GetObject("myTree", t);
if (!t) {delete f; return;} // just a precaution
gROOT->cd(); // all newly created histograms should be placed here
h = new TH1D("h", "number of particles;n;yield [%]", 110, 0., 55.);
h->Sumw2(kTRUE);
t->Project("h", "nParticles");
delete f; // no longer needed (automatically deletes "t", too)
integral = h->Integral();
if (integral != 0) h->Scale(100. / integral); // "normalize" to 100
h->Draw();
}

If you donâ€™t mind, I have one more question. If you want to rescale Y-axis to a certain value, how would you approach that? For instance, I want to know the percentage of every mass number (0-55). Mathematically, it should be: