Revision 4f52a00091cb1482dbd90d7c225768c4080d51fa authored by Philippe Canal on 25 August 2011, 22:28:35 UTC, committed by Philippe Canal on 25 August 2011, 22:28:35 UTC
The generic collection proxy's Commit method no longer uses the environment object, so Allocate no longer need to mark it as used.
This prevents a memory leak in the handling of associative containers stored in a TTree.


git-svn-id: http://root.cern.ch/svn/root/branches/v5-28-00-patches@40716 27541ba8-7e3a-0410-8455-c3a389f83636
1 parent d587879
Raw File
tornado.C
void tornado() {
//Show 3-d polymarkers
// To see the output of this macro, click begin_html <a href="gif/tornado.gif" >here</a> end_html
//Author: Rene Brun
   
    gBenchmark->Start("tornado");

    double PI = 3.141592653;
    int d = 16;
    int numberOfPoints=200;
    int numberOfCircles=40;

    // create and open a canvas
    TCanvas *sky = new TCanvas( "sky", "Tornado", 300, 10, 700, 500 );
    sky->SetFillColor(14);

    // creating view
    TView *view = TView::CreateView(1,0,0);
    float range = numberOfCircles*d;
    view->SetRange( 0, 0, 0, 4.0*range, 2.0*range, range );

    for( int j = d; j < numberOfCircles*d; j += d ) {

        // create a PolyMarker3D
        TPolyMarker3D *pm3d = new TPolyMarker3D( numberOfPoints );

        float x, y, z;

        // set points
        for( int i = 1; i < numberOfPoints; i++ ) {
            float csin = sin(2*PI / (double)numberOfPoints  * (double)i) + 1;
            float ccos = cos(2*PI / (double)numberOfPoints  * (double)i) + 1;
            float esin = sin(2*PI / (double)(numberOfCircles*d) * (double)j) + 1;
            x = j * ( csin + esin );
            y = j * ccos;
            z = j;
            pm3d->SetPoint( i, x, y, z );
        }

        // set marker size, color & style
        pm3d->SetMarkerSize( 1 );
        pm3d->SetMarkerColor( 2 + ( d == ( j & d ) ) );
        pm3d->SetMarkerStyle( 3 );

        //draw
        pm3d->Draw();
    }

    char timeStr[60];
    gBenchmark->Show("tornado");

    Float_t ct = gBenchmark->GetCpuTime("tornado");
    sprintf( timeStr, "Execution time: %g sec.", ct);

    TPaveText *text = new TPaveText( 0.1, 0.81, 0.9, 0.97 );
    text->SetFillColor( 42 );
    text->AddText("ROOT example: tornado.C");
    text->AddText(timeStr);
    text->Draw();
    sky->Update();
}
back to top