The event loop interface: Make histograms in one single line without ana macro with the PBatch script language


{
    PData::SetWeightVersion(0); //Disable 1/N_ev * BR weighting

    //First define our histograms
    TH2F *histo  = new TH2F ("histo",  "Dalitz", 30, 1., 4., 30, 1., 4.);
    TH1F *histo1 = new TH1F ("histo1", "p/pi0 missing mass", 100, 0.1, 2.0);
    TH1F *histo2 = new TH1F ("histo2", "cos theta of pp", 20, -1., 1.);
    TH1F *histo3 = new TH1F ("histo3", "cos theta of D+ decay", 20, -1., 1.);

    TH2F *histo_p1 = new TH2F ("histo_p1", "px vs. vy of the pp pair", 30, -1., 1., 30, -1., 1.);

    //If you want another decay angle of the D, uncomment this line:
    ((PScatterDistribution *)makeDistributionManager()->GetDistribution("pp_delta_waves1"))->SetAngleFunction(new TF1("delme","(1+3*x*x)*.25",-1,1));
 
    //No D+ angular distribution?
    //makeDistributionManager()->Disable("pp_delta+_angle");

    //Define the reaction as usual
    PReaction my_reaction(3.13, "p", "p", "p D+ [p pi0]", "delme", 1, 0, 0, 0);

    //Combine the masses of p,1 and pi0, p,2, pi0 to the Dalitz plot
    my_reaction.Do(histo, "_x = ([p,1] + [pi0])->M2() ; _y = ([p,2] + [pi0])->M2() ");

    //Missing mass of the p2 and pi0 pair:
    my_reaction.Do(histo1, "miss= [p + p]- ( [p,2]+ [pi0] );_x=miss->M()");

    //pp aligment angle: Important: copy the proton before boosting it, otherwise you
    //will have the boosted particle on tape
    my_reaction.Do(histo2, "p1=[p,1]; p1->Boost([p + p]); _x=cos(p1->Theta())");

    //The decay angle of the D+:
    my_reaction.Do(histo3, "_pi0=[pi0]; _d=[D+]; _pi0->Rot(_d); _d->Rot(_d); _pi0->Boost(_d); _x= cos(_pi0->Theta())");

    //Momentum of a pair
    //All methods of a PParticle of the type ->XXX(void) can be used
    //Syntax can be ->XXX() or .XXX()  (as you like)
    my_reaction.Do(histo_p1, "pp_pair= [p,1] + [p,2];_x=pp_pair.Px(); _y=pp_pair->Py()");

    my_reaction.Loop(50000);


    TCanvas *c1 = new TCanvas();

    c1->Divide(2,2);

    c1->cd(1); 
    gStyle->SetPalette(1,0);
    histo->Draw("colz");
    c1->cd(2); 
    histo2->Draw("e1");
    c1->cd(3); 
    histo1->Draw("e1");
    c1->cd(4); 
    histo3->Draw("e1");

    TCanvas *c2 = new TCanvas();

    histo_p1->Draw("colz");

}
 test_batch.C:1
 test_batch.C:2
 test_batch.C:3
 test_batch.C:4
 test_batch.C:5
 test_batch.C:6
 test_batch.C:7
 test_batch.C:8
 test_batch.C:9
 test_batch.C:10
 test_batch.C:11
 test_batch.C:12
 test_batch.C:13
 test_batch.C:14
 test_batch.C:15
 test_batch.C:16
 test_batch.C:17
 test_batch.C:18
 test_batch.C:19
 test_batch.C:20
 test_batch.C:21
 test_batch.C:22
 test_batch.C:23
 test_batch.C:24
 test_batch.C:25
 test_batch.C:26
 test_batch.C:27
 test_batch.C:28
 test_batch.C:29
 test_batch.C:30
 test_batch.C:31
 test_batch.C:32
 test_batch.C:33
 test_batch.C:34
 test_batch.C:35
 test_batch.C:36
 test_batch.C:37
 test_batch.C:38
 test_batch.C:39
 test_batch.C:40
 test_batch.C:41
 test_batch.C:42
 test_batch.C:43
 test_batch.C:44
 test_batch.C:45
 test_batch.C:46
 test_batch.C:47
 test_batch.C:48
 test_batch.C:49
 test_batch.C:50
 test_batch.C:51
 test_batch.C:52
 test_batch.C:53
 test_batch.C:54
 test_batch.C:55
 test_batch.C:56
 test_batch.C:57
 test_batch.C:58
 test_batch.C:59
 test_batch.C:60
 test_batch.C:61
 test_batch.C:62