Drawing zero suppressed data from the command line


I have one more specific question again for drawing from the command line.
When channels were less in our experiments data from e.g. one detector
with 10 channels were stored as



with a lot of zeros of course since only two-three would fire,
moving to a more efficient zero suppressed storage, the data are now
stored in the following way

det[multiplicity] // detector (paddle) number

I am sure many use similar ways to store data from multi-channel detectors. In the old way it was easy from the command line to draw
some correlations like det_1_e:det_2_e, however having the data stored
in the new way it seems as this correlation is not possible (with the command line) without a script.
Is this a true limitation of storing the data in this way
or I am missing something?



I think that all you need to do is:tree->Draw("energy[1]:energy[2]");
or tree->Draw("energy[det[1]]:energy[det[2]]");depend of the meaning and indexing of your variables.


This does not work since the
will draw the 1st hit of vs the second hit so there is no
handle on the detector number.
will not be valid since det[1] gives indeed the detector number
but the energy[] stores elements according to multiplicity.
So two hits one in detector number 3 and one in detector number 10
will be stored in the following way
/1st hit/ energy[0]=some energy, det[0]=3
/2nd hit/ energy[1]=some energy, det[1]=10

but for the next event element 0 and 1 will correspond to different detector
numbers, so how does correlates the energy from the detector 3
versus the energy from detector 10?


[quote] so how does correlates the energy from the detector 3
versus the energy from detector 10? [/quote]If I understood correctly, the algorithm must be equivalent to:

  • for each event
    • find i where det[i]==3
    • find j where det[j]==10
    • plot energy[i] vs energy[j]
      (besides the fact that you may want to revise the way you store the information) I think you should be able to get what you want with: tree->Draw("Sum$(energy[]*(det[]==3)):Sum$(energy[]*(det[]==10))")



Yes what you discribe is what I would like to do,
the command you sent me, however, seems to do something
but when comparing it with the result from looping in a script
it is quite different. Could you please send me some more information
on what this command is actually doing or if there are other suggestions?


[quote]it is quite different.[/quote]How so?

As far I can tell the code I wrote should do:[code] - for each event

  • find i where det[i]==3
  • find j where det[j]==10
  • plot energy[i] vs energy[j] [/code]It assumes that for each event there is only one match for det[i]==3 and det[j]==10.

Otherwise this plots[code]- for each event

  • find all i where det[i]==3 and call those sub_set_i
  • find all j where det[j]==10 and call those sub_set_j
  • plot sum(energy[i]) for i in sub_set_i vs sum(energy[j]) for j in sub_set_j [/code]


Ps. Please re-read the user’s guide and the documentation at root.cern.ch/root/html/TTree.html#TTree:Draw for more details on how TTree::Draw works.


Thanks a lot for the information and especially the link
which I hadn’t read.
Before bothering you more with this I will try to make an example and
somehow test it thouroughly and then (if still I get different results)
I will contact you again with a very specific example.

One more short question though:
it is possible that there are
NAN (not a number) in some of the elements of the varables.
i.e. the multiplicity is increased when either energy or time signal is present,
but if only one is present the corresponding element of the other one will
be nan.
Could that cause unexpected results in the special function Sum?

[quote]Could that cause unexpected results in the special function Sum?[/quote]I guess it is possible.