About TH2F Histogram

Dear Rooters,

I would like to plot eta versus phi histogram after PYTHIA run. For this reason I write followig lines. But unfortunately it can not be worked. It gives “bad numerical expression” error. When I try to plot eta or phi histogram seperetaly with using these expressions I can get the correct histograms. I don’t know what is the reason which I could not use these two formula together.

I would be grateful if you could help me to solve this problem.

Thank you very much and kind regards.

TH2F* EtaPhi = new TH2F(“EtaPhi”, “Eta vs Phi +”, 760, -190., 190., 400, 160., 180.);

EtaPhi->SetXTitle("#eta");
EtaPhi->SetYTitle("#phi");

part->Draw(" -log(tan(atan2(sqrt(pow(particles.fPx,2)+pow(particles.fPy,2)),particles.fPz)/2.0)), TMath::Pi()+atan2(-particles.fPy,-particles.fPx) >> EtaPhi ",“charge!=0 && fKS==1”);
EtaPhi->Scale(0.001);

You should use “:” instead of “,” to make a 2-d histogram, ie replcae

part->Draw(" -log(tan(atan2(sqrt(pow(particles.fPx,2)+pow(particles.fPy,2)),particles.fPz)/2.0)), TMath::Pi()+atan2(-particles.fPy,-particles.fPx) >> EtaPhi ","charge!=0 && fKS==1"); by

part->Draw(" -log(tan(atan2(sqrt(pow(particles.fPx,2)+pow(particles.fPy,2)),particles.fPz)/2.0)): TMath::Pi()+atan2(-particles.fPy,-particles.fPx) >> EtaPhi ","charge!=0 && fKS==1");
Rene

Dear Rene,

Thank you very much for your help. I can plot the correct histogram now.

Kind regards.