Introducing Id
[u/mrichter/AliRoot.git] / ZDC / testGen.C
1 void testGen()
2 {
3 gROOT.Reset();
4 //
5 // ************* Parameters for AliGenHIJING generator **************
6 //
7 AliGenZDC *gener = new AliGenZDC();
8 gener->SetParticle(kProton);
9 gener->SetMomentum(2760.);
10 gener->SetDirection(0,0,0,1);
11 gener->SetFermi(1);
12 gener->SetDiv(0.000032,0.0001,2);
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 c1->SetFillColor(38);
19 pad11 = new TPad("pad11"," ",0.01,0.51,0.49,0.99);
20 pad12 = new TPad("pad12"," ",0.51,0.51,0.99,0.99);
21 pad13 = new TPad("pad13"," ",0.01,0.01,0.99,0.49);
22 pad11->SetFillColor(18);
23 pad12->SetFillColor(18);
24 pad13->SetFillColor(18);
25 pad11->Draw();
26 pad12->Draw();
27 pad13->Draw();
28
29 TCanvas *c2 = new TCanvas("c2","Nucleon Momentum with Fermi and Divergence",600,10,600,700);
30 c2->SetFillColor(38);
31 pad21 = new TPad("pad21"," ",0.01,0.51,0.49,0.99);
32 pad22 = new TPad("pad22"," ",0.51,0.51,0.99,0.99);
33 pad23 = new TPad("pad23"," ",0.01,0.01,0.99,0.49);
34 pad21->SetFillColor(10);
35 pad22->SetFillColor(10);
36 pad23->SetFillColor(10);
37 pad21->Draw();
38 pad22->Draw();
39 pad23->Draw();
40
41 TH1F *hpx  = new TH1F("hpx","Nucleon momentum Px",100,-1.,1.);
42 TH1F *hpy  = new TH1F("hpy","Nucleon momentum Py",100,-1.,1.);
43 TH1F *hpz  = new TH1F("hpz","Nucleon momentum Pz",100,2000.,3000.);
44
45 TH1F *hpbx = new TH1F("hpbx","Px with Fermi and Divergence",100,-1.,1.);
46 TH1F *hpby = new TH1F("hpby","Py with Fermi and Divergence",100,-1.,1.);
47 TH1F *hpbz = new TH1F("hpbz","Pz with Fermi and Divergence",100,0.,6000.);
48
49 // ************* Generation of events **************
50 //
51 for(Int_t i=0; i<=1000; i++){
52    gener->Generate();
53   //
54    // ************* Getting momenta **************
55    //
56    Double_t px = gener->GetInMomentum(0);
57    Double_t py = gener->GetInMomentum(1);
58    Double_t pz = gener->GetInMomentum(2);
59 //   printf("Initial momentum -> px = %f, py = %f, pz = %f \n", px,py,pz);
60    Double_t ptrackx = gener->GetTrackMomentum(0);
61    Double_t ptracky = gener->GetTrackMomentum(1);
62    Double_t ptrackz = gener->GetTrackMomentum(2);
63 //   printf("Track momentum -> px = %f, py = %f, pz = %f \n\n", ptrackx,ptracky,ptrackz);
64    //
65    // ************* Filling histograms **************
66    //
67    hpx->Fill(px);
68    hpy->Fill(py);
69    hpz->Fill(pz);
70    hpbx->Fill(ptrackx);
71    hpby->Fill(ptracky);
72    hpbz->Fill(ptrackz);
73    //
74    // ************* Drawing histograms **************
75    //
76    pad11->cd();
77 //   pad11->GetFrame()->SetFillColor(10);
78 //   pad11->GetFrame()->SetBorderMode(-1);
79 //   pad11->GetFrame()->SetBorderSize(12);
80    hpx->Draw();
81
82    pad12->cd();
83 //   pad12->GetFrame()->SetFillColor(10);
84 //   pad12->GetFrame()->SetBorderMode(-1);
85 //   pad12->GetFrame()->SetBorderSize(12);
86    hpy->Draw();
87    
88    pad13->cd();
89 //   pad13->GetFrame()->SetFillColor(10);
90 //   pad13->GetFrame()->SetBorderMode(-1);
91 //   pad13->GetFrame()->SetBorderSize(12);
92    hpz->Draw();
93    
94    pad21->cd();
95 //   pad21->GetFrame()->SetFillColor(10);
96 //   pad21->GetFrame()->SetBorderMode(-1);
97 //   pad21->GetFrame()->SetBorderSize(12);
98    hpbx->Draw();
99    
100    pad22->cd();
101 //   pad22->GetFrame()->SetFillColor(10);
102 //   pad22->GetFrame()->SetBorderMode(-1);
103 //   pad22->GetFrame()->SetBorderSize(12);
104    hpby->Draw();
105    
106    pad23->cd();
107 //   pad23->GetFrame()->SetFillColor(10);
108 //   pad23->GetFrame()->SetBorderMode(-1);
109 //   pad23->GetFrame()->SetBorderSize(12);
110    hpbz->Draw();
111 }  
112 }