Changeset 2641 for trunk/MagicSoft


Ignore:
Timestamp:
12/11/03 14:01:52 (21 years ago)
Author:
gaug
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Mars
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/Changelog

    r2640 r2641  
    99        - calculate signal with only 6 most significant slices (2 before, 4 after the maximum)
    1010
     11   * mhist/MHCalibrationBlindPixel:
     12        - do the consistency check fitting the pedestal
     13
     14   * mhist/MHCalibrationPixel:
     15        - store Hi Gain vs. Lo Gain values to extract the conversion factor
    1116
    1217 2003/12/11: Thomas Bretz
  • trunk/MagicSoft/Mars/manalysis/MExtractedSignalPix.cc

    r2627 r2641  
    4141
    4242MExtractedSignalPix::MExtractedSignalPix(const char* name, const char* title)
    43   : fExtractedSignal(-1.),
    44     fExtractedSignalError(-1.),
     43  : fExtractedSignalHiGain(-1.),
     44    fExtractedSignalHiGainError(-1.),
     45    fExtractedSignalLoGain(-1.),
     46    fExtractedSignalLoGainError(-1.),
    4547    fIsLoGainUsed(kFALSE),
    4648    fNumHiGainSaturated(0),
     
    6264{
    6365
    64   fExtractedSignal = -1.;
    65   fExtractedSignalError = -1.;
     66  fExtractedSignalHiGain = -1.;
     67  fExtractedSignalHiGainError = -1.;
    6668  fIsLoGainUsed = kFALSE;
    6769  fNumHiGainSaturated = 0;
     
    7577  *fLog << all << GetDescriptor() << ":" << endl;
    7678
    77   *fLog << " Signal: " << fExtractedSignal 
    78         << " +- " << fExtractedSignalError
     79  *fLog << " Signal: " << fExtractedSignalHiGain
     80        << " +- " << fExtractedSignalHiGainError
    7981        << " LoGain? " << fIsLoGainUsed
    8082        << " Nr. Sat. Hi Gain: " <<  fNumHiGainSaturated
  • trunk/MagicSoft/Mars/manalysis/MExtractedSignalPix.h

    r2634 r2641  
    1010private:
    1111
    12     Float_t fExtractedSignal;      // mean value of the extracted signal
    13     Float_t fExtractedSignalError; // error of the mean value of the extracted signal
     12    Float_t fExtractedSignalHiGain;      // mean value of the extracted signal
     13    Float_t fExtractedSignalHiGainError; // error of the mean value of the extracted signal
     14    Float_t fExtractedSignalLoGain;      // mean value of the extracted signal
     15    Float_t fExtractedSignalLoGainError; // error of the mean value of the extracted signal
    1416    Bool_t fIsLoGainUsed;
    1517    Byte_t fNumHiGainSaturated;
     
    2527    void Clear(Option_t *o="");
    2628
    27     Float_t GetExtractedSignal()      const   { return fExtractedSignal; }
    28     Float_t GetExtractedSignalError() const   { return fExtractedSignalError; }
     29    Float_t GetExtractedSignalHiGain()      const   { return fExtractedSignalHiGain; }
     30    Float_t GetExtractedSignalHiGainError() const   { return fExtractedSignalHiGainError; }
     31
     32    Float_t GetExtractedSignalLoGain()      const   { return fExtractedSignalLoGain; }
     33    Float_t GetExtractedSignalLoGainError() const   { return fExtractedSignalLoGainError; }
    2934
    3035    Float_t GetMeanArrivalTime()      const   { return fMeanArrivalTime; }
     
    3338    void SetExtractedSignal(Float_t sig, Float_t sigerr)   
    3439                                        {
    35                                           fExtractedSignal = sig;
    36                                           fExtractedSignalError = sigerr;
     40                                          fExtractedSignalHiGain = sig;
     41                                          fExtractedSignalHiGainError = sigerr;
     42                                        }
     43
     44    void SetExtractedSignal(Float_t sighi, Float_t sighierr,Float_t siglo, Float_t sigloerr)   
     45                                        {
     46                                          fExtractedSignalHiGain = sighi;
     47                                          fExtractedSignalHiGainError = sighierr;
     48                                          fExtractedSignalLoGain = siglo;
     49                                          fExtractedSignalLoGainError = sigloerr;
    3750                                        }
    3851
     
    4962    Bool_t IsLoGainUsed()               { return fIsLoGainUsed; }
    5063
    51     Bool_t IsValid() const              { return fExtractedSignal >= 0 || fExtractedSignalError >= 0; }
     64    Bool_t IsValid() const              { return fExtractedSignalHiGain >= 0. || fExtractedSignalHiGainError >= 0.; }
    5265
    5366    void PrintOut();
  • trunk/MagicSoft/Mars/mhist/MHCalibrationBlindPixel.cc

    r2627 r2641  
    6262//
    6363MHCalibrationBlindPixel::MHCalibrationBlindPixel(const char *name, const char *title)
    64     : fSinglePheFit(NULL), fTimeGausFit(NULL)
     64  : fSinglePheFit(NULL), fTimeGausFit(NULL), fSinglePhePedFit(NULL),
     65    fLambda(0.), fMu0(0.), fMu1(0.), fSigma0(0.), fSigma1(0.),
     66    fLambdaErr(0.), fMu0Err(0.), fMu1Err(0.), fSigma0Err(0.), fSigma1Err(0.),   
     67    fChisquare(0.), fProb(0.),  fNdf(0),
     68    fMeanTime(0.),  fMeanTimeErr(0.), fSigmaTime(0.), fSigmaTimeErr(0.),
     69    fLambdaCheck(0.), fLambdaCheckErr(0.)
    6570{
    6671
     
    7782    fHBlindPixelCharge->SetXTitle("Sum FADC Slices");
    7883    fHBlindPixelCharge->SetYTitle("Nr. of events");
    79     fHBlindPixelCharge->Sumw2();
     84    //    fHBlindPixelCharge->Sumw2();
    8085
    8186    fErrBlindPixelChargefirst = 0.;
     
    120125  if (fSinglePheFit)
    121126    delete fSinglePheFit;
     127  if (fSinglePhePedFit)
     128    delete fSinglePhePedFit;
    122129  if (fTimeGausFit)
    123130    delete fTimeGausFit;
     
    155162  fFitLegend->AddText(line1);
    156163
     164  const TString line6 =
     165  Form("Mean #lambda (check) = %2.2f #pm %2.2f",GetLambdaCheck(),GetLambdaCheckErr());
     166  fFitLegend->AddText(line6);
     167
    157168  const TString line2 =
    158169  Form("Pedestal: #mu_{0} = %2.2f #pm %2.2f",GetMu0(),GetMu0Err());
     
    215226      {
    216227        if (fFitOK)
    217           fSinglePheFit->SetLineColor(kGreen);         
     228          fSinglePheFit->SetLineColor(kGreen);         
    218229        else
    219230          fSinglePheFit->SetLineColor(kRed);
     
    222233        c->Modified();
    223234        c->Update();
     235
     236        if (fSinglePhePedFit)
     237          {
     238            fSinglePhePedFit->SetLineColor(kBlue);
     239            fSinglePhePedFit->DrawCopy("same");
     240          }
    224241      }
     242
    225243
    226244    c->cd(2);
     
    311329  // otherwise the fit goes gaga because of high number of dimensions ...
    312330  //
    313   const Stat_t   entries      = fHBlindPixelCharge->GetSumOfWeights();
    314   const Double_t lambda_guess = 0.2;
     331  const Stat_t   entries      = fHBlindPixelCharge->GetEntries();
     332  const Double_t lambda_guess = 0.5;
    315333  const Double_t mu_0_guess = fHBlindPixelCharge->GetBinCenter(fHBlindPixelCharge->GetMaximumBin());
    316   const Double_t si_0_guess = mu_0_guess/5.;
    317   const Double_t mu_1_guess = mu_0_guess + 50.;
     334  const Double_t si_0_guess = 20.;
     335  const Double_t mu_1_guess = mu_0_guess + 100.;
    318336  const Double_t si_1_guess = si_0_guess + si_0_guess;
    319337
     
    321339  fSinglePheFit->SetParameters(lambda_guess,mu_0_guess,mu_1_guess,si_0_guess,si_1_guess,entries);
    322340  fSinglePheFit->SetParNames("#lambda","#mu_0","#mu_1","#sigma_0","#sigma_1","area");
    323   fSinglePheFit->SetParLimits(0,0.,5.);
     341  fSinglePheFit->SetParLimits(0,0.,3.);
    324342  fSinglePheFit->SetParLimits(1,rmin,rmax);
    325343  fSinglePheFit->SetParLimits(2,rmin,rmax);
    326344  fSinglePheFit->SetParLimits(3,1.0,rmax-rmin);
    327345  fSinglePheFit->SetParLimits(4,1.7,rmax-rmin);
    328   fSinglePheFit->SetParLimits(5,0.,2.5*entries);
     346  fSinglePheFit->SetParLimits(5,0.,1.5*entries);
    329347  //
    330348  // Normalize the histogram to facilitate faster fitting of the area
     
    355373
    356374  fHBlindPixelCharge->Fit(fSinglePheFit,opt);
     375  fHBlindPixelCharge->Fit(fSinglePheFit,opt);
    357376
    358377  fLambda = fSinglePheFit->GetParameter(0);
     
    372391  fNdf       = fSinglePheFit->GetNDF();
    373392
     393  // Perform the cross-check fitting only the pedestal:
     394  fSinglePhePedFit = new TF1("GausPed","gaus",rmin,fMu0);
     395  fHBlindPixelCharge->Fit(fSinglePhePedFit,opt);
     396
     397  Double_t pedarea = fSinglePhePedFit->GetParameter(0)*gkSq2Pi*fSinglePhePedFit->GetParameter(2);
     398  cout << "Parameter0: " << fSinglePhePedFit->GetParameter(0) << endl;
     399  cout << "Parameter2: " << fSinglePhePedFit->GetParameter(2) << endl;
     400  cout << "Pedarea: " << pedarea << endl;
     401  cout << "entries: " << entries << endl;
     402  fLambdaCheck     = TMath::Log((double)entries/pedarea);
     403  fLambdaCheckErr  = fSinglePhePedFit->GetParError(0)/fSinglePhePedFit->GetParameter(0)
     404                     + fSinglePhePedFit->GetParError(2)/fSinglePhePedFit->GetParameter(2);
     405
    374406  *fLog << "Results of the Blind Pixel Fit: " << endl;
    375407  *fLog << "Chisquare: " << fChisquare << endl;
     
    380412  //
    381413  // The fit result is accepted under condition
    382   // The Probability is greater than gkProbLimit (default 0.01 == 99%)
     414  // The fit result is accepted under condition
     415  // The Probability is greater than gkProbLimit (default 0.001 == 99.7%)
    383416  //
    384417  if (fProb < gkProbLimit)
Note: See TracChangeset for help on using the changeset viewer.