Ignore:
Timestamp:
04/24/02 14:10:54 (23 years ago)
Author:
wittek
Message:
*** empty log message ***
File:
1 edited

Legend:

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

    r1265 r1295  
    2828//  MHTimeDiffTime                                                          //
    2929//                                                                          //
     30//  calculates the 2D-histogram   time-difference vs. time                  //
     31//                                                                          //
    3032//                                                                          //
    3133//////////////////////////////////////////////////////////////////////////////
     
    4850// --------------------------------------------------------------------------
    4951//
    50 // Default Constructor. It sets name and title only. Typically you won't
    51 // need to change this.
     52// Default Constructor. It sets name and title of the histogram
    5253//
    5354MHTimeDiffTime::MHTimeDiffTime(const char *name, const char *title)
     
    6263    fHist.SetDirectory(NULL);
    6364
    64     fHist.GetXaxis()->SetTitle("\\Delta t [s]");
    65     fHist.GetYaxis()->SetTitle("t [s]");
     65    fHist.SetXTitle("\\Delta t [s]");
     66    fHist.SetYTitle("t [s]");
    6667}
    6768
     69// --------------------------------------------------------------------------
     70//
     71// Set the binnings and prepare the filling of the histogram
     72//
    6873Bool_t MHTimeDiffTime::SetupFill(const MParList *plist)
    6974{
    70    fTime = (MTime*)plist->FindObject("MTime");
    71    if (!fTime)
    72    {
    73        *fLog << err << dbginf << "MTime not found... aborting." << endl;
    74        return kFALSE;
    75    }
     75    fTime = (MTime*)plist->FindObject("MTime");
     76    if (!fTime)
     77    {
     78        *fLog << err << dbginf << "MTime not found... aborting." << endl;
     79        return kFALSE;
     80    }
    7681
    77    const MBinning* binsdtime = (MBinning*)plist->FindObject("BinningTimeDiff");
    78    const MBinning* binstime  = (MBinning*)plist->FindObject("BinningTime");
    79    if (!binstime || !binsdtime)
    80    {
    81        *fLog << err << dbginf << "At least one MBinning not found... aborting." << endl;
    82        return kFALSE;     
    83    }
     82    const MBinning* binsdtime = (MBinning*)plist->FindObject("BinningTimeDiff");
     83    const MBinning* binstime  = (MBinning*)plist->FindObject("BinningTime");
     84    if (!binstime || !binsdtime)
     85    {
     86        *fLog << err << dbginf << "At least one MBinning not found... aborting." << endl;
     87        return kFALSE;
     88    }
    8489
    85    SetBinning(&fHist, binsdtime, binstime);
     90    SetBinning(&fHist, binsdtime, binstime);
    8691
    87    return kTRUE;
     92    return kTRUE;
    8893}
    8994
     95// --------------------------------------------------------------------------
     96//
     97// Draw a copy of the histogram
     98//
    9099TObject *MHTimeDiffTime::DrawClone(Option_t *opt) const
    91100{
    92     TCanvas *c = MakeDefCanvas("DiffTimeTime", "Distrib of dt, t");
    93     c->Divide(2, 2);
     101
     102    TCanvas &c = *MakeDefCanvas("DiffTimeTime", "Distrib of \\Delta t, time");
     103
     104    c.Divide(2, 2);
    94105
    95106    gROOT->SetSelectedPad(NULL);
    96107
    97     //
    98     // FIXME: ProjectionX,Y is not const within root
    99     //
    100108    TH1D *h;
    101109
    102     c->cd(1);
    103     h = ((TH2*)&fHist)->ProjectionX("ProX", -1, 9999, "E");
     110    c.cd(1);
     111    h = ((TH2*)&fHist)->ProjectionX("ProjX-sumtime", -1, 9999, "E");
     112
     113    h->SetTitle("Distribution of \\Delta t [s]");
     114    h->SetXTitle("\\Delta t [s]");
     115    h->SetYTitle("Counts");
     116
    104117    h->Draw(opt);
    105118    h->SetBit(kCanDelete);
    106119    gPad->SetLogy();
    107120
    108     c->cd(2);
    109     h = ((TH2*)&fHist)->ProjectionY("ProY", -1, 9999, "E");
     121    c.cd(2);
     122    h = ((TH2*)&fHist)->ProjectionY("ProjY-sumtimediff", -1, 9999, "E");
     123
     124    h->SetTitle("Distribution of time [s]");
     125    h->SetXTitle("time [s]");
     126    h->SetYTitle("Counts");
     127
    110128    h->Draw(opt);
    111129    h->SetBit(kCanDelete);
    112130
    113     c->cd(3);
     131    c.cd(3);
    114132    ((TH2*)&fHist)->DrawCopy(opt);
    115133
    116     c->Modified();
    117     c->Update();
     134    c.Modified();
     135    c.Update();
    118136
    119     return c;
     137    return &c;
    120138}
    121139
     140// --------------------------------------------------------------------------
     141//
     142// Draw the histogram
     143//
    122144void MHTimeDiffTime::Draw(Option_t *opt)
    123145{
    124146    if (!gPad)
    125         MakeDefCanvas("DiffTimeTime", "Distrib of dt, t");
     147        MakeDefCanvas("DiffTimeTime", "Distrib of \\Delta t, time");
    126148
    127149    gPad->Divide(2,2);
     
    130152
    131153    gPad->cd(1);
    132     h = fHist.ProjectionX("ProX", -1, 9999, "E");
     154    h = fHist.ProjectionX("ProjX_sumtime", -1, 9999, "E");
     155
     156    h->SetTitle("Distribution of \\Delta t [s]");
     157    h->SetXTitle("\\Delta t [s]");
     158    h->SetYTitle("Counts");
     159
    133160    h->Draw(opt);
    134161    h->SetBit(kCanDelete);
     
    136163
    137164    gPad->cd(2);
    138     h = fHist.ProjectionY("ProY", -1, 9999, "E");
     165    h = fHist.ProjectionY("ProjY_sumtimediff", -1, 9999, "E");
     166
     167    h->SetTitle("Distribution of time [s]");
     168    h->SetXTitle("time [s]");
     169    h->SetYTitle("Counts");
     170
    139171    h->Draw(opt);
    140172    h->SetBit(kCanDelete);
     
    145177    gPad->Modified();
    146178    gPad->Update();
     179
    147180}
    148181
     182// --------------------------------------------------------------------------
     183//
     184//  Fill the histogram
     185//
    149186Bool_t MHTimeDiffTime::Fill(const MParContainer *par)
    150187{
     
    158195}
    159196
     197
     198
     199
Note: See TracChangeset for help on using the changeset viewer.