10 void plBbc(
int page=21,TString fName=
"aa3" ) {
13 TString outDir=
"../outBbc/";
16 gStyle->SetOptStat(1111111);
17 gStyle->SetOptFit(1111111);
19 gStyle->SetPalette(1,0);
22 TString name2=outDir+fName+
".hist.root";
23 printf(
"opening '%s'\n",name2.Data());
26 printf(
"NOT found file=%s, STOP\n",hName.Data());
32 TString ctit=fName+
"_"; ctit+=page;
33 c=
new TCanvas(ctit,ctit,450,350);
37 TPad *pad0 =
new TPad(
"pad0",
"apd0",0.0,0.95,1.,1.);
41 TPaveText *pt =
new TPaveText(0,0.,1,1,
"br");
44 TString txt2=fName+
", page="+page+
", ";
51 pad =
new TPad(
"pad1",
"apd1",0.0,0.0,1,.95);
57 gStyle->SetOptStat(11111 );
65 TH1* h= (TH1*)fd->Get(
"vd"); assert(h);
66 h->Fit(
"gaus",
"R",
"",-60,60);
74 char *namex[]={
"vk",
"va",
"vt",
"vv"};
77 TH1* h= (TH1*)fd->Get(namex[i]); assert(h);
86 char *namex[]={
"vk",
"va",
"vt",
"vE",
"vv",
"vd",
"vW"};
89 TH1* h= (TH1*)fd->Get(namex[i]); assert(h);
90 if(i!=5)h->Draw(
"box");
100 TH2F*h2= (TH2F*)gROOT->FindObject(tt);
103 TH1D*hd= (TH1D*)gROOT->FindObject(tt+
"_1");
106 hd->SetMarkerStyle(20);
108 hd->Fit(cFunc,
"R",
"same",220,280);
109 TF1* f1=hd->GetFunction(cFunc);
110 f1->SetLineColor(kYellow);
111 f1->SetLineWidth(2.);
118 calT(pad,fd,page-21);
124 calW(pad,fd,page-31);
128 default: printf(
"page %d not defined\n",page);
133 TString outF=fName+
"_"+page+
".ps";
137 outF.ReplaceAll(
".ps",
".gif");
147 calT(TPad *pad, TFile *fd,
int iew=0) {
148 char cEW[2]={
'E',
'W'};
151 ln0=
new TLine(0,0,0,200); ln0->SetLineColor(kGreen);
153 for(
int ih=0;ih<16;ih++) {
156 sprintf(tt1,
"w%c%02d",cEW[iew],iT+1);
158 TH2* h2= (TH2*)fd->Get(tt1);
162 printf(
"pmt=%s neve=%.0f mean=%f\n",tt1,h2->GetEntries(),h2->GetMean(1));
163 if(h2->GetEntries()<50)
continue;
164 TH1D *hd=h2->ProjectionY();
167 f=hd->GetFunction(
"gaus");
168 f->SetLineColor(kRed);
171 sprintf(tt1,
"bbc%c%02d",cEW[iew],iT+1);
172 printf(
"#2 pmt=%s dz/cm=%.1f + / - %.1f sigDZ/cm %.1f + / - %.1f\n",tt1,f->GetParameter(1),f->GetParError(1),f->GetParameter(2),f->GetParError(2));
175 printf(
"#1 %s %.1f + / - %.1f N=%.0f\n",tt1,pm*f->GetParameter(1)/fac,f->GetParError(1)/fac, h2->GetEntries());
177 printf(
"#1# found %d pmt in bbc%c, sign= %.1f\n",nok,cEW[iew],pm);
183 calW(TPad *pad, TFile *fd,
int iew=0) {
184 char cEW[2]={
'E',
'W'};
190 for(
int ih=0;ih<16 ;ih++) {
194 sprintf(tt1,
"w%c%02d",cEW[iew],iT+1);
196 TH2* h2= (TH2*)fd->Get(tt1); assert(h2);
198 printf(
"pmt=%s neve=%.0f mean=%f\n",tt1,h2->GetEntries(),h2->GetMean(1));
199 if(h2->GetEntries()<400)
continue;
201 TString tt=h2->GetName();
202 pad->Print(tt+
".gif");
205 printf(
"#1# added %d pmt in bbc%c\n",nok,cEW[iew]);
212 ln0=
new TLine(0,0,200,0); ln0->SetLineColor(kGreen);
213 TString tt=h2->GetName();
215 TF1 *f1 =
new TF1(tt+
"fit",timeWalkFunc,-100,120,4);
217 f1->SetParameters(-50,40,0.01 0.1);
219 f1->SetLineColor(kRed);
220 f1->SetLineWidth(2.);
223 TH1D*hd= (TH1D*)gROOT->FindObject(tt+
"_1");
225 hd->SetMinimum(-100);
226 hd->SetMarkerStyle(20);
228 hd->Fit(tt+
"fit",
"R",
"same",4,200);
234 memset(er1,0,
sizeof(er1));
236 TH1D *he= (TH1D*)gROOT->FindObject(tt+
"_2");
237 TH1D *yu=(TH1D*) hd->Clone(); yu->SetLineColor(kMagenta);
238 yu->Add(he); yu->SetError(er1);
241 TH1D *yd=(TH1D*) hd->Clone();
242 yd->Add(he,-1); yd->SetError(er1); yd->SetLineColor(kMagenta);
245 double *par=f1->GetParameters();
246 double *parE=f1->GetParErrors();
251 printf(
"#1 bbc%s %g %g %g %g \n",h2->GetName()+1,pm*par[0]/fac,pm*par[1]/fac,par[2],par[3]);
257 Double_t timeWalkFunc(Double_t *x, Double_t *par){
260 if(xx>maxAdc) xx=maxAdc;
261 Double_t f = par[0] + par[1]*exp(-par[2]*pow(xx,par[3]));