Index: /trunk/MagicSoft/Mars/Changelog
===================================================================
--- /trunk/MagicSoft/Mars/Changelog	(revision 5330)
+++ /trunk/MagicSoft/Mars/Changelog	(revision 5331)
@@ -20,4 +20,23 @@
 
                                                  -*-*- END OF LINE -*-*-
+
+ 2004/11/01: Markus Meyer and Keiichi Mase
+
+   * mmuon/MMuonCalibParCalc.[h,cc],
+     - changed according to Thomas Bretz's suggestion.
+       The main part of the calculation is moved from MMuonCalibPar to 
+       MMuonCalibParCalc.
+
+     - changed. The function of the UseCleanForWidth is removed since we found 
+       that we should get the Arc Width with uncleaned images.
+
+   * mmuon/MMuonSearchPar.[h,cc]
+     - changed according to Thomas Bretz's suggestion.
+       The pointer of the funciotn is changed to the reference.
+
+   * mmuon/MMuonCalibPar.[h,cc],
+     - changed according to Thomas Bretz's suggestion as written above.
+
+
 
  2004/11/01: Abelardo Moralejo
Index: /trunk/MagicSoft/Mars/mmuon/MMuonCalibPar.h
===================================================================
--- /trunk/MagicSoft/Mars/mmuon/MMuonCalibPar.h	(revision 5330)
+++ /trunk/MagicSoft/Mars/mmuon/MMuonCalibPar.h	(revision 5331)
@@ -10,5 +10,4 @@
 #endif
 
-class MGeomCam;
 class MCerPhotEvt;
 class MMuonSearchPar;
@@ -29,5 +28,10 @@
   Float_t fArcPhiThres;   // The threshold value to define arc phi
   Float_t fArcWidthThres; // The threshold value to define arc width
-  Int_t   fArcPhiBinNum;  // The bin number for the histogram of arc phi. You may change this value. However, if you change this, YOU ALSO HAVE TO CHANGE THE THRESHOLD VALUE TO GET ARC LENGTH.
+
+public:
+  MMuonCalibPar(const char *name=NULL, const char *title=NULL);
+  ~MMuonCalibPar();
+  
+  Int_t   fArcPhiBinNum;         // The bin number for the histogram of arc phi. You may change this value. However, if you change this, YOU ALSO HAVE TO CHANGE THE THRESHOLD VALUE TO GET ARC LENGTH.
   Int_t   fArcWidthBinNum;       // The bin number for the histogram of arc wid
   Float_t fArcPhiHistStartVal;   // The starting value for the histogram of arc phi
@@ -35,14 +39,7 @@
   Float_t fArcWidthHistStartVal; // The starting value for the histogram of arc width
   Float_t fArcWidthHistEndVal;   // The end value for the histogram of arc width
-  Bool_t fEnableImpactCalc;      // If true, the impact calculation will be done, which will consume a lot of time.
-  Bool_t fDisablePreCuts;        // If true, the pre cuts to select muons for the calibration will be disabled.
-  Bool_t fUseCleanForWidth;      // If true, the only signal after image cleaningwill be used for the histogram of arc width
 
-  TH1F *fHistPhi;      // Histogram of photon distribution along the arc.
-  TH1F *fHistWidth;    // Histogram of radial photon distribution of the arc.
-  
-public:
-  MMuonCalibPar(const char *name=NULL, const char *title=NULL);
-  ~MMuonCalibPar();
+  TH1F *fHistPhi;   // Histogram of photon distribution along the arc.
+  TH1F *fHistWidth; // Histogram of radial photon distribution of the arc.
   
   void Reset();
@@ -65,5 +62,14 @@
   TH1F    *GetHistWidth()     { return fHistWidth; }
   
+  void    SetArcLength(Float_t len)       { fArcLength = len; }
+  void    SetArcPhi(Float_t phi)          { fArcPhi = phi; }
+  void    SetArcWidth(Float_t wid)        { fArcWidth = wid; }
+  void    SetChiArcPhi(Float_t chi)       { fChiArcPhi = chi; }
+  void    SetChiArcWidth(Float_t chi)     { fChiArcWidth = chi; }
   void    SetMargin(Float_t margin)       { fMargin = margin; }
