Index: /trunk/MagicSoft/Mars/macros/ONOFFAnalysis.C
===================================================================
--- /trunk/MagicSoft/Mars/macros/ONOFFAnalysis.C	(revision 3597)
+++ /trunk/MagicSoft/Mars/macros/ONOFFAnalysis.C	(revision 3598)
@@ -170,10 +170,19 @@
 
       //-----------------------------------------------
+      //TString tag = "040126";
+      TString tag = "040127";
+      //TString tag = "040215";
+
       //const char *offfile = "~magican/ct1test/wittek/offdata.preproc"; 
       //const char *offfile = "20040126_OffCrab_"; 
       //const char *offfile  = "*.OFF";
       //const char *offfile  = "12776.OFF";
+      // 27 Jan 04
       //const char *offfile  = "12*.OFF";
+      // 26 Jan 04
+      //const char *offfile  = "*.OFF";
+      // 15 Feb 04
       const char *offfile  = "*.OFF";
+
 
       //const char *onfile  = "~magican/ct1test/wittek/mkn421_on.preproc"; 
@@ -182,7 +191,12 @@
       //const char *onfile  = "MCerPhot_output";
       //const char *onfile  = "*.ON";
-      //const char *onfile  = "12162*.ON";
+      const char *onfile  = "1216*.ON";
+      // 27 Jan 04
       //const char *onfile  = "12*.ON";
-      const char *onfile  = "*.ON";
+      // 26 Jan 04
+      //const char *onfile  = "*.ON";
+      // 15 Feb 04
+      //const char *onfile  = "*.ON";
+
 
      const char *mcfile  = "/data/MAGIC/mc_eth/magLQE_3/gh/0/0/G_M0_00_0_550*.root";
@@ -197,11 +211,25 @@
       //TString inPath = "~wittek/datacrab_26feb04/";
      //TString inPath = "/.magic/magicserv01/scratch/David/CalibratedRuns/";
-     //TString inPath = "/.magic/magicserv01/scratch/calibrated/";
-     TString inPath = "/.magic/magicserv01/scratch/calibrated26/";
+     // 26 Jan 04, Hendrik
+     if (tag == "040126")
+       TString inPath = "/.magic/magicserv01/scratch/calibrated26/";
+
+     // 27 Jan 04, Hendrik
+     if (tag == "040127")
+        TString inPath = "/.magic/magicserv01/scratch/calibrated/";
+
+     // 27 Jan 04, David
+     //if (tag == "040127")
+     //TString inPath = "/mnt/magicserv01/scratch/David/CalibratedData/Crab/2004_01_27/";
+
+     // 15 Feb 04, David
+     if (tag == "040215")
+       TString inPath = "/mnt/magicserv01/scratch/David/CalibratedData/Crab/2004_02_15/";
+   
 
       // path for output from Mars
       //TString outPath = "~wittek/datacrab_feb04/";
      //TString outPath = "~wittek/datacrab_01march04/";
-      TString outPath = "~wittek/datacrab_04mar04/";
+      TString outPath = "~wittek/datacrab_19mar04/";
 
       //-----------------------------------------------
@@ -352,6 +380,6 @@
     //--------------------------------------------------
     // type of data to be padded 
-    //TString typeInput = "ON";
-    TString typeInput = "OFF";
+    TString typeInput = "ON";
+    //TString typeInput = "OFF";
     //TString typeInput = "MC";
     gLog << "typeInput = " << typeInput << endl;
@@ -368,13 +396,13 @@
 
     // name of output root file
-    if (typeInput == "ON")
-      TString file(onfile);
-    else if (typeInput == "OFF")
-      TString file(offfile);
-    else if (typeInput == "MC")
-      TString file(mcfile);
+    //if (typeInput == "ON")
+    //  TString file(onfile);
+    //else if (typeInput == "OFF")
+    //  TString file(offfile);
+    //else if (typeInput == "MC")
+    //  TString file(mcfile);
 
     TString outNameImage = outPath;
