I want to read in Data of a Tree file, as usual with date and time columns. Like that:
2010-04-29 15:20:49.335 0 1 2 3
2010-04-29 15:21:09.735 0 0 0 0
2010-04-29 15:21:30.135 0 0 2 0
2010-04-29 15:21:50.535 0 0 0 0
2010-04-29 15:22:10.935 0 0 0 0
I read in the Time/Data as Ch. like that:
Now I want to Draw something like:
As I have a lot of 10.000 lines and even more there are always too much Labels drawn…
I tried allready to change h1 with:
as a Time axis
And some other things, which I already found in the forum or the user guide. Nothing worked.
At least I would have to decrease the number of labels or even better to include the days at the same axis. As this format of variables is quite usual, I maybe thought to be not the only one thinking about that…
If you read the dates as character strings, you will have one bin per date each of them labelled with a character string (a date). That’s the definition of an histogram with alpha numeric labels. There is no way to reduce the number of labels for such histograms: by definition all the bins must be visible. What you want is a time axis. In that case you should convert the date into integers with TDatime and stored these numbers in your tree instead of the character string.
More details here: root.cern.ch/drupal/content/how- … time-units
I still have problems, I tried to convert the date with:
int XO = T0.Convert();
So I’m not sure, if everything is alright with the seconds (they are no integers) and I didn’t find the command how to take exactly the data from one tree, to convert them and over all how to store them afterward in the same tree. I hope its not just a simply thing, but somehow I can’t see it…
As you can see here : root.cern.ch/root/html/TDatime.html
TDatime takes 6 integers.
Yes, that’s the problem. Furthermore I can’t find anything about taking the data from the tree convert them and put them back…maybe I have to search somewhere else for that??
Instead of using TTree::ReadFile, read line by line and convert your date/time into more appropriate units.
see example in $ROOTSYS/tutorials/tree/cernbuild.C
I’m sorry but I didn’t manage it. I can’t see how to convert the time data to reach right time axis. If I separate seconds, minutes,… I won’t be able to draw something without containing a lot of data at the next time dimension (hours…). I thought, as many people are working with “timber” that there is a more convenient solution.