April 2010 Archives

2010-04-27 10:42:42

Unix Time (Epoch)


C code (copied from wiki  modified in order to convert a known unix epoch time

#include <stdio.h>
#include <time.h>

int main(void)
{
    time_t     now;
    time_t     old;

    struct tm  *ts;
    struct tm  *ots;
    char       buf[80];
    char       buf2[80];
    /* Get the current time */
    now = time(NULL);
    ts  = localtime(&now);

    strftime(buf, sizeof(buf), "%a %Y-%m-%d %H:%M:%S %Z", ts);
    printf("%s\n", buf);

    old = 1257169741;
    ots = localtime(&old);
    strftime(buf2, sizeof(buf2), "%a %Y-%m-%d %H:%M:%S %Z", ots);
    printf("%s\n", buf2);
    return 0;
}

 Tue 2010-04-27 10:27:59 EDT
 Mon 2009-11-02 08:49:01 EST


* $date -d @1257169741
Mon Nov  2 08:49:01 EST 2009

References

Posted by Jeong Han Lee | Permanent link

2010-04-23 12:08:05

a SVN command collection for the QwAnalysis

QwAnalysis trunk


svn --no-auth-cache --username jhlee checkout https://qweaksvn.jlab.org/repos/QwAnalysis/trunk/ ~/QwAnalysis/trunk/

QwDB_Admin


svn --no-auth-cache --username jhlee checkout https://qweaksvn.jlab.org/repos/QwDB_Admin/trunk/ ~/QwAnalysis/QwDB_Admin/trunk/

If one want toreset all values in used database (qw_test_00_01_0000)


In mysql console,

DROP DATABASE IF EXISTS qw_test_00_01_0000;
CREATE DATABASE qw_test_00_01_0000;

In a xterm,

mysql -u root -p qw_test_00_01_0000 < bin/create_qweak.sql

If one wants to create a new database


CREATE DATABASE  qw_test_00_01_0001;

mysql -u root -p qw_test_00_01_0001 < bin/create_qweak.sql



Posted by Jeong Han Lee | Permanent link

2010-04-22 18:25:35

Convention for numbering bins in ROOT Histogram

For all histogram types: nbins, xlow, xup

bin = 0; underflow bin
bin = 1; first bin with low-edge xlow INCLUDED
bin = nbins; last bin with upper-edge xup EXCLUDED
bin = nbins+1; overflow bin

See TH1 in detail.


  1) nbins = 5, xlow = 0, xup = 5
       ---------------------
       | 1 | 2 | 3 | 4 | 5 |    5 : nbins
       ---------------------
       0   1   2   3   4   5


  2)  offset = -0.5, nbins = 5, xlow = offset, xup = 5+offset
       ---------------------
       | 1 | 2 | 3 | 4 | 5 |    5 : nbins
       ---------------------
     0   1   2   3   4   5



Posted by Jeong Han Lee | Permanent link