-    outNameImage += file;
+    outNameImage += tag;
     outNameImage += "Hillas";
     outNameImage += typeInput;
@@ -711,10 +739,31 @@
     if (typeInput == "ON")
     {
-      sourcefromstar.SetSourceAndStarPosition("Crab", 22, 0, 52, 5, 34, 32,
-    					"Zeta-Tau", 21, 8, 33, 5, 37, 38.7);
-      sourcefromstar.AddFile("~wittek/datacrab_26feb04/positionsOn.4.txt", 0);
+      sourcefromstar.SetSourceAndStarPosition(
+                               "Crab", 22,  0, 52, 5, 34, 32.0,
+      			   "Zeta-Tau", 21,  8, 33, 5, 37, 38.7);
+      sourcefromstar.AddStar("Tau114", 21, 56, 13, 5, 27, 38.1);
+      //sourcefromstar.AddFile("~wittek/datacrab_26feb04/positionsOn.4.txt",0);
+
+      if(inPath == "/.magic/magicserv01/scratch/calibrated/")
+      {
+        sourcefromstar.AddFile("~wittek/datacrab_26feb04/positions2stars.txt", 0);
+        //sourcefromstar.AddFile("~wittek/datacrab_26feb04/positionsNoStar.txt", 0);
+      }
+      else if(inPath == "/.magic/magicserv01/scratch/calibrated26/")
+        sourcefromstar.AddFile("~wittek/datacrab_26feb04/stars_2004_01_26", 0);
+
+      else if(inPath == "/mnt/magicserv01/scratch/David/CalibratedData/Crab/2004_02_15/")
+        sourcefromstar.AddFile("~wittek/datacrab_26feb04/positions040215.txt", 0);
     }
     else if (typeInput == "OFF")
-      sourcefromstar.AddFile("~wittek/datacrab_26feb04/positionsOff.txt", 0);
+    {
+      if(inPath == "/.magic/magicserv01/scratch/calibrated/")
+        sourcefromstar.AddFile("~wittek/datacrab_26feb04/positionsOff.txt", 0);
+      else if(inPath == "/.magic/magicserv01/scratch/calibrated26/")
+        sourcefromstar.AddFile("~wittek/datacrab_26feb04/positions_2004_01_26", 0);
+      else if(inPath == "/mnt/magicserv01/scratch/David/CalibratedData/Crab/2004_02_15")
+        sourcefromstar.AddFile("~wittek/datacrab_26feb04/positions040215.txt", 0);
+    }
+
 
     //MBlindPixelCalc blindbeforepad;
@@ -729,8 +778,9 @@
     MSigmabarCalc sigbar;
 
-    MBadPixelCalcRms blind;
+    //MBadPixelCalcRms blind;
+    MBlindPixelsCalc2 blind;
     //blind.SetUseBlindPixels();
     blind.SetUseInterpolation();
-    blind.SetCheckPedestalRMS();
+    blind.SetCheckPedestalRms();
     blind.SetName("BlindAfterPadding");
 
@@ -748,5 +798,5 @@
 
     MImgCleanStd    clean(3.0, 2.5);
-    clean.SetMethod(MImgCleanStd::kDemocratic);
+    //clean.SetMethod(MImgCleanStd::kDemocratic);
     clean.SetCleanRings(3); 
 
@@ -785,5 +835,5 @@
     selstandard.SetHillasName(fHilName);
     selstandard.SetImgParName(fImgParName);
-    selstandard.SetCuts(300, 6, 3000, 0.0, 1.1, 0.001, 0.001);
+    selstandard.SetCuts(200, 5, 200, 0.0, 5.0, 0.1, 0.07);
     MContinue contstandard(&selstandard);
     contstandard.SetName("SelStandard");
