Changeset 5100


Ignore:
Timestamp:
09/17/04 15:07:15 (20 years ago)
Author:
tbretz
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Mars
Files:
11 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/Changelog

    r5090 r5100  
    1919
    2020                                                 -*-*- END OF LINE -*-*-
     21 2004/09/17: Thomas Bretz
     22
     23   * mhcalib/MH*.[h,cc]:
     24     - redone some changes from yesterday - for unknown reason they
     25       were lost
     26
     27   * mbase/MTask.cc:
     28     - make sure that the correct number of executions is returned
     29       counter which cannot be reset properly)
     30
     31   * mdata/MDataArray.cc:
     32     - some changes to Print-output
     33
     34   * mfbase/MF.[h,cc]:
     35     - added GetRule
     36
     37   * mfileio/MReadTree.cc:
     38     - some improvements to output
     39
     40   * mhbase/MHMatrix.cc:
     41     - some improvements in Print
     42
     43   * mhflux/MAlphaFitter.[h,cc]:
     44     - calculate the significance also from the first bins
     45     - added Copy
     46     - added print
     47
     48   * mhflux/MHAlpha.[h,cc]:
     49     - added some fFit.Print to keep track of what's going on
     50
     51   * mhflux/MHFalseSource.cc:
     52     - made lines of 2D-Gauss smaller
     53
     54
    2155
    2256 2004/09/16: Abelardo Moralejo
     
    3165
    3266
     67
    3368 2004/09/16: Markus Gaug
    3469
     
    4075     - re-installed the Clone-function. Without, DrawClone() does not
    4176       Clone()
     77
    4278
    4379
  • trunk/MagicSoft/Mars/mbase/MTask.cc

    r5064 r5100  
    201201Int_t MTask::CallPreProcess(MParList *plist)
    202202{
    203     fStopwatch->Reset();
     203    // This does not reset the counter!
     204    // fStopwatch->Reset();
     205
     206    delete fStopwatch;
     207    fStopwatch = new TStopwatch;
    204208
    205209    *fLog << all << fName << "... " << flush;
  • trunk/MagicSoft/Mars/mdata/MDataArray.cc

    r3572 r5100  
    135135    while ((data=(MData*)Next()))
    136136    {
    137         *fLog << all << " Line " << setw(3) << n++ << ": " << flush;
     137        *fLog << all << " " << fName << "[" << setw(3) << n++ << "] = " << flush;
    138138        data->Print();
    139139        *fLog << endl;
  • trunk/MagicSoft/Mars/mfbase/MF.h

    r3573 r5100  
    3737    ~MF();
    3838
     39    TString GetRule() const { return fF ? fF->GetRule() : MFilter::GetRule(); }
     40
    3941    Bool_t IsExpressionTrue() const;
    4042
  • trunk/MagicSoft/Mars/mfileio/MReadTree.cc

    r4895 r5100  
    724724        fChain->SetBranchAddress(bname, pcont);
    725725
    726         *fLog << inf << "Master branch address " << bname << " [";
     726        *fLog << inf << "Master branch address '" << bname << "' [";
    727727        *fLog << classname << "] setup for reading." << endl;
    728728
  • trunk/MagicSoft/Mars/mhbase/MHMatrix.cc

    r4656 r5100  
    369369
    370370    if (fData && str.Contains("cols", TString::kIgnoreCase))
     371    {
     372        fData->SetName(fName);
    371373        fData->Print();
     374    }
    372375
    373376    if (str.Contains("data", TString::kIgnoreCase))
  • trunk/MagicSoft/Mars/mhflux/MAlphaFitter.cc

    r5012 r5100  
    8484Bool_t MAlphaFitter::Fit(TH1D &h, Bool_t paint)
    8585{
    86     Double_t sigint=fSigInt;
    8786    Double_t sigmax=fSigMax;
    8887    Double_t bgmin =fBgMin;
    8988    Double_t bgmax =fBgMax;
     89
     90    //*fLog << inf << "Fit: " << sigmax << " " << fSigInt << "  " << bgmin << " " << bgmax << endl;
    9091
    9192    //TF1 fFunc("", Form("gaus(0) + pol%d(3)", fPolynomOrder), 0, 90);
     
    167168    }
    168169    // ------------------------------------
    169     const Double_t s = fFunc->Integral(0, sigint)/alphaw;
    170     fFunc->SetParameter(0, 0);
    171     fFunc->SetParameter(2, 1);
    172     const Double_t b = fFunc->Integral(0, sigint)/alphaw;
    173     fSignificance = MMath::SignificanceLiMaSigned(s, b);
    174 
    175     const Double_t uin = 1.25*sigint;
    176     const Int_t    bin = h.GetXaxis()->FindFixBin(uin);
     170
     171     //const Double_t s = fFunc->Integral(0, fSigInt)/alphaw;
     172     fFunc->SetParameter(0, 0);
     173     fFunc->SetParameter(2, 1);
     174     //const Double_t b = fFunc->Integral(0, fSigInt)/alphaw;
     175     //fSignificance = MMath::SignificanceLiMaSigned(s, b);
     176
     177
     178    const Int_t bin = h.GetXaxis()->FindFixBin(fSigInt*0.999);
    177179
    178180    fIntegralMax      = h.GetBinLowEdge(bin+1);
     
    180182    fEventsSignal     = h.Integral(0, bin);
    181183    fEventsExcess     = fEventsSignal-fEventsBackground;
    182     //fSignificance     = MMath::SignificanceLiMaSigned(fEventsSignal, fEventsBackground);
     184    fSignificance     = MMath::SignificanceLiMaSigned(fEventsSignal, fEventsBackground);
     185
     186    if (fEventsExcess<0)
     187        fEventsExcess=0;
    183188
    184189    return kTRUE;
     
    187192void MAlphaFitter::PaintResult(Float_t x, Float_t y, Float_t size) const
    188193{
    189     TLatex text(x, y, Form("\\sigma_{Li/Ma}=%.1f (\\alpha<%.1f\\circ) \\omega=%.1f\\circ  E=%d  (\\alpha<%.1f\\circ)  (\\chi_{b}^{2}=%.1f  \\chi_{s}^{2}=%.1f)",
    190                            fSignificance, fSigInt, GetGausSigma(),
     194    TLatex text(x, y, Form("\\sigma_{Li/Ma}=%.1f \\omega=%.1f\\circ  E=%d  (\\alpha<%.1f\\circ)  (\\chi_{b}^{2}=%.1f  \\chi_{s}^{2}=%.1f)",
     195                           fSignificance, GetGausSigma(),
    191196                           (int)fEventsExcess, fIntegralMax,
    192197                           fChiSqBg, fChiSqSignal));
     
    196201    text.Paint();
    197202}
     203
     204void MAlphaFitter::Copy(TObject &o) const
     205{
     206    MAlphaFitter &f = static_cast<MAlphaFitter&>(o);
     207
     208    f.fSigInt       = fSigInt;
     209    f.fSigMax       = fSigMax;
     210    f.fBgMin        = fBgMin;
     211    f.fBgMax        = fBgMax;
     212    f.fPolynomOrder = fPolynomOrder;
     213    f.fCoefficients.Set(fCoefficients.GetSize());
     214    f.fCoefficients.Reset();
     215
     216    TF1 *fcn = f.fFunc;
     217    f.fFunc = new TF1(*fFunc);
     218    gROOT->GetListOfFunctions()->Remove(f.fFunc);
     219    delete fcn;
     220}
     221
     222void MAlphaFitter::Print(Option_t *o) const
     223{
     224    *fLog << inf << GetDescriptor() << ": Fitting..." << endl;
     225    *fLog << " ...background from " << fBgMin << " to " << fBgMax << endl;
     226    *fLog << " ...signal to " << fSigMax << " (integrate into bin at " << fSigInt << ")" << endl;
     227    *fLog << " ...polynom order " << fPolynomOrder << endl;
     228}
  • trunk/MagicSoft/Mars/mhflux/MAlphaFitter.h

    r5080 r5100  
    1919{
    2020private:
    21     TF1 *fFunc;
    22 
    2321    Float_t fSigInt;
    2422    Float_t fSigMax;
     
    3836    TArrayD fCoefficients;
    3937
     38    TF1 *fFunc;
     39
    4040public:
    4141    // Implementing the function yourself is only about 5% faster
    42     MAlphaFitter() : fFunc(new TF1("", "gaus(0) + pol1(3)", 0, 90)), fSigInt(10), fSigMax(75), fBgMin(45), fBgMax(85), fPolynomOrder(1), fCoefficients(3+fPolynomOrder+1)
     42    MAlphaFitter(const char *name=0, const char *title=0) : fSigInt(15), fSigMax(75), fBgMin(45), fBgMax(85), fPolynomOrder(2), fCoefficients(3+fPolynomOrder+1), fFunc(new TF1("", Form("gaus(0) + pol%d(3)", fPolynomOrder), 0, 90))
    4343    {
     44        fName  = name  ? name  : "MAlphaFitter";
     45        fTitle = title ? title : "Fit alpha";
     46
    4447        gROOT->GetListOfFunctions()->Remove(fFunc);
    4548    }
     
    5457    }
    5558
    56     void Copy(TObject &o) const
    57     {
    58         MAlphaFitter &f = static_cast<MAlphaFitter&>(o);
    59 
    60         f.fSigInt       = fSigInt;
    61         f.fSigMax       = fSigMax;
    62         f.fBgMin        = fBgMin;
    63         f.fBgMax        = fBgMax;
    64         f.fPolynomOrder = fPolynomOrder;
    65         f.fCoefficients.Set(fCoefficients.GetSize());
    66         f.fCoefficients.Reset();
    67 
    68         TF1 *fcn = f.fFunc;
    69         f.fFunc = new TF1(*fFunc);
    70         gROOT->GetListOfFunctions()->Remove(f.fFunc);
    71         delete fcn;
    72     }
     59    void Print(Option_t *o=0) const;
     60    void Copy(TObject &o) const;
    7361
    7462    void SetSignalIntegralMax(Float_t s)   { fSigInt       = s; }
  • trunk/MagicSoft/Mars/mhflux/MHAlpha.cc

    r5012 r5100  
    277277        fit->Copy(fFit);
    278278
     279    fFit.Print();
     280
    279281    return kTRUE;
    280282}
     
    540542    // Store the final result in fFit
    541543    TH1D *h = fHAlpha.ProjectionZ("AlphaExc_px", -1, 9999, -1, 9999, "E");
     544    fFit.Print();
    542545    Bool_t rc = fFit.Fit(*h);
    543546    delete h;
  • trunk/MagicSoft/Mars/mhflux/MHAlpha.h

    r5012 r5100  
    8484{
    8585private:
    86     MAlphaFitter fFit;          //! SEEMS THAT STREAMER HAS SOME PROBLEMS... MAYBE IF FUNC IS USED AT THE SAME TIME FOR FITS (PAINT)
     86    MAlphaFitter fFit;          // SEEMS THAT STREAMER HAS SOME PROBLEMS... MAYBE IF FUNC IS USED AT THE SAME TIME FOR FITS (PAINT)
    8787
    8888    TH3D fHAlpha;               // Alpha vs. theta and energy
  • trunk/MagicSoft/Mars/mhflux/MHFalseSource.cc

    r5080 r5100  
    740740
    741741    //Gaus(Double_t x, Double_t mean=0, Double_t sigma=1, Bool_t norm=kFALSE);
    742     return par[0]*(g0+g1);
     742    return par[0]*g0*g1;
    743743}
    744744
     
    942942
    943943
    944     TF2 f2d("", FcnGauss2d, -1.5, 1.5, -1.5, 1.5, 6);
     944    TF2 f2d("Gaus-2D", FcnGauss2d, -1.5, 1.5, -1.5, 1.5, 6);
     945    f2d.SetLineWidth(1);
    945946    f2d.SetParName(0, "Max   sigma");
    946947    f2d.SetParName(1, "Mean_1  deg");
     
    954955    f2d.SetParLimits(4, 0, 1);     // sigma_2
    955956    f2d.SetParLimits(5, 0, 90);    // phi
    956     f2d.SetParameter(0, maxs); // A
    957     f2d.SetParameter(1, 0);    // mu_1
    958     f2d.SetParameter(2, 0.2);  // sigma_1
    959     f2d.SetParameter(3, 0);    // mu_2
    960     f2d.SetParameter(4, 0.2);  // sigma_2
    961     f2d.SetParameter(5, 0);    // phi
    962     hist->Fit(&f2d, "IN0");
    963     //f2d.DrawClone("cont2same")->SetBit(kCanDelete);
     957    f2d.SetParameter(0, maxs);     // A
     958    f2d.SetParameter(1, 0);        // mu_1
     959    f2d.SetParameter(2, 0.5);      // sigma_1
     960    f2d.SetParameter(3, 0);        // mu_2
     961    f2d.SetParameter(4, 0.5);      // sigma_2
     962    f2d.SetParameter(5, 0);        // phi
     963    hist->Fit(&f2d, "NI0");
     964    f2d.DrawCopy("cont2same");
    964965
    965966
Note: See TracChangeset for help on using the changeset viewer.