Drawing contents of 2 different trees versus the same string

Dear rooters

I have two trees which I want to Draw on the same graph. The trees have been
created with different programs. The second tree has a subset of variables of
the first tree.

On the Y axis I have a variable and I plot it versus a string. When I plot one
tree on top of another it seems like the second one is plotted with respect to
the entry number rather than the actual string value. How can I fix this?

I attach the code and the data I am using. I run it as: root -l commands.C

Thank you


_ROOT Version: ROOT 6.12/04
Platform: CentOS Linux release 7.4.1708 64 bit
Compiler: gcc version 4.8.5 20150623


question.zip (107.6 KB)

The labels are not the same for both histograms SAME cannot work …

Hello, thank you very much for your answer.

Yes, I agree that the labels are not exactly the same for the 2 trees. But some labels are the same in both trees. I would expect that Draw plots something in the case the labels coincide.

For instance, the following labels are present in both trees:

CIS16-EPI-12-50-DS-89-1000ohm
CIS16-EPI-01-50-DS-97-10ohm
CIS16-EPI-08-50-DS-103-250ohm
CIS16-EPI-12-50-DS-102-1000ohm
CIS16-EPI-12-50-DS-96-1000ohm
CIS16-EPI-01-50-DS-98-10ohm
CIS16-EPI-12-50-DS-83-1000ohm
CIS16-EPI-08-50-DS-104-250ohm
CIS16-EPI-01-50-DS-78-10ohm
CIS16-EPI-08-50-DS-100-250ohm
CIS16-EPI-12-50-DS-99-1000ohm

Crosscheck: for the first one…

root [8] tree->Scan("sensor","sensor==\"CIS16-EPI-12-50-DS-89-1000ohm\"","colsize=32")
***********************************************
*    Row   *                           sensor *
***********************************************
*        3 *    CIS16-EPI-12-50-DS-89-1000ohm *
***********************************************
==> 1 selected entry
(long long) 1

and for the second one:

root [9] tree2->Scan("sensor","sensor==\"CIS16-EPI-12-50-DS-89-1000ohm\"","colsize=32")
***********************************************
*    Row   *                           sensor *
***********************************************
*        4 *    CIS16-EPI-12-50-DS-89-1000ohm *
***********************************************
==> 1 selected entry
(long long) 1

Labels are only string attached to bins. When you overlap the histograms like you do the bins are mapped one to one not taking into account the labels value. To make sure the labels match you will need to create two histograms (before drawing the trees) with exactly the same labels in X, then in the Draw command you draw inside the histograms using the >> operator

I created two histograms like you said and that resolved the issue. Thanks for your help.

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