Steffen Müller > SOOT > SOOT::Examples::Tree

Download:
SOOT-0.17.tar.gz

Annotate this POD

View/Report Bugs
Source  

NAME ^

SOOT::Examples::Tree - SOOT Examples for Tree

DESCRIPTION ^

This is a listing of all SOOT examples for Tree.

EXAMPLES ^

simple.pl

  use strict;
  use warnings;
  use SOOT qw/:all/;
  SOOT::Init(1);
  use SOOT::Struct;
  use Data::Dumper;
  my $struct = SOOT::Struct->new(
    name => 'car_t',
    fields => [
      'age_years'  => 'UInt_t',
      'top_speed' => 'Double_t',
    ],
  );
  $struct->compile;
  
  my $file = TFile->new("t.root","recreate");
  my $tree = TTree->new("T", "test");
  my $car = car_t->new;
  my $branch = $tree->StructBranch("car", $car);
  
  foreach (0..50000) {
    my $age = int(rand 20);
    my $top_speed = 250-$age*15 + rand($age*10); # whatever
    $car->age_years($age);
    $car->top_speed($top_speed);
    $tree->Fill;
  }
  
  $tree->Write();
  $tree->Draw("top_speed:age_years", "", "COLZ");
  SOOT->Run;

SEE ALSO ^

SOOT

AUTHOR ^

Steffen Mueller, <smueller@cpan.org>

COPYRIGHT AND LICENSE ^

Copyright (C) 2010 by Steffen Mueller

SOOT, the Perl-ROOT wrapper, is free software; you can redistribute it and/or modify it under the same terms as ROOT itself, that is, the GNU Lesser General Public License. A copy of the full license text is available from the distribution as the LICENSE file.

syntax highlighting: