Normalizing One Histogram to Another

Good Day,

I am trying to renormalize a histogram to another. Meaning I have the “parent” histogram, then I apply a cut to this “parent” histogram to make a “daughter” histogram. Now what I want to do is see if this cut is an acceptable cut buy normalizing the “daughter” to the “parent” using the number of entries of the “parent”.

I am trying to do this all in TPostScript.
Here is a sort of code I am working with, as well as a figure to give some idea.

Thanks
MK

[code]#include
#include
#include
#include
#include
void NormMasses(){

TChain *chain = new TChain(“NTuple_omega”);

//chain->Add("/Volumes/MAC PC/Work/Omega/Analysis/Root Files/Ntuple_Omega_eta_31.root");
chain->Add("/media/disk-1/NTuples/NTupOmega/Omega_1.root");
Int_t nEvent = chain->GetEntries();

std::cout <<"Number of events " <<nEvent <<std::endl;

TPostScript *ps = new TPostScript(“Mass_Plots.ps”,112);
ps->Range(26,26);
gStyle->SetPalette(1);
TCanvas *c1 = new TCanvas(“c1”,“Blank”, 800, 650);

// picture 8
ps->NewPage();
TCanvas *c2 = new TCanvas(“c2”,“mm_P”, 800, 650);
c2->Divide(1,1);
c2->SetFillColor(0);
c2->SetBorderMode(0);

c2->cd(1);
c2->cd(1)->SetFrameFillColor(0);
c2->cd(1)->SetFrameBorderMode(0);

chain->Draw(“mm_P >> mmP(1000,0.0,2.5)”);
mmP->SetLineColor(2);

chain->Draw("mm_P ",“abs((pow(abs(dP_TOF-0.125),2)/1.5 + pow(abs(dPim_TOF-0.02),2))) < 0.08 && abs((pow(abs(dP_TOF-0.125),2)/1.5 + pow(abs(dPip_TOF-0.02),2))) < 0.08 && abs((pow(abs(dPip_TOF-0.02),2)/1.5 + pow(abs(dPim_TOF-0.02),2)/1.5)) < 0.04”,“same”);

mmP.DrawNormalized();

c2->Update();
ps->Close();

}[/code]
Mass_Plots.pdf (21.9 KB)

Could you provide your data file as attachment and give more explanations about your problem?

Rene

Thank you for replying Renee,

I have uploaded a small sample of the data.

What appears to be the problem is when I try to renormalize the “daughter” histogram to the “parent” by using

mmP -> DrawNormalize("same","Nevent of parent")

It will only draw the “daughter” histogram.

Thanks again
MK
Ntuple_Omega_1.root (786 KB)

Well I can do a scale and achieve an approximation of what I am trying to accomplish. However I still would like to know what I am doing wrong with the Normalization.

If anyone can help, please let me know.

Much Thanks
MK

I do not see anything wrong with DrawNormalized. I execute the following script:

[code]#include
#include
#include
#include
#include
void NormMasses(){

TChain *chain = new TChain(“NTuple_omega”);

chain->Add(“Ntuple_Omega_1.root”);
Int_t nEvent = chain->GetEntries();

std::cout <<"Number of events " <<nEvent <<std::endl;

TCanvas *c2 = new TCanvas(“c2”,“mm_P”, 800, 650);

chain->Draw(“mm_P >> mmP(1000,0.0,2.5)”);
TH1 mmP = (TH1)gDirectory->Get(“mmP”);
mmP->SetLineColor(2);

chain->Draw("mm_P ",“abs((pow(abs(dP_TOF-0.125),2)/1.5 + pow(abs(dPim_TOF-0.02),2))) < 0.08 && abs((pow(abs(dP_TOF-0.125),2)/1.5 + pow(abs(dPip_TOF-0.02),2))) < 0.08 && abs((pow(abs(dPip_TOF-0.02),2)/1.5 + pow(abs(dPim_TOF-0.02),2)/1.5)) < 0.04”,“same”);

mmP->DrawNormalized();
}
[/code]

Rene