Changeset 2913 for trunk/MagicSoft/Mars


Ignore:
Timestamp:
01/26/04 15:09:56 (21 years ago)
Author:
gaug
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Mars
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/Changelog

    r2911 r2913  
    1414     - TSpline5 now on stack.
    1515
     16   * mcalib/MHCalibrationBlindPixel.[h,cc]:
     17     - force mu_0 in Blind Pixel Fit to be around 0 in fKPoisson4
    1618
    1719 2004/01/26: Thomas Bretz
  • trunk/MagicSoft/Mars/mcalib/MHCalibrationBlindPixel.cc

    r2904 r2913  
    347347  const Stat_t   entries      = fHBlindPixelCharge->Integral("width");
    348348  const Double_t lambda_guess = 0.5;
    349   const Double_t mu_0_guess = fHBlindPixelCharge->GetBinCenter(fHBlindPixelCharge->GetMaximumBin());
     349  const Double_t maximum_bin  = fHBlindPixelCharge->GetBinCenter(fHBlindPixelCharge->GetMaximumBin());
     350  const Double_t norm         = entries/gkSq2Pi;
     351
     352  //
     353  // Initialize the fit function
     354  //
     355  switch (fFitFunc)
     356    {
     357    case kEPoisson4:
     358      //      fSinglePheFit = new TF1("SinglePheFit",&fPoissonKto4,min,max,5);
     359      fSinglePheFit = new TF1("SinglePheFit",&fPoissonKto4,min,max,6);
     360      break;
     361    case kEPoisson5:
     362      fSinglePheFit = new TF1("SinglePheFit",&fPoissonKto5,min,max,6);
     363      break;
     364    case kEPoisson6:
     365      fSinglePheFit = new TF1("SinglePheFit",&fPoissonKto6,min,max,6);
     366      break;
     367    case kEPolya:
     368      break;
     369
     370    case kEMichele:
     371      break;
     372
     373    default:
     374      *fLog << warn << "WARNING: Could not find Fit Function for Blind Pixel " << endl;
     375      return kFALSE;
     376      break;
     377    }
     378 
     379  const Double_t mu_0_guess = maximum_bin;
    350380  const Double_t si_0_guess = 20.;
    351381  const Double_t mu_1_guess = mu_0_guess + 50.;
    352382  const Double_t si_1_guess = si_0_guess + si_0_guess;
    353   const Double_t norm       = entries/gkSq2Pi;
    354 
    355   //
    356   // Initialize
     383  //
     384  // Initialize boundaries and start parameters
    357385  //
    358386  switch (fFitFunc)
     
    360388     
    361389    case kEPoisson4:
    362       fSinglePheFit = new TF1("SinglePheFit",&fPoissonKto4,min,max,6);
     390      fSinglePheFit->SetParameters(lambda_guess,mu_0_guess,mu_1_guess,si_0_guess,si_1_guess,norm);
     391      fSinglePheFit->SetParNames("#lambda","#mu_0","#mu_1","#sigma_0","#sigma_1","Area");
     392      fSinglePheFit->SetParLimits(0,0.,1.);
     393      fSinglePheFit->SetParLimits(1,-2.,2.);
     394      fSinglePheFit->SetParLimits(2,(max-min)/2.,(max-0.05*(max-min)));
     395      fSinglePheFit->SetParLimits(3,1.0,(max-min)/2.0);
     396      fSinglePheFit->SetParLimits(4,1.0,(max-min)/2.5);
     397      fSinglePheFit->SetParLimits(5,norm-0.5,norm+0.5);
     398      break;
     399    case kEPoisson5:
     400    case kEPoisson6:
    363401      fSinglePheFit->SetParameters(lambda_guess,mu_0_guess,mu_1_guess,si_0_guess,si_1_guess,norm);
    364402      fSinglePheFit->SetParNames("#lambda","#mu_0","#mu_1","#sigma_0","#sigma_1","Area");
     
    369407      fSinglePheFit->SetParLimits(4,1.0,(max-min)/2.5);
    370408      fSinglePheFit->SetParLimits(5,norm-0.1,norm+0.1);
    371       break;
    372      
    373     case kEPoisson5:
    374       fSinglePheFit = new TF1("SinglePheFit",&fPoissonKto5,min,max,6);
    375       fSinglePheFit->SetParameters(lambda_guess,mu_0_guess,mu_1_guess,si_0_guess,si_1_guess,norm);
    376       fSinglePheFit->SetParNames("#lambda","#mu_0","#mu_1","#sigma_0","#sigma_1","Area");
    377       fSinglePheFit->SetParLimits(0,0.,1.);
    378       fSinglePheFit->SetParLimits(1,min,(max-min)/1.5);
    379       fSinglePheFit->SetParLimits(2,(max-min)/2.,(max-0.05*(max-min)));
    380       fSinglePheFit->SetParLimits(3,1.0,(max-min)/2.0);
    381       fSinglePheFit->SetParLimits(4,1.0,(max-min)/2.5);
    382       fSinglePheFit->SetParLimits(5,norm-0.1,norm+0.1);
    383       break;
    384 
    385     case kEPoisson6:
    386       fSinglePheFit = new TF1("SinglePheFit",&fPoissonKto6,min,max,6);
    387       fSinglePheFit->SetParameters(lambda_guess,mu_0_guess,mu_1_guess,si_0_guess,si_1_guess,norm);
    388       fSinglePheFit->SetParNames("#lambda","#mu_0","#mu_1","#sigma_0","#sigma_1","Area");
    389       fSinglePheFit->SetParLimits(0,0.,1.);
    390       fSinglePheFit->SetParLimits(1,min,(max-min)/1.5);
    391       fSinglePheFit->SetParLimits(2,(max-min)/2.,(max-0.05*(max-min)));
    392       fSinglePheFit->SetParLimits(3,1.0,(max-min)/2.0);
    393       fSinglePheFit->SetParLimits(4,1.0,(max-min)/2.5);
    394       fSinglePheFit->SetParLimits(5,norm-0.1,norm+0.1);
    395       break;
    396 
    397     case kEPoisson7:
    398409      break;
    399410
  • trunk/MagicSoft/Mars/mcalib/MHCalibrationBlindPixel.h

    r2904 r2913  
    132132    {
    133133
     134      const Double_t qe = 0.247;
     135
    134136      Double_t lambda = par[0]; 
     137
     138      Double_t b1 = par[1];
     139      Double_t b2 = par[2];
    135140     
    136141      Double_t sum = 0.;
    137142      Double_t arg = 0.;
    138      
    139       Double_t mu0 = par[1];
    140       Double_t mu1 = par[2];
    141      
    142       if (mu1 < mu0)
    143         return fNoWay;
    144 
    145       Double_t sigma0 = par[3];
    146       Double_t sigma1 = par[4];
    147      
    148       if (sigma1 < sigma0)
    149         return fNoWay;
    150      
    151       Double_t mu2 = (2.*mu1)-mu0; 
    152       Double_t mu3 = (3.*mu1)-(2.*mu0);
    153       Double_t mu4 = (4.*mu1)-(3.*mu0);
    154      
    155       Double_t sigma2 = TMath::Sqrt((2.*sigma1*sigma1) - (sigma0*sigma0)); 
    156       Double_t sigma3 = TMath::Sqrt((3.*sigma1*sigma1) - (2.*sigma0*sigma0));
    157       Double_t sigma4 = TMath::Sqrt((4.*sigma1*sigma1) - (3.*sigma0*sigma0));
    158      
    159       Double_t lambda2 = lambda*lambda;
    160       Double_t lambda3 = lambda2*lambda;
    161       Double_t lambda4 = lambda3*lambda;
    162      
    163       // k=0:
    164       arg = (x[0] - mu0)/sigma0;
    165       sum = TMath::Exp(-0.5*arg*arg)/sigma0;
    166      
    167       // k=1:
    168       arg = (x[0] - mu1)/sigma1;
    169       sum += lambda*TMath::Exp(-0.5*arg*arg)/sigma1;
    170      
    171       // k=2:
    172       arg = (x[0] - mu2)/sigma2;
    173       sum += 0.5*lambda2*TMath::Exp(-0.5*arg*arg)/sigma2;
    174      
    175       // k=3:
    176       arg = (x[0] - mu3)/sigma3;
    177       sum += 0.1666666667*lambda3*TMath::Exp(-0.5*arg*arg)/sigma3;
    178      
    179       // k=4:
    180       arg = (x[0] - mu4)/sigma4;
    181       sum += 0.041666666666667*lambda4*TMath::Exp(-0.5*arg*arg)/sigma4;
    182143     
    183144      return TMath::Exp(-1.*lambda)*par[5]*sum;
     
    193154      Double_t arg = 0.;
    194155     
     156      //      Double_t mu0 = 0.;
    195157      Double_t mu0 = par[1];
    196158      Double_t mu1 = par[2];
Note: See TracChangeset for help on using the changeset viewer.