Ignore:
Timestamp:
04/24/02 12:29:54 (22 years ago)
Author:
wittek
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Mars/mhist
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/mhist/MHAlphaEnergyTheta.cc

    r1227 r1292  
    2626//////////////////////////////////////////////////////////////////////////////
    2727//                                                                          //
    28 //  MHAlphaEnergyTheta                                                       //
     28//  MHAlphaEnergyTheta                                                      //
    2929//                                                                          //
     30//  3D-histogram in alpha, E-est and Theta                                  //
    3031//                                                                          //
    3132//////////////////////////////////////////////////////////////////////////////
     
    3435
    3536#include <TCanvas.h>
     37
     38#include <math.h>
    3639
    3740#include "MMcEvt.hxx"
     
    4952// --------------------------------------------------------------------------
    5053//
    51 // Default Constructor. It sets name and title only. Typically you won't
    52 // need to change this.
     54// Default Constructor. It sets name and title of the histogram.
    5355//
    5456MHAlphaEnergyTheta::MHAlphaEnergyTheta(const char *name, const char *title)
     
    6264    fHist.SetDirectory(NULL);
    6365
    64     fHist.GetXaxis()->SetTitle("\\alpha [\\circ]");
    65     fHist.GetYaxis()->SetTitle("E_{est} [GeV]");
    66     fHist.GetZaxis()->SetTitle("\\Theta [\\circ]");
    67 }
    68 
     66    fHist.SetTitle("3D-plot of alpha, E-est, Theta");
     67    fHist.SetXTitle("\\alpha [\\circ]");
     68    fHist.SetYTitle("E-est [GeV]            ");
     69    fHist.SetZTitle("\\Theta [\\circ]");
     70}
     71
     72// --------------------------------------------------------------------------
     73//
     74// Set binnings and prepare filling of the histogram
     75//
    6976Bool_t MHAlphaEnergyTheta::SetupFill(const MParList *plist)
    7077{
     
    94101   SetBinning(&fHist, binsalpha, binsenergy, binstheta);
    95102
     103   fHist.Sumw2();
     104
    96105   return kTRUE;
    97106}
    98107
     108// --------------------------------------------------------------------------
     109//
     110// Fill the histogram
     111//
    99112Bool_t MHAlphaEnergyTheta::Fill(const MParContainer *par)
    100113{
     
    106119}
    107120
     121// --------------------------------------------------------------------------
     122//
     123// Draw the histogram
     124//
    108125void MHAlphaEnergyTheta::Draw(Option_t *opt)
    109126{
    110127    if (!gPad)
    111         MakeDefCanvas("AlphaEnergyTheta", "Distrib of alpha, E, Theta");
     128        MakeDefCanvas("AlphaEnergyTheta", fTitle);
    112129
    113130    gPad->Divide(2,2);
     
    116133
    117134    gPad->cd(1);
    118     h = fHist.Project3D("x");
     135    h = fHist.Project3D("expro");
     136
     137    h->SetTitle("Distribution of \\alpha [\\circ]");
     138    h->SetXTitle("\\alpha [\\circ]");
     139    h->SetYTitle("Counts");
     140
    119141    h->Draw(opt);
    120142    h->SetBit(kCanDelete);
    121143
    122144    gPad->cd(2);
    123     h = fHist.Project3D("y");
    124     h->Draw(opt);
    125     h->SetBit(kCanDelete);
     145    h = fHist.Project3D("eypro");
     146
     147    h->SetTitle("Distribution of E-est [GeV]");
     148    h->SetXTitle("E-est [GeV]            ");
     149    h->SetYTitle("Counts");
     150
     151    h->Draw(opt);
     152    h->SetBit(kCanDelete);
     153    gPad->SetLogx();
    126154
    127155    gPad->cd(3);
    128     h = fHist.Project3D("z");
     156    h = fHist.Project3D("ezpro");
     157
     158    h->SetTitle("Distribution of \\Theta [\\circ]");
     159    h->SetXTitle("\\Theta [\\circ]");
     160    h->SetYTitle("Counts");
     161
    129162    h->Draw(opt);
    130163    h->SetBit(kCanDelete);
     
    137170}
    138171
     172// --------------------------------------------------------------------------
     173//
     174// Draw copies of the histogram
     175//
    139176TObject *MHAlphaEnergyTheta::DrawClone(Option_t *opt) const
    140177{
    141     TCanvas *c = MakeDefCanvas("AlphaEnergyTheta", "Distrib of alpha, E, Theta");
    142     c->Divide(2, 2);
     178    TCanvas &c = *MakeDefCanvas("AlphaEnergyTheta", fTitle);
     179    c.Divide(2, 2);
    143180
    144181    gROOT->SetSelectedPad(NULL);
    145182
    146     //
    147     // FIXME: ProjectionX,Y is not const within root
    148     //
    149183    TH1 *h;
    150184
    151     c->cd(1);
    152     h = ((TH3*)(&fHist))->Project3D("x");
    153     h->Draw(opt);
    154     h->SetBit(kCanDelete);
    155 
    156     c->cd(2);
    157     h = ((TH3*)(&fHist))->Project3D("y");
    158     h->Draw(opt);
    159     h->SetBit(kCanDelete);
    160 
    161     c->cd(3);
    162     h = ((TH3*)(&fHist))->Project3D("z");
    163     h->Draw(opt);
    164     h->SetBit(kCanDelete);
    165 
    166     c->cd(4);
     185    c.cd(1);
     186    h = ((TH3*)(&fHist))->Project3D("expro");
     187
     188    h->SetTitle("Distribution of \\alpha [\\circ]");
     189    h->SetXTitle("\\alpha [\\circ]");
     190    h->SetYTitle("Counts");
     191
     192    h->Draw(opt);
     193    h->SetBit(kCanDelete);
     194
     195    c.cd(2);
     196    h = ((TH3*)(&fHist))->Project3D("eypro");
     197
     198    h->SetTitle("Distribution of E-est [GeV]");
     199    h->SetXTitle("E-est [GeV]            ");
     200    h->SetYTitle("Counts");
     201
     202    h->Draw(opt);
     203    h->SetBit(kCanDelete);
     204    gPad->SetLogx();
     205
     206    c.cd(3);
     207    h = ((TH3*)(&fHist))->Project3D("ezpro");
     208
     209    h->SetTitle("Distribution of \\Theta [\\circ]");
     210    h->SetXTitle("\\Theta [\\circ]");
     211    h->SetYTitle("Counts");
     212
     213    h->Draw(opt);
     214    h->SetBit(kCanDelete);
     215
     216    c.cd(4);
    167217    ((TH3&)fHist).DrawCopy(opt);
    168218
    169     c->Modified();
    170     c->Update();
    171 
    172     return c;
    173 }
    174 
    175 void MHAlphaEnergyTheta::Substract(const TH3D *h1, const TH3D *h2)
    176 {
    177     MH::SetBinning(&fHist, (TH1*)h1);
    178 
    179     fHist.Sumw2();
     219    c.Modified();
     220    c.Update();
     221
     222    return &c;
     223}
     224
     225// --------------------------------------------------------------------------
     226//
     227// Calculate the histogram as the difference of two histograms :
     228//          fHist(gamma) = h1(source) - h2(antisource)
     229//
     230void MHAlphaEnergyTheta::Subtract(const TH3D *h1, const TH3D *h2)
     231{
     232    // MH::SetBinning(&fHist, (TH1*)h1);
     233
     234    //    fHist.Sumw2();
    180235    fHist.Add((TH1*)h1, (TH1*)h2, 1, -1); // Root: FIXME
    181236}
    182237
    183 void MHAlphaEnergyTheta::SetAlphaRange(Axis_t lo, Axis_t up)
    184 {
     238
     239// --------------------------------------------------------------------------
     240//
     241// Integrate fHist(gamma) in the alpha range (lo, up)
     242//
     243TH2D *MHAlphaEnergyTheta::GetAlphaProjection(Axis_t lo, Axis_t up)
     244{
     245    if (up < lo)
     246    {
     247        *fLog << err << fName << ": Alpha projection not possible: lo=" << lo << " up=" << up << endl;
     248        return NULL;
     249    }
     250
    185251    TAxis &axe = *fHist.GetXaxis();
    186252
    187     //
    188     // FIXME: ROOT Binning??? of projection
    189     // root 3.02: SetRangeUser
    190 #if ROOT_VERSION_CODE < ROOT_VERSION(3,02,06)
    191     axe.SetRange(axe.FindFixBin(lo), axe.FindFixBin(up));
    192 #else
    193     axe.SetRangeUser(lo, up);
    194 #endif
    195 }
    196 
    197 TH2D *MHAlphaEnergyTheta::GetAlphaProjection(Axis_t lo, Axis_t up)
    198 {
    199     SetAlphaRange(lo, up);
    200     return (TH2D*)fHist.Project3D("yz");
    201 }
     253    Int_t ilo = axe.FindFixBin(lo);
     254    Int_t iup = axe.FindFixBin(up);
     255
     256    const Double_t epslo1 = lo-axe.GetBinLowEdge(ilo);
     257    const Double_t epslo2 = axe.GetBinUpEdge(ilo)-lo;
     258
     259    const Double_t epsup1 = up-axe.GetBinLowEdge(iup);
     260    const Double_t epsup2 = axe.GetBinUpEdge(iup)-up;
     261
     262    const Double_t epslo = epslo1<epslo2 ? epslo1 : epslo2;
     263    const Double_t epsup = epsup1<epsup2 ? epsup1 : epsup2;
     264
     265    if (epslo1>epslo2)
     266        ilo++;
     267
     268    if (epsup1<epsup2)
     269        iup--;
     270
     271    if (epslo>0.01*axe.GetBinWidth(ilo) || epsup>0.01*axe.GetBinWidth(iup))
     272    {
     273        *fLog << err << fName << ": binning is not adequate for the requested projection:" << endl;
     274        *fLog << "Please specify a lower or upper limit which is not more than 1% away from a bin edge" << endl;
     275        *fLog << " epslo = " << epslo << endl;
     276        *fLog << " epsup = " << epsup << endl;
     277        *fLog << " dwl   = " << axe.GetBinWidth(ilo) << endl;
     278        *fLog << " dwu   = " << axe.GetBinWidth(iup) << endl;
     279        return NULL;
     280    }
     281
     282    axe.SetRange(ilo, iup);
     283
     284    TH2D &h2D = *(TH2D *)fHist.Project3D("ezypro");
     285
     286    h2D.SetTitle("2D-plot  of Theta vs. E-est");
     287    h2D.SetXTitle("E-est [GeV]            ");
     288    h2D.SetYTitle("\\Theta [\\circ]");
     289
     290    return &h2D;
     291}
     292
     293// --------------------------------------------------------------------------
     294//
     295// Draw the integrated histogram
     296//
     297TH2D *MHAlphaEnergyTheta::DrawAlphaProjection(Axis_t lo, Axis_t up, Option_t *opt)
     298{
     299    TH2D *h2D = GetAlphaProjection(lo, up);
     300
     301    if (!h2D)
     302        return NULL;
     303
     304    char txt[100];
     305    sprintf(txt, "No.of Gammas vs. E-est and Theta (%.1f < alpha < %.1f deg)", lo, up);
     306
     307    //    TCanvas *c = MakeDefCanvas("AlphaEnergyTheta", "2D histogram of gamma signal in energy and theta");
     308    TCanvas &c = *MakeDefCanvas("AlphaEnergyTheta", txt);
     309
     310    c.Divide(2, 2);
     311
     312    gROOT->SetSelectedPad(NULL);
     313
     314    TH1 *h;
     315
     316    c.cd(1);
     317    h = h2D->ProjectionX("Eest", -1, 9999, "E");
     318    h->SetTitle("Distribution of E-est [GeV]");
     319    h->SetXTitle("E-est [GeV]            ");
     320    h->SetYTitle("Counts");
     321
     322    h->Draw(opt);
     323    h->SetBit(kCanDelete);
     324    gPad->SetLogx();
     325
     326    c.cd(2);
     327    h = h2D->ProjectionY("theta", -1, 9999, "E");
     328    h->SetTitle("Distribution of \\Theta [\\circ]");
     329    h->SetXTitle("\\Theta [\\circ]");
     330    h->SetYTitle("Counts");
     331
     332    h->Draw(opt);
     333    h->SetBit(kCanDelete);
     334
     335    c.cd(3);
     336
     337    h2D->DrawCopy(opt);
     338    gPad->SetLogx();
     339
     340    c.Modified();
     341    c.Update();
     342
     343    return h2D;
     344}
     345
     346
     347
     348
     349
     350
     351
     352
     353
     354
     355
     356
  • trunk/MagicSoft/Mars/mhist/MHAlphaEnergyTheta.h

    r1211 r1292  
    55#include "MH.h"
    66#endif
     7
    78#ifndef ROOT_TH3
    89#include "TH3.h"
     10#endif
     11
     12#ifndef ROOT_TH2
     13#include "TH2.h"
    914#endif
    1015
     
    2530    TH3D fHist;
    2631
    27     void SetAlphaRange(Axis_t lo, Axis_t up);
    28 
    2932public:
    3033    MHAlphaEnergyTheta(const char *name=NULL, const char *title=NULL);
     
    3942    TObject *DrawClone(Option_t *option="") const;
    4043
    41     void Substract(const TH3D *h1, const TH3D *h2);
    42     void Substract(const MHAlphaEnergyTheta *h1, const MHAlphaEnergyTheta *h2)
     44    void Subtract(const TH3D *h1, const TH3D *h2);
     45    void Subtract(const MHAlphaEnergyTheta *h1, const MHAlphaEnergyTheta *h2)
    4346    {
    44         Substract(h1->GetHist(), h2->GetHist());
     47        Subtract(h1->GetHist(), h2->GetHist());
    4548    }
    4649
     50    TH2D *DrawAlphaProjection(Axis_t lo, Axis_t up, Option_t *opt="");
    4751    TH2D *GetAlphaProjection(Axis_t lo, Axis_t up);
    4852
    49     ClassDef(MHAlphaEnergyTheta, 1) //Histogram to store a 3-Dim histogram in alpha, Energy and theta
     53    ClassDef(MHAlphaEnergyTheta, 1) //3D-histogram in alpha, Energy and theta
    5054};
    5155
  • trunk/MagicSoft/Mars/mhist/MHAlphaEnergyTime.cc

    r1227 r1292  
    2828//  MHAlphaEnergyTime                                                       //
    2929//                                                                          //
     30//  3D-histogram in alpha, E-est and time                                   //
    3031//                                                                          //
    3132//////////////////////////////////////////////////////////////////////////////
     
    3435
    3536#include <TCanvas.h>
     37
     38#include <math.h>
    3639
    3740#include "MHillasSrc.h"
     
    5053// --------------------------------------------------------------------------
    5154//
    52 // Default Constructor. It sets name and title only. Typically you won't
    53 // need to change this.
    54 //
    55 #include <iostream.h>
     55// Default Constructor. It sets name and title of the histogram.
     56//
    5657MHAlphaEnergyTime::MHAlphaEnergyTime(const char *name, const char *title)
    5758  : fHist()
     
    6566    fHist.SetDirectory(NULL);
    6667
    67     fHist.GetXaxis()->SetTitle("\\alpha [\\circ]");
    68     fHist.GetYaxis()->SetTitle("E_{est} [GeV]");
    69     fHist.GetZaxis()->SetTitle("t [s]");
    70 }
    71 
     68    fHist.SetTitle("3D-plot of alpha, E-est, time");
     69    fHist.SetXTitle("\\alpha [\\circ]");
     70    fHist.SetYTitle("E-est [GeV]            ");
     71    fHist.SetZTitle("time [s]");
     72}
     73
     74// --------------------------------------------------------------------------
     75//
     76// Set binnings and prepare filling of the histogram
     77//
    7278Bool_t MHAlphaEnergyTime::SetupFill(const MParList *plist)
    7379{
     
    102108}
    103109
     110// --------------------------------------------------------------------------
     111//
     112// Fill the histogram
     113//
    104114Bool_t MHAlphaEnergyTime::Fill(const MParContainer *par)
    105115{
     
    110120}
    111121
     122// --------------------------------------------------------------------------
     123//
     124// Draw the histogram
     125//
    112126void MHAlphaEnergyTime::Draw(Option_t *opt)
    113127{
    114128    if (!gPad)
    115         MakeDefCanvas("AlphaEnergyTime", "Distrib of alpha, E, t");
     129        MakeDefCanvas("AlphaEnergyTime", fTitle);
    116130
    117131    gPad->Divide(2,2);
     
    120134
    121135    gPad->cd(1);
    122     h = fHist.Project3D("x");
     136    h = fHist.Project3D("ex");
     137
     138    h->SetTitle("Distribution of \\alpha [\\circ]");
     139    h->SetXTitle("\\alpha [\\circ]");
     140    h->SetYTitle("Counts");
     141
    123142    h->Draw(opt);
    124143    h->SetBit(kCanDelete);
    125144
    126145    gPad->cd(2);
    127     h = fHist.Project3D("y");
    128     h->Draw(opt);
    129     h->SetBit(kCanDelete);
     146    h = fHist.Project3D("ey");
     147
     148    h->SetTitle("Distribution of E-est [GeV]");
     149    h->SetXTitle("E-est [GeV]            ");
     150    h->SetYTitle("Counts");
     151
     152    h->Draw(opt);
     153    h->SetBit(kCanDelete);
     154    gPad->SetLogx();
    130155
    131156    gPad->cd(3);
    132     h = fHist.Project3D("z");
     157    h = fHist.Project3D("ez");
     158
     159    h->SetTitle("Distribution of time [s]");
     160    h->SetXTitle("time [s]");
     161    h->SetYTitle("Counts");
     162
    133163    h->Draw(opt);
    134164    h->SetBit(kCanDelete);
     
    139169    gPad->Modified();
    140170    gPad->Update();
    141 }
    142 
     171
     172}
     173
     174// --------------------------------------------------------------------------
     175//
     176// Draw copies of the histogram
     177//
    143178TObject *MHAlphaEnergyTime::DrawClone(Option_t *opt) const
    144179{
    145     TCanvas *c = MakeDefCanvas("AlphaEnergyTime", "Distrib of alpha, E, t");
    146     c->Divide(2, 2);
     180    TCanvas &c = *MakeDefCanvas("AlphaEnergyTime", fTitle);
     181
     182    c.Divide(2, 2);
    147183
    148184    gROOT->SetSelectedPad(NULL);
    149185
    150     //
    151     // FIXME: ProjectionX,Y is not const within root
    152     //
    153186    TH1 *h;
    154187
    155     c->cd(1);
    156     h = ((TH3D*)(&fHist))->Project3D("x");
    157     h->Draw(opt);
    158     h->SetBit(kCanDelete);
    159 
    160     c->cd(2);
    161     h = ((TH3D*)(&fHist))->Project3D("y");
    162     h->Draw(opt);
    163     h->SetBit(kCanDelete);
    164 
    165     c->cd(3);
    166     h = ((TH3D*)(&fHist))->Project3D("z");
    167     h->Draw(opt);
    168     h->SetBit(kCanDelete);
    169 
    170     c->cd(4);
     188    c.cd(1);
     189    h = ((TH3D*)(&fHist))->Project3D("ex");
     190
     191    h->SetTitle("Distribution of \\alpha [\\circ]");
     192    h->SetXTitle("\\alpha [\\circ]");
     193    h->SetYTitle("Counts");
     194
     195    h->Draw(opt);
     196    h->SetBit(kCanDelete);
     197
     198    c.cd(2);
     199    h = ((TH3D*)(&fHist))->Project3D("ey");
     200
     201    h->SetTitle("Distribution of E-est [GeV]");
     202    h->SetXTitle("E-est [GeV]            ");
     203    h->SetYTitle("Counts");
     204
     205    h->Draw(opt);
     206    h->SetBit(kCanDelete);
     207    gPad->SetLogx();
     208
     209    c.cd(3);
     210    h = ((TH3D*)(&fHist))->Project3D("ez");
     211
     212    h->SetTitle("Distribution of time [s]");
     213    h->SetXTitle("time [s]");
     214    h->SetYTitle("Counts");
     215
     216    h->Draw(opt);
     217    h->SetBit(kCanDelete);
     218
     219    c.cd(4);
    171220    ((TH3D&)fHist).DrawCopy(opt);
    172221
    173     c->Modified();
    174     c->Update();
    175 
    176     return c;
    177 }
    178 
    179 void MHAlphaEnergyTime::Substract(const TH3D *h1, const TH3D *h2)
    180 {
    181     MH::SetBinning(&fHist, (TH1*)h1);
    182 
    183     fHist.Sumw2();
     222    c.Modified();
     223    c.Update();
     224
     225    return &c;
     226}
     227
     228// --------------------------------------------------------------------------
     229//
     230// Calculate the histogram as the difference of two histograms :
     231//          fHist(gamma) = h1(source) - h2(antisource)
     232//
     233void MHAlphaEnergyTime::Subtract(const TH3D *h1, const TH3D *h2)
     234{
     235  //    MH::SetBinning(&fHist, (TH1*)h1);
     236
     237  //    fHist.Sumw2();
    184238    fHist.Add((TH1*)h1, (TH1*)h2, 1, -1); // ROOT: FIXME!
    185239}
    186240
    187 void MHAlphaEnergyTime::SetAlphaRange(Axis_t lo, Axis_t up)
    188 {
     241// --------------------------------------------------------------------------
     242//
     243// Integrate fHist(gamma) in the alpha range (lo, up)
     244//
     245TH2D *MHAlphaEnergyTime::GetAlphaProjection(Axis_t lo, Axis_t up)
     246{
     247    if (up < lo)
     248    {
     249        *fLog << err << fName << ": Alpha projection not possible: lo=" << lo << " up=" << up << endl;
     250        return NULL;
     251    }
     252
    189253    TAxis &axe = *fHist.GetXaxis();
    190254
    191     //
    192     // FIXME: ROOT Binning??? of projection
    193     // root 3.02: SetRangeUser
    194     axe.SetRange(axe.FindFixBin(lo), axe.FindFixBin(up));
    195 }
    196 
    197 TH2D *MHAlphaEnergyTime::GetAlphaProjection(Axis_t lo, Axis_t up)
    198 {
    199     SetAlphaRange(lo, up);
    200     return (TH2D*)fHist.Project3D("yz");
    201 }
     255    Int_t ilo = axe.FindFixBin(lo);
     256    Int_t iup = axe.FindFixBin(up);
     257
     258    const Double_t epslo1 = lo-axe.GetBinLowEdge(ilo);
     259    const Double_t epslo2 = axe.GetBinUpEdge(ilo)-lo;
     260
     261    const Double_t epsup1 = up-axe.GetBinLowEdge(iup);
     262    const Double_t epsup2 = axe.GetBinUpEdge(iup)-up;
     263
     264    const Double_t epslo = epslo1<epslo2 ? epslo1 : epslo2;
     265    const Double_t epsup = epsup1<epsup2 ? epsup1 : epsup2;
     266
     267    if (epslo1>epslo2)
     268        ilo++;
     269
     270    if (epsup1<epsup2)
     271        iup--;
     272
     273    if (epslo>0.01*axe.GetBinWidth(ilo) || epsup>0.01*axe.GetBinWidth(iup))
     274    {
     275        *fLog << err << fName << ": binning is not adequate for the requested projection:" << endl;
     276        *fLog << "Please specify a lower or upper limit which is not more than 1% away from a bin edge" << endl;
     277        *fLog << " epslo = " << epslo << endl;
     278        *fLog << " epsup = " << epsup << endl;
     279        *fLog << " dwl   = " << axe.GetBinWidth(ilo) << endl;
     280        *fLog << " dwu   = " << axe.GetBinWidth(iup) << endl;
     281        return NULL;
     282    }
     283
     284    axe.SetRange(ilo, iup);
     285
     286    TH2D &h2D = *(TH2D *)fHist.Project3D("ezy");
     287
     288    h2D.SetTitle("2D-plot  of time vs. E-est");
     289    h2D.SetXTitle("E-est [GeV]            ");
     290    h2D.SetYTitle("time [s]");
     291
     292    return &h2D;
     293}
     294
     295//---------------------------------------------------------
     296//
     297// Draw the projected histogram
     298//
     299TH2D *MHAlphaEnergyTime::DrawAlphaProjection(Axis_t lo, Axis_t up, Option_t *opt)
     300{
     301    TH2D *h2D = GetAlphaProjection(lo, up);
     302
     303    if (!h2D)
     304        return NULL;
     305
     306    char txt[100];
     307    sprintf(txt, "No.of Gammas vs. E-est and Time (%.1f < alpha < %.1f deg)", lo, up);
     308
     309    //    TCanvas *c = MakeDefCanvas("AlphaEnergyTime", "2D histogram of gamma signal in energy and time");
     310    TCanvas &c = *MakeDefCanvas("AlphaEnergyTime", txt);
     311
     312    c.Divide(2, 2);
     313
     314    gROOT->SetSelectedPad(NULL);
     315
     316    TH1 *h;
     317
     318    c.cd(1);
     319    h = h2D->ProjectionX("Eest", -1, 9999, "E");
     320    h->SetTitle("Distribution of E-est [GeV]");
     321    h->SetXTitle("E-est [GeV]            ");
     322    h->SetYTitle("Counts");
     323
     324    h->Draw(opt);
     325    h->SetBit(kCanDelete);
     326    gPad->SetLogx();
     327
     328    c.cd(2);
     329    h = h2D->ProjectionY("time", -1, 9999, "E");
     330    h->SetTitle("Distribution of time [s]");
     331    h->SetXTitle("time [s]");
     332    h->SetYTitle("Counts");
     333
     334    h->Draw(opt);
     335    h->SetBit(kCanDelete);
     336
     337    c.cd(3);
     338
     339    h2D->DrawCopy(opt);
     340    gPad->SetLogx();
     341
     342    c.Modified();
     343    c.Update();
     344
     345    return h2D;
     346}
     347
  • trunk/MagicSoft/Mars/mhist/MHAlphaEnergyTime.h

    r1211 r1292  
    55#include "MH.h"
    66#endif
     7
    78#ifndef ROOT_TH3
    89#include "TH3.h"
     10#endif
     11
     12#ifndef ROOT_TH2
     13#include "TH2.h"
    914#endif
    1015
     
    2429    TH3D    fHist;
    2530
    26     void SetAlphaRange(Axis_t lo, Axis_t up);
    2731
    2832public:
     
    3842    TObject *DrawClone(Option_t *option="") const;
    3943
    40     void Substract(const TH3D *h1, const TH3D *h2);
    41     void Substract(const MHAlphaEnergyTime *h1, const MHAlphaEnergyTime *h2)
     44    void Subtract(const TH3D *h1, const TH3D *h2);
     45    void Subtract(const MHAlphaEnergyTime *h1, const MHAlphaEnergyTime *h2)
    4246    {
    43         Substract(h1->GetHist(), h2->GetHist());
     47        Subtract(h1->GetHist(), h2->GetHist());
    4448    }
    4549
     50    TH2D *DrawAlphaProjection(Axis_t lo, Axis_t up, Option_t *opt="");
    4651    TH2D *GetAlphaProjection(Axis_t lo, Axis_t up);
    4752
    48     ClassDef(MHAlphaEnergyTime, 1) //Histogram to store a 3-Dim histogram in alpha, Energy and time
     53    ClassDef(MHAlphaEnergyTime, 1) //3D-histogram in alpha, Energy and time
    4954};
    5055
    5156#endif
    5257
     58
     59
     60
     61
     62
  • trunk/MagicSoft/Mars/mhist/MHEffOnTimeTheta.h

    r1213 r1292  
    1616{
    1717private:
    18     TH1D   fHist;
     18    TH1D fHEffOn;
     19    TH1D fHChi2;
     20    TH1D fHN0del;
     21    TH1D fHLambda;
    1922
    2023public:
     
    2427    virtual Bool_t Fill(const MParContainer *par);
    2528
    26     const TH1D *GetHist() { return &fHist; }
    27     const TH1D *GetHist() const { return &fHist; }
     29    const TH1D *GetHist() { return &fHEffOn; }
     30    const TH1D *GetHist() const { return &fHEffOn; }
    2831
    2932    void Calc(TH2D *hist);
     
    3235    TObject *DrawClone(Option_t *option="") const;
    3336
    34     ClassDef(MHEffOnTimeTheta, 1) //Histogram to store a 3-Dim histogram in alpha, Energy and time
     37    ClassDef(MHEffOnTimeTheta, 1) //1D-plot of Delta t vs. Theta
    3538};
    3639
    3740#endif
    3841
     42
Note: See TracChangeset for help on using the changeset viewer.