Pluto v6.3.0
Loading...
Searching...
No Matches
demo_PAnyDistribution.C
Go to the documentation of this file.
1{
2
3 //First, we create the general purpose distribution
4 //model:
5 PAnyDistribution *mydecay =
6 new PAnyDistribution("pt_rho",
7 "A function to define a new pt-distribution");
8 mydecay->Add("q, parent");
9 mydecay->Add("p, daughter");
10 mydecay->Add("p, daughter");
11 mydecay->Add("rho0, daughter");
12
13 //This is the cache for the undistorted data
14 //It is needed because the mandelstam t is a non-uniform
15 //distribution. The size and binning of the cache must
16 //be chosen such, that during runtime (or even better: during Preheating) the statistic
17 //is sufficiently filled
18 TH1F *cache = new TH1F ("cache", "Rho0 pt cache", 400, 0, 1.0);
19
20 //For the following it could be important to know that the daughters are in
21 //their rest frame (i.e. the parent).
22 //But the parent itself is in lab frame.
23 //The parent is indicated by "_parent"
24 //Moreover, all particles of the decay (daughters and parent)
25 //can be accessed via the usual '[parname]' identifier.
26 //N.B.: "x,y,z,t" are reserved in TFormula, do NOT use it
27 mydecay->AddEquation(cache, "_x = [rho0]->Pt();");
28
29 //This is the final equation. The distribution (the probability function)
30 //must be stored in "_f"
31 mydecay->AddEquation("_f = 1; if ([rho0]->Pt() > 0.4) _f = 0.5;");
32 //This function is of course completely arbitrary!
33
34 //Remember, AnyDistribution is a rejection method. Therefore
35 //it can happen, that parts of the phase space, where _f has a
36 //large probability, is not well populated by the generated events.
37 //In this case, the event loop will run forever, as Pluto tries
38 //to match the shape defined by _f.
39 //The following factor is the maximum enhancement factor to avoid such
40 //deadlocks.
41 //N.B.: It directly scales with the computing time!!!
43
44 //Add this model to the Pluto data base:
45 makeDistributionManager()->Add(mydecay);
46
47 //Construct the reaction, as usual:
48 PReaction my_reaction("_T1 = 2.2", "p", "p", "p p rho0 [pi+ pi-]");
49
50 TH1F *histo1 = new TH1F("histo1", "rho0 pt", 40, 0, 0.7);
51 TH1F *histo3 = new TH1F("histo3", "cos theta of rho0", 50, -1., 1.);
52
53 my_reaction.Do(histo1, "_x = [rho0]->Pt();");
54 my_reaction.Do(histo3, "_rho=[rho0]; _rho->Boost([p+p]); _x= cos(_rho->Theta())");
55
56 my_reaction.Print();
57
58 //Make a dummy loop to fill the AnyDistribution with some statistics:
59 my_reaction.Preheating(500);
60 //The event loop prints warnings - that's normal
61 //The MaxFactor should not changed very much after the PreHeating finished
62
63 my_reaction.Loop(10000);
64
65 histo1->Draw();
66}
TH1F * histo3
void SetMaxEnhancementFactor(Double_t _max_enhance_factor)
Bool_t AddEquation(TH1 *histo, const char *command)
Int_t Add(const Char_t *opt)
PReaction my_reaction("_T1 = 2.2", "p", "p", "p p rho0 [pi+ pi-]")
makeDistributionManager() -> Add(mydecay)
TH1F * cache
TH1F * histo1
PReaction my_reaction("3.5","p","7Li","p (n) phi [K+ K-] (6Li)","delme")