Index: trunk/MagicSoft/Mars/mtemp/MFindStars.cc
===================================================================
--- trunk/MagicSoft/Mars/mtemp/MFindStars.cc	(revision 4705)
+++ trunk/MagicSoft/Mars/mtemp/MFindStars.cc	(revision 4706)
@@ -120,16 +120,4 @@
   UInt_t numPixels = geom->GetNumPixels();
   
-  // fix the correlation if requested
-  if ( find->GetUseCorrelatedGauss() && find->GetFixCorrelation() )
-  {
-    Double_t tandel;
-    if (par[1] != 0.0)
-      tandel = par[3]/par[1];
-    else
-      tandel = 1.e10;
-    Double_t cxx = par[2]*par[2];
-    Double_t cyy = par[4]*par[4];
-    par[5] =   tandel/(tandel*tandel-1.0) * (cyy-cxx)/sqrt(cxx*cyy);
-  }
 
 //calculate chisquare
@@ -205,5 +193,4 @@
   fNumVar = 6;
   fUseCorrelatedGauss = kTRUE;
-  fFixCorrelation     = kFALSE;
 
   fNumIntegratedEvents=0;
@@ -287,16 +274,13 @@
 //-------------------------------------------------------------------------
 //
-// Set 'fUseCorrelatedGauss' and 'fFixCorrelation'  flag
+// Set 'fUseCorrelatedGauss' flag
 //
 //     if 'fUseCorrelatedGauss' is TRUE a 2dim Gaussian with correlation
 //                                 will be fitted
-//     if 'fFixCorrelation' is TRUE the orientation of the 2dim Gaussian
-//                             will be kept fixed at the angle delta,
-//                             where tan(delta) = ymean/xmean
-
-void MFindStars::SetUseCorrelatedGauss(Bool_t usecorrgauss, Bool_t fixcorr)
+//
+
+void MFindStars::SetUseCorrelatedGauss(Bool_t usecorrgauss)
 {
   fUseCorrelatedGauss = usecorrgauss;
-  fFixCorrelation   = fixcorr;
 
   if (usecorrgauss)
@@ -445,6 +429,10 @@
       TIter Next(fStars->GetList());
       while ((starpos=(MStarPos*)Next())) {
-	starpos->SetCalcValues(40,40,starpos->GetXExp(),starpos->GetYExp(),fRingInterest/2,fRingInterest/2);
-	starpos->SetFitValues (40,40,starpos->GetXExp(),starpos->GetYExp(),fRingInterest/2,fRingInterest/2,0.,-1);
+	//starpos->SetCalcValues(40,40,starpos->GetXExp(), starpos->GetYExp(),
+        //                       fRingInterest/2,          fRingInterest/2,
+        //                       0.,   0., 0., 0.);
+	//starpos->SetFitValues (40,40,starpos->GetXExp(), starpos->GetYExp(),
+        //                       fRingInterest/2,          fRingInterest/2, 0.,
+        //                       0., 0., 0.,   0., -1);
       }
 
@@ -483,11 +471,19 @@
 	
 	while(FindPixelWithMaxDC(maxPixelDC, maxPixel)) {
-	  
 	  MStarPos *starpos = new MStarPos;
-	  starpos->SetExpValues(maxPixelDC,maxPixel.GetX(),maxPixel.GetY());
-	  starpos->SetCalcValues(maxPixelDC,maxPixelDC,maxPixel.GetX(),maxPixel.GetY(),fRingInterest/2,fRingInterest/2);
-	  starpos->SetFitValues(maxPixelDC,maxPixelDC,maxPixel.GetX(),maxPixel.GetY(),fRingInterest/2,fRingInterest/2,0.,-1);
+
+  	  starpos->SetExpValues(maxPixelDC,maxPixel.GetX(),maxPixel.GetY());
+
+	  //starpos->SetCalcValues(maxPixelDC,      maxPixelDC,
+          //                       maxPixel.GetX(), maxPixel.GetY(),
+          //                       fRingInterest/2, fRingInterest/2,
+          //                       0.,   0., 0., 0.);
+
+	  //starpos->SetFitValues(maxPixelDC,      maxPixelDC,
+          //                      maxPixel.GetX(), maxPixel.GetY(),
+          //                      fRingInterest/2, fRingInterest/2, 0.,
+          //                      0., 0., 0.,      0., -1);
+
 	  fStars->GetList()->Add(starpos);
-	  
 	  ShadowStar(starpos);
 	}	
@@ -792,13 +788,15 @@
   Float_t expY = star->GetYExp();
 
-  Float_t max=0;
-  UInt_t  pixmax=0;
-  Float_t meanX=0;
-  Float_t meanY=0;
-  Float_t meanSqX=0;
-  Float_t meanSqY=0;
-  Float_t sumCharge=0;
-  UInt_t  usedInnerPx=0;	
-  UInt_t  usedOuterPx=0;	
+  Float_t max         =0;
+  UInt_t  pixmax      =0;
+  Float_t meanX       =0;
+  Float_t meanY       =0;
+  Float_t meanSqX     =0;
+  Float_t meanSqY     =0;
+  Float_t sumCharge   =0;
+  Float_t sumSqCharge =0;
+  UInt_t  usedInnerPx =0;	
+  UInt_t  usedOuterPx =0;	
+  Float_t factor = 1.0;
 
   Float_t meanXold = 1.e10;
@@ -882,4 +880,5 @@
       meanSqY     = 0.0;
       sumCharge   = 0.0;
+      sumSqCharge = 0.0;
       usedInnerPx =   0;	
       usedOuterPx =   0;	
@@ -905,5 +904,6 @@
 	      meanSqX   += charge*pixXpos*pixXpos;
 	      meanSqY   += charge*pixYpos*pixYpos;
-	      sumCharge += charge;
+	      sumCharge   += charge;
+	      sumSqCharge += charge*charge;
 	    }
 	} 
