Index: /trunk/MagicSoft/Mars/mmuon/MMuonCalibParCalc.cc
===================================================================
--- /trunk/MagicSoft/Mars/mmuon/MMuonCalibParCalc.cc	(revision 7007)
+++ /trunk/MagicSoft/Mars/mmuon/MMuonCalibParCalc.cc	(revision 7008)
@@ -30,62 +30,29 @@
 // Task to calculate the muon parameters
 //
-//  This class allows you to get more muon information especially useful for
+// This class allows you to get more muon information especially useful for
 // the calibration of our telescope. This class store the information into the
 // container of MMuonCalibPar. 
 //
-//  In order to make this class work, we need the information of the arc
+// In order to make this class work, we need the information of the arc
 // center and the radius. Therefore, we need to use the task of 
 // MMuonSearchParCalc.
+// In the second step two histograms has to be filled for every muon.
+// This is made by MHSingleMuon (look there for more information).
 //
-//  You can use this class such as the followings;
+// The calculation of Muon parameters works as the followings;
 //
 //   MTaskList tlist;
 //   MMuonSearchParCalc musearchcalc;
+//   MFillH fillmuon("MHSingleMuon", "", "FillMuon");
 //   MMuonCalibParCalc mucalibcalc;
 //   tlist.AddToList(&musearchcalc);
+//   tlist.AddToList(&fillmuon);
 //   tlist.AddToList(&mucalibcalc);.
 //
-//  You may change the allowed region to estimate muon parameters such as 
-// Muon SIZE and ARC LENGTH. The default value is 60 mm (0.2 deg.). If the
-// estimated radius of the arc is 1.0 degree, we take the photons in the 
-// radius range from 0.8 to 1.2 degrees. You can change this value such as
-// the followings;
 //
-//   mucalibcalc.SetMargin(60.);
+// For a faster coputation, pre cuts to select the candidates
+// of muons for the calibration should be done. It is already implemented
+// in star. You can set the values in star.rc.
 //
-//  You can retrieve the histogram (TH1F) using the function of GetHistPhi() 
-// (also GetHistWid()). Therefore, you can draw the histogram such as
-//
-//   MParList  plist;
-//   MMuonCalibPar muparcalib;
-//   plist.AddToList(&muparcalib);.
-//   muparcalib.GetHistPhi().Draw();.
-//
-//  In order to use another information of muons such as the center position 
-// of the estimated circle, the radius of the circle. Use the infomation 
-// stored in MMuonSearchPar. 
-//
-// 
-// // For the faster computation, by default, the calculation of impact
-// // parameter is suppressed. If you want to calculate the impact parameter
-// // from the muon image, you can use the function of EnableImpactCalc(),
-// // namely;
-// // 
-// //   mucalibcalc.EnableImpactCalc();.
-//
-//  In addition, for the faster comutation, pre cuts to select the candidates
-// of muons for the calibration is done. You can set the values using the
-// function of SetPreCuts. This function takes 5 variables. They correspond
-// to the cur for the Arc Radius (low and high), the deviation of the fit
-// (high), the Muon Size (low) and Arc Phi (low). You can set them such as 
-//
-//   mucalibcalc.SetPreCuts(180., 400., 50., 2000., 180.);
-// 
-//  If you want to disable the pre cuts, you can disable it by using the 
-// function of DisablePreCuts(), namely;
-//  
-//   mucalibcalc.DisablePreCuts();.
-//
-// 
 // ### TODO ###
 //  Up to now, in the histogram the error of the signal is estimated from
@@ -95,5 +62,5 @@
 // the pedestal is not taken into accout. The error treatment should be
 // done correctly.
-// 
+//
 //
 //  Input Containers:
@@ -186,5 +153,5 @@
 Int_t MMuonCalibParCalc::Process()
 {
-    // Calculation of Arc Phi etc...
+    // Calculation of ArcPhi, ArcWidth and MuonSize.
     const Float_t thresphi   = fMuonSetup->GetThresholdArcPhi();
     const Float_t threswidth = fMuonSetup->GetThresholdArcWidth();
@@ -202,15 +169,21 @@
     fMuonCalibPar->SetMuonSize(fHist->GetHistPhi().Integral());
 
-    // Calculate Arc Length
+    // Calculate ArcPhi
     fMuonCalibPar->SetPeakPhi(peakphi);
     fMuonCalibPar->SetArcPhi(arcphi);
 
-    const Float_t conv = TMath::RadToDeg()*fGeomCam->GetConvMm2Deg();
-    fMuonCalibPar->SetArcLength(fMuonCalibPar->GetArcPhi()*fMuonSearchPar->GetRadius()*conv);
+//    const Float_t conv = TMath::RadToDeg()*fGeomCam->GetConvMm2Deg();
+//    fMuonCalibPar->SetArcLength(fMuonCalibPar->GetArcPhi()
+//                                *fMuonSearchPar->GetRadius()*conv);
 
-    // Calculation of Arc Width etc...
+    // Calculation of ArcWidth etc...
     fMuonCalibPar->SetChiArcWidth(chi);
     fMuonCalibPar->SetArcWidth(width);
 
+    // Check if this is a 'Write-Out' candidate
+    if (fMuonCalibPar->GetArcPhi()>160    && fMuonSearchPar->GetRadius()<400 &&
+        fMuonSearchPar->GetDeviation()<50 && fMuonSearchPar->GetRadius()>170)
+        fMuonCalibPar->SetReadyToSave();
+
     return kTRUE;
 }