+  void    SetMuonSize(Float_t size)       { fMuonSize = size; }
+  void    SetEstImpact(Float_t impact)    { fEstImpact = impact; }
+  void    SetUseUnmap()                   { fUseUnmap = kTRUE; }
+  void    SetPeakPhi(Float_t phi)         { fPeakPhi = phi; }
   void    SetArcPhiThres(Float_t thres)   { fArcPhiThres = thres; }
   void    SetArcWidthThres(Float_t thres) { fArcWidthThres = thres; }
@@ -71,24 +77,6 @@
   void    SetArcWidthBinNum(Int_t num)    { fArcWidthBinNum = num; }
   
-  void    EnableImpactCalc()   { fEnableImpactCalc = kTRUE; }
-  Bool_t  IsEnableImpactCalc() { return fEnableImpactCalc; }
-  void    DisablePreCuts()     { fDisablePreCuts = kTRUE; }
-  Bool_t  IsDisablePreCuts()   { return fDisablePreCuts; }
-  void    UseCleanForWidth()   { fUseCleanForWidth = kTRUE; }
-  Bool_t  IsUseCleanForWidth() { return fUseCleanForWidth; }
-
   void    Print(Option_t *opt=NULL) const;
 
-  void    FillHist(const MGeomCam &geom, const MCerPhotEvt &evt,
-		   const MMuonSearchPar &musearch);
-  void    CalcPhi(const MGeomCam &geom, const MCerPhotEvt &evt,
-		  const MMuonSearchPar &musearch);
-  void    CalcImpact(const MGeomCam &geom, const MMuonSearchPar &musearch,
-		     Int_t effbinnum, Float_t startfitval, Float_t endfitval);
-  Float_t CalcWidth(const MGeomCam &geom, const MCerPhotEvt &evt, 
-		  const MMuonSearchPar &musearch);
-  Int_t   Calc(const MGeomCam &geom, const MCerPhotEvt &evt,
-	       MMuonSearchPar &musearch, const Float_t *cuts);
-  
   ClassDef(MMuonCalibPar, 1) // Container to hold muon calibration parameters
 };
Index: /trunk/MagicSoft/Mars/mmuon/MMuonSearchPar.cc
===================================================================
--- /trunk/MagicSoft/Mars/mmuon/MMuonSearchPar.cc	(revision 5330)
+++ /trunk/MagicSoft/Mars/mmuon/MMuonSearchPar.cc	(revision 5331)
@@ -30,9 +30,9 @@
 // Storage Container for muon
 //
-//  This class is the container for muon parameters. Actually, in this class, 
-// muons are searched by fitting the image with a circle. (This function will
-// be called by using the class of MMuonSearchParCalc.) This container
-// especially holds the information of the results of the search (fit of 
-// a image by a circle).
+//  This class is the container for muon parameters. Actually, the calculation
+// is done here. Muons are searched by fitting the image with a circle. 
+// (This function will be called by using the class of MMuonSearchParCalc.) 
+// This container especially holds the information of the results of the 
+// search (fit of a image by a circle).
 //
 //  In order to use further information of muons such as the width of arcs,
@@ -85,5 +85,4 @@
 #include "MCerPhotEvt.h"
 #include "MCerPhotPix.h"
-#include "MBinning.h"
 
 using namespace std;
@@ -118,5 +117,5 @@
 //
 void MMuonSearchPar::CalcTempCenter(const MHillas &hillas, 
-      Float_t *xtmp1, Float_t *ytmp1, Float_t *xtmp2, Float_t *ytmp2)
+      Float_t &xtmp1, Float_t &ytmp1, Float_t &xtmp2, Float_t &ytmp2)
 {
   Float_t a,dx,dy;
@@ -128,8 +127,8 @@
   dy = -tmp_r/TMath::Sqrt(1+a*a)/3.;
 
-  *xtmp1 = hillas.GetMeanX() + dx;
-  *ytmp1 = hillas.GetMeanY() + dy;
-  *xtmp2 = hillas.GetMeanX() - dx;
-  *ytmp2 = hillas.GetMeanY() - dy;
+  xtmp1 = hillas.GetMeanX() + dx;
+  ytmp1 = hillas.GetMeanY() + dy;
+  xtmp2 = hillas.GetMeanX() - dx;
+  ytmp2 = hillas.GetMeanY() - dy;
 }
 