@@ -915,4 +915,5 @@
       meanSqX /= sumCharge;
       meanSqY /= sumCharge;
+      factor = sqrt( sumSqCharge/(sumCharge*sumCharge) );
 
       // stop iteration when (meanX, meanY) becomes stable
@@ -962,4 +963,8 @@
     }
   
+  Float_t deltameanX = factor * rmsX;
+  Float_t deltameanY = factor * rmsY;
+
+
   // Substrack pedestal DC
   sumCharge-= (usedInnerPx*innerped+usedOuterPx*outerped)/(usedInnerPx+usedOuterPx);
@@ -967,5 +972,6 @@
   
   
-  star->SetCalcValues( sumCharge, max, meanX, meanY, rmsX, rmsY);
+  star->SetCalcValues( sumCharge, max, meanX, meanY, rmsX, rmsY,
+                       0.,   deltameanX*deltameanX, 0., deltameanY*deltameanY);
   
   if (rmsX <= 0. || rmsY <= 0.)
@@ -1004,11 +1010,4 @@
     }
 
-    // set the correlation fixed if requested
-    if (fUseCorrelatedGauss && fFixCorrelation)
-    {
-      fStep[5] = 0.0;
-      fFix[5]  = 1;
-    }
-
 
     // -------------------------------------------
@@ -1053,5 +1052,5 @@
       Double_t sigmaY,   sigmaYError;
       Float_t  chisquare = GetChisquare();
-      Int_t    dregrees  = GetDegreesofFreedom()-fNumVar;
+      Int_t    degrees  = GetDegreesofFreedom()-fNumVar;
 
       if (!ierflg)
@@ -1078,15 +1077,12 @@
       }
 
-      //rwagner: get error matrix
+      // get error matrix
       Double_t matrix[5][5];
       gMinuit->mnemat(&matrix[0][0],5);
 
       star->SetFitValues(integratedCharge,maxFit,       meanXFit,    meanYFit,
-                         sigmaX,          sigmaY,       chisquare,   dregrees,
-  	          	 matrix[1][1],    matrix[1][3], matrix[3][3]);
-
-      // set the results from the correlated Gauss fit to zero
-      star->SetCGFitValues(100.0,  100.0,  0.0, 0.0,  0.0,   0.0,  0.0,
-  	       	           0.0,      0.0,  0.0, 0.0,   -1);
+                         sigmaX,          sigmaY,       0.0,
+      	          	 matrix[1][1],    matrix[1][3], matrix[3][3],
+                         chisquare,   degrees);
     }
     //----------  for the uncorrelated Gauss fit (end)   ---------    
@@ -1180,5 +1176,5 @@
       if (fMinuitPrintOutLevel>=0)
       {
-        *fLog << "Before calling SetCGFitValues : " << endl; 
+        *fLog << "Before calling SetFitValues : " << endl; 
         *fLog << "fValues = " << fValues[0] << ",  " << fValues[1] << ",  "
               << fValues[2] << ",  " << fValues[3] << ",  " << fValues[4]
@@ -1215,11 +1211,8 @@
       }
 
