Projecting a Cut from a 2D Histogram to Y-axis

Hi, I know how to project a vertical cut to the y-axis using the following code TH1D *h1 = histogram_name->ProjectionY("cutg",firstxbin,lastxbin,"[cutg]")
, but I don’t know how to project only the area within the TCutG/polygon (the blue shape in the histogram below) to the y-axis. Your help is greatly appreciated. Thanks. I am using 5.10.


see TH2::ProjectionX

Rene

Okay, I checked http://root.cern.ch/root/htmldoc/TH2.html#TH2:ProjectionX, but I’m still not sure how I can project just the bins inside of the TCutG to the y-axis. Would I have to do multiple cuts? and if so how would I do so? Thanks again.

Does anyone know how to do this? Your help is greatly appreciated.

Could you post the shortest possible RUNNING script where

TH1D *h1 = histogram_name->ProjectionY("cutg",firstxbin,lastxbin,"[cutg]") does not work?

Rene

[quote=“brun”]Could you post the shortest possible RUNNING script where

TH1D *h1 = histogram_name->ProjectionY("cutg",firstxbin,lastxbin,"[cutg]") does not work?

Rene[/quote]

That code works, but it takes a vertical cut of the histogram between the firstxbin and lastxbin. I want to only project a distinct boxed area. Thanks.

I understand that, but the [cutg] option should restrict the projection to the only bins where the center is in the cut. Please send me the shortest possible RUNNING script reproducing your problem?

Rene

I’m sorry; I tried the code again and it worked. I must have been doing something wrong. Thank you!