Changeset 17100 for trunk/Mars


Ignore:
Timestamp:
09/06/13 16:58:59 (11 years ago)
Author:
Daniela Dorner
Message:
added 3 new variables to be filled to the DB
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Mars/fact/processing/currents.C

    r16725 r17100  
    2828    double dev_avg  = 0;
    2929    double dev_rms  = 0;
    30     int    cnt  = 0;
    3130    int    cnt_beg  = 0;
    3231    int    cnt_end  = 0;
     
    3736
    3837    double calc_dev_avg  = 0;
     38    double calc_dev_rel  = 0;
     39
     40    TGraph g;
    3941
    4042    while (file.GetNextRow())
     
    7678
    7779        //calculate the light condition
    78         double calt = sin(hrzm.alt*TMath::DegToRad());
    7980        double disk = Nova::GetLunarDisk(jd);
    80         double lc = calt*pow(disk, 2.5);
    8181
    82         double Ical = lc>0 ? 4.5+103.0*lc : 4.5;
     82        // Current prediction
     83        //double cang = sin(angle);
     84        const double calt = sin(hrzm.alt*TMath::DegToRad());
     85
     86        //                                                                           semi-major axis
     87        const double lc = /*cang==0 ? 0 :*/ calt*pow(disk, 2.2)*pow(Nova::GetLunarEarthDist(jd)/384400, -2);///sqrt(cang);
     88        //const double lc = cang==0 ? -1 : calt*pow(disk, 2.2)*pos(dist, -2);
     89        const double Ical = lc>0 ? 4+103*lc : 4;
     90
     91        g.SetPoint(g.GetN(), time, med);
     92
    8393        calc_dev_avg += med - Ical;
     94        calc_dev_rel += med/Ical;
    8495
    85         cnt++;
    8696    }
    8797
    88     if (cnt==0)
     98    if (g.GetN()==0)
    8999    {
    90100        if (diff<5./24/3600)
    91101            return;
    92102
     103        // return the last report before the run
     104        //   (if not older than 5 minutes)
    93105        cout << "result " << med_last << " 0 " << dev_last << " 0 0 0 0" << endl;
    94106        return;
     107    }
     108
     109    Double_t a0, a1;
     110    Int_t ifail;
     111    g.LeastSquareLinearFit(0, a0, a1, ifail);
     112
     113    double fluct_abs = 0;
     114    double fluct_rel = 0;
     115    if (ifail==0)
     116    {
     117        for (int i=0; i<g.GetN(); i++)
     118            g.GetY()[i] -= a0+a1*g.GetX()[i];
     119        fluct_abs = g.GetRMS(2);
     120
     121        for (int i=0; i<g.GetN(); i++)
     122            g.GetY()[i] /= a0+a1*g.GetX()[i];
     123        fluct_rel = g.GetRMS(2);
    95124    }
    96125
     
    98127    med_end = cnt_end>0 ? med_end/cnt_end : -1;
    99128
    100     med_avg /= cnt;
    101     med_rms /= cnt;
     129    med_avg /= g.GetN();
     130    med_rms /= g.GetN();
    102131    med_rms = sqrt(med_rms-med_avg*med_avg);
    103132
    104     dev_avg /= cnt;
    105     dev_rms /= cnt;
     133    dev_avg /= g.GetN();
     134    dev_rms /= g.GetN();
    106135    dev_rms = sqrt(dev_rms-dev_avg*dev_avg);
    107     calc_dev_avg = calc_dev_avg / cnt;
     136    calc_dev_avg /= g.GetN();
    108137
    109     cout << "result " << med_avg << " " << med_rms << " " << dev_avg << " " << dev_rms << " " << med_beg << " " << med_end << " " << calc_dev_avg << endl;
     138    calc_dev_rel -= g.GetN();
     139    calc_dev_rel /= g.GetN();
     140
     141
     142    cout << "result " << med_avg << " " << med_rms << " " << dev_avg << " " << dev_rms << " " << med_beg << " " << med_end << " " << calc_dev_avg << " " << calc_dev_rel << " " << fluct_abs << " " << fluct_rel << endl;
    110143}
Note: See TracChangeset for help on using the changeset viewer.