Index: /trunk/MagicSoft/Mars/manalysis/MSourcePosfromStarPos.cc
===================================================================
--- /trunk/MagicSoft/Mars/manalysis/MSourcePosfromStarPos.cc	(revision 3597)
+++ /trunk/MagicSoft/Mars/manalysis/MSourcePosfromStarPos.cc	(revision 3598)
@@ -88,10 +88,11 @@
     fdPhiTel.Set(fSize);
 
-    fDecStar.Set(1);
-    fRaStar.Set(1);
-    fxStar.ResizeTo(1,fSize);
-    fyStar.ResizeTo(1,fSize);
-    fdxStar.ResizeTo(1,fSize);
-    fdyStar.ResizeTo(1,fSize);
+    Int_t fRows = 1;
+    fDecStar.Set(fRows);
+    fRaStar.Set(fRows);
+    fxStar.ResizeTo(fRows,fSize);
+    fyStar.ResizeTo(fRows,fSize);
+    fdxStar.ResizeTo(fRows,fSize);
+    fdyStar.ResizeTo(fRows,fSize);
 
     fStars = 0;
@@ -194,5 +195,5 @@
 
   // convert into radians
-  fStars = fDecStar.GetSize() + 1;
+  fStars += 1;
   fDecStar.Set(fStars);
   fRaStar.Set(fStars);
@@ -274,4 +275,8 @@
 
       *fLog << "read data" << endl;
