Filling Error on the TH2F Histogram

Dear Rooters,

I want to study the multiplicity correlation between two detectors for the events within several multiplicity bins.
When I use following command,

TH1F fhVZEROMultA->Fill(esdVZERO->GetMTotV0A()); and
TH1F fhAmpC->Fill(amp[i]); (by the way amp=esdTZERO1->GetT0amplitude()

those produce a right histograms for each detector.

But I try to use those together

if (esdTZERO1) {
for (Int_t i=1; i<12; i++){
fhAmpC->Fill(amp[i]); //TH2F fhAmpC is TH2F//

if (esdVZERO) {
{
fhMultAmp_C->Fill(amp[i],esdVZERO->GetMTotV0C())
}

if(0<=amp[i]<=5 && 0<=esdVZERO->GetMTotV0C()<=5){
fhMultAmp_C_0_5->Fill(amp[i],esdVZERO->GetMTotV0C()) // fhMultAmp_C_0_5 is TH2F//
}
}
}
}

At this time I get 0 for the result of esdVZERO->GetMTotV0C(). Also, fhMultAmp_C and fhMultAmp_C_0_5 histograms are completely same. For the fhMultAmp_C_0_5 histogram some amp[i] values bigger then 5.

So, Iâ€™m not sure this may be a stupid question, but I didnâ€™t find where is the mistake.

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

Thank you,

Kind regards,

Ayben

I have attached the root file and example macro.

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

if fhAmpC is a TH2 you must fill it with a Fill function having 2 arguments Fill(x,y) or Fill(x,y,w)

Rene

Dear Rene,

Thank you for the answer. Iâ€™m sorry I made a writing mistake. fhAmpC is TH1F in mu code.

Dear Rene,

I found the problem

if(0<=amp[i]<=5 && 0<=esdVZERO->GetMTotV0C()<=5)

line should be

if(0<amp[i] && amp[i] <5 && 0GetMTotV0C() && esdVZERO->GetMTotV0C()<5)

Sorry for this easy question.

Kind regards,

Ayben