Index: branches/MarsWobble/fact/analysis/callisto.C
===================================================================
--- branches/MarsWobble/fact/analysis/callisto.C	(revision 18160)
+++ branches/MarsWobble/fact/analysis/callisto.C	(revision 18278)
@@ -1,5 +1,8 @@
 #include "MLogManip.h"
 
-int callisto(const char *seqfile="seq/2012/01/23/20120123_023.seq", const char *outpath = "output", const char *delays="resources/delays-20150217.txt")
+int callisto(const char *seqfile="seq/2012/01/23/20120123_023.seq", const char *outpath = "output",
+//             TString drstime = "/gpfs0/fact/processing/drs_time_calib/20111115.time.drs.fits",
+             const char *drstime = "/gpfs0/fact/processing/drs_time_calib/20111115.time.drs.fits",
+             const char *delays="resources/delays-20150217.txt")
 {
     // ======================================================
@@ -107,5 +110,4 @@
     }
 
-    TString timfile = drs.GetFileName(0, MSequence::kFitsDat);
     TString drs1024 = drs.GetFileName(0, MSequence::kFitsDrs);
     TString pedfile = seq.GetFileName(0, MSequence::kFitsPed);
@@ -115,15 +117,19 @@
     gLog << "DRS calib     300: " << drsfile << '\n';
     gLog << "DRS calib    1024: " << drs1024 << "\n\n";
+    gLog << "DRS calib    Time: " << drstime << "\n\n";
+
+    MDrsCalibrationTime drscalibtime;
+    if (!drscalibtime.ReadFits(drstime)))
+        return 5;
 
     MDrsCalibration drscalib300;
     if (!drscalib300.ReadFits(drsfile.Data()))
-        return 5;
+        return 6;
 
     MDrsCalibration drscalib1024;
     if (!drscalib1024.ReadFits(drs1024.Data()))
-        return 6;
+        return 7;
 
     gLog << all;
-    gLog << "Time calibration : " << timfile << '\n';
     gLog << "Pedestal     file: " << pedfile << '\n';
     gLog << "Light Pulser file: " << calfile << '\n' << endl;
@@ -135,5 +141,5 @@
     {
         gLog << err << "ERROR - Sequence valid but without files." << endl;
-        return 7;
+        return 8;
     }
     iter.Print();
@@ -195,10 +201,10 @@
     // hrate.DefaultLabelY("ERROR");
 
-    MDrsCalibrationTime timecam;
+//    MDrsCalibrationTime timecam;
 
     gStyle->SetOptFit(kTRUE);
 
     // ======================================================
