7 cout<<
"<tileHelper>: Wrong instantiation sequence - hLabHelper already exists. EXITING"<<endl;
26 for(
int ifb = 0; ifb<
fibers; ifb++) {
fiberY[ifb] = 15.-2.5*(ifb+1);
if(ifb)
fiberY[ifb] -= 2.5;}
34 hlHelper -> setPRDFRun(run);
43 cout <<
"<evLoop> Couldn't open input file " << hlHelper->
prdfName << endl;
56 cout <<
"eventseq " << hlHelper->
eventseq <<
" event type = " << evt->
getEvtType() << endl;
84 hlHelper-> thcl ->
Fill();
89 for(
int bx = 1; bx<=nbs; bx++){
91 if(normx<=0.)
continue;
116 if(!(
fiberDisplay=(TCanvas*)(gROOT->FindObject(
"fiberDisplay")))) {
118 TString fD =
"Fiber Amplitudes (black - raw, red - fit) Run "; fD +=
runId.Data();
120 fiberDisplay =
new TCanvas(
"fiberDisplay",fD,400*nx_c,200*ny_c);
125 Double_t rvmax, fvmax, ivmax(0), rvrms, fvrms, ivrms(0), rvmean, fvmean, ivmean(0);
126 rvmax = hlHelper->
rpeak[ich]->GetMaximum();
127 fvmax = hlHelper->
fm[ich]->GetMaximum();
129 rvrms = hlHelper->
rpeak[ich]->GetRMS();
130 fvrms = hlHelper->
fm[ich]->GetRMS();
132 rvmean = hlHelper->
rpeak[ich]->GetMean();
133 fvmean = hlHelper->
fm[ich]->GetMean();
136 Double_t ym = std::max(max(rvmax, fvmax), ivmax);
137 ymx[ich] = (int)(log10(ym)); ymx[ich] = pow(10., ymx[ich]);
138 while(ymx[ich]<ym) ymx[ich] *=2;
139 Double_t xm = std::max(max(rvmean+4*rvrms, fvmean+4*fvrms), ivmean+4*ivrms); xmx[ich] = (int)(log10(xm)); xmx[ich] = pow(10., xmx[ich]);
140 while(xmx[ich]<xm) xmx[ich] *=2;
141 cout<<
"chan "<<ich<<
" rvmax "<<rvmax<<
" fvmax "<<fvmax<<
" ivmax "<<ivmax<<
" xm "<<xm<<
" xmx "<<xmx[ich]<<endl;
146 hlHelper->
rpeak[ich]->SetLineColor(1); hlHelper->
rpeak[ich]->SetMaximum(ymx[ich]);
147 hlHelper->
fm[ich] ->SetLineColor(2); hlHelper->
fm[ich] ->SetMaximum(ymx[ich]);
148 hlHelper->
fint[ich] ->SetLineColor(4); hlHelper->
fint[ich] ->SetMaximum(ymx[ich]);
149 if(!(ich%2)) xm = max(xmx[ich], xmx[ich+1]);
150 cout<<
"chan "<<ich<<
" xrange "<<xm<<endl;
152 hlHelper->
fm[ich]->Draw(
"same");
167 hlHelper->
active[TILECHANNELS+ich] = -1;
168 }
else if(runnumber>=1125&&runnumber<1152) {
183 }
else if (runnumber<1061) {
185 }
else if (runnumber<1123) {
234 for(
int is = 0; is <
NSAMPLES; is++){
249 for(
int is = 0; is <
NSAMPLES; is++){
258 TCanvas * tiledisplay = (TCanvas *)(gROOT->FindObject(
"tiledisplay"));
259 if(!tiledisplay) tiledisplay =
new TCanvas(
"tiledisplay",
"sPhenix tile display", 300, 300, 800, 500);
260 else tiledisplay->Clear();
268 tiledisplay->Update();
271 tiledisplay->Update();
281 if(!(
triggerDisplay=(TCanvas*)(gROOT->FindObject(
"triggerDisplay")))) {
282 TString fD =
"Fiber Amplitudes (black - raw, red - fit) Run "; fD +=
runId.Data();
284 triggerDisplay =
new TCanvas(
"triggerDisplay",fD,400*nx_c,200*ny_c);
300 cout<<
"<ERROR> pattern(): root file for runNumber "<<hlHelper->
runnumber<<
" not in the list"<<endl;
304 gStyle ->SetOptFit();
308 if((
lyFits = (TCanvas*)(gROOT->FindObject(
"lyFits"))))
delete lyFits;
310 TString lyp =
"Pattern of light yield "; lyp +=
runId.Data();
311 TString lyd =
"LYD "; lyd +=
runId.Data();
312 lyPattern =
new TCanvas(lyd, lyp, 400, 400);
313 TString lyv =
"LIV "; lyv +=
runId.Data();
314 TString lyf =
"Fits to the measurenments of light yield "; lyf += (mod==0?
"(pc_imp) " :
"(pc_fimp)"); lyf +=
runId.Data();
315 lyFits =
new TCanvas(
"lyv", lyf, 200*nx, 200*ny);
318 TH3 * pcimp = (TH3F *) (gROOT->FindObject(mod==0?
"pc_imp" :
"pc_fimp"));
321 cout<<
"<ERROR> pattern(): "<<(mod==0?
"(pc_imp) " :
"(pc_fimp)")<<
" Scatterplot is not found"<<endl;
324 Int_t nximp = pcimp->GetNbinsX(); Int_t nyimp = pcimp->GetNbinsY();
325 Int_t nzimp = pcimp->GetNbinsZ();
329 Int_t dnx = nximp/
nx; Int_t dny = nyimp/
ny;
330 if(dnx*nx!=nximp || dny*ny!=nyimp) {
331 cout<<
"Patterning request does not match your binning in the pixel count distribution pcimp"<<endl;
334 pcPat = (TH2F *) (gROOT->FindObject(
"pcPat"));
335 if(pcPat)
delete pcPat;
336 pcPat =
new TH2F(
"pcPat",
" fitted positions of maxima in pcimp pixel distributions", nx, 0., 25., ny, 0., 15.);
337 pcPatH =
new TH1 * [nx*
ny];
338 for (
int iy = 0; iy<
ny; iy++){
339 for (
int ix = 0; ix<
nx; ix++){
340 Int_t cpad = nx*(ny-iy-1) + ix +1;
341 TString hn =
"h_"; hn += ix; hn +=
"_"; hn += iy;
342 TString ht =
"Pixel count. Range X = "; ht += (dxr*ix); ht +=
" | "; ht += (dxr*(ix+1));
343 ht +=
" Y = "; ht += (dyr*iy); ht +=
" | "; ht += (dyr*(iy+1));
344 if((pcPatH[iy*nx+ix]=(TH1 *) (gROOT->FindObject(hn))))
delete pcPatH[iy*nx+ix];
345 pcPatH[iy*nx+ix] =
new TH1D(hn, ht, nzimp, 0., pcimp->GetZaxis()->GetXmax());
347 pcimp->ProjectionZ(hn, 1+dnx*ix, dnx*(ix+1), 1+dny*iy, dny*(iy+1));
350 pcPatH[iy*nx+ix]->
Draw();
352 Int_t entries = pcPatH[iy*nx+ix]->GetEntries();
356 while (((norm=pcPatH[iy*nx+ix]->GetMaximum())<50.||
357 pcPatH[iy*nx+ix]->GetBinCenter(pcPatH[iy*nx+ix]->GetMaximumBin())<=10)&&
358 pcPatH[iy*nx+ix]->GetNbinsX()>50 ) {
360 while((pcPatH[iy*nx+ix]->GetNbinsX()/combine)*combine!=pcPatH[iy*nx+ix]->GetNbinsX()) combine++;
361 pcPatH[iy*nx+ix] = pcPatH[iy*nx+ix]->Rebin(combine);
364 pcPatH[iy*nx+ix]->
Draw();
366 Double_t
mean = pcPatH[iy*nx+ix]->GetMean();
367 Double_t
rms = pcPatH[iy*nx+ix]->GetRMS();
369 p[0] =
norm; p[1] =
mean; p[2] =
rms; p[3] = 0.; p[4] = 0.; p[5] = 0.;
370 TF1 *
fg =
new TF1(
"fg",
"[0]*TMath::Gaus(x,[1],[2])", 15., pcimp->GetZaxis()->GetXmax());
371 fg -> SetParameters(p);
375 pcPatH[iy*nx+ix]->Fit(fg,
"r");
376 fg ->GetParameters(p);
377 TF1 * fgb =
new TF1(
"fgb",
"[0]*TMath::Gaus(x,[1],[2])+[3]+[4]*x+[5]*x*x", 15., pcimp->GetZaxis()->GetXmax());
378 fgb ->SetParameters(p);
379 fgb ->SetParLimits(1, p[1]-rms,p[1]+rms);
380 fgb ->SetParLimits(2, rms/2,2.*rms);
381 fgb ->SetParLimits(3, 0., p[0]);
382 pcPatH[iy*nx+ix]->Fit(fgb,
"r");
384 fgb ->GetParameters(p);
386 pcPat->Fill(dxr*(ix+0.5), dyr*(iy+0.5), p[1]);
390 pcPat->Draw(
"lego2");
481 Double_t tower_pc = hlHelper->
fitPeak[9]/0.05;
492 yFit =
new TF1(
"yFit",
"[0]*exp(-abs(x-[1])/[2])", 0.,
tileSizeY);
493 Double_t par[] = {20.,
tileSizeY/2., 1.};
494 yFit -> SetParameters(par);
499 yFit->GetParameters(par);
511 yFit =
new TF1(
"yFit",
"[0]*exp(-abs(x-[1])/[2])", 0.,
tileSizeY);
512 Double_t par[] = {20.,
tileSizeY/2., 1.};
513 yFit -> SetParameters(par);
518 yFit->GetParameters(par);
524 Float_t dsl = 0.5/20;
525 for (
int isl = 0; isl< 20; isl++){
526 slope = dsl/2.+dsl*isl;
527 Double_t
X = 12.5*(1 +
ctas/slope);
547 if(rVal<0.) rVal = 0.;
550 par0[1] = max(0.,(Double_t)(rTime-
RISETIME));
579 hlHelper-> fhcl->
cd();
580 TString hn =
"Raw data: Events peaking in channel RunId = "; hn +=
runId; hn +=
";Channel #;ADC Peak (events with max in this channel) [counts]";
582 hn =
"Total Pixel Count with tighter triggering RunId = "; hn +=
runId; hn +=
";HitMultThr;HitAmplThr [trigger counts];Pixels";
583 treff =
new TH3F(
"treff", hn,
HITMULTTHRESHOLDS, 0,
HITMULTTHRESHOLDS,
CHANNELTHRESHOLDS, 0,
CHANNELTHRESHOLDS, 1000, 0., 200.);
584 hn =
"Total Pixel Count vs impact position RunId = "; hn +=
runId; hn +=
";Calibated X [cm];Calibrated Y [cm];Pixels";
585 pc_imp =
new TH3F(
"pc_imp", hn, 250, 0., 25., 150, 0., 15., 1000, 0, 200.);
587 pc_fimp =
new TH3F(
"pc_fimp", hn, 250, 0., 25., 150, 0., 15., 1000, 0, 200.);
588 hn =
"Fit to the Pixel Count vs impact position RunId = "; hn +=
runId; hn +=
";Calibated X [cm];Calibrated Y [cm];Pixels";
589 pc_pat =
new TH2F(
"pc_pat", hn, 25, 0., 25., 15, 0., 15.);
591 pc_fpat =
new TH2F(
"pc_fpat", hn, 25, 0., 25., 15, 0., 15.);
592 hn =
"Raw Fiber sum (R+L), Peak in this fiber RunId = "; hn +=
runId; hn +=
";Fiber #;Fiber ADC Sum (events with max in this fiber) [counts]";
594 hn =
"Raw Total sum, Peak in this fiber RunId = "; hn +=
runId; hn +=
";Fiber #;Event ADC Sum (events with max in this fiber) [counts]";
596 hn =
"Raw Fiber Asymmetry RunId = "; hn +=
runId; hn +=
";Fiber #;Fiber R/L Asymmetry";
598 hn =
"Raw Event Asymmetry RunId = "; hn +=
runId; hn +=
";Event Raw R/L Event Asymmetry";
599 rtasym =
new TH1F(
"rtasym", hn, 200, -1., 1.);
600 hn =
"Raw X RunId = "; hn +=
runId; hn +=
";Event Raw X-coordinate [cm]";
601 rx =
new TH1F(
"rx", hn, 250, 0., 25.);
602 hn =
"Raw Y RunId = "; hn +=
runId; hn +=
";Event Raw Y-coordinate [cm]";
603 ry =
new TH1F(
"ry", hn, 150, 0., 15.);
604 hn =
"Raw impact position RunId = "; hn +=
runId; hn +=
";Raw X [cm];Raw Y [cm]";
605 rimp =
new TH2F(
"rimp", hn, 250, 0., 25., 150, 0., 15.);
607 hn =
"Calibrated data: Fitted Maxima RunId = "; hn +=
runId; hn +=
";Channel #; Calibrated Fit Peak [pixels]";
609 hn =
"Calibrated data: Events peaking in channel RunId = "; hn +=
runId; hn +=
";Channel #;Calibrated Fit Peak (evens with max in this channel) [pixels]";
611 hn =
"Calibrated Fiber sum (R+L), Peak in the fiber RunId = "; hn +=
runId; hn +=
";Fiber #;Calibrated Fiber Sum (events with max in this fiber) [pixels]";
613 hn =
"Calibrated Total sum, Peak in this fiber RunId = "; hn +=
runId; hn +=
";Fiber #;Calibrated Total Sum (events with max in this fiber) [pixels]";
615 hn =
"Calibrated Fiber Asymmetry RunId = "; hn +=
runId; hn +=
";Fiber #;Fiber R/L Asymmetry (calibrated)";
617 hn =
"Calibrated Event Asymmetry RunId = "; hn +=
runId; hn +=
";Event R/L Event Asymmetry (calibrated)";
618 ctasym =
new TH1F(
"ctasym", hn, 200, -1., 1.);
619 hn =
"Calibrated X RunId = "; hn +=
runId; hn +=
";Calibrated X [cm]";
620 cx =
new TH1F(
"cx", hn, 250, 0., 25.);
621 hn =
"Calibrated Y RunId = "; hn +=
runId; hn +=
";Calibrated Y [cm]";
622 cy =
new TH1F(
"cy", hn, 150, 0., 15.);
623 hn =
"Fitted Y RunId = "; hn +=
runId; hn +=
";Fitted Y [cm]";
624 fy =
new TH1F(
"fy", hn, 150, 0., 15.);
625 hn =
"Calibrated Impact Position RunId = "; hn +=
runId; hn +=
";Calibrated X [cm];Calibrated Y [cm]";
626 cimp =
new TH2F(
"cimp", hn, 250, 0., 25., 150, 0., 15.);
627 hn =
"Calibrated Pixel Count (Y) vs X-impact RunId = "; hn +=
runId; hn +=
";Calibrated X [cm];Calibrated Total Sum [pixels]";
628 cx_pc =
new TH2F(
"cx_pc", hn, 250, 0., 25., 1000, 0., 200.);
629 hn =
"Calibrated Pixel Count (Y) vs Y-impact RunId = "; hn +=
runId; hn +=
";Calibrated Y [cm];Calibrated Total Sum [pixels]";
630 cy_pc =
new TH2F(
"cy_pc", hn, 150, 0., 15., 1000, 0., 200.);
631 hn =
"Calibrated Pixel Count (Y) vs Fitted Y-impact RunId = "; hn +=
runId; hn +=
";Fitted Y [cm];Calibrated Total Sum [pixels]";
632 fy_pc =
new TH2F(
"fy_pc", hn, 150, 0., 15., 1000, 0., 200.);
633 hn =
"Calibrated Weighted Impact Position RunId = "; hn +=
runId; hn +=
";Calibrated X [cm];Calibrated Y [cm]";
634 cimpW =
new TH2F(
"cimpW", hn, 250, 0., 25., 150, 0., 15.);
638 hn =
"Uncalibrated trigger sum [trigger counts] RunId = "; hn +=
runId; hn +=
runId; hn +=
";Trigger hits;";
639 trhits =
new TH1F(
"trhits", hn, 500, 0., 500.);
640 hn =
"Number of hits in triggered events vs channel threshold(Y) and total trigger sum (X) RunId = "; hn +=
runId; hn +=
";TotalSum [trigger counts];Trigger THr [trigger counts]";
647 Y0 =
new TH1F(
"Y0",
"Y-coordinate fit P(0)", 200, 0., 200.);
648 Y1 =
new TH1F(
"Y1",
"Y-coordinate fit P(1)", 100, 0., 15.);
649 Y2 =
new TH1F(
"Y2",
"Y-coordinate fit P(2)", 100, 0., 10.);
650 y_yChi2 =
new TH2F(
"y_yChi2",
"yFit: Chi2 at different fitted Y values", 150,0.,15., 100,0.,50.);
651 s_y_Chi2 =
new TH2F(
"s_y_Chi2",
"Chi2 of tile signal vs Chi2 of Y coordinate", 100, 0., 500., 100, 0., 50.);
652 y_ys =
new TH2F(
"y_ys",
"yFit sigma vs fitted Y", 150,0.,15. ,100, 0., 5.);
653 yCleaned =
new TH1F(
"yCleaned",
"Fitted Y after event rejection (fit sigma <4.5)", 150,0.,15.);
654 yKept =
new TH1F(
"yKept",
"Fitted Y after event rejection (s<4.5, rejectcode=0)", 150,0.,15.);
655 XvsSl =
new TH2F(
"XvsSl",
"X-Coordinate computed using different asymmentry slopes", 275, -15., 40., 20, 0., 0.5);
656 XY =
new TH2F(
"XY",
"Muon Impact: x vs Y. Fit Y vs Best X", 225, -15., 40., 75, 0., 15.);
657 td_r_l =
new TH2F(
"td_r_l",
"R/L Timing difference in hit fiber vs PixelCount in Hit Fiber", 200, -1, 1., 200, 0., 100.);
658 td_t_tw =
new TH3F(
"td_t_tw",
"Tile-to-tower time difference(X) vs Pixel Counts in tile(Y) and tower(Z)", 200, -1. ,1., 100, 0., 100., 100, 0., 100.);
659 trcode =
new TH1F(
"trcode",
"Tile reject codes ", 1000, 0., 1000.);
660 yc_rcode =
new TH2F(
"yc_rcode",
"Tile reject code vs Cleaned Y ", 150, 0., 15., 1000, 0., 1000.);
683 list<rootfile>::iterator
next;
684 for (next = hlHelper->
roots.begin(); next != hlHelper->
roots.end(); ++
next){