ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/HFmon2012/macros/raddam.C
Revision: 1.1
Committed: Mon Aug 13 14:57:42 2012 UTC (12 years, 8 months ago) by yilmaz
Content type: text/plain
Branch: MAIN
CVS Tags: HEAD
Error occurred while calculating annotation data.
Log Message:
update analysis

File Contents

# Content
1 #include "TH1D.h"
2 #include "TCanvas.h"
3 #include "TF1.h"
4 #include "TFile.h"
5 #include "TGraphErrors.h"
6
7
8 void analyzeRun(int run = 1777, double &s1, double &e1, double &s2, double& e2){
9
10 // TFile* inf = new TFile(Form("Histolaser%d.root",run));
11
12 TFile* inf = new TFile(Form("output.root"));
13 TCanvas* c = new TCanvas(Form("c%d",run),"",900,400);
14 c->Divide(3,1);
15
16 int ieta= 40;
17 int iphi = 71;
18 int depth = 1;
19
20 TF1* f1 = new TF1("f1","gaus",0,500);
21 TF1* f2 = new TF1("f2","gaus",0,500);
22
23 f1->SetLineColor(2);
24 f2->SetLineColor(2);
25
26 c->cd(1);
27 TH1* h = (TH1*)inf->Get(Form("Sig1_fC_ieta=%d_iphi=%d_depth=%d",40,71,1));
28 h->Draw();
29 h->Fit(f1);
30
31 s1 = f1->GetParameter(1);
32
33 c->cd(2);
34 h = (TH1*)inf->Get(Form("Sig2_fC_ieta=%d_iphi=%d_depth=%d",40,71,1));
35 h->Draw();
36 h->Fit(f2);
37
38 s2 = f2->GetParameter(1);
39
40 c->cd(3);
41 h = (TH1*)inf->Get(Form("Ratio_ieta=%d_iphi=%d_depth=%d",40,71,1));
42 h->Draw();
43
44 c->cd(11);
45 // h = (TH1*)inf->Get(Form("Ratio_ieta=%d_iphi=%d_depth=%d",40,71,1));
46 // h->Draw();
47
48 c->Print(Form("plots_run%d.gif",run));
49
50 }
51
52
53 void raddam(){
54
55 TFile* outf = new TFile("raddam_results.root","recreate");
56
57 double s1[100],s2[100],e1[100],e2[100];
58
59 int Nrun = 1;
60
61 TGraphErrors* g1 = new TGraphErrors(Nrun);
62 TGraphErrors* g2 = new TGraphErrors(Nrun);
63 TGraphErrors* gR = new TGraphErrors(Nrun);
64
65 g1->SetName("g1");
66 g2->SetName("g2");
67 gR->SetName("gR");
68
69 g1->GetXaxis()->SetNdivisions(1);
70
71 g2->GetXaxis()->SetNdivisions(1);
72
73 gR->GetXaxis()->SetNdivisions(1);
74
75
76 g1->GetXaxis()->LabelsOption("v");
77 g2->GetXaxis()->LabelsOption("v");
78 gR->GetXaxis()->LabelsOption("v");
79
80 g1->GetXaxis()->SetLabelSize(3);
81 g2->GetXaxis()->SetLabelSize(3);
82 gR->GetXaxis()->SetLabelSize(3);
83
84 int run[100] = {177734}
85 ;
86
87 for(int i = 0; i < Nrun; ++i){
88 analyzeRun(run[i],s1[i],e1[i],s2[i],e2[i]);
89 g1->SetPoint(i,run[i],s1[i]);
90 g1->SetPointError(i,0,e1[i]);
91 g2->SetPoint(i,run[i],s2[i]);
92 g2->SetPointError(i,0,e2[i]);
93
94 gR->SetPoint(i,run[i],s1[i]/s2[i]);
95 double er = s1[i]/s2[i] * sqrt(pow(e1[i]/s1[i],2)+pow(e2[i]/s2[i],2));
96 gR->SetPointError(i,0,er);
97
98 }
99
100 TCanvas* cc = new TCanvas("cc","",900,400);
101 cc->Divide(3,1);
102 outf->cd();
103
104 cc->cd(1);
105 g1->Draw("Ap");
106 cc->cd(2);
107 g2->Draw("Ap");
108 cc->cd(3);
109 gR->Draw("Ap");
110
111 g1->Write();
112 g2->Write();
113 gR->Write();
114
115 outf->Write();
116 cc->Print("runs2011.gif");
117 }
118
119