Convert an TNtuple (from the example above) to a PParticle and make a bulk decay


{
    //Using the ntuple from:
    // * hello_world.C
    // * batch_write_ntuple.C

    TFile *f = new TFile("ntuple.root");
    
    //Define an "empty" reaction
    PReaction my_reaction("output");

    TNtuple *ntuple = (TNtuple *)f->Get("ntuple"); 
    
    my_reaction.Input(ntuple);
    
    //reconstruct the eta:
    my_reaction.Do("myeta = P3M(eta_px,eta_py,eta_pz,0.54745); myeta->SetID(eta.pid)");

    //Add eta to particle stream:
    my_reaction.Do("Push(myeta)");
 
    //Bulk decay of eta
    PPlutoBulkDecay *pl = new PPlutoBulkDecay();
    pl->SetRecursiveMode(1);  //Let also the products decay
    pl->SetTauMax(0.001);     //maxTau in ns
    my_reaction.AddBulk(pl);

    //This is for debugging the decay chain:
    //my_reaction->Do("echo *******new event");
    //my_reaction->Do("foreach(*); id = [*]->ID(); echo PID: $id");

    my_reaction.Print();

    cout << my_reaction.Loop() << " events recovered" << endl;
}
 ntuple_to_pparticle.C:1
 ntuple_to_pparticle.C:2
 ntuple_to_pparticle.C:3
 ntuple_to_pparticle.C:4
 ntuple_to_pparticle.C:5
 ntuple_to_pparticle.C:6
 ntuple_to_pparticle.C:7
 ntuple_to_pparticle.C:8
 ntuple_to_pparticle.C:9
 ntuple_to_pparticle.C:10
 ntuple_to_pparticle.C:11
 ntuple_to_pparticle.C:12
 ntuple_to_pparticle.C:13
 ntuple_to_pparticle.C:14
 ntuple_to_pparticle.C:15
 ntuple_to_pparticle.C:16
 ntuple_to_pparticle.C:17
 ntuple_to_pparticle.C:18
 ntuple_to_pparticle.C:19
 ntuple_to_pparticle.C:20
 ntuple_to_pparticle.C:21
 ntuple_to_pparticle.C:22
 ntuple_to_pparticle.C:23
 ntuple_to_pparticle.C:24
 ntuple_to_pparticle.C:25
 ntuple_to_pparticle.C:26
 ntuple_to_pparticle.C:27
 ntuple_to_pparticle.C:28
 ntuple_to_pparticle.C:29
 ntuple_to_pparticle.C:30
 ntuple_to_pparticle.C:31
 ntuple_to_pparticle.C:32
 ntuple_to_pparticle.C:33
 ntuple_to_pparticle.C:34
 ntuple_to_pparticle.C:35
 ntuple_to_pparticle.C:36