+
+      // read "fStarsRead" = no.of (x,y) pairs to be read
+      *fIn >> fStarsRead;
+
       while (1)
       {
@@ -294,5 +299,6 @@
     if (fDecSource == 0.0  ||  fRaSource == 0.0  ||  fStars == 0) 
     {
-      *fLog << warn << "MSourcePosfromStarPos::PreProcess; there are no sky coordinates defined for the source or from stars; fStars = " << fStars 
+      *fLog << warn << "MSourcePosfromStarPos::PreProcess; there are no sky coordinates defined for the source or from stars; fStars, fStarsRead = " 
+            << fStars << ",  " << fStarsRead 
             << endl;
     }
@@ -482,4 +488,6 @@
 Bool_t MSourcePosfromStarPos::ReInit(MParList *pList)
 {
+  //if (1 == 1) return kTRUE;
+
 
   Int_t run = fRun->GetRunNumber();
@@ -519,5 +527,5 @@
 
       
-      if (fStars > 0)
+      if (fStars > 0  && fStars == fStarsRead)
       {
         TArrayD xStar(fxStar.GetNrows());
@@ -624,10 +632,7 @@
 void MSourcePosfromStarPos::FixSize()
 {
-  *fLog << "MSourcePosfromStarPos::FixSize; fix size of arrays : fRuns = "
-        << fRuns << ",  fStars = " << fStars << endl;
-  *fLog << "       first run : " << fRunNr[0] << ",  last run : "
-        << fRunNr[fRuns-1] << endl;
-
     fSize = fRuns;
+    if (fRuns <= 0)
+      fSize = 1;
 
     fRunNr.Set(fSize);
@@ -639,10 +644,14 @@
 
     Int_t fRows = fxStar.GetNrows();
-    if (fRows <= 0)
-      fRows = 1;
     fxStar.ResizeTo(fRows, fSize);
     fyStar.ResizeTo(fRows, fSize);
     fdxStar.ResizeTo(fRows, fSize);
     fdyStar.ResizeTo(fRows, fSize);
+
+  *fLog << "MSourcePosfromStarPos::FixSize; fix size of arrays : fStars = "
+        << fStars << ",  fRuns = " << fRuns << ",  fRows = " << fRows
+        << ",  fSize = " << fSize << endl;
+  *fLog << "       first run : " << fRunNr[0] << ",  last run : "
+        << fRunNr[fRuns-1] << endl;
 }
 
@@ -657,5 +666,5 @@
 
   // extend size of arrays if necessary
-  if ( fRuns >= (fSize-1) )
+  if ( fRuns >= fSize )
   {
     fSize += 100;
@@ -669,10 +678,11 @@
     
     Int_t fRows = fxStar.GetNrows();
-    if (fRows <= 0)
-      fRows = 1;
     fxStar.ResizeTo(fRows, fSize);
     fyStar.ResizeTo(fRows, fSize);
     fdxStar.ResizeTo(fRows, fSize);
     fdyStar.ResizeTo(fRows, fSize);
+
+    *fLog << "MSourcePosfromStarPos::ReadData(); size of arrays has been increased to (fRows, fSize) = ("
+          << fRows << ",  " << fSize << ")" << endl;
   }
 
@@ -694,4 +704,5 @@
   //*fIn >> val;
   //-------------------
+
 
 
@@ -700,6 +711,9 @@
     *fIn >> ival;
 
+    if (fIn->eof())
+      return;
+
     // run number must be greater than 10000
-    if (fabs((Double_t)ival) < 10000)
+    if (fabs(ival) < 10000)
     {
       *fLog << err << "===========> Error when reading file with theta and phi <========="
@@ -711,5 +725,5 @@
 
   fRuns += 1;
-  //*fLog << fRuns <<"th run : " << ival << endl;  
+  *fLog << fRuns <<"th run : " << ival << endl;  
 
   fRunNr.AddAt(ival, fRuns-1);
@@ -755,34 +769,22 @@
   // input is in [deg], convert to [mm]
 
-  //*fLog << "ReadData : fStars = " << fStars << endl;
-  for (Int_t i=0; i<fStars; i++)
-  {
-    *fIn >> val;
-    //fxStar(i, fRuns-1) = val / fMm2Deg;
-    fxStar(i, fRuns-1) = val;
-    //*fLog << "val, fxStar(i, fRuns-1) = " << val << ",  "
-    //      << fxStar(i, fRuns-1) << endl;
-
-    *fIn >> val;
-    //fyStar(i, fRuns-1) = val / fMm2Deg;
-    fyStar(i, fRuns-1) = val;
-    //*fLog << "val, fyStar(i, fRuns-1) = " << val << ",  "
-    //      << fyStar(i, fRuns-1) << endl;
-
-
-    //*fIn >> val;
-    //*fLog << "y=dxStar = " << val << endl;
-
-    //fdxStar(i, fRuns-1) = val / fMm2Deg;
-    //fdxStar(i, fRuns-1) = val;
-    fdxStar(i, fRuns-1) = 1.0;
-    //*fIn >> val;
-    //*fLog << "y=dyStar = " << val << endl;
-
-    //fdyStar(i, fRuns-1) = val / fMm2Deg;
-    //fdyStar(i, fRuns-1) = val;
-    fdyStar(i, fRuns-1) = 1.0;
-  }
-
+  //*fLog << "ReadData : fStarsRead = " << fStarsRead << endl;
+
+    for (Int_t i=0; i<fStarsRead; i++)
+    {
+      *fIn >> val;
+      if (i<fStars) fxStar(i, fRuns-1) = val;
+
+      *fIn >> val;
+      if (i<fStars) fyStar(i, fRuns-1) = val;
+
+      //*fIn >> val;
+      // if (i < fStars) fdxStar(i, fRuns-1) = val;
+      if (i < fStars) fdxStar(i, fRuns-1) = 1.0;
+
+      //*fIn >> val;
+      // if (i < fStars) fdyStar(i, fRuns-1) = val;
+      if (i < fStars) fdyStar(i, fRuns-1) = 1.0;
+    }
 }
 
Index: /trunk/MagicSoft/Mars/manalysis/MSourcePosfromStarPos.h
===================================================================
--- /trunk/MagicSoft/Mars/manalysis/MSourcePosfromStarPos.h	(revision 3597)
+++ /trunk/MagicSoft/Mars/manalysis/MSourcePosfromStarPos.h	(revision 3598)
@@ -53,4 +53,5 @@
     Int_t   fSize;                // final   number of runs
     Int_t   fStars;               // number of stars
+    Int_t   fStarsRead;           // number of (x,y) pairs to be read
 
 
