Hello World


{
    //This macro combines several features of Pluto:
    // 1.) Setting up a reaction 
    // 2.) Adding a filter
    // 3.) Writing an additional NTuple
    // 4.) Making an online histogram

    //Create a file for the NTuple:
    TFile *f = new TFile("ntuple.root", "RECREATE");
    //Create an NTuple with several variables
    TNtuple *ntuple = new TNtuple("ntuple", "data from Pluto events", "eta_px:eta_py:eta_pz:opang");
    
    //Create a control histo
    TH1F *histo1 = new TH1F ("histo1", "dilepton mass with opening angle < 9deg", 100, 0.0, 0.7);

    //Define the reaction: pp -> pp eta @ 3.5 kinetic beam energy
    PReaction my_reaction("3.5", "p", "p", "p p eta [g dilepton [e+ e-]]", "eta_dalitz");

    //Adding a filter
    //It is very simple: all variables starting with "#" are recognized as an file event filter
    my_reaction.Do("theta_ep = ([e+]->Theta() * 180.)/TMath::Pi()");
    my_reaction.Do("theta_em = ([e-]->Theta() * 180.)/TMath::Pi()");
    my_reaction.Do("#acc_filter = 1; if theta_ep<18 || theta_ep>85 || theta_em<18 || theta_em>85; #acc_filter = 0");
    
    //Writing variables to an NTuple
    my_reaction.Do("eta_px = [eta]->Px() ; eta_py = [eta]->Py() ; eta_pz = [eta]->Pz();");
    my_reaction.Do("opang = [e+]->Angle([e-])");
    my_reaction.Output(ntuple);

    //An additional filter on opening angle...
    my_reaction.Do("#opang_filter = 0; if opang > (9./180.)*TMath::Pi();  #opang_filter = 1");

    //Some control histo
    my_reaction.Do(histo1,"if opang > (9./180.)*TMath::Pi(); _x = ([e+] + [e-])->M()");

    cout << my_reaction.Loop(100000) << " events recorded" << endl;
    
    histo1->Draw();
    f->Write();
}
 hello_world.C:1
 hello_world.C:2
 hello_world.C:3
 hello_world.C:4
 hello_world.C:5
 hello_world.C:6
 hello_world.C:7
 hello_world.C:8
 hello_world.C:9
 hello_world.C:10
 hello_world.C:11
 hello_world.C:12
 hello_world.C:13
 hello_world.C:14
 hello_world.C:15
 hello_world.C:16
 hello_world.C:17
 hello_world.C:18
 hello_world.C:19
 hello_world.C:20
 hello_world.C:21
 hello_world.C:22
 hello_world.C:23
 hello_world.C:24
 hello_world.C:25
 hello_world.C:26
 hello_world.C:27
 hello_world.C:28
 hello_world.C:29
 hello_world.C:30
 hello_world.C:31
 hello_world.C:32
 hello_world.C:33
 hello_world.C:34
 hello_world.C:35
 hello_world.C:36
 hello_world.C:37
 hello_world.C:38
 hello_world.C:39
 hello_world.C:40
 hello_world.C:41
 hello_world.C:42