source: trunk/WuerzburgSoft/Thomas/mphys/anale.C@ 1369

Last change on this file since 1369 was 1364, checked in by tbretz, 22 years ago
*** empty log message ***
File size: 3.2 KB
Line 
1//Double_t kRad2Deg = 180./TMath::Pi();
2
3void anale()
4{
5 TChain chain("Electrons");
6 //chain.Add("cascade.root");
7
8 chain.Add("cascade_100kpc_01.root");
9 chain.Add("cascade_100kpc_02.root");
10 chain.Add("cascade_100kpc_03.root");
11
12
13 MElectron *e = new MElectron;
14 chain.SetBranchAddress("MElectron.", &e);
15
16 Int_t n = chain.GetEntries();
17
18 cout << "Found " << n << " entries." << endl;
19
20 MBinning binsx;
21 MBinning binsy;
22 MBinning binsr;
23 binsx.SetEdgesLog(80, 1e1, 1e9);
24 binsy.SetEdgesLog(80, 1e1, 1e9);
25 binsr.SetEdgesLog(84, 1e-5, 1.8);
26
27 TH2D h;
28 h.SetName("Photons");
29 h.SetTitle(" Photons from inv.Compton ");
30 h.SetXTitle("E_{e} [GeV]");
31 h.SetYTitle("E\\gamma [GeV]");
32 h.SetZTitle("Counts");
33 MH::SetBinning(&h, &binsx, &binsy);
34
35 TH2D r;
36 r.SetName("ratio");
37 r.SetTitle("Ratio E\\gamma / E_{e}");
38 r.SetXTitle("E_{e} [GeV]");
39 r.SetYTitle("Ratio");
40 r.SetZTitle("Counts");
41 MH::SetBinning(&r, &binsx, &binsr);
42
43 Double_t E = -1;
44 for (int i=0; i<n; i++)
45 {
46 chain.GetEntry(i);
47
48 if (e->IsPrimary())
49 {
50 E = e->GetEnergy();
51 continue;
52 }
53
54 Double_t dE = E - e->GetEnergy();
55
56 h.Fill(E, dE);
57 r.Fill(E, dE/E);
58
59 E = e->GetEnergy();
60 }
61
62 delete e;
63
64 gStyle->SetOptStat(10);
65
66 TLine line;
67 line.SetLineColor(kBlack);
68 line.SetLineWidth(1);
69
70 TCanvas *c = new TCanvas("c1", "name");
71 c->Divide(2,2);
72
73 c->cd(1);
74 gPad->SetLogx();
75 gPad->SetLogy();
76 h.GetXaxis()->SetRangeUser(1e4, 1e9);
77 h.GetXaxis()->SetLabelOffset(-0.015);
78 h.GetXaxis()->SetTitleOffset(1.1);
79 h.GetXaxis()->SetRangeUser(1e4, 1e9);
80 h.GetYaxis()->SetTitleOffset(1.1);
81 h.DrawCopy();
82 TH1 *p=h.ProfileX();
83 p->SetBit(kCanDelete);
84 p->SetTitle("Profile e^{-} / \\gamma ");
85 p->SetLineColor(kRed);
86 p->GetXaxis()->SetLabelOffset(-0.015);
87 p->GetXaxis()->SetTitleOffset(1.1);
88 p->SetXTitle("E_{e} [GeV]");
89 p->SetYTitle("E\\gamma [GeV]");
90 p->SetMinimum(1e3);
91 p->SetMaximum(1e9);
92 p->GetXaxis()->SetRangeUser(1e3, 1e9);
93 p->Draw("same");
94 line.DrawLine(4.2, 4.2, 8.8, 8.8);
95
96 c->cd(2);
97 gPad->SetLogx();
98 gPad->SetLogy();
99 r.GetXaxis()->SetLabelOffset(-0.015);
100 r.GetXaxis()->SetTitleOffset(1.1);
101 r.GetXaxis()->SetRangeUser(1e4, 1e9);
102 r.DrawCopy();
103 p=r.ProfileX();
104 p->SetBit(kCanDelete);
105 p->SetLineColor(kRed);
106 p->Draw("same");
107
108 c->cd(3);
109 gPad->SetLogx();
110 p=h.ProjectionX();
111 p->SetBit(kCanDelete);
112 p->SetTitle("e^{-} / \\gamma Distribution");
113 p->GetXaxis()->SetLabelOffset(-0.015);
114 p->GetXaxis()->SetTitleOffset(1.1);
115 p->GetYaxis()->SetTitleOffset(1.3);
116 p->SetXTitle("E [GeV]");
117 p->SetYTitle("Counts");
118 p->Draw();
119 p=h.ProjectionY();
120 p->SetBit(kCanDelete);
121 p->SetTitle("Projection Y");
122 p->SetLineColor(kBlue);
123 p->Draw("same");
124
125 c->cd(4);
126 gPad->SetLogx();
127 p=r.ProjectionY();
128 p->SetBit(kCanDelete);
129 p->SetTitle("Ratio E\\gamma / E_{e}");
130 p->GetXaxis()->SetLabelOffset(-0.015);
131 p->GetXaxis()->SetTitleOffset(1.1);
132 p->GetYaxis()->SetTitleOffset(1.3);
133 p->SetXTitle("Ratio");
134 p->SetYTitle("Counts");
135 p->SetLineColor(kBlue);
136 p->Draw();
137}
Note: See TracBrowser for help on using the repository browser.