@@ -140,5 +139,5 @@
 //
 Bool_t MMuonSearchPar::CalcRadius(const MGeomCam &geom, const MCerPhotEvt &evt,
-      Float_t x, Float_t y, Float_t *r, Float_t *sigma)
+      Float_t x, Float_t y, Float_t &r, Float_t &sigma)
 {
   Float_t mean_r=0., dev_r=0., sums=0., tmp=0.;
@@ -165,10 +164,10 @@
       return kFALSE;
 
-  *r = mean_r/sums;
-
-  if(dev_r/sums-(*r)*(*r)<1.E-10)
+  r = mean_r/sums;
+
+  if(dev_r/sums-(r)*(r)<1.E-10)
       return kFALSE;
 
-  *sigma = TMath::Sqrt(dev_r/sums-(*r)*(*r)); 
+  sigma = TMath::Sqrt(dev_r/sums-(r)*(r)); 
 
   return kTRUE;
@@ -182,6 +181,6 @@
 void MMuonSearchPar::CalcMinimumDeviation
 ( const MGeomCam &geom, const MCerPhotEvt &evt, Float_t x, Float_t y, 
- Float_t xcog, Float_t ycog, Float_t sigma, Float_t *opt_rad, 
- Float_t *new_sigma, Float_t *newx, Float_t *newy )
+ Float_t xcog, Float_t ycog, Float_t sigma, Float_t &opt_rad, 
+ Float_t &new_sigma, Float_t &newx, Float_t &newy )
 {
   Float_t delta = 3.;  // 3 mm (1/10 of an inner pixel size) Step to move.
@@ -195,48 +194,54 @@
       if(r2 > 360000.)
       { 
-	  *new_sigma=sigma;
-	  *opt_rad=rad_tmp;
-	  *newx=x; *newy=y;
+	  new_sigma=sigma;
+	  opt_rad=rad_tmp;
+	  newx=x; 
+	  newy=y;
 	  fNoMuon = kTRUE;
 	  break;
       }
-      if(CalcRadius(geom,evt,x,y+delta,&rad_tmp,&sig_tmp))
+      if(CalcRadius(geom,evt,x,y+delta,rad_tmp,sig_tmp))
       {
 	  if(sig_tmp<sigma)
 	  {
-	      sigma=sig_tmp; *opt_rad=rad_tmp;
+	      sigma=sig_tmp; 
+	      opt_rad=rad_tmp;
 	      y=y+delta;
 	      continue;
 	  }
       }
-      if(CalcRadius(geom,evt,x-delta,y,&rad_tmp,&sig_tmp))
+      if(CalcRadius(geom,evt,x-delta,y,rad_tmp,sig_tmp))
       {
 	  if(sig_tmp<sigma)
 	  {
-	      sigma=sig_tmp; *opt_rad=rad_tmp;
+	      sigma=sig_tmp; 
+	      opt_rad=rad_tmp;
 	      x=x-delta;
 	      continue;
 	  }
       }
-      if(CalcRadius(geom,evt,x+delta,y,&rad_tmp,&sig_tmp))
+      if(CalcRadius(geom,evt,x+delta,y,rad_tmp,sig_tmp))
       {
 	  if(sig_tmp<sigma)
 	  {
-	      sigma=sig_tmp; *opt_rad=rad_tmp;
+	      sigma=sig_tmp; 
+	      opt_rad=rad_tmp;
 	      x=x+delta;
 	      continue;
 	  }
       }
-      if(CalcRadius(geom,evt,x,y-delta,&rad_tmp,&sig_tmp))
+      if(CalcRadius(geom,evt,x,y-delta,rad_tmp,sig_tmp))
       {
 	  if(sig_tmp<sigma)
 	  {
-	      sigma=sig_tmp; *opt_rad=rad_tmp;
+	      sigma=sig_tmp; 
+	      opt_rad=rad_tmp;
 	      y=y-delta;
 	      continue;
 	  }
       }
-      *new_sigma=sigma;
-      *newx=x; *newy=y;
+      new_sigma=sigma;
+      newx=x; 
+      newy=y;
       break;
     }
