Changeset 2414 for trunk/MagicSoft/Mars


Ignore:
Timestamp:
10/20/03 18:33:11 (21 years ago)
Author:
tbretz
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Mars
Files:
13 edited

Legend:

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

    r2206 r2414  
    324324    const Ssiz_t length = last-first-1;
    325325
     326    //
     327    // Make a copy before stripping leading and trailing White Spaces.
     328    //
    326329    TString strip = fHName(first+1, length);
    327330    return strip.Strip(TString::kBoth);
     
    340343        return kTRUE;
    341344
    342     if (!fH->OverwritesDraw())
    343         return kTRUE;
    344 
    345345    if (TestBit(kDoNotDisplay))
    346346        return kTRUE;
    347347
     348    const Bool_t dr = fH->OverwritesDraw();
     349    const Bool_t ts = fH->OverwritesDraw(NULL, "TS");
     350    if (!dr && !ts)
     351        return kTRUE;
     352
     353    if (!ts)
     354    {
     355        *fLog << warn << "You overwrote " << fH->ClassName() << "::";
     356        *fLog << "Draw instead of " << fH->ClassName() << "::DrawTS" << endl;
     357        *fLog << "This is not thread safe and might result in trouble using" << endl;
     358        *fLog << "multithreaded programs like MONA." << endl;
     359        *fLog << "" << endl;
     360        return kTRUE;
     361    }
     362
    348363    fCanvas = &fDisplay->AddTab(fH->GetName());
    349     fH->Draw();
     364    fH->DrawTS(fCanvas);
     365
     366    return kTRUE;
     367}
     368
     369// --------------------------------------------------------------------------
     370//
     371//
     372Bool_t MFillH::DrawCloneToDisplay()
     373{
     374    fH->DrawCloneTS(fCanvas);
     375    fCanvas->Modified();
     376    fCanvas->Update();
    350377
    351378    return kTRUE;
     
    506533    //
    507534    if (fDisplay && fDisplay->HasCanvas(fCanvas))
    508     {
    509         fCanvas->cd();
    510         fH->DrawClone("nonew");
    511         fCanvas->Modified();
    512         fCanvas->Update();
    513     }
     535        DrawCloneToDisplay();
    514536
    515537    return kTRUE;
  • trunk/MagicSoft/Mars/mhist/MFillH.h

    r2206 r2414  
    4444
    4545    Bool_t DrawToDisplay();
     46    Bool_t DrawCloneToDisplay();
    4647
    4748public:
     
    6364    Int_t PostProcess();
    6465
     66    MH *GetH() { return fH; }
     67    TCanvas *GetCanvas() { return fCanvas; }
     68
    6569    ClassDef(MFillH, 2) // Task to fill a histogram with data from a parameter container
    6670};
  • trunk/MagicSoft/Mars/mhist/MHHadronness.cc

    r2307 r2414  
    503503    gPad->SetBorderMode(0);
    504504    //gStyle->SetOptStat(10);
    505     MH::Draw(*fGhness, *fPhness, "Hadronness"); // Displ both stat boxes
     505    MH::DrawSame(*fGhness, *fPhness, "Hadronness"); // Displ both stat boxes
    506506
    507507    pad->cd(2);
  • trunk/MagicSoft/Mars/mhist/MHTriggerLvl0.cc

    r2377 r2414  
    171171}
    172172
    173 void MHTriggerLvl0::Draw(Option_t *)
     173void MHTriggerLvl0::DrawTS(TVirtualPad *p=NULL, Option_t * ="")
    174174{
    175     TVirtualPad *pad = gPad ? gPad : MakeDefCanvas(this);
     175    TVirtualPad *pad = p ? p : MakeDefCanvas(this);
    176176    pad->SetBorderMode(0);
    177177
     178    //-----------------------------
    178179    pad->Divide(1,2);
    179180
    180     pad->cd(1);
    181     gPad->SetBorderMode(0);
    182     gPad->Divide(1,1);
    183     gPad->cd(1);
    184     gPad->SetBorderMode(0);
    185     fSum->Draw();
     181    p = pad->GetPad(1);
     182    p->SetBorderMode(0);
     183    p->Divide(1,1);
     184    p->cd(1);
     185    p->SetBorderMode(0);
     186    // fSum does not derive from MParContainer
     187    MParContainer::DrawTS(fSum, p);
    186188
    187     pad->cd(2);
    188     gPad->SetBorderMode(0);
    189     fSum->Draw("EPhist");
     189    p = pad->GetPad(2);
     190    p->SetBorderMode(0);
     191    // fSum does not derive from MParContainer
     192    MParContainer::DrawTS(fSum, p, "EPhist");
     193    //-----------------------------
     194
     195    //MParContainer::DrawTS(fSum, p);
    190196}
  • trunk/MagicSoft/Mars/mhist/MHTriggerLvl0.h

    r2298 r2414  
    3434    TH1 *GetHistByName(const TString name="");
    3535
    36     void Draw(Option_t * ="");
     36    //void Draw(Option_t * ="");
     37    void DrawTS(TVirtualPad *pad=NULL, Option_t * ="");
    3738
    3839    void PrintOutlayers(Float_t s) const;
  • trunk/MagicSoft/Mars/mimage/MHHillas.cc

    r2320 r2414  
    278278    gStyle->SetPalette(50, c);
    279279}
    280 
     280/*
    281281// --------------------------------------------------------------------------
    282282//
     
    323323    pad->Update();
    324324}
     325*/
     326
     327// --------------------------------------------------------------------------
     328//
     329// Creates a new canvas and draws the four histograms into it.
     330// Be careful: The histograms belongs to this object and won't get deleted
     331// together with the canvas.
     332//
     333void MHHillas::DrawTS(TVirtualPad *p, Option_t *)
     334{
     335    TVirtualPad *pad = p ? p : MakeDefCanvas(this);
     336    pad->SetBorderMode(0);
     337
     338    MParContainer::DrawTS(pad);
     339
     340    pad->Divide(2,3);
     341
     342    p = pad->GetPad(1);
     343    p->SetBorderMode(0);
     344    MH::DrawSame(*fWidth, *fLength, "Width'n'Length", p);
     345
     346    p = pad->GetPad(2);
     347    p->SetBorderMode(0);
     348    MParContainer::DrawTS(fDistC, p);
     349
     350    p = pad->GetPad(3);
     351    p->SetBorderMode(0);
     352    p->SetLogx();
     353    MParContainer::DrawTS(fSize, p);
     354
     355    p = pad->GetPad(4);
     356    p->SetBorderMode(0);
     357    p->SetPad(0.51, 0.01, 0.99, 0.65);
     358    SetColors();
     359    MParContainer::DrawTS(fCenter, p, "colz");
     360
     361    p = pad->GetPad(5);
     362    p->SetBorderMode(0);
     363    MParContainer::DrawTS(fDelta, p);
     364
     365    delete pad->GetPad(6);
     366
     367    pad->Modified();
     368    pad->Update();
     369}
     370
    325371
    326372TH1 *MHHillas::GetHistByName(const TString name)
  • trunk/MagicSoft/Mars/mimage/MHHillas.h

    r2043 r2414  
    5151    TH2F *GetHistCenter() { return fCenter; }
    5252
    53     void Draw(Option_t *opt=NULL);
     53    //void Draw(Option_t *opt=NULL);
     54    void DrawTS(TVirtualPad *pad=NULL, Option_t *opt=NULL);
    5455
    5556    //Int_t DistancetoPrimitive(Int_t px, Int_t py) { return 0; }
  • trunk/MagicSoft/Mars/mimage/MHHillasExt.cc

    r2320 r2414  
    242242    pad->cd(1);
    243243    gPad->SetBorderMode(0);
    244     MH::Draw(fHM3Long, fHM3Trans, "3^{rd} Moments");
     244    MH::DrawSame(fHM3Long, fHM3Trans, "3^{rd} Moments");
    245245
    246246    pad->cd(2);
  • trunk/MagicSoft/Mars/mimage/MHHillasSrc.cc

    r2320 r2414  
    198198// together with the canvas.
    199199//
    200 void MHHillasSrc::Draw(Option_t *)
    201 {
    202     TVirtualPad *pad = gPad ? gPad : MakeDefCanvas(this);
     200void MHHillasSrc::DrawTS(TVirtualPad *p, Option_t *)
     201{
     202    TVirtualPad *pad = p ? p : MakeDefCanvas(this);
    203203    pad->SetBorderMode(0);
    204204
    205     AppendPad("");
     205    //
     206    // Add this object to the given pad
     207    //
     208    MParContainer::DrawTS(pad);
    206209
    207210    // FIXME: Display Source position
    208211
     212    //
     213    // Fill the pad with histograms
     214    //
    209215    pad->Divide(2, 2);
    210216
    211     pad->cd(1);
    212     gPad->SetBorderMode(0);
    213     fAlpha->Draw();
    214 
    215     pad->cd(2);
    216     gPad->SetBorderMode(0);
    217     fDist->Draw();
    218 
    219     pad->cd(4);
    220     gPad->SetBorderMode(0);
    221     //gPad->SetLogy();
    222     fCosDA->Draw();
     217    p = pad->GetPad(1);
     218    p->SetBorderMode(0);
     219    MParContainer::DrawTS(fAlpha, p);
     220
     221    p = pad->GetPad(2);
     222    p->SetBorderMode(0);
     223    MParContainer::DrawTS(fDist, p);
     224
     225    delete pad->GetPad(3);
     226
     227    p = pad->GetPad(4);
     228    p->SetBorderMode(0);
     229    MParContainer::DrawTS(fCosDA, p);
    223230
    224231    pad->Modified();
  • trunk/MagicSoft/Mars/mimage/MHHillasSrc.h

    r2100 r2414  
    3535    TH1F *GetHistCosDeltaAlpha() { return fCosDA; }
    3636
    37     void Draw(Option_t *opt=NULL);
     37    //void Draw(Option_t *opt=NULL);
     38    void DrawTS(TVirtualPad *pad=NULL, Option_t *opt=NULL);
    3839    void Paint(Option_t *opt);
    3940
  • trunk/MagicSoft/Mars/mimage/MHNewImagePar.cc

    r2320 r2414  
    191191    TAxis &x = *fHistLeakage1.GetXaxis();
    192192    x.SetRangeUser(0.0, x.GetXmax());
    193     MH::Draw(fHistLeakage1, fHistLeakage2, "Leakage1 and Leakage2");
     193    MH::DrawSame(fHistLeakage1, fHistLeakage2, "Leakage1 and Leakage2");
    194194
    195195    pad->cd(2);
    196196    gPad->SetBorderMode(0);
    197     MH::Draw(fHistCorePix, fHistUsedPix, "Number of core/used Pixels");
     197    MH::DrawSame(fHistCorePix, fHistUsedPix, "Number of core/used Pixels");
    198198
    199199    pad->cd(3);
    200200    gPad->SetBorderMode(0);
    201     MH::Draw(fHistConc1, fHistConc, "Concentrations");
     201    MH::DrawSame(fHistConc1, fHistConc, "Concentrations");
    202202
    203203    pad->cd(4);
  • trunk/MagicSoft/Mars/mraw/MRawEvtData.cc

    r2372 r2414  
    215215//     <index>      The pixel with the given index is drawn
    216216//
    217 void MRawEvtData::Draw(Option_t *opt)
     217// Rem: DrawTS is the thread-safe version of Draw. In most cases
     218//      you can use Draw instead
     219//
     220void MRawEvtData::DrawTS(TVirtualPad *pad=NULL, Option_t *opt="")
    218221{
    219222    if (GetNumPixels()==0)
    220223    {
    221224        *fLog << warn << "Sorry, no pixel to draw!" << endl;
     225        return;
     226    }
     227    if (!pad)
     228    {
     229        *fLog << warn << "MRawEvtData::DrawTS - No pad available..." << endl;
    222230        return;
    223231    }
     
    238246    if (!pix.Jump(id))
    239247    {
    240         *fLog << warn << "Pixel Idx #" << id << " doesn't exist!" << endl;
     248        *fLog << warn << "Pixel Idx #" << dec << id << " doesn't exist!" << endl;
    241249        return;
    242250    }
     
    255263    if (str.BeginsWith("graph"))
    256264    {
    257         *fLog << inf << "Drawing Graph: Pixel Idx #" << pix.GetPixelId();
     265        *fLog << inf << "Drawing Graph: Pixel Idx #" << dec << pix.GetPixelId();
    258266        *fLog << " of " << (int)GetNumPixels() << "Pixels" << endl;
    259267
     
    267275
    268276        graphhi->SetBit(kCanDelete);
    269         graphhi->Draw(same ? "C*" : "AC*");
     277        MParContainer::DrawTS(graphhi, pad, same ? "C*" : "AC*");
    270278
    271279        TH1F *histhi = graphhi->GetHistogram();
     
    286294
    287295            graphlo->SetBit(kCanDelete);
    288             graphlo->Draw("C*");
     296            MParContainer::DrawTS(graphlo, pad, "C*");
    289297
    290298            TH1F *histlo = graphlo->GetHistogram();
     
    300308    {
    301309        // FIXME: Add Legend
    302         *fLog << inf << "Drawing Histogram of Pixel with Idx #" << pix.GetPixelId() << endl;
     310        *fLog << inf << "Drawing Histogram of Pixel with Idx #";
     311        *fLog << dec << pix.GetPixelId() << endl;
    303312
    304313        TH1F *histh = new TH1F(name, "FADC Samples", nh, -0.5, nh-.5);
     
    309318            histh->Fill(i, higains[i]);
    310319        histh->SetBit(kCanDelete);
    311         histh->Draw(same ? "same" : "");
     320        MParContainer::DrawTS(histh, pad, same ? "same" : "");
    312321
    313322        if (nl>0)
     
    319328                histl->Fill(i, logains[i]);
    320329            histl->SetBit(kCanDelete);
    321             histl->Draw("same");
     330            MParContainer::DrawTS(histl, pad, "same");
    322331        }
    323332        return;
     
    516525    return kTRUE;
    517526}
     527
     528void MRawEvtData::Copy(TObject &named)
     529#if ROOT_VERSION_CODE > ROOT_VERSION(3,04,01)
     530const
     531#endif
     532{
     533    MRawEvtData &evt = (MRawEvtData &)named;
     534
     535    *evt.fHiGainPixId = *fHiGainPixId;
     536    *evt.fLoGainPixId = *fLoGainPixId;
     537
     538    *evt.fHiGainFadcSamples = *fHiGainFadcSamples;
     539    *evt.fLoGainFadcSamples = *fLoGainFadcSamples;
     540
     541    evt.fPosInArray      = fPosInArray;
     542    evt.fConnectedPixels = fConnectedPixels;
     543    evt.fArraySize       = fArraySize;
     544}
     545
  • trunk/MagicSoft/Mars/mraw/MRawEvtData.h

    r2207 r2414  
    2424    // FIXME: COMMENT ABOUT ORDERING
    2525
    26     MArrayS *fHiGainPixId;        // list of pixel IDs of hi gain channel
    27     MArrayB *fHiGainFadcSamples;  // list of hi gain samples of all pixels (ordering: see fHiGainPixId)
     26    MArrayS *fHiGainPixId;        //-> list of pixel IDs of hi gain channel
     27    MArrayB *fHiGainFadcSamples;  //-> list of hi gain samples of all pixels (ordering: see fHiGainPixId)
    2828
    29     MArrayS *fLoGainPixId;        // list of pixel IDs of lo gain channel
    30     MArrayB *fLoGainFadcSamples;  // list of lo gain samples of all pixels (ordering: see fLoGainPixId)
     29    MArrayS *fLoGainPixId;        //-> list of pixel IDs of lo gain channel
     30    MArrayB *fLoGainFadcSamples;  //-> list of lo gain samples of all pixels (ordering: see fLoGainPixId)
    3131
    3232    Int_t fPosInArray;        //!
     
    5252    void Clear(Option_t * = NULL);
    5353    void Print(Option_t * = NULL) const;
    54     void Draw (Option_t * = NULL);
     54    void DrawTS(TVirtualPad *pad=NULL, Option_t *option="");
     55    void Copy(TObject &named)
     56#if ROOT_VERSION_CODE > ROOT_VERSION(3,04,01)
     57const
     58#endif
     59        ;
    5560
    5661    void DeletePixels(Bool_t flag=kFALSE);
     
    6570
    6671    Bool_t GetPixelContent(Double_t &val, Int_t idx, const MGeomCam &cam, Int_t type=0) const;
    67     void   DrawPixelContent(Int_t num) const
     72    void   DrawPixelContent(Int_t num, TVirtualPad *pad=NULL) const
    6873    {
    6974        TString s("HIST");
    7075        s += num;
    71         const_cast<MRawEvtData*>(this)->Draw(s);
     76        const_cast<MRawEvtData*>(this)->DrawTS(pad, s);
     77        //const_cast<MRawEvtData*>(this)->Draw(s);
    7278    }
    7379
Note: See TracChangeset for help on using the changeset viewer.