ProjectionY problem

Hello there

I am trying to get the ProjectionY, but I am facing an error ROOT message

Can’t call TH1::ProjectionY

although, I

#include "TH1.h"
in the begining of my code

My syntax is
TH1D* px = MetvsJetsTtbar->ProjectionY(“px”, 160, 180); // where firstYbin = 160 and lastYbin = 180

where MetvsJetsTtbar is a TH2D one

Any ideas?

Thanks

Alexis

Are you really sure that MetvsJetsTtbar is a TH2D and not a TH1 ?

Rene

Yes, I am absolutely sure .

For the history, I am using ROOT v 5.17/04

Could you post the shortest possible RUNNING script reproducing the problem?

Rene

Ok - I am attaching the .root and .cc files

Thanks in advance
Projection.cpp (593 Bytes)
test.root (54.5 KB)

Oops - I posted wrong .cpp file. Here is the correct one

Sorry for that!
Projection.cpp (531 Bytes)

I just found the problem

it is
TH2 MetvsJetsTtbar = (TH2)b->Get (“NJETSvsMETTtbar”);

and not

TH1 MetvsJetsTtbar = (TH1)b->Get (“NJETSvsMETTtbar”);

as I wrote…

Sorry for the trouble…

I requested a RUNNINg script. Please post your data file too.

Rene

My data file is the .root one I posted above. But as I said, I found the problem

Thanks again!