@@ -257,10 +262,10 @@
     
   // gets temporaly center
-  CalcTempCenter(hillas,&xtmp1,&ytmp1,&xtmp2,&ytmp2);
+  CalcTempCenter(hillas,xtmp1,ytmp1,xtmp2,ytmp2);
   
   // determine which position will be the true position. Here mainly
   // the curvature of a muon arc is relied on.
-  CalcRadius(geom, evt, xtmp1,ytmp1,&rad,&dev);
-  CalcRadius(geom, evt, xtmp2,ytmp2,&rad2,&dev2);
+  CalcRadius(geom, evt, xtmp1,ytmp1,rad,dev);
+  CalcRadius(geom, evt, xtmp2,ytmp2,rad2,dev2);
   if(dev2<dev){
     xtmp1=xtmp2; ytmp1=ytmp2; dev=dev2; rad=rad2;
@@ -268,6 +273,7 @@
   
   // find the best fit.
-  CalcMinimumDeviation(geom, evt, xtmp1,ytmp1,hillas.GetMeanX(),hillas.GetMeanY(), 
-		 dev, &opt_rad, &new_sigma, &newx, &newy);
+  CalcMinimumDeviation(geom, evt, xtmp1,ytmp1,hillas.GetMeanX(),
+		       hillas.GetMeanY(), dev, opt_rad, new_sigma, 
+		       newx, newy);
 
   fRadius = opt_rad;
Index: /trunk/MagicSoft/Mars/mmuon/MMuonSearchPar.h
===================================================================
--- /trunk/MagicSoft/Mars/mmuon/MMuonSearchPar.h	(revision 5330)
+++ /trunk/MagicSoft/Mars/mmuon/MMuonSearchPar.h	(revision 5331)
@@ -4,12 +4,4 @@
 #ifndef MARS_MParContainer
 #include "MParContainer.h"
-#endif
-
-#ifndef ROOT_TH1
-#include <TH1.h>
-#endif
-
-#ifndef ROOT_TArrayI
-#include <TArrayI.h>
 #endif
 
@@ -39,16 +31,17 @@
     void    SetNoMuon()          { fNoMuon = kTRUE; }
 
+    void   CalcTempCenter(const MHillas &hillas, Float_t &xtmp1, 
+			  Float_t &ytmp1, Float_t &xtmp2, Float_t &ytmp2);
+    Bool_t CalcRadius(const MGeomCam &geom, const MCerPhotEvt &evt, Float_t x,
+		      Float_t y, Float_t &r, Float_t &sigma);
+    void   CalcMinimumDeviation(const MGeomCam &geom, const MCerPhotEvt &evt, 
+			     Float_t x, Float_t y, Float_t xcog, 
+			     Float_t ycog, Float_t sigma, Float_t &opt_rad, 
+			     Float_t &new_sigma, Float_t &newx, Float_t &newy);
+    void   Calc(const MGeomCam &geom, const MCerPhotEvt &evt,
+		const MHillas &hillas);
+
     void   Print(Option_t *opt=NULL) const;
     void   Print(const MGeomCam &geom, Option_t *opt=NULL) const;
-    void   CalcTempCenter(const MHillas &hillas, Float_t *xtmp1, 
-			 Float_t *ytmp1, Float_t *xtmp2, Float_t *ytmp2);
-    Bool_t CalcRadius(const MGeomCam &geom, const MCerPhotEvt &evt, Float_t x,
-		      Float_t y, Float_t *r, Float_t *sigma);
-    void   CalcMinimumDeviation(const MGeomCam &geom, const MCerPhotEvt &evt, 
-			 Float_t x, Float_t y, Float_t xcog, 
-			 Float_t ycog, Float_t sigma, Float_t *opt_rad, 
-			 Float_t *new_sigma, Float_t *newx, Float_t *newy);
-    void   Calc(const MGeomCam &geom, const MCerPhotEvt &evt,
-	       const MHillas &hillas);
 
     ClassDef(MMuonSearchPar, 1) // Container to hold muon search parameters
