Hi,
I am trying to use an equation to select only specific events to plot an elliptical shape for my data. I have used all sorts of equations for ellipse but the process doesn’t seem to work. The plot in which the events should be selected is attached below. One easily see the elliptical shape at the line joining 400 keV at both axes, I need to select only those events.
Is there any way to do that?
Thanks.
Mod A E1 vs E2.pdf (38.6 KB)
Please read tips for efficient and successful posting and posting code
ROOT Version: Not Provided
Platform: Not Provided
Compiler: Not Provided
Hi @Siddharth_Parashari ,
can you please share the code you used and point out what does not work exactly? Is the selection wrong (in which case I’m not sure we can help) or is there a problem with some calls to ROOT classes?
Cheers,
Enrico
Here is the code that I’m using to fill the histogram.
firedPxA and B are the pixel energies.
I am summing two pixel to check if their sum is 511±3sig and then I’m trying to plot correlated 2D histogram.
if( !((firedPxA[0]==32 && firedPxA[1]==13) || (firedPxA[0]==13 && firedPxA[1]==32)) ) continue;
Float_t sum_2fired =0;
if(!(q[firedPxA[0]]==-999) && !(q[firedPxA[1]]==-999))
{
sum_2fired= q[firedPxA[0]]+q[firedPxA[1]];
}
if( sum_2fired>E_511min[0] && sum_2fired<E_511max[0] && (((pow((q[firedPxA[0]]-250)*(0.707),2)+(pow((q[firedPxA[1]]-250)*(0.707),2))))/pow(sum_2fired,2) + ((pow((q[firedPxA[0]]-250)*(0.85),2)-(pow((q[firedPxA[1]]-250)*(0.52),2))))/pow(q[firedPxA[0]],2))<1)
{
hE6Ac->Fill(sum_2fired);
hE6A->Fill(q[firedPxA[0]]);
hE5A->Fill(q[firedPxA[1]]);
hE6_E4->Fill(q[firedPxA[0]],q[firedPxA[1]]);
}
The output plots of this code is attached. You can find the 2D histo as the rightmost plot in the canvas.
I need to select only the eliptical area at the center of the rightmost plot but it is not working.
two pix sum.pdf (33.1 KB)
Thanks.
Try something like this (creates an “ellipse”):
your_tree->Draw("E1:E2", "E1 > 0. && E2 > 0. && pow((E1 + E2 - 511.) / 50., 2.) + pow((E1 - E2) / 150., 2.) < 1."); // assumes 3sig(E1+E2) = 50. and 3sig(E1-E2) = 150.
and / or that (creates a “rectangle”):
your_tree->Draw("E1:E2", "E1 > 0. && E2 > 0. && abs(E1 + E2 - 511.) < 50. && abs(E1 - E2) < 150."); // assumes 3sig(E1+E2) = 50. and 3sig(E1-E2) = 150.
Thank you so much. This works
Thanks for sharing. I found a lot of interesting information here!