Changeset 8651


Ignore:
Timestamp:
07/28/07 00:16:22 (17 years ago)
Author:
tbretz
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Mars
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/Changelog

    r8648 r8651  
    1818
    1919                                                 -*-*- END OF LINE -*-*-
     20
     21 2007/07/2 Thomas Bretz
     22
     23   * mjobs/MJSpectrum.[h,cc]:
     24     - added CutQ
     25     - added some checks for the Zenith angle distribution
     26
     27
    2028
    2129 2007/07/26 Daniela Dorner
  • trunk/MagicSoft/Mars/mjobs/MJSpectrum.cc

    r8587 r8651  
    8686
    8787MJSpectrum::MJSpectrum(const char *name, const char *title)
    88     : fCut0(0),fCut1(0), fCut2(0), fCut3(0), fEstimateEnergy(0),
     88    : fCutQ(0), fCut0(0),fCut1(0), fCut2(0), fCut3(0), fEstimateEnergy(0),
    8989    fCalcHadronness(0), fRefill(kFALSE), fSimpleMode(kTRUE),
    9090    fRawMc(kFALSE), fNoThetaWeights(kFALSE)
     
    9696MJSpectrum::~MJSpectrum()
    9797{
     98    if (fCutQ)
     99        delete fCutQ;
    98100    if (fCut0)
    99101        delete fCut0;
     
    159161
    160162    fLog->Separator("Used Cuts");
     163    fCutQ->Print();
    161164    fCut0->Print();
    162165    fCut1->Print();
     
    246249        arr.DisplayIn(*fDisplay, "Hist");
    247250
     251    if (!ReadTask(fCutQ, "CutQ"))
     252        return -1;
    248253    if (!ReadTask(fCut0, "Cut0"))
    249254        return -1;
     
    375380// Display the final theta distribution.
    376381//
    377 void MJSpectrum::DisplayResult(const TH2D &h2) const
     382Bool_t MJSpectrum::DisplayResult(const TH2D &h2) const
    378383{
    379384    if (!fDisplay || !fDisplay->CdCanvas("ZdDist"))
     
    395400    pad->cd(1);
    396401    TH1D *theta = (TH1D*)gPad->FindObject("Theta");
    397     if (theta)
    398     {
    399         proj.Scale(theta->GetMaximum()/proj.GetMaximum());
    400         theta->SetMaximum(1.05*TMath::Max(theta->GetMaximum(), proj.GetMaximum()));
    401     }
     402    if (!theta)
     403    {
     404        *fLog << err << "ERROR - Theta-Histogram vanished... cannot proceed." << endl;
     405        return kFALSE;
     406    }
     407
     408    if (proj.GetMaximum()==0)
     409    {
     410        *fLog << err;
     411        *fLog << "ERROR - The Zenith Angle distribution of your Monte Carlos doesn't overlap";
     412        *fLog << "        with the the Zenith Angle distribution of your observation.";
     413        theta->SetLineColor(kRed);
     414        return kFALSE;;
     415    }
     416
     417    proj.Scale(theta->GetMaximum()/proj.GetMaximum());
     418    theta->SetMaximum(1.05*TMath::Max(theta->GetMaximum(), proj.GetMaximum()));
     419
    402420    proj.Draw("same");
     421
     422    // Compare both histograms
     423    const Double_t prob = proj.Chi2Test(theta, "");
     424    if (prob==1)
     425        return kTRUE;
     426
     427    if (prob>0.99)
     428    {
     429        *fLog << inf;
     430        *fLog << "The Zenith Angle distribution of your Monte Carlos fits well";
     431        *fLog << "with the the Zenith Angle distribution of your observation.";
     432        return kTRUE;
     433    }
     434
     435    // <0.01: passen gar nicht
     436    // ==1: passen perfekt
     437    // >0.99: passer sehr gut
     438
     439    if (prob<0.01)
     440    {
     441        *fLog << err;
     442        *fLog << "ERROR - The Zenith Angle distribution of your Monte Carlos does not fit";
     443        *fLog << "        with the the Zenith Angle distribution of your observation.";
     444        theta->SetLineColor(kRed);
     445        return kFALSE;
     446    }
     447
     448    *fLog << warn;
     449    *fLog << "WARNING - The Zenith Angle distribution of your Monte Carlos doesn't fits well";
     450    *fLog << "          with the the Zenith Angle distribution of your observation.";
     451    return kTRUE;
    403452}
    404453
     
    11311180    }
    11321181
    1133     DisplayResult(fSimpleMode ? hist : (TH2D&)mh1.GetHist());
     1182    if (!DisplayResult(fSimpleMode ? hist : (TH2D&)mh1.GetHist()))
     1183        return kFALSE;
    11341184
    11351185    // ------------------------- Final loop --------------------------
     
    12451295    tlist2.AddToList(&fill1a);
    12461296    tlist2.AddToList(&fill30);
     1297    tlist2.AddToList(fCutQ);
    12471298    tlist2.AddToList(fCut0);
    12481299    tlist2.AddToList(&taskenv0);
  • trunk/MagicSoft/Mars/mjobs/MJSpectrum.h

    r8173 r8651  
    2424{
    2525private:
     26    MTask *fCutQ;
    2627    MTask *fCut0;
    2728    MTask *fCut1;
     
    4647    // Display Output
    4748    void    PrintSetup(const MAlphaFitter &fit) const;
    48     void    DisplayResult(const TH2D &mh1) const;
     49    Bool_t  DisplayResult(const TH2D &mh1) const;
    4950    Bool_t  IntermediateLoop(MParList &plist, MH3 &h1, TH1D &temp1, const MDataSet &set, MMcSpectrumWeight &w) const;
    5051    TArrayD FitSpectrum(TH1D &spectrum) const;
Note: See TracChangeset for help on using the changeset viewer.