-      star->SetCGFitValues(charge,       fValues[0],  fValues[1], fValues[3],
-                           fValues[2],   fValues[4],  fValues[5],
-  	       	           matrix[1][1], matrix[1][3],matrix[3][3],
-                           chi2,         ndof);
-      // set the results from the uncorrelated Gauss fit to zero
-      star->SetFitValues(100.0, 100.0,  0.0, 0.0,  0.0, 0.0,  0.0, -1,
-                           0.0, 0.0, 0.0);
+      star->SetFitValues(charge,       fValues[0],  fValues[1], fValues[3],
+                         fValues[2],   fValues[4],  fValues[5],
+  	       	         matrix[1][1], matrix[1][3],matrix[3][3],
+                         chi2,         ndof);
     }
 
@@ -1248,5 +1241,6 @@
         Float_t starYpos = star->GetMeanY();
 
-        Float_t starSize = 3*star->GetSigmaMajorAxis();      
+        Float_t starSize = 3*sqrt(   star->GetSigmaX()*star->GetSigmaX()
+				   + star->GetSigmaY()*star->GetSigmaY() );
         
 	Float_t dist = sqrt((pixXpos-starXpos)*(pixXpos-starXpos)+
Index: trunk/MagicSoft/Mars/mtemp/MFindStars.h
===================================================================
--- trunk/MagicSoft/Mars/mtemp/MFindStars.h	(revision 4705)
+++ trunk/MagicSoft/Mars/mtemp/MFindStars.h	(revision 4706)
@@ -60,5 +60,4 @@
     
     Bool_t fUseCorrelatedGauss;
-    Bool_t fFixCorrelation;
 
     TString *fVname;
@@ -88,8 +87,6 @@
     Int_t PostProcess();
 
-    void SetUseCorrelatedGauss(Bool_t usecorrgauss = kTRUE,
-                               Bool_t fixcorr      = kFALSE);
+    void SetUseCorrelatedGauss(Bool_t usecorrgauss = kTRUE);
     Bool_t  GetUseCorrelatedGauss()          {return fUseCorrelatedGauss;}
-    Bool_t  GetFixCorrelation()              {return fFixCorrelation;}
 
     // setters
Index: trunk/MagicSoft/Mars/mtemp/MSourceDirections.cc
===================================================================
--- trunk/MagicSoft/Mars/mtemp/MSourceDirections.cc	(revision 4705)
+++ trunk/MagicSoft/Mars/mtemp/MSourceDirections.cc	(revision 4706)
@@ -90,10 +90,14 @@
   } 
 
+
   fStars = (MStarCam*)pList->FindCreateObj(AddSerialNumber("MStarCam"),"MSourceCam");
   if (!fStars) {
-    *fLog << err << AddSerialNumber("MStarCam") << " cannot be created ... aborting" << endl;
+    *fLog << err << AddSerialNumber("MStarCam") << " with name '"
+          << "MSourceCam" << " cannot be created ... aborting" << endl;
     return kFALSE;
   }
   
+
+
   MObservatory magic1;
   
@@ -110,5 +114,5 @@
   fAstro.SetGeom(*geom);	
   fAstro.SetObservatory(magic1);  
-    
+
   return kTRUE;
 }
@@ -116,10 +120,9 @@
 Int_t MSourceDirections::AddDirection(Float_t ra, Float_t dec, Float_t mag, TString name) 
 {
+  *fLog << "MSourceDirections::AddDirection; add the direction : ra, dec, mag, name = " 
+        << ra << ",  " << dec << ",  " << mag << ",  " << name << endl;
+
   Int_t rc = fAstro.AddObject(ra,dec,1,name);
-  if (rc) {
-    MStarPos *starpos = new MStarPos;
-    starpos->SetName(name);
-    fStars->GetList()->Add(starpos);
-  }
+
   return rc;
 }
@@ -127,5 +130,5 @@
 Int_t MSourceDirections::Process()
 {
-  //Fist delete the previous directions in the list
+  //First delete the previous directions in the list
   fStars->GetList()->Delete();
 
@@ -137,8 +140,10 @@
   TIter Next(fStars->GetList());
   while ((starpos=(MStarPos*)Next())) {
-    starpos->SetCalcValues(40,40,starpos->GetXExp(),starpos->GetYExp(),0.,0.);
-    starpos->SetFitValues (40,40,starpos->GetXExp(),starpos->GetYExp(),0.,0.,0.,1);
+    //starpos->SetCalcValues(40,40,starpos->GetXExp(),starpos->GetYExp(),
+    //                       0.,0.,0.,    0.,0.,0.);
+    //starpos->SetFitValues (40,40,starpos->GetXExp(),starpos->GetYExp(),
+    //                       0.,0.,0.,    0.,0.,0.,  0., -1);
   }
-    
+
   if (fStars->GetList()->GetSize() == 0) {
     *fLog << err << GetName() << "No directions inside the chosen FOV." << endl;
@@ -154,2 +159,3 @@
   return kTRUE;
 }
+
