Ignore:
Timestamp:
06/28/12 14:10:18 (12 years ago)
Author:
Jens Buss
Message:
bug fix in scaled spectrum fit, took of likelihood fit
File:
1 edited

Legend:

Unmodified
Added
Removed
  • fact/tools/marsmacros/singlepe.C

    r14245 r14246  
    161161class MHSingles : public MH
    162162{
    163     MH2F       fSignal;
    164     MH2F       fTime;
    165     MProfile2D fPulse;
     163    TH2F       fSignal;     //changed from MH2F to TH2F
     164    TH2F       fTime;       //changed from MH2F to TH2F
     165    TProfile2D fPulse;      //changed from MProfile2D to TProfile2D
     166
    166167
    167168    UInt_t fNumEntries;
     
    476477
    477478int singlepe(
    478 //        const char *runfile, const char *drsfile, const char *outfile
     479        const char *runfile, const char *drsfile, const char *outfile
    479480)
    480481{
     
    482483  // ======================================================
    483484
    484   const char *drsfile = "/fact/raw/2012/05/18/20120518_003.drs.fits.gz";
    485485//    const char *drsfile = "/fact/raw/2012/06/25/20120625_112.drs.fits.gz";
    486486
    487487  MDirIter iter;
    488   iter.AddDirectory("/fact/raw/2012/05/18", "20120518_005.fits.gz");
    489 //    iter.AddDirectory(gSystem->DirName(runfile), gSystem->BaseName(runfile));
    490 
    491 //    TString filename;
    492 //    for (UInt_t fileNr = 116; fileNr < 147; fileNr++)
    493 //    {
    494 //        filename    = "20120625_";
    495 //        filename   += fileNr;
    496 //        filename   += ".fits.gz";
    497 //        iter.AddDirectory("/fact/raw/2012/06/25", filename);
    498 //    }
    499 
    500 //     iter.AddDirectory("/fact/raw/2012/06/25", "20120625_116.fits.gz");
    501 //     iter.AddDirectory("/fact/raw/2012/06/25", "20120625_117.fits.gz");
    502 //     iter.AddDirectory("/fact/raw/2012/06/25", "20120625_118.fits.gz");
    503 //     iter.AddDirectory("/fact/raw/2012/06/25", "20120625_119.fits.gz");
     488    iter.AddDirectory(gSystem->DirName(runfile), gSystem->BaseName(runfile));
    504489
    505490  // ======================================================
     
    677662
    678663  TH1F hGain      ("Gain",      "Gain distribution",
    679                    400,  100,   300);
     664                   100,  0,   400);
    680665  hGain.SetXTitle("gain [a.u.]");
    681666  hGain.SetYTitle("Rate");
     
    735720  funcScaled.SetLineColor(kBlue);
    736721
     722  /*
    737723  TF1 funcScaledBL("gain_sum_spektrum", fcn, 0, 10, 5);
    738724  funcScaledBL.SetParNames("Maximum", "Gain", "Sigma", "XtalkProb", "Offset");
    739725  funcScaledBL.SetLineColor(kRed);
    740 
     726  */
    741727
    742728
     
    10611047  for (UInt_t bin = 1; bin < (UInt_t)hSum.GetNbinsX()+1; bin++)
    10621048    {
    1063       hSumScale.SetBinError(bin, hSum.GetBinContent(bin)*0.1);
     1049      hSumScale.SetBinError(bin, hSumScale.GetBinContent(bin)*0.1);
    10641050    }
    10651051
     
    10941080
    10951081  funcScaled.SetParameters(par2);
    1096   funcScaledBL.SetParameters(par2);
     1082//  funcScaledBL.SetParameters(par2);
    10971083//    funcScaled.FixParameter(1,0.9);
    10981084  funcScaled.FixParameter(4,0);
    1099   funcScaledBL.FixParameter(4,0);
     1085//  funcScaledBL.FixParameter(4,0);
    11001086  funcScaled.FixParameter(5,Crosstlk);
    1101   funcScaledBL.FixParameter(5,Crosstlk);
     1087//  funcScaledBL.FixParameter(5,Crosstlk);
    11021088
    11031089  const double minScaled = par2[1]-fwhmScaled;
     
    11081094
    11091095  funcScaled.SetRange(minScaled, maxScaled);
    1110   funcScaledBL.SetRange(minScaled, maxScaled);
     1096//  funcScaledBL.SetRange(minScaled, maxScaled);
    11111097  hSumScale.Fit(&funcScaled, "N0QS", "", minScaled, maxScaled);
    1112   hSumScale.Fit(&funcScaledBL, "WLN0QS", "", minScaled, maxScaled);
     1098//  hSumScale.Fit(&funcScaledBL, "WLN0QS", "", minScaled, maxScaled);
    11131099  funcScaled.DrawCopy("SAME");
    1114   funcScaledBL.DrawCopy("SAME");
     1100//  funcScaledBL.DrawCopy("SAME");
    11151101  //--------fit gausses to peaks of gain corrected sum specetrum -----------
    11161102
     
    12121198  hGain.DrawCopy();
    12131199
    1214 
     1200/*
    12151201  TCanvas &c25 = d->AddTab("Spectra");
    12161202  c25.Divide(2,1);
     
    12271213  funcScaled.DrawCopy("SAME");
    12281214  funcScaledBL.DrawCopy("SAME");
    1229 
     1215*/
    12301216
    12311217  /*
     
    12351221  */
    12361222
    1237   d->SaveAs("/home_nfs/isdc/jbbuss/singlepe.root");
     1223  d->SaveAs(outfile);
    12381224  return 0;
    12391225}
     
    12481234  Double_t cross  = par[3];
    12491235  Double_t shift  = par[4];
    1250 //    Double_t k      = par[5];
    12511236
    12521237  Double_t xTalk = 1;
     
    12621247      y += xTalk*gauss;
    12631248
    1264 //        for (int j = 1; j < k; j++)
    1265 //        {
    12661249      xTalk *= cross;
    1267 //        }
     1250
    12681251    }
    12691252
Note: See TracChangeset for help on using the changeset viewer.