Problem With the function tree1->Draw

Hi everyone
I have a problem with the function simulation->Draw each time I try to excute this command

root [4] simulation->Draw("X:errX:Y:errY:Z:errZ", "Ntracks==50", "gl5d"); 

or

root [2] simulation->Draw("X:Y:Z:errX:errY:errZ", "Ntracks==1", "gl5d");

it gives an empty canvas file or does nothing in the terminal if I add "; "
My Root program’s version is 6.28/04.
Can someone assist me, please?

root [0] TFile myFile("simulation.root")
(TFile &) Name: simulation.root Title:
root [1] simulation->Scan()
************************************************************************************************************
*    Row   * Ntracks.N * Nlayers.N *       X.X * errX.errX *       Y.Y * errY.errY *       Z.Z * errZ.errZ *
************************************************************************************************************
*        0 *         1 *         5 *   10.2639 *         3 *  -2.93448 *         3 *     252.5 *         1 *
*        1 *         1 *         5 *   10.5143 *         3 *   22.9147 *         3 *       231 *         1 *
*        2 *         1 *         5 *  -15.6972 *         3 *     16.25 *         3 *       209 *         1 *
*        3 *         1 *         5 *  -11.4554 *         3 *   3.77944 *         3 *        82 *         1 *
*        4 *         1 *         5 *  -13.9854 *         3 *   4.69995 *         3 *        60 *         1 *
*        5 *         2 *         5 *   6.80438 *         3 *  -27.6466 *         3 *     274.5 *         1 *
*        6 *         2 *         5 *   5.53446 *   1.26992 *  -16.0853 *         3 *       231 *         1 *
*        7 *         2 *         5 *   4.05961 *   2.74477 *  -10.7812 *         3 *       209 *         1 *
*        8 *         2 *         5 *    1.3532 *         3 *   9.84375 *         3 *       126 *         1 *
*        9 *         2 *         5 *  -1.80656 *         3 *   26.7312 *         3 *        60 *         1 *
*       10 *         3 *         6 *   19.8493 *         3 *  -2.99036 *         3 *     274.5 *         1 *
*       11 *         3 *         6 *   9.32343 *         3 *   2.66475 *         3 *       231 *         1 *
*       12 *         3 *         6 *   3.24769 *         3 *     5.625 *         3 *       209 *         1 *
*       13 *         3 *         6 *   -14.344 *         3 *   0.46875 *         3 *       126 *         1 *
*       14 *         3 *         6 *  -16.4474 *         3 *  -4.65713 *         3 *       104 *         1 *
*       15 *         3 *         6 *   4.40419 *         3 *  -24.6536 *         3 *        82 *         1 *
*       16 *         4 *         6 *  -15.9295 *       0.3 *   0.47839 *       0.3 *     274.5 *         1 *
*       17 *         4 *         6 *  -13.7265 *   2.20297 *  -2.43225 *   2.91064 *     252.5 *         1 *
*       18 *         4 *         6 *  -11.7866 *         3 *  -6.71025 *         3 *       231 *         1 *
*       19 *         4 *         6 *  -10.0137 *         3 *  -9.84375 *         3 *       209 *         1 *
*       20 *         4 *         6 *  -2.97705 *         3 *  -23.9062 *         3 *       126 *         1 *
*       21 *         4 *         6 * -0.389411 *         3 *  -27.7918 *         3 *       104 *         1 *
*       22 *         5 *         5 *  -24.0487 *         3 *  -7.95911 *         3 *     274.5 *         1 *
*       23 *         5 *         5 *  -21.8457 *   2.20297 *  -4.30725 *         3 *     252.5 *         1 *
*       24 *         5 *         5 *   -17.321 *         3 *    2.1875 *         3 *       209 *         1 *
Type <CR> to continue or q to quit ==> q
************************************************************************************************************
(long long) 25
root [2] simulation->Draw("X:Y:Z:errX:errY:errZ", "Ntracks==1", "gl5d");
root [3] simulation->Draw("X:errX:Y:errY:Z:errZ", "Ntracks==1", "gl5d");
root [4] simulation->Draw("X:errX:Y:errY:Z:errZ", "Ntracks==50", "gl5d");

Thank you
Houssem

The option “gl5d” needs OpenGL. Before the drawing command, you need to do:

gStyle->SetCanvasPreferGL(true);

Otherwise, if you have more than 5 variables, the option “PARA’” (parallel coordinates) allows you to draw a TTree.

1 Like

@couet I can see now that vital pieces of information are missing in the main “varexp” parameter description at the beginning of the TTree::Draw method description (which explicitly says that it supports up to 4 variables only).

1 Like

Thanks for replying but I just want to draw 3 variables (X,Y,Z) with their error bars (errX,errY,errZ) with a chosen event Ntracks.Because I need to simulate the trajectory of my particle in my detectors.
I succeded to do it without the error bars (physically it doesn’t make sense.)
Then the question is how can I include the errors in my 3D graph?
Thank you

The help says:

  • if expression has more than four fields the option "PARA"or “CANDLE” can be used.
  • If option GL5D is specified together with 5 variables, a 5D plot is drawn using OpenGL.
1 Like

@couet These notes (plus something like “the option "GOFF" allows for an arbitrary number of variables”) should appear directly in the description of the input parameter:
[in] varexp A string that takes one of these general forms:

1 Like

I guess you will need to inject the vectors and errors into a TGraph2DErrors.

1 Like

@couet Well, after reading the full description, it seems:

- Any number of variables no fewer than two can be used with the options "CANDLE" and "PARA"
- An arbitrary number of variables can be used with the option "GOFF"
1 Like

Thanks! I updated.

1 Like

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