Index: trunk/MagicSoft/Mars/macros/calibration.C
===================================================================
--- trunk/MagicSoft/Mars/macros/calibration.C	(revision 5712)
+++ trunk/MagicSoft/Mars/macros/calibration.C	(revision 5714)
@@ -83,5 +83,5 @@
 static TString outpath = "./";
 static TString inpath  = "/home/rootdata/Calib/2004_09_22";
-static TString badfile = "";
+static TString badfile;
 //static TString badfile = "badpixels_only0_388_559.dat";
 //
@@ -170,10 +170,10 @@
   pruns.AddRun(prun,inpath);
 
-  if (crun2==0)
-    cruns.AddRun(crun1,inpath);
-  else
-    cruns.AddRuns(crun1,crun2,inpath);
-
-  
+  if (crun1!=0)
+    if (crun2==0)
+      cruns.AddRun(crun1,inpath);
+    else
+      cruns.AddRuns(crun1,crun2,inpath);
+
   MStatusDisplay *display = NULL;
 
@@ -255,4 +255,7 @@
       calloop.SetExtractorCam(pedloop2.GetPedestalCam());
     }
+
+  if (crun1 == 0)
+    return 0;
 
   MPedestalCam &pedcam = pedloop1.GetPedestalCam();
@@ -509,5 +512,5 @@
   // check for the right usage of the program
   //
-  if (arg.GetNumArguments()>4)
+  if (arg.GetNumArguments()>6)
     {
       Usage();
@@ -530,13 +533,35 @@
   Int_t calr1 = 0;
   Int_t calr2 = 0;
+  Int_t datr1 = 0;
+  Int_t datr2 = 0;
 
   const Int_t nargs = arg.GetNumArguments();
 
-  if (nargs>=3)
+  if (nargs>=5)
     {
       pedr = arg.GetArgumentInt(0);
       calr1 = arg.GetArgumentInt(1);
       calr2 = arg.GetArgumentInt(2);
-      return calibration(pedr,calr1,calr2);
+      datr1 = arg.GetArgumentInt(3);
+      datr2 = arg.GetArgumentInt(4);
+      return calibration(extractorflag,pedr,calr1,calr2,datr1,datr2);
+    }
+
+  if (nargs>=4)
+    {
+      pedr = arg.GetArgumentInt(0);
+      calr1 = arg.GetArgumentInt(1);
+      calr2 = arg.GetArgumentInt(2);
+      datr1 = arg.GetArgumentInt(3);
+      datr2 = arg.GetArgumentInt(4);
+      return calibration(extractorflag,pedr,calr1,calr2,datr1,0);
+    }
+
+  if (nargs>=3)
+    {
+      pedr = arg.GetArgumentInt(0);
+      calr1 = arg.GetArgumentInt(1);
+      calr2 = arg.GetArgumentInt(2);
+      return calibration(extractorflag,pedr,calr1,calr2,0);
     }
 
@@ -548,5 +573,5 @@
       gLog << "inpath: " << inpath << endl;
       gLog << "extractor: " << extractorflag << endl;
-      return calibration();
+      return calibration(extractorflag,pedr,calr1,0,0);
     }
 
@@ -554,8 +579,8 @@
     {
       pedr = arg.GetArgumentInt(0);
-      return calibration(pedr,calr1,calr2);
-    }
-
-  return calibration(pedr,calr1,calr2);
+      return calibration(extractorflag,pedr,0);
+    }
+
+  return calibration(extractorflag,pedr,calr1,calr2);
 }
 
