/[PAMELA software]/tof/flight/ToFdEdx_patch/macros/plot_BBneg.cxx
ViewVC logotype

Contents of /tof/flight/ToFdEdx_patch/macros/plot_BBneg.cxx

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.1 - (show annotations) (download)
Mon Dec 10 18:47:01 2018 UTC (6 years, 2 months ago) by mayorov
Branch: MAIN
CVS Tags: HEAD
ToFdEdx_patch from Wolfgang. Follows Rita Carbone's advanced method to
derive the ToF dEdx (including PMT saturation, Bethe-Bloch effect, etc.)

1 {
2
3 TString name1 = "../GoodParam/BetheBloch.txt";
4 ifstream fin1(name1);
5
6 TString name2 = "../GoodParam/BetheBloch_betagt1.txt";
7 ifstream fin2(name2);
8
9
10 gROOT->SetStyle("Plain");
11 gStyle->SetOptStat(0);
12 gStyle->SetOptFit(0);
13 gStyle->SetFuncColor( kRed );
14
15 Float_t tp[48][3];
16 Float_t tpbg1[48];
17 Float_t X[48];
18
19 char *s = new char[1];
20
21 Int_t idummy;
22 Float_t p0,p1,p2;
23
24
25 for (int i=0; i<48; i++) {
26 fin1>>idummy>>p0>>p1>>p2;
27 cout<<" "<<idummy<<" "<<p0<<" "<<p1<<" "<<p2<<endl;
28 tp[i][0]=p0;
29 tp[i][1]=p1;
30 tp[i][2]=p2;
31 }
32 fin1.close();
33
34
35 for (int i=0; i<48; i++) {
36 fin2>>idummy>>p0;
37 cout<<" "<<idummy<<" "<<p0<<endl;
38 tpbg1[i]=p0;
39 X[i] = 1.;
40 }
41 fin2.close();
42
43
44 TCanvas *c = new TCanvas("c","histograms",800,600);
45
46 TF1 *f1[48];
47
48 TGraph *gr[48];
49
50
51 for (Int_t i=0; i<48; i++) {
52
53 cout<<"PMT "<<i<<endl;
54
55 // return p[0]/(x*x)*(log(x*x/(1-x*x)) - p[1]*x*x - p[2]);
56 f1[i] = new TF1("f1","[0]/(x*x)*(log(x*x/(1-x*x)) - [1]*x*x - [2])",0.1,0.999);
57 f1[i].SetParameters(tp[i][0],tp[i][1],tp[i][2]);
58 f1[i]->SetLineColor(kRed);
59
60
61 for (Int_t ii=1; ii<20; ii++) {
62 Float_t xb = 1.*ii/20;
63 Float_t yhelp = f1[i]->Eval(xb);
64 cout<<xb<<" "<<yhelp<<endl;
65
66 }
67
68
69
70
71 gr[i] = new TGraph(1);
72 gr[i]->GetY()[0] = tpbg1[i];
73 gr[i]->GetX()[0] = 1.;
74
75
76 TH2F *hr = new TH2F("hr","",2,0,1.1,2,0,100);
77 hr->SetXTitle("beta");
78 hr->SetYTitle("BB_corr");
79 hr->Draw();
80
81 f1[i]->Draw("same");
82 //f1[i]->Draw();
83
84 gr[i]->SetMarkerStyle(20);
85 gr[i]->SetMarkerSize(1.5);
86 gr[i]->SetMarkerColor(kBlue);
87
88 gr[i]->Draw("P");
89
90
91 //gPad->SetLogy();
92 gPad->SetGrid();
93
94 c->Update();
95 //gets(s);
96
97 }
98
99 //==========================================================================
100 //==========================================================================
101 //==========================================================================
102
103 TCanvas *c1 = new TCanvas("c1","histograms1",1100,800);
104 c1->Divide(8,6);
105
106 TF1 *f1[48];
107
108 for (Int_t i=0; i<48; i++) {
109
110 cout<<"PMT "<<i<<endl;
111
112 c1->cd(i+1);
113
114 // return p[0]/(x*x)*(log(x*x/(1-x*x)) - p[1]*x*x - p[2]);
115 f1[i] = new TF1("f1","[0]/(x*x)*(log(x*x/(1-x*x)) - [1]*x*x - [2])",0.05,0.99);
116
117 f1[i].SetParameters(tp[i][0],tp[i][1],tp[i][2]);
118
119
120 f1[i]->SetLineColor(kRed);
121
122 TH2F *hr = new TH2F("hr","",2,0.1,1.1,2,0,100);
123 hr->SetXTitle("beta");
124 hr->SetYTitle("BB_corr");
125 hr->Draw();
126
127
128 f1[i]->Draw("same");
129 gr[i]->Draw("P");
130
131
132 //gPad->SetLogy();
133 gPad->SetGrid();
134
135 }
136
137
138 }
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155 }

  ViewVC Help
Powered by ViewVC 1.1.23