Index: trunk/Mars/fact/processing/currents.C
===================================================================
--- trunk/Mars/fact/processing/currents.C	(revision 16671)
+++ trunk/Mars/fact/processing/currents.C	(revision 16725)
@@ -1,2 +1,4 @@
+
+
 void currents(const char *fname, double beg=0, double end=100000)
 {
@@ -7,4 +9,6 @@
 
     Double_t time;
+    Double_t jd;
+
     Float_t med, dev;
     file.SetPtrAddress("Time",  &time);
@@ -32,7 +36,10 @@
     double diff = -1;
 
+    double calc_dev_avg  = 0;
+
     while (file.GetNextRow())
     {
         time += offset;
+        jd    = time + 2400000.5;
 
         if (time>end)
@@ -63,4 +70,17 @@
         }
 
+        //calculate the moon
+        Nova::EquPosn moon = Nova::GetLunarEquCoords(jd, 0.01);
+        // get local position of moon
+        Nova::HrzPosn hrzm = Nova::GetHrzFromEqu(moon, jd);
+
+        //calculate the light condition
+        double calt = sin(hrzm.alt*TMath::DegToRad());
+        double disk = Nova::GetLunarDisk(jd);
+        double lc = calt*pow(disk, 2.5);
+
+        double Ical = lc>0 ? 4.5+103.0*lc : 4.5;
+        calc_dev_avg += med - Ical;
+
         cnt++;
     }
@@ -71,5 +91,5 @@
             return;
 
-        cout << "result " << med_last << " 0 " << dev_last << " 0 0 0" << endl;
+        cout << "result " << med_last << " 0 " << dev_last << " 0 0 0 0" << endl;
         return;
     }
@@ -85,5 +105,6 @@
     dev_rms /= cnt;
     dev_rms = sqrt(dev_rms-dev_avg*dev_avg);
+    calc_dev_avg = calc_dev_avg / cnt;
 
-    cout << "result " << med_avg << " " << med_rms << " " << dev_avg << " " << dev_rms << " " << med_beg << " " << med_end << endl;
+    cout << "result " << med_avg << " " << med_rms << " " << dev_avg << " " << dev_rms << " " << med_beg << " " << med_end << " " << calc_dev_avg << endl;
 }
