Introducing Id
[u/mrichter/AliRoot.git] / ZDC / testGenFermi.C
1 void testGenFermi()
2 {
3 gROOT.Reset();
4 //
5 // ************* Parameters for AliGenHIJING generator **************
6 //
7 AliGenZDC *gener = new AliGenZDC();
8 gener->SetParticle(kNeutron);
9 gener->SetMomentum(2760.);
10 gener->SetDir(0,0,0,1);
11 gener->SetFermi(1);
12 gener->SetDiv(0,0,0);
13 gener->Init();
14 //
15 // ************* Creating canvas, pads & histograms **************
16 //
17 //TCanvas *c1 = new TCanvas("c1","Nucleon Momentum in LAB RS",0,10,580,700);
18 //pad11 = new TPad("pad11"," ",0.01,0.51,0.49,0.99);
19 //pad12 = new TPad("pad12"," ",0.51,0.51,0.99,0.99);
20 //pad13 = new TPad("pad13"," ",0.01,0.01,0.99,0.49);
21 //pad11->SetFillColor(18);
22 //pad12->SetFillColor(18);
23 //pad13->SetFillColor(18);
24 //pad11->Draw();
25 //pad12->Draw();
26 //pad13->Draw();
27
28 TCanvas *c2 = new TCanvas("c2","Nucleon Momentum Boosted with Fermi Momentum",600,10,600,700);
29 c2->SetFillColor(38);
30 pad21 = new TPad("pad21"," ",0.01,0.51,0.49,0.99);
31 pad22 = new TPad("pad22"," ",0.51,0.51,0.99,0.99);
32 pad23 = new TPad("pad23"," ",0.01,0.01,0.99,0.49);
33 pad21->SetFillColor(10);
34 pad22->SetFillColor(10);
35 pad23->SetFillColor(10);
36 pad21->Draw();
37 pad22->Draw();
38 pad23->Draw();
39
40 TCanvas *c3 = new TCanvas("c3","Fermi2Gaussian distributions",0,10,580,700);
41 c3->SetFillColor(38);
42 pad31 = new TPad("pad31"," ",0.01,0.51,0.99,0.99);
43 pad32 = new TPad("pad32"," ",0.01,0.01,0.99,0.49);
44 pad31->SetFillColor(10);
45 pad32->SetFillColor(10);
46 pad31->Draw();
47 pad32->Draw();
48
49 //TH1F *hpx  = new TH1F("hpx","Nucleon momentum Px",100,-100.,100.);
50 //TH1F *hpy  = new TH1F("hpy","Nucleon momentum Py",100,-100.,100.);
51 //TH1F *hpz  = new TH1F("hpz","Nucleon momentum Pz",100,-3000.,0.);
52
53 TH1F *hpbx = new TH1F("hpbx","Px boosted with Fermi momentum",100,-1.,1.);
54 TH1F *hpby = new TH1F("hpby","Py boosted with Fermi momentum",100,-1.,1.);
55 TH1F *hpbz = new TH1F("hpbz","Pz boosted with Fermi momentum",100,-8000.,0.);
56
57 TH1D *hdgp  = new TH1D("hdgp","Fermi Two Gaussian Distribution -> p",200,0.,200.);
58 TH1D *hdgn  = new TH1D("hdgn","Fermi Two Gaussian Distribution -> n",200,0.,200.);
59 //
60 // ************* Fermi Two Gaussian distributions **************
61 //
62 Double_t FermiDp[201], FermiDn[201];
63 for(Int_t i=0; i<=200; i++){
64    FermiDp[i] = gener->GetFermi2p(i);
65    FermiDn[i] = gener->GetFermi2n(i);
66 //     printf(" testGenZDC -> Fermi2p[%d] = %f, Fermi2n[%d] = %f\n",i,FermiDp[i],i,FermiDn[i]);
67    hdgp->Fill((Axis_t)i,(Stat_t)FermiDp[i]);
68    hdgn->Fill((Axis_t)i,(Stat_t)FermiDn[i]);
69 }
70    
71 pad31->cd();
72 //pad31->GetFrame()->SetFillColor(10);
73 //pad31->GetFrame()->SetBorderMode(-1);
74 //pad31->GetFrame()->SetBorderSize(12);
75 hdgp->Draw();
76
77 pad32->cd();
78 //pad32->GetFrame()->SetFillColor(10);
79 //pad32->GetFrame()->SetBorderMode(-1);
80 //pad32->GetFrame()->SetBorderSize(12);
81 hdgn->Draw();
82 //
83 // ************* Generation of events **************
84 //
85 for(Int_t i=0; i<=10000; i++){
86    gener->Generate();
87   //
88    // ************* Getting momenta **************
89    //
90 //   Double_t px = gener->GetMomentum(0);
91 //   Double_t py = gener->GetMomentum(1);
92 //   Double_t pz = gener->GetMomentum(2);
93    Double_t pboostx = gener->GetBoostMomentum(0);
94    Double_t pboosty = gener->GetBoostMomentum(1);
95    Double_t pboostz = gener->GetBoostMomentum(2);
96 //   printf ("  testGenZDC -> pz = %f pz_boost = %f\n",pz,pboostz);
97    //
98    // ************* Filling histograms **************
99    //
100 //   hpx->Fill(px);
101 //   hpy->Fill(py);
102 //   hpz->Fill(pz);
103    hpbx->Fill(pboostx);
104    hpby->Fill(pboosty);
105    hpbz->Fill(pboostz);
106    //
107    // ************* Drawing histograms **************
108    //
109 //   pad11->cd();
110 //   pad11->GetFrame()->SetFillColor(10);
111 //   pad11->GetFrame()->SetBorderMode(-1);
112 //   pad11->GetFrame()->SetBorderSize(12);
113 //   hpx->Draw();
114
115 //   pad12->cd();
116 //   pad12->GetFrame()->SetFillColor(10);
117 //   pad12->GetFrame()->SetBorderMode(-1);
118 //   pad12->GetFrame()->SetBorderSize(12);
119 //   hpy->Draw();
120    
121 //   pad13->cd();
122 //   pad13->GetFrame()->SetFillColor(10);
123 //   pad13->GetFrame()->SetBorderMode(-1);
124 //   pad13->GetFrame()->SetBorderSize(12);
125 //   hpz->Draw();
126    
127    pad21->cd();
128 //   pad21->GetFrame()->SetFillColor(10);
129 //   pad21->GetFrame()->SetBorderMode(-1);
130 //   pad21->GetFrame()->SetBorderSize(12);
131    hpbx->Draw();
132    
133    pad22->cd();
134 //   pad22->GetFrame()->SetFillColor(10);
135 //   pad22->GetFrame()->SetBorderMode(-1);
136 //   pad22->GetFrame()->SetBorderSize(12);
137    hpby->Draw();
138    
139    pad23->cd();
140 //   pad23->GetFrame()->SetFillColor(10);
141 //   pad23->GetFrame()->SetBorderMode(-1);
142 //   pad23->GetFrame()->SetBorderSize(12);
143    hpbz->Draw();
144 }  
145 }