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

Annotation of /tof/flight/ToFdEdx_patch/macros/plot_desatBB.cxx

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.1 - (hide 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 mayorov 1.1 {
2    
3     TString name1 = "../GoodParam/desaturation_beta.txt";
4     ifstream fin1(name1);
5    
6    
7     gROOT->SetStyle("Plain");
8     gStyle->SetOptStat(0);
9     gStyle->SetOptFit(0);
10     gStyle->SetFuncColor( kRed );
11    
12     Float_t tp[48][3];
13    
14     char *s = new char[1];
15    
16     Int_t idummy;
17     Float_t p0,p1,p2;
18    
19    
20     for (int i=0; i<48; i++) {
21     fin1>>idummy>>p0>>p1>>p2;
22     cout<<" "<<idummy<<" "<<p0<<" "<<p1<<" "<<p2<<endl;
23     tp[i][0]=p0;
24     tp[i][1]=p1;
25     tp[i][2]=p2;
26     }
27     fin1.close();
28    
29    
30     TCanvas *c = new TCanvas("c","histograms",800,600);
31    
32     TF1 *f1[48];
33    
34     for (Int_t i=0; i<48; i++) {
35    
36     cout<<"PMT "<<i<<endl;
37    
38     /*
39     double ToFNaNuclei::f_desatBB( TArrayF &p, float x )
40     {
41     return
42     p[0] +
43     p[1]*x +
44     p[2]*x*x;
45     }
46    
47     */
48    
49     f1[i] = new TF1("f1","[0]+[1]*x+[2]*x*x",0,1000);
50     f1[i].SetParameters(tp[i][0],tp[i][1],tp[i][2]);
51     f1[i]->SetLineColor(kRed);
52    
53    
54     for (Int_t ii=1; ii<20; ii++) {
55     Float_t xb = ii*20.;
56     Float_t yhelp = f1[i]->Eval(xb);
57     cout<<xb<<" "<<yhelp<<endl;
58     }
59    
60    
61    
62     //TH2F *hr = new TH2F("hr","",2,0,100,2,0,100);
63     TH2F *hr = new TH2F("hr","",2,0,10,2,0,10);
64     hr->SetXTitle("adclin");
65     hr->SetYTitle("f_desatBB");
66     hr->Draw();
67    
68     f1[i]->Draw("same");
69    
70     //gPad->SetLogy();
71     gPad->SetGrid();
72    
73     c->Update();
74     gets(s);
75    
76     }
77    
78     //==========================================================================
79     //==========================================================================
80     //==========================================================================
81    
82     TCanvas *c1 = new TCanvas("c1","histograms1",1100,800);
83     c1->Divide(8,6);
84    
85     TF1 *f1[48];
86    
87     for (Int_t i=0; i<48; i++) {
88    
89     cout<<"PMT "<<i<<endl;
90    
91     c1->cd(i+1);
92    
93    
94     hr->Draw();
95     f1[i]->Draw("same");
96    
97     //gPad->SetLogy();
98     gPad->SetGrid();
99    
100     }
101    
102    
103     }
104    
105    
106    
107    
108    
109    
110    
111    
112    
113    
114    
115    
116    
117    
118    
119    
120     }

  ViewVC Help
Powered by ViewVC 1.1.23