I believe I have to do the Convert, otherwise TH1F won’t understand what the x-axis is, right?
Then I fill my histogram in this way
h.SetBinContent(bin,value)
and set the timedisplay for plotting like this
h.SetTimeDisplay(1)
I now wonder: If I want to check the value of the x-axis for a certain point in my histogram, say doing
h.GetBinLowEdge(bin)
I get as a result an integer number. Is there any way of me converting this number back into a datetime object? And get the date/time out as a string?
So principle questions are
Am I defining and filling the histogram in the correct way for using a time-axis?
Is there any obvious way of getting hold of the date and time from a specific histogram point/bin - and not just the integer number?
and a 3.rd question
3) Why is it necessary to set an offset? Won’t the axis just start from the dt_start and end at the dt_end automatically, like I defined my histograms? If not, is it correct to set the offset to the start of the histogram, so to dt_start?
( I have had a look at the TDatime examples in the tutorial, but have not gotten the answer to this question)
But my question is: when I have already used Convert() (which I think I need to do in order to actually be able to make a histogram of the date time-objects) can I then extract the information from the bin? The bin is now just an integer ?
Thanks a lot, and sorry if it is obvious, I just have not managed to do
xbin_val = histo.GetBinLowEdge(bin)
and then extract the actual date and time from the xbin_val that is a converted date time-object.
I might be doing something completely wrong? I.e. looking at the example I tried to explain in the first post?
It looks like using TTimeStamp instead of TDatime makes it easier:
root [0] TTimeStamp *t1 = new TTimeStamp(2012,8,2,0,0,0)
root [1] t1->GetDate()
(const unsigned int)20120802
root [2] t1->GetSec()
(const time_t)1343865600
root [3] TTimeStamp *t2 = new TTimeStamp()
root [4] t2->SetSec(1343865600) // use the integer value of t1 to initialise t2
root [5] t2->GetDate()
(const unsigned int)20120802 // retrive the date in t2
Thanks a lot for your suggestion. That worked very well.
Now, I am having problems getting the x-axis to respond in the way I wish, but I believe this is a python question, so I continue asking in the pyroot-support.