Pluto v6.3.0
Loading...
Searching...
No Matches
multiple_branches.C
Go to the documentation of this file.
1//TITLE Using more than one ROOT TBranch to store undistorted sim particles
2
3{
4
5 PUtils::SetSeed(123);
6 PReaction my_reaction("_T1 = 2.2", "p", "p", "p p w [e+ e-]", "w_multiple_branches");
7 //for syntax see parse_eta.C
8
9 //save particles on a new branch, called "particles_stage1":
10 my_reaction.Do("foreach(*); [*]->Push(Branch(particles_stage1))");
11
12 //apply a filter (keeping the w out):
13 my_reaction.Do("loop: theta_ep = ([*]->Theta() * 180.)/TMath::Pi()");
14 my_reaction.Do("theta_em = ([*]->Theta() * 180.)/TMath::Pi()");
15 my_reaction.Do("if ((theta_ep<18 || theta_ep>85 || theta_em<18 || theta_em>85) && ![*]->HasID(w.pid)); [*]->SetInActive(); ");
16 my_reaction.Do("formore(*); goto loop;");
17
18 //reconstruct w, which "survived" the filter
19 my_reaction.Do("[w]->SetM(([e+]+[e-])->M()); else; [w]->SetInActive();");
20
21 //save particles on a new branch, called "particles_stage2", before doing the smearing:
22 my_reaction.Do("foreach(*); [*]->Push(Branch(particles_stage2))");
23
24 //10% momentum resolution:
25 my_reaction.Do("foreach(*); mom = [*]->P(); newmom = sampleGaus(mom,0.1*mom);[*]->SetMom(newmom);");
26
27 //reconstruct w, after smearing:
28 my_reaction.Do("[w]->SetM( ([e+]+[e-])->M() );");
29
30 my_reaction.Print(); //The "Print()" statement is optional
31 my_reaction.Loop(1000);
32
33#if 0
34 //root -l w_multiple_branches.root
35 data->Draw("particles_stage1.M() >> htemp1","particles_stage1.ID() == 52");
36 htemp1->SetLineColor(1);
37 data->Draw("particles_stage2.M() >> htemp2","particles_stage2.ID() == 52","same");
38 htemp2->SetLineColor(2);
39 data->Draw("Particles.M() >> htemp3","Particles.ID() == 52","same");
40#endif
41
42}
static void SetSeed(UInt_t s)
Definition PUtils.h:164
PReaction my_reaction("_T1 = 2.2", "p", "p", "p p w [e+ e-]", "w_multiple_branches")
PReaction my_reaction("3.5","p","7Li","p (n) phi [K+ K-] (6Li)","delme")