-
+/*
     gLog << endl;
     gLog.Separator("Processing DRS timing calibration run");
@@ -240,5 +246,5 @@
     if (!loop0.GetDisplay())
         return 9;
-
+*/
     /*
      MHDrsCalibrationT *t = (MHDrsCalibrationT*)plist4.FindObject("MHDrsCalibrationT");
@@ -258,5 +264,5 @@
     plist1.AddToList(&drscalib300);
     plist1.AddToList(&badpixels);
-    plist1.AddToList(&timecam);
+    plist1.AddToList(&drscalibtime);
 
     MEvtLoop loop1("DetermineCalConst");
@@ -348,9 +354,9 @@
     tlist1.AddToList(&fill1d);
 
-    if (!loop1.Eventloop(max1))
-        return 10;
-
-    if (!loop1.GetDisplay())
-        return 11;
+    //if (!loop1.Eventloop(max1))
+    //    return 10;
+
+    //if (!loop1.GetDisplay())
+    //    return 11;
 
     if (delays)
@@ -363,5 +369,5 @@
         }
 
-        timecam.SetDelays(g);
+        drscalibtime.SetDelays(g);
     }
 
@@ -377,5 +383,5 @@
     plist3.AddToList(&drscalib300);
     plist3.AddToList(&badpixels);
-    plist3.AddToList(&timecam);
+    plist3.AddToList(&drscalibtime);
 
     MEvtLoop loop3("DetermineRndmPed");
@@ -451,5 +457,5 @@
     plist4.AddToList(&drscalib300);
     plist4.AddToList(&badpixels);
-    plist4.AddToList(&timecam);
+    plist4.AddToList(&drscalibtime);
 
     MEvtLoop loop4("DetermineExtractedPed");
@@ -519,5 +525,5 @@
     plist5.AddToList(&drscalib300);
     plist5.AddToList(&badpixels);
-    plist5.AddToList(&timecam);
+    plist5.AddToList(&drscalibtime);
 
     MEvtLoop loop5("CalibratingData");
Index: branches/MarsWobble/fact/analysis/callisto_data.C
===================================================================
--- branches/MarsWobble/fact/analysis/callisto_data.C	(revision 18160)
+++ branches/MarsWobble/fact/analysis/callisto_data.C	(revision 18278)
@@ -90,17 +90,21 @@
     // -------------------------------------------------------
 
-    TFile file(drstime);
-    if (file.IsZombie())
+    MDrsCalibrationTime timecam;
+    if (!timecam.ReadFits(drstime))
     {
-        gLog << err << "ERROR - Could not open " << drstime << endl;
+        gLog << err << "ERROR - Could not get MDrsCalibrationTime from " << drstime << endl;
         return 21;
     }
 
-    MDrsCalibrationTime *timecam = 0;
-    file.GetObject("MDrsCalibrationTime", timecam);
-    if (!timecam)
+    if (delays)
     {
-        gLog << err << "ERROR - Could not get MDrsCalibrationTime from " << drstime << endl;
-        return 22;
+        TGraph g(delays);
+        if (g.GetN()!=1440)
+        {
+            gLog << err << "Error reading file " << delays << endl;
+            return 22;
+        }
+
+        timecam.SetDelays(g);
     }
 
@@ -203,5 +207,5 @@
     plist5.AddToList(&drscalib300);
     plist5.AddToList(&badpixels);
-    plist5.AddToList(timecam);
+    plist5.AddToList(&timecam);
 
     MEvtLoop loop5("CalibratingData");
Index: branches/MarsWobble/fact/plots/plotratescan.C
===================================================================
--- branches/MarsWobble/fact/plots/plotratescan.C	(revision 18160)
+++ branches/MarsWobble/fact/plots/plotratescan.C	(revision 18278)
@@ -129,5 +129,5 @@
 {
     TString query;
-    query += "SELECT fTimeBegin, fTimeEnd, fVoltageIsOn, fOvervoltage, fCurrentMedMean, fNight ";
+    query += "SELECT fTimeBegin, fTimeEnd, fVoltageIsOn, fOvervoltage, fCurrentMedMean, fNight, fAzMin, fAzMax, fZdMin, fZdMax ";
     query += "FROM Ratescan WHERE fRatescanID=";
     query += search_id;
@@ -149,4 +149,8 @@
     const char *time_end = (*row)[1];
     const char *night    = (*row)[5];
+    const char *az_beg = (*row)[6];
+    const char *az_end = (*row)[7];
+    const char *zd_beg = (*row)[8];
+    const char *zd_end = (*row)[9];
 
     int   voltage_on  = (*row)[2] ? atoi((*row)[2]) :   -1;
@@ -167,9 +171,12 @@
     leg.SetBorderSize(1);
     leg.SetFillColor(kWhite);
-    leg.AddText("Ratescan");
-    leg.AddText("");
-    leg.AddText(Form("Begin    %s", time_beg));
-    leg.AddText(Form("End       %s", time_end));
-    leg.AddText("");
+    leg.SetTextAlign(12);
+    leg.AddText(Form("Ratescan %d ", search_id));
+    //leg.AddText("");
+    leg.AddText(Form("Begin       %s", time_beg));
+    leg.AddText(Form("End          %s", time_end));
+    leg.AddText(Form("Az            %s#circ to %s#circ", az_beg, az_end));
+    leg.AddText(Form("Zd             %s#circ to %s#circ", zd_beg, zd_end));
+    //leg.AddText("");
     if (voltage_on==0)
         leg.AddText("Voltage off");
@@ -179,5 +186,5 @@
             leg.AddText(Form("Current     <I_{med}>  =  %.1f #muA", current));
         if (overvoltage>-70)
-            leg.AddText(Form("Voltage         #DeltaU  =  %+.2f V", overvoltage));
+            leg.AddText(Form("Voltage   #DeltaU  =  %+.2f V", overvoltage));
     }
 
@@ -209,4 +216,8 @@
     g.DrawClone("PL");
 
+    TGraph gr("good_ratescan_edit.txt", "%lg %lg");
+    gr.SetLineColor(12);
+    gr.DrawClone("L");
+
     c->Write();
 
@@ -216,7 +227,8 @@
     name += time_beg;
 
-    c->SaveAs(name+".pdf");
-    c->SaveAs(name+".eps");
-    c->SaveAs(name+".png");
+    //c->SaveAs(name+".pdf");
+    //c->SaveAs(name+".eps");
+    //c->SaveAs("/loc_data/analysis/"+name+".png");
+    c->SaveAs(Form("/loc_data/analysis/ratescans/%04d/%02d/%02d/%06d_%d.png", atoi(night)/10000, (atoi(night)/100)%100, atoi(night)%100, atoi(night), search_id));
 
     delete c;
@@ -305,7 +317,5 @@
 
     TString oname = Form("%06d-ratescan.root", night);
-
-    cout << "   " << oname << '\n' << endl;
-
+    //cout << "   " << oname << '\n' << endl;
     TFile rootfile(oname.Data(), "recreate");
 
Index: branches/MarsWobble/fact/plots/quality.C
===================================================================
--- branches/MarsWobble/fact/plots/quality.C	(revision 18160)
+++ branches/MarsWobble/fact/plots/quality.C	(revision 18278)
@@ -95,8 +95,35 @@
     Double_t jd = time + 40587 + 2400000.5;
 
+    // Sun properties  	 	 
+    Nova::EquPosn  sun  = Nova::GetSolarEquCoords(jd);  	 	 
+    Nova::ZdAzPosn hrzs = Nova::GetHrzFromEqu(sun, jd);  	 	 
+
     // Get source position
     Nova::EquPosn pos = FindPointing(time);
 
-    return FACT::PredictI(jd, pos);
+
+    // Moon properties 
+    Nova::EquPosn moon = Nova::GetLunarEquCoords(jd, 0.01); 
+    Nova::HrzPosn hrzm = Nova::GetHrzFromEqu(moon, jd); 
+    double        disk = Nova::GetLunarDisk(jd); 
+
+    // Derived moon properties 
+    double angle = Nova::GetAngularSeparation(moon, pos); 
+    double edist = Nova::GetLunarEarthDist(jd)/384400; 
+
+    // Current prediction 
+    double sin_malt  = hrzm.alt<0 ? 0 : sin(hrzm.alt*TMath::DegToRad()); 
+    double cos_mdist = cos(angle*TMath::DegToRad()); 
+    double sin_szd   = sin(hrzs.zd*TMath::DegToRad()); 
+
+    double c0 = pow(disk,      2.63); 
+    double c1 = pow(sin_malt,  0.60); 
+    double c2 = pow(edist,    -2.00); 
+    double c3 = exp(0.67*cos_mdist*cos_mdist*cos_mdist*cos_mdist); 
+    double c4 = exp(-97.8+105.8*sin_szd*sin_szd); 
+
+    double cur = 6.2 + 95.7*c0*c1*c2*c3 + c4; 
+
+    return cur; 
 }
 
@@ -340,4 +367,252 @@
 }
 
+Int_t PlotSqm(TArrayD **vec, TString fname)
+{
+    fname += ".SQM_CONTROL_DATA.fits";
+
+    fits file(fname.Data());
+    if (!file)
+    {
+        cerr << fname << ": " << gSystem->GetError() << endl;
+        return -2;
+    }
+
+    //cout << fname << endl;
+
+    Double_t time;
+    Float_t mag; // magnitude
+
+    if (!file.SetPtrAddress("Time",  &time))
+        return -1;
+    if (!file.SetPtrAddress("Mag",  &mag))
+        return -1;
+
+    //const int marker_style = kFullDotMedium;
+    const int marker_style = kDot;
+
+    TGraph g1;
+    g1.SetName("SQM");
+
+
+    bool found_first_time = false;
+    while (file.GetNextRow())
+        if (Contains(vec, time))
+        {
+            g1.SetPoint(g1.GetN(), time*24*3600, mag);
+        }
+
+
+    g1.SetMinimum(19.0);
+    g1.SetMaximum(21.5);
+    g1.SetMarkerColor(kBlack);
+    g1.SetMarkerStyle(marker_style);
+    g1.GetXaxis()->SetTimeDisplay(true);
+    g1.GetXaxis()->SetTimeFormat("%H:%M %F1995-01-01 00:00:00 GMT");
+    g1.GetXaxis()->SetLabelSize(0.12);
+    g1.GetYaxis()->SetLabelSize(0.1);
+    g1.GetYaxis()->SetTitle("SQM [mag]");
+    g1.GetYaxis()->SetTitleOffset(0.2);
+    g1.GetYaxis()->SetTitleSize(0.1);
+    g1.DrawClone("AP");
+
+    return 0;
+}
+
+Int_t PlotSqmLinear(TArrayD **vec, TString fname)
+{
+    fname += ".SQM_CONTROL_DATA.fits";
+
+    fits file(fname.Data());
+    if (!file)
+    {
+        cerr << fname << ": " << gSystem->GetError() << endl;
+        return -2;
+    }
+
+    //cout << fname << endl;
+
+    Double_t time;
+    Float_t mag; // magnitude
+
+    if (!file.SetPtrAddress("Time",  &time))
+        return -1;
+    if (!file.SetPtrAddress("Mag",  &mag))
+        return -1;
+
+    //const int marker_style = kFullDotMedium;
+    const int marker_style = kDot;
+
+    TGraph g1;
+    g1.SetName("SQM");
+
+
+    bool found_first_time = false;
+    while (file.GetNextRow())
+        if (Contains(vec, time))
+        {
+            Double_t mag_double = 4.4 * pow(10, 20) * pow( 10, mag*(-0.4));
+            g1.SetPoint(g1.GetN(), time*24*3600, mag_double);
+        }
+
+
+    g1.SetMinimum(1.e12);
+    g1.SetMaximum(5.e12);
+    g1.SetMarkerColor(kBlack);
+    g1.SetMarkerStyle(marker_style);
+    g1.GetXaxis()->SetTimeDisplay(true);
+    g1.GetXaxis()->SetTimeFormat("%H:%M %F1995-01-01 00:00:00 GMT");
+    g1.GetXaxis()->SetLabelSize(0.12);
+    g1.GetYaxis()->SetLabelSize(0.1);
+    g1.GetYaxis()->SetTitle("SQM lin [phot./(s sr m^2)]");
+    g1.GetYaxis()->SetTitleOffset(0.2);
+    g1.GetYaxis()->SetTitleSize(0.1);
+    g1.DrawClone("AP");
+
+    return 0;
+}
+
+Int_t PlotHumidity(TArrayD **vec, TString fname)
+{
+    fname += ".FSC_CONTROL_HUMIDITY.fits";
+
+    fits file(fname.Data());
+    if (!file)
+    {
+        cerr << fname << ": " << gSystem->GetError() << endl;
+        return -2;
+    }
+
+    //cout << fname << endl;
+
+    Double_t time;
+    Float_t H[4];
+
+    if (!file.SetPtrAddress("Time",  &time))
+        return -1;
+    if (!file.SetPtrAddress("H",  H))
+        return -1;
+
+    //const int marker_style = kFullDotMedium;
+    const int marker_style = kDot;
+
+    TGraph g1;
+    TGraph g2;
+    TGraph g3;
+    TGraph g4;
+    //TGraph g5;
+    g1.SetName("H0");
+    g2.SetName("H1");
+    g3.SetName("H2");
+    g4.SetName("H3");
+    //g5.SetName("PFmini");
+
+
+    Double_t first_time, last_time;
+    bool found_first_time = false;
+    while (file.GetNextRow())
+        if (Contains(vec, time))
+        {
+            if (!found_first_time){
+              first_time = time*24*3600;
+              found_first_time = true;
+            }            
+            g1.SetPoint(g1.GetN(), time*24*3600, H[0]);
+            g2.SetPoint(g2.GetN(), time*24*3600, H[1]);
+            g3.SetPoint(g3.GetN(), time*24*3600, H[2]);
+            g4.SetPoint(g4.GetN(), time*24*3600, H[3]);
+            //g5.SetPoint(g5.GetN(), time*24*3600, I[319]);
+            last_time = time*24*3600;
+        }
+
+
+    g1.SetMinimum(10);
+    g1.SetMaximum(80);
+    g1.SetMarkerColor(kAzure);
+    g1.SetMarkerStyle(marker_style);
+    g1.GetXaxis()->SetTimeDisplay(true);
+    g1.GetXaxis()->SetTimeFormat("%H:%M %F1995-01-01 00:00:00 GMT");
+    g1.GetXaxis()->SetLabelSize(0.12);
+    g1.GetYaxis()->SetLabelSize(0.1);
+    g1.GetYaxis()->SetTitle("HUMITIDY");
+    g1.GetYaxis()->SetTitleOffset(0.2);
+    g1.GetYaxis()->SetTitleSize(0.1);
+    g1.DrawClone("AP");
+
+    g2.SetMarkerColor(kAzure+1);
+    g2.SetMarkerStyle(marker_style);
+    g2.DrawClone("P");
+    
+    g3.SetMarkerColor(kAzure+3);
+    g3.SetMarkerStyle(marker_style);
+    g3.DrawClone("P");
+    
+    g4.SetMarkerColor(kAzure+6);
+    g4.SetMarkerStyle(marker_style);
+    g4.DrawClone("P");
+    
+    //g5.SetMarkerColor(kAzure+1);
+    //g5.SetMarkerStyle(kFullDotMedium);
+    //g5.DrawClone("P");
+    
+    g1.DrawClone("P");
+
+    TLine l1(first_time-600, 40, last_time+600, 40);
+    l1.SetLineColor(kOrange);
+    l1.DrawClone();
+    TText t1(first_time-600, 41, "Please, note in logbook");
+    t1.SetTextSize(0.1);
+    t1.DrawClone();
+
+    
+    TLine l2(first_time-600, 55, last_time+600, 55);
+    l2.SetLineColor(kRed);
+    l2.DrawClone();
+    TText t2(first_time-600, 56, "Please, report to fact-online");
+    t2.SetTextSize(0.1);
+    t2.DrawClone();
+
+
+    return 0;
+}
+
+Int_t PlotHumidity2(TArrayD **vec, TString fname)
+{
+    fname += ".PFMINI_CONTROL_DATA.fits";
+
+    fits file(fname.Data());
+    if (!file)
+    {
+        cerr << fname << ": " << gSystem->GetError() << endl;
+        return -2;
+    }
+
+    //cout << fname << endl;
+
+    Double_t time;
+    Float_t H;
+
+    if (!file.SetPtrAddress("Time",  &time))
+        return -1;
+    if (!file.SetPtrAddress("Humidity", &H))
+        return -1;
+
+    const int marker_style = kFullDotMedium;
+    //const int marker_style = kDot;
+
+    TGraph g1;
+    g1.SetName("PFmini");
+
+
+    while (file.GetNextRow())
+        if (Contains(vec, time))
+        {
+            g1.SetPoint(g1.GetN(), time*24*3600, H);
+        }
+    
+    g1.SetMarkerStyle(marker_style);
+    g1.SetMarkerColor(kGreen);
+    g1.DrawClone("P");
+    return 0;
+}
 
 Int_t PlotPointing(TArrayD **vec, TString fname)
@@ -420,5 +695,5 @@
     g.GetXaxis()->SetLabelSize(0.1);
     g.GetYaxis()->SetLabelSize(0.1);
-    g.GetYaxis()->SetTitle("TEMP");
+    g.GetYaxis()->SetTitle("TEMPERATURE");
     g.GetYaxis()->SetTitleOffset(0.2);
     g.GetYaxis()->SetTitleSize(0.1);
@@ -542,6 +817,7 @@
     if (!file.SetPtrAddress("Time",  &time))
         return -1;
-    if (!file.SetPtrAddress("Data1", temp) &&
-        !file.SetPtrAddress("temp", temp))
+//    if (!file.SetPtrAddress("Data1", temp) &&
+//        !file.SetPtrAddress("temp", temp))
+    if (!file.SetPtrAddress("temp", temp))
         return -1;
 
@@ -669,6 +945,14 @@
     }
 
-    TCanvas *c = new TCanvas("quality", Form("Quality %04d/%02d/%02d", y, m, d), 1280, 960);
-    c->Divide(1, 6, 1e-5, 1e-5);
+    //check if the sqm was already installed on the telescope                                                                                                       
+    TCanvas *c = NULL;
+    TString datestring = Form("%04d%02d%02d", y, m, d);
+    if( datestring.Atoi() > 20140723 ) {
+      TCanvas *c = new TCanvas("quality", Form("Quality %04d/%02d/%02d", y, m, d), 1280, 1280);
+      c->Divide(1, 8, 1e-5, 1e-5);
+    }else{
+      TCanvas *c = new TCanvas("quality", Form("Quality %04d/%02d/%02d", y, m, d), 1280, 1120);
+      c->Divide(1, 7, 1e-5, 1e-5);
+    }
 
     gROOT->SetSelectedPad(0);
@@ -716,4 +1000,5 @@
     gPad->SetRightMargin(0.001);
     gPad->SetLeftMargin(0.04);
+    gPad->SetBottomMargin(0);
     cout << PlotTemperature1(runs, fname) << endl;
     cout << PlotTemperature2(runs, fname) << endl;
@@ -721,4 +1006,45 @@
     cout << PlotTemperature4(runs, fname) << endl;
 
+    gROOT->SetSelectedPad(0);
+    c->cd(7);
+    gPad->SetGrid();
+    gPad->SetTopMargin(0);
+    gPad->SetBottomMargin(0);
+    gPad->SetRightMargin(0.001);
+    gPad->SetLeftMargin(0.04);
+    cout << PlotHumidity(runs, fname) << endl;
+    cout << PlotHumidity2(runs, fname) << endl;
+
+    //check if the sqm was already installed
+    if( datestring.Atoi() > 20140723 ) {
+      gROOT->SetSelectedPad(0);
+      c->cd(7);
+      gPad->SetGrid();
+      gPad->SetTopMargin(0);
+      gPad->SetBottomMargin(0);
+      gPad->SetRightMargin(0.001);
+      gPad->SetLeftMargin(0.04);
+      cout << PlotHumidity(runs, fname) << endl;
+      cout << PlotHumidity2(runs, fname) << endl;
+
+      gROOT->SetSelectedPad(0);
+      c->cd(8);
+      gPad->SetGrid();
+      gPad->SetTopMargin(0);
+      gPad->SetRightMargin(0.001);
+      gPad->SetLeftMargin(0.04);
+      cout << PlotSqm(runs, fname) << endl;
+    }else{
+
+      gROOT->SetSelectedPad(0);
+      c->cd(7);
+      gPad->SetGrid();
+      gPad->SetTopMargin(0);
+      gPad->SetRightMargin(0.001);
+      gPad->SetLeftMargin(0.04);
+      cout << PlotHumidity(runs, fname) << endl;
+      cout << PlotHumidity2(runs, fname) << endl;
+    }
+
     c->SaveAs(Form("%s/%04d%02d%02d.png", outpath, y, m, d));
 
Index: branches/MarsWobble/fact/processing/drstemp.C
===================================================================
--- branches/MarsWobble/fact/processing/drstemp.C	(revision 18160)
+++ branches/MarsWobble/fact/processing/drstemp.C	(revision 18278)
@@ -163,9 +163,9 @@
 
     float temp[160];
-    if (file.SetPtrAddress("temp", temp, 82))
-    {
-        drstemp82(file, beg, end);
-        return;
-    }
+//    if (file.SetPtrAddress("temp", temp, 82))
+//    {
+//        drstemp82(file, beg, end);
+//        return;
+//    }
 
     file.SetPtrAddress("temp", temp, 160);
Index: branches/MarsWobble/fact/processing/fillratescan.C
===================================================================
--- branches/MarsWobble/fact/processing/fillratescan.C	(revision 18160)
+++ branches/MarsWobble/fact/processing/fillratescan.C	(revision 18278)
@@ -48,5 +48,8 @@
 Float_t GetOffset(TString fname, Double_t beg, Double_t end)
 {
-    fname.ReplaceAll("RATE_SCAN_DATA", "FEEDBACK_DEVIATION");
+    if (end < 15937)
+        fname.ReplaceAll("RATE_SCAN_DATA", "FEEDBACK_DEVIATION");
+    else
+        fname.ReplaceAll("RATE_SCAN_DATA", "FEEDBACK_CALIBRATED_CURRENTS");
 
     fits file(fname.Data());
@@ -61,6 +64,14 @@
         return -100;
 
-    if (!file.SetPtrAddress("DeltaUser", &delta))
-        return -100;
+    if (end < 15937)
+    {
+        if (!file.SetPtrAddress("DeltaUser", &delta))
+            return -100;
+    }
+    else
+    {
+        if (!file.SetPtrAddress("U_nom", &delta))
+            return -100;
+    }
 
     //cout << "Search for: " << beg-15773 << " " << end-15773 << endl;
@@ -80,8 +91,10 @@
 Float_t GetCurrent(TString fname, Double_t beg, Double_t end)
 {
-    fname.ReplaceAll("RATE_SCAN_DATA", "CALIBRATED_CURRENTS");
-    fname = gSystem->BaseName(fname.Data());
-
-    fname.Prepend("/scratch_nfs/calibrated_currents/");
+    fname.ReplaceAll("RATE_SCAN_DATA", "FEEDBACK_CALIBRATED_CURRENTS");
+
+    //the next two lines are needed for ISDC and data before 11.3.2013
+    //fname.ReplaceAll("RATE_SCAN_DATA", "CALIBRATED_CURRENTS");
+    //fname = gSystem->BaseName(fname.Data());
+    //fname.Prepend("/scratch_nfs/calibrated_currents/");
 
     fits file(fname.Data());
@@ -326,5 +339,5 @@
         !file.SetPtrAddress(string(old ? "Data3" : "RelOnTime"), &ontime))
         return -1;
-    */
+        */
     Double_t  *ptime   = file.SetPtrAddress("Time");
     ULong64_t *pid     = file.SetPtrAddress(old ? "Data0" : "Id");
