Pluto v6.3.0
Loading...
Searching...
No Matches
batch_filters.C
Go to the documentation of this file.
1//TITLE Demonstrate how batch scripting can be used to define filters
2
3{
4
5 //First define our histograms
6 TH1F * histo1 = new TH1F ("histo1","p p missing mass",100,0.1,1.0);
7 TH1F * histo1_cut = new TH1F ("histo1_cut","p p missing mass",100,0.1,1.0);
8
9 TH1F * histo2 = new TH1F ("histo2","p p missing momentum",100,0.1,1.0);
10 TH1F * histo2_cut = new TH1F ("histo2_cut","p p missing momentum",100,0.1,1.0);
11 TH1F * histo2_cut2 = new TH1F ("histo2_cut2","p p missing momentum",100,0.1,1.0);
12
13 TH1F * histo3 = new TH1F ("histo3","Theta of the first proton",100,0,180);
14
15 //Define the reaction
16 PReaction my_reaction("3.5","p","p","p p w [pi+ pi- pi0]");
17
18 //The batch commands
19 my_reaction.Do("pp_miss = [p + p] - ([p,1] + [p,2]); total_miss = [p + p] - ([p,1] + [p,2] + [pi+] + [pi-])");
20
21 //my_reaction.Do("[p,1]->Print();[p,2]->Print(); echo *************");
22 //A simple missing mass/momentum histogram
23 my_reaction.Do(histo1,"_x= pp_miss->M2()");
24 my_reaction.Do(histo2,"_x= pp_miss->P()");
25
26 //Mathematical operations can be used:
27 my_reaction.Do(histo3,"_x= ([p,1]->Theta() * 180.)/TMath::Pi()");
28
29 //*******Conditional histogram
30 //Only omegas having a certain momentum:
31 my_reaction.Do(histo1_cut,"if pp_miss->P() > 0.3; _x= pp_miss->M2()");
32 //Control (to be on the save side!):
33 my_reaction.Do(histo2_cut,"if pp_miss->P() > 0.3; _x= pp_miss->P()");
34
35
36 //*******Conditional Reaction: filters (in our case connected with a control histo)
37 //Boolean operations:
38 my_reaction.Do(histo2_cut2,"#mom = 0.; if pp_miss->P() > 0.3 && pp_miss->P() < 0.6 ; #mom = 1.");
39
40 my_reaction.Print();
41
42 //Start event loop:
43 cout << my_reaction.Loop(50000) << " events recorded" << endl;
44
45 //Plot our on-line histograms
46 //******* Starting from here all commands are standard ROOT ***********
47 TCanvas *c1 = new TCanvas("c1","Canvas");
48 c1->SetLogy(1);
49 c1->Divide(2);
50 c1->cd(1);
51 histo1->Draw("");
52 histo1_cut->Draw("same");
53 histo1_cut->SetLineColor(2);
54
55 c1->cd(2);
56 histo2->Draw("");
57 histo2_cut->Draw("same");
58 histo2_cut->SetLineColor(2);
59 histo2_cut2->Draw("same");
60 histo2_cut2->SetLineColor(3);
61}
TH1F * histo2_cut2
PReaction my_reaction("3.5","p","p","p p w [pi+ pi- pi0]")
TH1F * histo2_cut
TH1F * histo1_cut
TH1F * histo3
new TCanvas()
TH1F * histo1
PReaction my_reaction("3.5","p","7Li","p (n) phi [K+ K-] (6Li)","delme")
TH2F * histo2