Changeset 2107 for trunk/MagicSoft


Ignore:
Timestamp:
05/09/03 19:58:55 (21 years ago)
Author:
moralejo
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Mars
Files:
1 added
2 deleted
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/Changelog

    r2106 r2107  
    11                                                 -*-*- END OF LINE -*-*-
     2
     3 2003/05/09: Abelardo Moralejo
     4
     5   * mhistmc/MHMcEnergyMigration.[h,cc]
     6     - Added histograms, changed Draw() to display them. Still
     7       provisional, many changes in the whole part of the energy
     8       estimator are needed.
     9
     10   * macros/CT1EEst.C, CT1EnergyEst.C
     11     - Removed
     12
     13   * macros/CT1EgyEst.C
     14     - Added example on how to use the energy estimation for CT1.
     15       Very provisional!
    216
    317 2003/05/09: Wolfgang Wittek
  • trunk/MagicSoft/Mars/mhistmc/MHMcEnergyMigration.cc

    r2043 r2107  
    1717!
    1818!   Author(s): Wolfgang Wittek 4/2002 <mailto:wittek@mppmu.mpg.de>
     19!              Abelardo Moralejo 5/2003 <mailto:moralejo@pd.infn.it>
    1920!
    2021!   Copyright: MAGIC Software Development, 2000-2002
     
    4546#include "MLog.h"
    4647#include "MLogManip.h"
     48#include <TProfile.h>
    4749
    4850ClassImp(MHMcEnergyMigration);
     
    5456//
    5557MHMcEnergyMigration::MHMcEnergyMigration(const char *name, const char *title)
    56     : fHist()
     58  : fHist(), fHist2(), fHistImp()
    5759{
    5860    //
     
    6365
    6466    fHist.SetDirectory(NULL);
    65 
    66     fHist.SetTitle("3D-plot   E-true E-est Theta");
    67     fHist.SetXTitle("E_{true} [GeV]");
    68     fHist.SetYTitle("E_{est} [GeV]");
     67    fHist.SetTitle("3D-plot   E_{TRUE} E_{EST} \\Theta");
     68    fHist.SetXTitle("E_{TRUE} [GeV]");
     69    fHist.SetYTitle("E_{EST} [GeV]");
    6970    fHist.SetZTitle("\\Theta [\\circ]");
     71
     72    fHist2.SetDirectory(NULL);
     73    fHist2.SetTitle("3D-plot \\Delta E / E vs E_{TRUE} E_{EST}");
     74    fHist2.SetXTitle("E_{TRUE} [GeV]");
     75    fHist2.SetYTitle("E_{EST} [GeV]");
     76    fHist2.SetZTitle("\\frac{E_{EST} - E_{TRUE}}{E_{TRUE}}");
     77
     78    fHistImp.SetDirectory(NULL);
     79    fHistImp.SetTitle("\\Delta E / E  vs Impact parameter");
     80    fHistImp.SetXTitle("Impact parameter (m)");
     81    fHistImp.SetYTitle("\\frac{E_{EST} - E_{TRUE}}{E_{TRUE}}");
     82
    7083}
    7184
     
    99112
    100113    SetBinning(&fHist, binsenergy, binsenergy, binstheta);
    101 
    102114    fHist.Sumw2();
     115
     116    const MBinning* binsde = (MBinning*)plist->FindObject("BinningDE");
     117    const MBinning* binsimpact = (MBinning*)plist->FindObject("BinningImpact");
     118    SetBinning(&fHistImp, binsimpact, binsde);
     119
     120    fHistImp.Sumw2();
     121
     122    SetBinning(&fHist2, binsenergy, binsenergy, binsde);
     123    fHist2.Sumw2();
    103124
    104125    return kTRUE;
     
    124145    gPad->SetLogx();
    125146    h = fHist.Project3D("ex_pro");
    126     h->SetTitle("Distribution of E_{true}");
    127     h->SetXTitle("E_{true} [GeV]");
     147    h->SetTitle("Distribution of E_{TRUE}");
     148    h->SetXTitle("E_{TRUE} [GeV]");
    128149    h->SetBit(kCanDelete);
    129150    h->Draw(opt);
     151    h->SetDirectory(NULL);
    130152
    131153    pad->cd(2);
     
    133155    gPad->SetLogx();
    134156    h = fHist.Project3D("ey_pro");
    135     h->SetTitle("Distribution of E_{est}");
     157    h->SetTitle("Distribution of E_{EST}");
    136158    h->SetXTitle("E_{est} [GeV]");
    137159    h->SetBit(kCanDelete);
    138160    h->Draw(opt);
     161    Double_t minEest = h->GetXaxis()->GetXmin();
     162    h->SetDirectory(NULL);
    139163
    140164    pad->cd(3);
    141165    gPad->SetBorderMode(0);
    142     h = fHist.Project3D("ez_pro");
     166    h = fHist.Project3D("z_pro");
    143167    h->SetTitle("Distribution of \\Theta");
    144168    h->SetXTitle("\\Theta [\\circ]");
    145169    h->SetBit(kCanDelete);
     170    h->SetLineWidth(2);
    146171    h->Draw(opt);
     172    h->SetDirectory(NULL);
    147173
    148174    pad->cd(4);
    149175    gPad->SetBorderMode(0);
    150     fHist.Draw(opt);
     176    TH1D* hpx;
     177    hpx = fHistImp.ProjectionX("_px", 1, fHistImp.GetNbinsY(),"e");
     178    hpx->SetTitle("Distribution of Impact parameter");
     179    hpx->SetXTitle("Impact parameter (m)");
     180    hpx->SetBit(kCanDelete);
     181    hpx->Draw(opt);
     182    hpx->SetDirectory(NULL);
     183    fHistImp.SetDirectory(NULL);
    151184
    152185    pad->Modified();
    153186    pad->Update();
     187
     188    TVirtualPad *pad2 = MakeDefCanvas((TString)GetName()+"2");
     189    pad2->SetBorderMode(0);
     190
     191    AppendPad("");
     192
     193    pad2->Divide(2,2);
     194   
     195    TH2D *h2;
     196
     197    pad2->cd(1);
     198    gPad->SetBorderMode(0);
     199    gPad->SetLogx();
     200    gPad->SetLogy();
     201    h2 = (TH2D*) fHist.Project3D("xy");
     202
     203    TProfile* h2pfx;
     204    h2pfx = h2->ProfileX("_pfx", 1, h2->GetNbinsY(),"S");
     205    h2pfx->SetXTitle("E_{TRUE} (GeV)");
     206    h2pfx->SetYTitle("E_{EST} (GeV)");
     207    h2pfx->SetTitle("E_{EST} vs E_{TRUE}");
     208    h2pfx->SetBit(kCanDelete);
     209    h2pfx->SetFillColor(41);
     210    h2pfx->SetMinimum(minEest);
     211    h2pfx->SetStats(kFALSE);
     212    h2pfx->Draw("E3");
     213
     214    h2->SetBit(kCanDelete);
     215    h2->SetFillColor(1);
     216    h2->Draw("box,same");
     217    h2->SetDirectory(NULL);
     218
     219    h2pfx->SetLineColor(2);
     220    h2pfx->SetLineWidth(2);
     221    h2pfx->Draw("L,histo,same");
     222    h2pfx->SetDirectory(NULL);
     223
     224    pad2->cd(2);
     225    gPad->SetBorderMode(0);
     226    gPad->SetLogx();
     227    gPad->SetLeftMargin(0.15);
     228    h2 = (TH2D*) fHist2.Project3D("zx");
     229    h2->SetBit(kCanDelete);
     230    h2pfx = h2->ProfileX("_pfx", 1, h2->GetNbinsY(),"S");
     231    h2pfx->SetTitle("\\Delta E / E vs E_{TRUE}");
     232    h2pfx->SetXTitle("E_{TRUE} (GeV)");
     233    h2pfx->SetYTitle("\\frac{E_{EST} - E_{TRUE}}{E_{TRUE}}");
     234    h2pfx->SetBit(kCanDelete);
     235    h2pfx->SetFillColor(41);
     236    h2pfx->GetYaxis()->SetTitleOffset(1.4);
     237    h2pfx->SetStats(kFALSE);
     238    h2pfx->Draw("E3");
     239    h2->SetFillColor(1);
     240    h2->Draw("same,box");
     241    h2->SetDirectory(NULL);
     242    h2pfx->SetLineColor(2);
     243    h2pfx->SetLineWidth(2);
     244    h2pfx->Draw("L,histo,same");
     245    h2pfx->SetDirectory(NULL);
     246   
     247    pad2->cd(3);
     248    gPad->SetBorderMode(0);
     249    gPad->SetLogx();
     250    gPad->SetLeftMargin(0.15);
     251    h2 = (TH2D*) fHist2.Project3D("zy");
     252    h2->SetBit(kCanDelete);
     253    h2pfx = h2->ProfileX("_pfx", 1, h2->GetNbinsY(),"S");
     254    h2pfx->SetTitle("\\Delta E / E vs E_{EST}");
     255    h2pfx->SetXTitle("E_{TRUE} (GeV)");
     256    h2pfx->SetYTitle("\\frac{E_{EST} - E_{TRUE}}{E_{TRUE}}");
     257    h2pfx->SetBit(kCanDelete);
     258    h2pfx->SetFillColor(41);
     259    h2pfx->GetYaxis()->SetTitleOffset(1.4);
     260    h2pfx->SetStats(kFALSE);
     261    h2pfx->SetMinimum(-1.);
     262    h2pfx->SetMaximum(1.);
     263    h2pfx->Draw("E3");
     264   
     265    h2->SetFillColor(1);
     266    h2->Draw("same,box");
     267    h2->SetDirectory(NULL);
     268    h2pfx->SetLineColor(2);
     269    h2pfx->SetLineWidth(2);
     270    h2pfx->Draw("L,histo,same");
     271    h2pfx->SetDirectory(NULL);
     272   
     273    pad2->cd(4);
     274    gPad->SetBorderMode(0);
     275    h = fHist2.ProjectionZ("_pz",1,fHist2.GetNbinsX(),1,fHist2.GetNbinsY(),"e");
     276    h->SetBit(kCanDelete);
     277    h->Draw();
     278    h->SetDirectory(NULL);
     279
     280    pad2->Modified();
     281    pad2->Update();
     282
     283    fHist.SetDirectory(NULL);
     284    fHist2.SetDirectory(NULL);
     285
    154286}
    155287
     
    160292Bool_t MHMcEnergyMigration::Fill(const MParContainer *par, const Stat_t w)
    161293{
    162     //    MHillasSrc &hil = *(MHillasSrc*)par;
    163     //    fHist.Fill(fMcEvt->GetEnergy(), hil.GetSize());
    164 
    165294    // get E-true from fMcEvt and E-est from fEnergy
    166     fHist.Fill(fMcEvt->GetEnergy(), fEnergy->GetEnergy(), fMcEvt->GetTheta()*kRad2Deg);
     295
     296    fHist.Fill(fMcEvt->GetEnergy(), fEnergy->GetEnergy(), fMcEvt->GetTelescopeTheta()*kRad2Deg, w);
     297
     298    fHist2.Fill(fMcEvt->GetEnergy(), fEnergy->GetEnergy(), (fEnergy->GetEnergy()-fMcEvt->GetEnergy())/fMcEvt->GetEnergy(), w);
     299
     300    fHistImp.Fill(fMcEvt->GetImpact()/100., (fEnergy->GetEnergy()-fMcEvt->GetEnergy())/fMcEvt->GetEnergy(), w);
    167301
    168302    return kTRUE;
  • trunk/MagicSoft/Mars/mhistmc/MHMcEnergyMigration.h

    r2043 r2107  
    88#ifndef ROOT_TH3
    99#include <TH3.h>
     10#endif
     11
     12#ifndef ROOT_TH2
     13#include <TH2.h>
    1014#endif
    1115
     
    2125
    2226    TH3D        fHist;
     27    TH3D        fHist2;
     28    TH2D        fHistImp;
    2329
    2430public:
     
    3036    const TH3D *GetHist() { return &fHist; }
    3137    const TH3D *GetHist() const { return &fHist; }
     38    TH1 *GetHistByName(const TString name) { return &fHist; }
    3239
    33     TH1 *GetHistByName(const TString name) { return &fHist; }
     40    const TH3D *GetHist2() { return &fHist2; }
     41    const TH2D *GetHistImp() { return &fHistImp; }
    3442
    3543    void Draw(Option_t *option="");
     
    4048
    4149#endif
    42 
    43 
    44 
Note: See TracChangeset for help on using the changeset viewer.