Make selection at an angle for 2D efficiency map

I have a 2D efficiency map of senor where we can clearly see the position of sensor is tilted (left). Is there a way I can make selection at some angle (for both Xtr and Ytr) to select the events that hits the senor (try to make a rectangular selection as on right).
Thanks in advance.

Please find the part of code I used to draw the efficiency map.

            Cut = "ntrack==1&&chi2ndf<3"
            mask = "Xtr>1.5&&Xtr<3.7&&Ytr>-0.2&&Ytr<1.0"
            if var == "charge":
                h2Eff = ROOT.TProfile2D(nameEffHist,nameEffHist+";Xtr; Ytr; Eff", 100,-2.0,5.0,100,-2.0,5.0)
                t.Draw("(charge>2):Ytr:Xtr>>"+nameEffHist,Cut+"&&"+mask,"profi colz")

_ROOT Version: 6.28/10
_Platform: linuxx8664gcc
_Compiler: g++ (GCC) 13.1.0

Dear Khuram,

Thanks for the interesting post.
My suggestion would be to use for this kinds of tasks RDataFrame, which allows you to filter the dataset according to your criteria and create out of the box 2D profiles.


Dear Danilo,

Thanks for the nice suggestion moving to the RDataFrame, but I need to do further analyses based on the selection for which I already have script. Moving to RDataFrame, will require more time and effort.

So, I applied an approach to rotate the 2D maps (applying rotation matrix), and then easily apply the selections.
Thank you

Hi Khuram,

Thanks for the update!


This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.