Changeset 4051 for trunk


Ignore:
Timestamp:
05/11/04 19:47:22 (20 years ago)
Author:
jlopez
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Mars/mtemp
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/mtemp/MFindStars.cc

    r4037 r4051  
    3030#include "MFindStars.h"
    3131
     32#include <TMinuit.h>
     33#include <TStopwatch.h>
    3234#include <TTimer.h>
    3335#include <TString.h>
     
    4042#include "MAstroCamera.h"
    4143#include "MMcConfigRunHeader.h"
     44
     45#include "MMinuitInterface.h"
    4246
    4347#include "MLog.h"
     
    5963using namespace std;
    6064
    61 MFindStars::MFindStars(const char *name, const char *title)
     65const Float_t sqrt2 = sqrt(2.);
     66const Float_t sqrt3 = sqrt(3.);
     67
     68Bool_t HandleInput()
     69{
     70    TTimer timer("gSystem->ProcessEvents();", 50, kFALSE);
     71    while (1)
     72    {
     73        //
     74        // While reading the input process gui events asynchronously
     75        //
     76        timer.TurnOn();
     77        cout << "Type 'q' to exit, <return> to go on: " << endl;
     78        char q;
     79        cin >> q;
     80        TString input = q;
     81        timer.TurnOff();
     82
     83        if (input=="q\n")
     84            return kFALSE;
     85
     86        if (input=="\n")
     87            return kTRUE;
     88    };
     89}
     90
     91
     92//______________________________________________________________________________
     93//
     94// The 2D gaussian fucntion used to fit the spot of the star
     95//
     96static Double_t func(float x,float y,Double_t *par)
     97{
     98    Double_t value=par[0]*exp(-(x-par[1])*(x-par[1])/(2*par[2]*par[2]))*exp(-(y-par[3])*(y-par[3])/(2*par[4]*par[4]));
     99    return value;
     100}
     101
     102//______________________________________________________________________________
     103//
     104// Function used by Minuit to do the fit
     105//
     106static void fcn(Int_t &npar, Double_t *gin, Double_t &f, Double_t *par, Int_t iflag)
     107{
     108
     109    MFindStars* find =  (MFindStars*)gMinuit->GetObjectFit();
     110    MHCamera* display = (MHCamera*)find->GetDisplay();
     111    Float_t ped = find->GetPedestalDC();
     112    //    Float_t rms = find->GetPedestalRMSDC();
     113    MGeomCam& geom = (MGeomCam&)display->GetGeomCam();
     114
     115    UInt_t numPixels = geom.GetNumPixels();
     116 
     117//calculate chisquare
     118    Double_t chisq = 0;
     119    Double_t delta;
     120    Double_t x,y,z;
     121    Double_t errorz = 0.2; //[uA]
     122
     123    UInt_t usedPx=0;
     124    for (UInt_t pixid=1; pixid<numPixels; pixid++)
     125    {
     126        z = display->GetBinContent(pixid+1)-ped;
     127
     128        if (display->IsUsed(pixid) && z > 0.)
     129        {
     130            x = geom[pixid].GetX();
     131            y = geom[pixid].GetY();
     132
     133            if (errorz > 0.0)
     134            {
     135              usedPx++;
     136                delta  = (z-func(x,y,par))/errorz;
     137                chisq += delta*delta;
     138            }
     139            else
     140                cerr << " TMinuit::fcn errorz[" << pixid << "] " << errorz << endl;
     141        }
     142    }
     143    f = chisq;
     144
     145    find->SetChisquare(chisq);
     146    find->SetDegreesofFreedom(usedPx);
     147}
     148
     149MFindStars::MFindStars(const char *name, const char *title): fNumVar(5)
    62150{
    63151  fName  = name  ? name  : "MFindStars";
     
    71159  fPixelsUsed.Set(577);
    72160  fPixelsUsed.Reset((Char_t)kTRUE);
     161 
     162  //Fitting(Minuit) initialitation
     163  const Float_t pixelSize = 31.5; //[mm]
     164
     165  fVname = new TString[fNumVar];
     166  fVinit.Set(fNumVar);
     167  fStep.Set(fNumVar);
     168  fLimlo.Set(fNumVar);
     169  fLimup.Set(fNumVar);
     170  fFix.Set(fNumVar);
     171
     172  fVname[0] = "max";
     173  fVinit[0] = 10.*fMaxNumIntegratedEvents;
     174  fStep[0]  = fVinit[0]/sqrt2;
     175  fLimlo[0] = fMinDCForStars;
     176  fLimup[0] = 30.*fMaxNumIntegratedEvents;
     177  fFix[0]   = 0;
     178
     179  fVname[1] = "meanx";
     180  fVinit[1] = 0.;
     181  fStep[1]  = fVinit[0]/sqrt2;
     182  fLimlo[1] = -600.;
     183  fLimup[1] = 600.;
     184  fFix[1]   = 0;
     185
     186  fVname[2] = "sigmaminor";
     187  fVinit[2] = pixelSize;
     188  fStep[2]  = fVinit[0]/sqrt2;
     189  fLimlo[2] = pixelSize/(2*sqrt3);
     190  fLimup[2] = 500.;
     191  fFix[2]   = 0;
     192
     193  fVname[3] = "meany";
     194  fVinit[3] = 0.;
     195  fStep[3]  = fVinit[0]/sqrt2;
     196  fLimlo[3] = -600.;
     197  fLimup[3] = 600.;
     198  fFix[3]   = 0;
     199
     200  fVname[4] = "sigmamajor";
     201  fVinit[4] = pixelSize;
     202  fStep[4]  = fVinit[0]/sqrt2;
     203  fLimlo[4] = pixelSize/(2*sqrt3);
     204  fLimup[4] = 500.;
     205  fFix[4]   = 0;
     206
     207  fObjectFit  = NULL;
     208  //  fMethod     = "SIMPLEX";
     209  //  fMethod     = "MIGRAD";
     210  fMethod     = "MINIMIZE";
     211  fNulloutput = kFALSE;
    73212}
    74213
     
    85224
    86225    fDisplay.SetGeometry(*fGeomCam);
     226    fDisplay.SetUsed(fPixelsUsed);
    87227   
    88228    fCurr = (MCameraDC*)pList->FindObject(AddSerialNumber("MCameraDC"));
     
    171311Int_t MFindStars::Process()
    172312{
     313  UInt_t numPixels = fGeomCam->GetNumPixels();
     314  TArrayC origPixelsUsed;
     315  origPixelsUsed.Set(numPixels);
     316
    173317    if (fNumIntegratedEvents >= fMaxNumIntegratedEvents)
    174318    {
     319
    175320      if (fDrive)
    176321        {
     
    185330      else
    186331        {
    187           UInt_t numPixels = fGeomCam->GetNumPixels();
    188           TArrayC origPixelsUsed;
    189           origPixelsUsed.Set(numPixels);
     332          //Fist delete the previus stars in the list
     333          fStars->GetList()->Delete();
     334          //
    190335
    191336          for (UInt_t pix=1; pix<numPixels; pix++)
     
    194339                origPixelsUsed[pix]=(Char_t)kTRUE;
    195340              else
    196                 origPixelsUsed[pix]=(Char_t)kFALSE;
     341                  origPixelsUsed[pix]=(Char_t)kFALSE;
    197342            }
    198343         
    199           Float_t ped;
    200           Float_t rms;
    201           DCPedestalCalc(ped, rms);
    202           fMinDCForStars = fMinDCForStars>(ped+5*rms)?fMinDCForStars:(ped+5*rms);
    203 
    204           *fLog << dbg << " DC pedestal = " << ped << " pedestal rms = " << rms << endl;
     344          DCPedestalCalc(fPedestalDC, fPedestalRMSDC);
     345          fMinDCForStars = fMinDCForStars>(fPedestalDC+5*fPedestalRMSDC)?fMinDCForStars:(fPedestalDC+5*fPedestalRMSDC);
     346
     347          *fLog << dbg << " DC pedestal = " << fPedestalDC << " pedestal rms = " << fPedestalRMSDC << endl;
    205348          *fLog << dbg << " fMinDCForStars " << fMinDCForStars << endl;
    206349         
     
    211354          while(FindPixelWithMaxDC(maxPixelDC, maxPixel))
    212355            {
    213               *fLog << dbg << "Star candidate maxDC(" << setw(3) << maxPixelDC << " uA) x position(" << setw(3) << maxPixel.GetX() <<  " mm) x position(" << setw(3) << maxPixel.GetY() << " mm)" << endl;
    214              
     356
    215357              MStarLocalPos *starpos = new MStarLocalPos;
    216358              starpos->SetExpValues(maxPixelDC,maxPixel.GetX(),maxPixel.GetY());
    217               starpos->SetCalcValues(maxPixelDC,maxPixel.GetX(),maxPixel.GetY(),fRingInterest/2,fRingInterest/2);
    218               starpos->SetFitValues(maxPixelDC,maxPixel.GetX(),maxPixel.GetY(),fRingInterest/2,fRingInterest/2);
     359              starpos->SetCalcValues(maxPixelDC,maxPixelDC,maxPixel.GetX(),maxPixel.GetY(),fRingInterest/2,fRingInterest/2);
     360              starpos->SetFitValues(maxPixelDC,maxPixelDC,maxPixel.GetX(),maxPixel.GetY(),fRingInterest/2,fRingInterest/2,0.,1);
    219361              fStars->GetList()->Add(starpos);
    220362
     
    235377          *fLog << inf << GetName() << " Found " << fStars->GetList()->GetSize() << " stars candidates in the camera." << endl;
    236378         
     379
     380      for (UInt_t pix=1; pix<numPixels; pix++)
     381        {
     382          if (fDisplay.IsUsed(pix))
     383            origPixelsUsed[pix]=(Char_t)kTRUE;
     384          else
     385            origPixelsUsed[pix]=(Char_t)kFALSE;
     386        }
     387
    237388      TIter Next(fStars->GetList());
    238389      MStarLocalPos* star;
    239390      while ((star=(MStarLocalPos*)Next()))
    240       {
    241         FindStar(star);
    242         ShadowStar(star);
    243       }
     391        {
     392          FindStar(star);
     393          ShadowStar(star);
     394        }
    244395     
    245396      //After finding stars reset all vairables
    246397      fDisplay.Reset();
     398      fDisplay.SetUsed(origPixelsUsed);
    247399      fNumIntegratedEvents=0;
    248400    }
     401
     402    for (UInt_t pix=1; pix<numPixels; pix++)
     403      {
     404        if (fDisplay.IsUsed(pix))
     405          origPixelsUsed[pix]=(Char_t)kTRUE;
     406        else
     407            origPixelsUsed[pix]=(Char_t)kFALSE;
     408       
     409      }
    249410
    250411    fDisplay.AddCamContent(*fCurr);
    251412    fNumIntegratedEvents++;
     413    fDisplay.SetUsed(origPixelsUsed);
     414   
    252415
    253416  return kTRUE;
     
    267430
    268431    for (Int_t idx=0; idx<npix; idx++)
     432      {
    269433        fPixelsUsed[blindpixels[idx]]=(Char_t)kFALSE;
    270 
     434        *fLog << dbg << "MFindStars::SetBlindPixels fDisplay.IsUsed(" <<blindpixels[idx]  << ") kFALSE" << endl;
     435      }
     436   
    271437    fDisplay.SetUsed(fPixelsUsed);
    272438}
     
    304470   
    305471   dchist.Fit("func","QR0");
     472   // Remove the comments if you want to go through the file
     473   // event-by-event:
     474   //   HandleInput();
    306475
    307476   UInt_t aproxnumdegrees = 6*(bin-dchist.GetMaximumBin());
     
    344513            for(Int_t nextNeighbor=0; nextNeighbor<numNextNeighbors; nextNeighbor++)
    345514            {
    346                 if(fDisplay.IsUsed(pix))
    347                 {
    348                     UInt_t swneighbor = g.GetNeighbor(nextNeighbor);
    349                     dc[1] = fDisplay.GetBinContent(swneighbor+1);
    350                     if (dc[1] < fMinDCForStars)
    351                         continue;
    352                    
    353                     dcsum = dc[0] + dc[1];
    354                    
    355                     if(dcsum > maxDC*2)
    356                     {
     515              UInt_t swneighbor = g.GetNeighbor(nextNeighbor);
     516              if(fDisplay.IsUsed(swneighbor))
     517                {
     518                  dc[1] = fDisplay.GetBinContent(swneighbor+1);
     519                  if (dc[1] < fMinDCForStars)
     520                    continue;
     521                 
     522                  dcsum = dc[0] + dc[1];
     523                 
     524                  if(dcsum > maxDC*2)
     525                    {
    357526                      if(dc[0]>=dc[1])
    358527                        {
    359                         maxPixIdx[0] = pix;
    360                         maxPixIdx[1] = swneighbor;
    361                         maxDC = dc[0];
     528                          maxPixIdx[0] = pix;
     529                          maxPixIdx[1] = swneighbor;
     530                          maxDC = dc[0];
    362531                        }
    363532                      else
     
    367536                          maxDC = dc[1];
    368537                        }
    369                     }   
    370                 }
    371             }
    372         }
     538                    }   
     539                }
     540            }
     541        }
    373542    }
    374543
     
    377546
    378547    maxPix = (*fGeomCam)[maxPixIdx[0]];
     548
     549    *fLog << dbg << "Star candidate maxDC(" << setw(3) << maxDC << " uA) x position(" << setw(3) << maxPix.GetX() <<  " mm) x position(" << setw(3) << maxPix.GetY() << " mm) swnumber(" << maxPixIdx[0] << ")" << endl;
     550
    379551    return kTRUE;
    380552}
     
    415587    fDisplay.SetUsed(fPixelsUsed);
    416588   
    417     // determine mean x and mean y of the selected px
     589// determine mean x and mean y
     590    Float_t max=0;
    418591    Float_t meanX=0;
    419592    Float_t meanY=0;
     
    432605            Float_t pixYpos = (*fGeomCam)[pix].GetY();
    433606
     607            if (charge>max) max=charge;
    434608            meanX     += charge*pixXpos;
    435609            meanY     += charge*pixYpos;
     
    450624    Float_t rmsY = TMath::Sqrt(meanSqY - meanY*meanY);
    451625   
    452     star->SetCalcValues(sumCharge,meanX,meanY,rmsX,rmsY);
     626    star->SetCalcValues(sumCharge,max,meanX,meanY,rmsX,rmsY);
     627
     628
     629// fit the star spot using TMinuit
     630
     631  for (UInt_t pix=1; pix<numPixels; pix++)
     632      if (fDisplay.IsUsed(pix))
     633        *fLog << dbg << "[fit the star spot] fDisplay.IsUsed(" << pix << ") kTRUE" << endl;
     634 
     635  //Initialate variables for fit
     636    fVinit[0] = star->GetMaxCalc()-fPedestalDC;
     637    fLimlo[0] = fMinDCForStars-fPedestalDC;
     638    fLimup[0] = fLimup[0]-fPedestalDC;
     639    fVinit[1] = meanX;
     640    fVinit[2] = rmsX;
     641    fVinit[3] = meanY;
     642    fVinit[4] = rmsY;
     643    //Init steps
     644    for(Int_t i=0; i<fNumVar; i++)
     645        if (fVinit[i] != 0)
     646          fStep[i] = TMath::Abs(fVinit[i]/sqrt2);
     647    //
     648
     649    TStopwatch clock;
     650    clock.Start();
     651
     652    *fLog << dbg << " before calling CallMinuit" << endl;
     653
     654    MMinuitInterface inter;               
     655    Bool_t rc = inter.CallMinuit(fcn, fVname,
     656                                 fVinit, fStep, fLimlo, fLimup, fFix,
     657                                 this, fMethod, fNulloutput);
    453658 
     659    *fLog << dbg << "after calling CallMinuit" << endl;
     660    *fLog << dbg << "Time spent for the minimization in MINUIT :   " << endl;;
     661    clock.Stop();
     662    clock.Print();
     663
     664    Double_t integratedCharge;
     665    Double_t maxFit, maxFitError;
     666    Double_t meanXFit, meanXFitError;
     667    Double_t sigmaMinorAxis, sigmaMinorAxisError;
     668    Double_t meanYFit, meanYFitError;
     669    Double_t sigmaMajorAxis, sigmaMajorAxisError;
     670    Float_t chisquare = GetChisquare();
     671    Int_t   dregrees  = GetDegreesofFreedom()-fNumVar;
     672
     673    if (rc)
     674      {
     675        gMinuit->GetParameter(0,maxFit, maxFitError);
     676        gMinuit->GetParameter(1,meanXFit,meanXFitError);
     677        gMinuit->GetParameter(2,sigmaMinorAxis,sigmaMinorAxisError);
     678        gMinuit->GetParameter(3,meanYFit,meanYFitError);
     679        gMinuit->GetParameter(4,sigmaMajorAxis,sigmaMajorAxisError);
     680       
     681        //FIXME: Do the integral properlly
     682        integratedCharge = 0.;
     683
     684       
     685      }
     686    else
     687      {
     688        maxFit = 0.;
     689        meanXFit = 0.;
     690        sigmaMinorAxis = 0.;
     691        meanYFit = 0.;
     692        sigmaMajorAxis = 0.;
     693        integratedCharge = 0.;
     694      }
     695   
     696   
     697   
     698    star->SetFitValues(integratedCharge,maxFit,meanXFit,meanYFit,sigmaMinorAxis,sigmaMajorAxis,chisquare,dregrees);
     699
     700    // reset the display to the starting values
    454701    fDisplay.SetUsed(origPixelsUsed);
    455702
    456     return kTRUE;
     703    return rc;
    457704}
    458705
     
    479726        else
    480727          {
    481           fPixelsUsed[pix]=(Char_t)kFALSE;
    482           shadowPx++;
     728            fPixelsUsed[pix]=(Char_t)kFALSE;
     729            shadowPx++;
    483730          }
    484731    }
  • trunk/MagicSoft/Mars/mtemp/MFindStars.h

    r4037 r4051  
    5151    Float_t fMinDCForStars; //[uA]
    5252
     53    Float_t fPedestalDC;    //[ua]
     54    Float_t fPedestalRMSDC; //[ua]
     55
     56    //Fitting(Minuit) variables
     57    const Int_t fNumVar;
     58    Float_t fTempChisquare;
     59    Int_t fTempDegreesofFreedom;
     60   
     61    TString *fVname;
     62    TArrayD fVinit;
     63    TArrayD fStep;
     64    TArrayD fLimlo;
     65    TArrayD fLimup;
     66    TArrayI fFix;
     67    TObject *fObjectFit;
     68    TString fMethod;
     69    Bool_t fNulloutput;
     70   
    5371    Bool_t DCPedestalCalc(Float_t &ped, Float_t &rms);
    5472    Bool_t FindPixelWithMaxDC(Float_t &maxDC, MGeomPix &maxPix);
     
    6886    void SetBlindPixels(TArrayS blindpixels);
    6987
     88    void SetChisquare(Float_t chi) {fTempChisquare=chi;}
     89    void SetDegreesofFreedom(Int_t free) {fTempDegreesofFreedom=free;}
    7090
     91    MHCamera* GetDisplay() { return &fDisplay; }
     92    Float_t GetPedestalDC() { return fPedestalDC; }
     93    Float_t GetPedestalRMSDC() { return fPedestalRMSDC; }
     94   
     95    Float_t GetChisquare() {return fTempChisquare;}
     96    Int_t GetDegreesofFreedom() {return fTempDegreesofFreedom;}
     97   
     98   
    7199  ClassDef(MFindStars, 0) // Tool to find stars from DC Currents
    72100};
  • trunk/MagicSoft/Mars/mtemp/MStarLocalCam.cc

    r4037 r4051  
    7979}
    8080
     81void MStarLocalCam::Paint(Option_t *o)
     82{
     83        TIter Next(fStars);
     84        MStarLocalPos* star;
     85        while ((star=(MStarLocalPos*)Next()))
     86            star->Paint(o);
     87}
     88
    8189void MStarLocalCam::Print(Option_t *o) const
    8290{
    83         //loop to extract position of stars on the camera
    8491        TIter Next(fStars);
    8592        MStarLocalPos* star;
     
    8895          {
    8996            *fLog << inf << "Star[" << starnum << "] info:" << endl;
    90             star->Print();
     97            star->Print(o);
    9198            starnum++;
    9299          }
  • trunk/MagicSoft/Mars/mtemp/MStarLocalCam.h

    r3808 r4051  
    3030  TList *GetList() const { return fStars; }
    3131
    32   void Print(Option_t *o="") const;
     32  void Paint(Option_t *o=NULL);
     33  void Print(Option_t *o=NULL) const;
    3334
    3435  ClassDef(MStarLocalCam, 1)    // Storage Container for star positions in the camera
  • trunk/MagicSoft/Mars/mtemp/MStarLocalPos.cc

    r4037 r4051  
    5353
    5454     fMagCalc = 0.;
     55     fMaxCalc = 0.;
    5556     fMeanXCalc = 0.;
    5657     fMeanYCalc = 0.;
     
    6162
    6263     fMagFit = 0.;
     64     fMaxFit = 0.;
    6365     fMeanXFit = 0.;
    6466     fMeanYFit = 0.;
    6567     fSigmaMinorAxisFit = 0.;
    6668     fSigmaMajorAxisFit = 0.;
    67      fChisquarenDof = 0.;
     69     fChiSquare = 0.;
     70     fNdof = 0;
    6871
    6972}
     
    7679}
    7780
    78 void MStarLocalPos::SetCalcValues(Float_t mag, Float_t x, Float_t y, Float_t sigmaMinorAxis, Float_t sigmaMajorAxis)
     81void MStarLocalPos::SetCalcValues(Float_t mag, Float_t max, Float_t x, Float_t y, Float_t sigmaMinorAxis, Float_t sigmaMajorAxis)
    7982{
    8083     fMagCalc = mag;
     84     fMaxCalc = max;
    8185     fMeanXCalc = x;
    8286     fMeanYCalc = y;
     
    8589}
    8690
    87 void MStarLocalPos::SetFitValues(Float_t mag, Float_t x, Float_t y, Float_t sigmaMinorAxis, Float_t sigmaMajorAxis)
     91void MStarLocalPos::SetFitValues(Float_t mag, Float_t max, Float_t x, Float_t y, Float_t sigmaMinorAxis, Float_t sigmaMajorAxis, Float_t chiSquare, Int_t ndof)
    8892{
    8993     fMagFit = mag;
     94     fMaxFit = max;
    9095     fMeanXFit = x;
    9196     fMeanYFit = y;
    9297     fSigmaMinorAxisFit = sigmaMinorAxis;
    9398     fSigmaMajorAxisFit = sigmaMajorAxis;
     99     fChiSquare = chiSquare;
     100     fNdof = ndof;
    94101}
    95102
     103// --------------------------------------------------------------------------
     104//
     105// Paint the ellipse corresponding to the parameters
     106//
    96107void MStarLocalPos::Paint(Option_t *opt)
    97 {}
     108{
     109  //Print a cross in the expected position
     110
     111  if (fSigmaMinorAxisCalc>0. && fSigmaMajorAxisCalc>0.)
     112    {
     113      TEllipse ecalc(fMeanXCalc, fMeanYCalc, fSigmaMinorAxisCalc, fSigmaMajorAxisCalc, 0, 360, 0);
     114      ecalc.SetLineWidth(2);
     115      ecalc.SetLineColor(kRed);
     116      ecalc.Paint();
     117    }
     118
     119  if (fSigmaMinorAxisFit>0. || fSigmaMajorAxisFit>0.)
     120    {
     121      TEllipse efit(fMeanXFit, fMeanYFit, fSigmaMinorAxisFit, fSigmaMajorAxisFit, 0, 360, 0);
     122      efit.SetLineWidth(2);
     123      efit.SetLineColor(kBlack);
     124      efit.Paint();
     125    }
     126}
    98127 
    99128void MStarLocalPos::Print(Option_t *opt) const
    100129{
    101   *fLog << inf << "Star position:" << endl;
    102   *fLog << inf << " Expected \t X " << setw(4) << fXExp << " mm \tY " << setw(4) << fYExp << " mm" << endl;
    103   *fLog << inf << " Calcultated \t X " << setw(4) << fMeanXCalc << " mm \tY " << setw(4) << fMeanYCalc << " mm" << endl;
    104   *fLog << inf << " Fitted \t X " << setw(4) << fMeanXFit << " mm \tY " << setw(4) << fMeanYFit << " mm" << endl;
    105   *fLog << inf << "Star size:" << endl;
    106   *fLog << inf << " Calcultated \t X " << setw(4) << fSigmaMinorAxisCalc << " mm \tY " << setw(4) << fSigmaMajorAxisCalc << " mm" << endl;
    107   *fLog << inf << " Fitted \t X " << setw(4) << fSigmaMinorAxisFit << " mm \tY " << setw(4) << fSigmaMajorAxisFit << " mm" << endl;
     130  TString o = opt;
     131 
     132  if (o.Contains("mag", TString::kIgnoreCase) || opt == NULL)
     133    {
     134      *fLog << inf << "Star maginitude:" << endl;
     135      *fLog << inf << " Expected \t" << setw(4) << fMagExp << endl;
     136      *fLog << inf << " Calcultated \t " << setw(4) << fMagCalc << endl;
     137      *fLog << inf << " Fitted \t " << setw(4) << fMagFit << endl;
     138    }
     139 
     140  if (o.Contains("max", TString::kIgnoreCase) || opt == NULL)
     141    {
     142      *fLog << inf << "Star Maximum:" << endl;
     143      *fLog << inf << " Calcultated \t " << setw(4) << fMaxCalc << " uA" << endl;
     144      *fLog << inf << " Fitted \t " << setw(4) << fMaxFit << " uA" << endl;
     145    }
     146 
     147  if (o.Contains("pos", TString::kIgnoreCase) || opt == NULL)
     148    {
     149      *fLog << inf << "Star position:" << endl;
     150      *fLog << inf << " Expected \t X " << setw(4) << fXExp << " mm \tY " << setw(4) << fYExp << " mm" << endl;
     151      *fLog << inf << " Calcultated \t X " << setw(4) << fMeanXCalc << " mm \tY " << setw(4) << fMeanYCalc << " mm" << endl;
     152      *fLog << inf << " Fitted \t X " << setw(4) << fMeanXFit << " mm \tY " << setw(4) << fMeanYFit << " mm" << endl;
     153    }
     154
     155  if (o.Contains("siz", TString::kIgnoreCase) || opt == NULL)
     156    {
     157      *fLog << inf << "Star size:" << endl;
     158      *fLog << inf << " Calcultated \t X " << setw(4) << fSigmaMinorAxisCalc << " mm \tY " << setw(4) << fSigmaMajorAxisCalc << " mm" << endl;
     159      *fLog << inf << " Fitted \t X " << setw(4) << fSigmaMinorAxisFit << " mm \tY " << setw(4) << fSigmaMajorAxisFit << " mm" << endl;
     160    }
     161
     162  if (o.Contains("chi", TString::kIgnoreCase) || opt == NULL)
     163    {
     164      *fLog << inf << "Star Fit Quality:" << endl;
     165      *fLog << inf << " ChiSquare/Ndof \t " << setw(3) << fChiSquare << "/" << fNdof << endl;
     166    }
    108167}
  • trunk/MagicSoft/Mars/mtemp/MStarLocalPos.h

    r3808 r4051  
    1919
    2020    Float_t fMagCalc;
     21    Float_t fMaxCalc;            //[uA]
    2122    Float_t fMeanXCalc;          //[mm]
    2223    Float_t fMeanYCalc;          //[mm]
     
    2728
    2829    Float_t fMagFit;
     30    Float_t fMaxFit;             //[uA]
    2931    Float_t fMeanXFit;           //[mm]
    3032    Float_t fMeanYFit;           //[mm]
    3133    Float_t fSigmaMinorAxisFit;  //[mm]
    3234    Float_t fSigmaMajorAxisFit;  //[mm]
    33     Float_t fChisquarenDof;
     35    Float_t fChiSquare;
     36    Int_t   fNdof;
    3437
    3538public:
     
    4346
    4447    Float_t GetMagCalc() {return fMagCalc;}
     48    Float_t GetMaxCalc() {return fMaxCalc;}
    4549    Float_t GetMeanXCalc() {return fMeanXCalc;}
    4650    Float_t GetMeanYCalc() {return fMeanYCalc;}
     
    4953
    5054    Float_t GetMagFit() {return fMagFit;}
     55    Float_t GetMaxFit() {return fMaxFit;}
    5156    Float_t GetMeanXFit() {return fMeanXFit;}
    5257    Float_t GetMeanYFit() {return fMeanYFit;}
    5358    Float_t GetSigmaMinorAxisFit() {return fSigmaMinorAxisFit;}
    5459    Float_t GetSigmaMajorAxisFit() {return fSigmaMajorAxisFit;}
    55     Float_t GetChisquarenDof() {return fChisquarenDof;}
     60    Float_t GetChiSquare() {return fChiSquare;}
     61    Float_t GetNdof() {return fNdof;}
     62    Float_t GetChiSquareNdof() {return fChiSquare/fNdof;}
     63
     64    //    Float_t GetMeanX();
     65    //    Float_t GetMeanY();
     66    //    Float_t GetSigmaMinorAxis();
     67    //    Float_t GetSigmaMajorAxis();
    5668
    5769    void Reset();
    5870
    5971    void SetExpValues(Float_t mag, Float_t x, Float_t y);
    60     void SetCalcValues(Float_t mag, Float_t x, Float_t y, Float_t sigmaMinorAxis, Float_t sigmaMajorAxis);
    61     void SetFitValues(Float_t mag, Float_t x, Float_t y, Float_t sigmaMinorAxis, Float_t sigmaMajorAxis);
     72    void SetCalcValues(Float_t mag, Float_t max, Float_t x, Float_t y, Float_t sigmaMinorAxis, Float_t sigmaMajorAxis);
     73    void SetFitValues(Float_t mag, Float_t max, Float_t x, Float_t y, Float_t sigmaMinorAxis, Float_t sigmaMajorAxis, Float_t chi, Int_t ndof);
    6274
    6375    void Paint(Option_t *opt=NULL);
    6476    void Print(Option_t *opt=NULL) const;
    6577
    66     ClassDef(MStarLocalPos, 1) // Container that holds
     78    ClassDef(MStarLocalPos, 1) // Container that holds the star information in the PMT camera
    6779};
    6880
Note: See TracChangeset for help on using the changeset viewer.