timeonaxis2.C

Go to the documentation of this file.
00001 void timeonaxis2() {
00002    // Define the time offset as 2003, January 1st
00003    //Author: Olivier Couet
00004    
00005    TDatime T0(2003,01,01,00,00,00);
00006    int X0 = T0.Convert();
00007    gStyle->SetTimeOffset(X0);
00008    
00009    // Define the lowest histogram limit as 2002, September 23rd
00010    TDatime T1(2002,09,23,00,00,00);
00011    int X1 = T1.Convert()-X0;
00012 
00013    // Define the highest histogram limit as 2003, March 7th
00014    TDatime T2(2003,03,07,00,00,00);
00015    int X2 = T2.Convert(1)-X0;
00016 
00017    TH1F * h1 = new TH1F("h1","test",100,X1,X2);      
00018 
00019    TRandom r;
00020    for (Int_t i=0;i<30000;i++) {
00021       Double_t noise = r.Gaus(0.5*(X1+X2),0.1*(X2-X1));
00022       h1->Fill(noise);
00023    }
00024    
00025    h1->GetXaxis()->SetTimeDisplay(1);
00026    h1->GetXaxis()->SetLabelSize(0.03);
00027    h1->GetXaxis()->SetTimeFormat("%Y\/%m\/%d");
00028    h1->Draw();
00029 }

Generated on Tue Jul 5 15:44:22 2011 for ROOT_528-00b_version by  doxygen 1.5.1