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