33 sprintf(dirname,
"%s",shortname);
43 gSystem->cd(workdir.c_str());
44 gSystem->MakeDirectory(labfull);
56 sprintf(bsmodule,
"beamspotanalyzer%s",
postfix);
58 sprintf(bsmodule,
"onlinebsanalyzer%s",
postfix);
60 sprintf(bsmodule,
"testbsanalyzer%s",
postfix);
66 TH1F* ntrvtx = (TH1F*)castat.getObject(
"ntruevtx");
71 plotfilename += outtrunk;
74 plotfilename += labfull;
75 plotfilename +=
"/ntrvtx_";
76 plotfilename += labfull;
79 plotfilename +=
".gif";
80 gPad->Print(plotfilename.c_str());
85 gStyle->SetOptStat(111);
86 gStyle->SetOptFit(111);
87 TProfile* ntrvtxvslumi = (TProfile*)castat.getObject(
"ntruevtxvslumi");
88 if(ntrvtxvslumi && ntrvtxvslumi->GetEntries()>0 ) {
90 ntrvtxvslumi->Fit(
"pol2",
"",
"",0.5,3.0);
91 if(ntrvtxvslumi->GetFunction(
"pol2")) {
92 ntrvtxvslumi->GetFunction(
"pol2")->SetLineColor(kBlack);
93 ntrvtxvslumi->GetFunction(
"pol2")->SetLineWidth(1);
96 plotfilename += outtrunk;
99 plotfilename += labfull;
100 plotfilename +=
"/ntrvtxvslumi_";
101 plotfilename += labfull;
104 plotfilename +=
".gif";
105 gPad->Print(plotfilename.c_str());
108 gStyle->SetOptStat(1111);
110 TH2D* ntrvtxvslumi2D = (TH2D*)castat.getObject(
"ntruevtxvslumi2D");
111 if(ntrvtxvslumi2D && ntrvtxvslumi2D->GetEntries()>0 ) {
112 ntrvtxvslumi2D->Draw(
"colz");
114 ntrvtxvslumi->SetMarkerStyle(20);
115 ntrvtxvslumi->SetMarkerSize(.3);
116 ntrvtxvslumi->Draw(
"same");
119 plotfilename += outtrunk;
122 plotfilename += labfull;
123 plotfilename +=
"/ntrvtxvslumi2D_";
124 plotfilename += labfull;
127 plotfilename +=
".gif";
129 gPad->Print(plotfilename.c_str());
131 delete ntrvtxvslumi2D;
137 TH1F* ndofvtx = (TH1F*)castat.getObject(
"ndof");
141 plotfilename += outtrunk;
144 plotfilename += labfull;
145 plotfilename +=
"/ndofvtx_";
146 plotfilename += labfull;
149 plotfilename +=
".gif";
150 gPad->Print(plotfilename.c_str());
154 TH1F* ntracksvtx = (TH1F*)castat.getObject(
"ntracks");
158 plotfilename += outtrunk;
161 plotfilename += labfull;
162 plotfilename +=
"/ntracksvtx_";
163 plotfilename += labfull;
166 plotfilename +=
".gif";
167 gPad->Print(plotfilename.c_str());
171 TH1F* aveweight = (TH1F*)castat.getObject(
"aveweight");
175 plotfilename += outtrunk;
178 plotfilename += labfull;
179 plotfilename +=
"/aveweight_";
180 plotfilename += labfull;
183 plotfilename +=
".gif";
184 gPad->Print(plotfilename.c_str());
188 TProfile* aveweightvsvtxz = (TProfile*)castat.getObject(
"aveweightvsvtxz");
189 if(aveweightvsvtxz) {
190 aveweightvsvtxz->Draw();
191 aveweightvsvtxz->GetYaxis()->SetRangeUser(0.75,1.05);
193 plotfilename += outtrunk;
196 plotfilename += labfull;
197 plotfilename +=
"/aveweightvsvtxz_";
198 plotfilename += labfull;
201 plotfilename +=
".gif";
202 gPad->Print(plotfilename.c_str());
203 delete aveweightvsvtxz;
206 TProfile* ndofvsvtxz = (TProfile*)castat.getObject(
"ndofvsvtxz");
210 plotfilename += outtrunk;
213 plotfilename += labfull;
214 plotfilename +=
"/ndofvsvtxz_";
215 plotfilename += labfull;
218 plotfilename +=
".gif";
219 gPad->Print(plotfilename.c_str());
223 TProfile* ntracksvsvtxz = (TProfile*)castat.getObject(
"ntracksvsvtxz");
225 ntracksvsvtxz->Draw();
227 plotfilename += outtrunk;
230 plotfilename += labfull;
231 plotfilename +=
"/ntracksvsvtxz_";
232 plotfilename += labfull;
235 plotfilename +=
".gif";
236 gPad->Print(plotfilename.c_str());
237 delete ntracksvsvtxz;
242 TH2F* ndofvsntrks = (TH2F*)castat.getObject(
"ndofvstracks");
244 ndofvsntrks->Draw(
"colz");
247 plotfilename += outtrunk;
250 plotfilename += labfull;
251 plotfilename +=
"/ndofvsntrks_";
252 plotfilename += labfull;
255 plotfilename +=
".gif";
256 gPad->Print(plotfilename.c_str());
262 TH1F* trkweights = (TH1F*)castat.getObject(
"weights");
267 plotfilename += outtrunk;
270 plotfilename += labfull;
271 plotfilename +=
"/trkweights_";
272 plotfilename += labfull;
275 plotfilename +=
".gif";
276 gPad->Print(plotfilename.c_str());
282 TH1F* vtxx = (TH1F*)castat.getObject(
"vtxx");
288 plotfilename += outtrunk;
291 plotfilename += labfull;
292 plotfilename +=
"/pvtxx_";
293 plotfilename += labfull;
296 plotfilename +=
".gif";
297 gPad->Print(plotfilename.c_str());
302 TH1F* vtxy = (TH1F*)castat.getObject(
"vtxy");
308 plotfilename += outtrunk;
311 plotfilename += labfull;
312 plotfilename +=
"/pvtxy_";
313 plotfilename += labfull;
316 plotfilename +=
".gif";
317 gPad->Print(plotfilename.c_str());
322 TH1F* vtxz = (TH1F*)castat.getObject(
"vtxz");
328 plotfilename += outtrunk;
331 plotfilename += labfull;
332 plotfilename +=
"/pvtxz_";
333 plotfilename += labfull;
336 plotfilename +=
".gif";
337 gPad->Print(plotfilename.c_str());
356 TH1D* vtxxmeansum =
new TH1D(
"vtxxmeansum",
"PV mean X position vs run",10,0.,10.);
357 vtxxmeansum->SetCanExtend(TH1::kAllAxes);
358 TH1D* vtxymeansum =
new TH1D(
"vtxymeansum",
"PV mean Y position vs run",10,0.,10.);
359 vtxymeansum->SetCanExtend(TH1::kAllAxes);
360 TH1D* vtxzmeansum =
new TH1D(
"vtxzmeansum",
"PV mean Z position vs run",10,0.,10.);
361 vtxzmeansum->SetCanExtend(TH1::kAllAxes);
362 TH1D* vtxzsigmasum =
new TH1D(
"vtxzsigmasum",
"PV sigma Z position vs run",10,0.,10.);
363 vtxzsigmasum->SetCanExtend(TH1::kAllAxes);
365 std::vector<unsigned int>
runs = castat.getRunList();
370 std::cout <<
"Found " << runs.size() <<
" runs" << std::endl;
372 for(
unsigned int i=0;
i<runs.size();++
i) {
375 sprintf(runlabel,
"%d",runs[
i]);
377 sprintf(runpath,
"run_%d",runs[
i]);
378 castat.setPath(runpath);
379 cabs.setPath(runpath);
380 cabsonl.setPath(runpath);
381 cabstest.setPath(runpath);
384 TH1F* vtxx = (TH1F*)castat.getObject(
"vtxxrun");
385 if (vtxx && vtxx->GetEntries()>0) {
390 int bin = vtxxmeansum->Fill(runlabel,vtxx->GetMean());
391 vtxxmeansum->SetBinError(bin,vtxx->GetMeanError());
395 plotfilename += outtrunk;
398 plotfilename += labfull;
399 plotfilename +=
"/pvtxx_";
400 plotfilename += labfull;
404 plotfilename += runpath;
405 plotfilename +=
".gif";
406 gPad->Print(plotfilename.c_str());
410 TH1F* vtxy = (TH1F*)castat.getObject(
"vtxyrun");
411 if (vtxy && vtxy->GetEntries()>0) {
415 int bin = vtxymeansum->Fill(runlabel,vtxy->GetMean());
416 vtxymeansum->SetBinError(bin,vtxy->GetMeanError());
419 plotfilename += outtrunk;
422 plotfilename += labfull;
423 plotfilename +=
"/pvtxy_";
424 plotfilename += labfull;
428 plotfilename += runpath;
429 plotfilename +=
".gif";
430 gPad->Print(plotfilename.c_str());
434 double vtxsigmazrunvalue = -1.;
double vtxsigmazrunerror = -1.;
435 double vtxsigmazrunfitvalue = -1.;
double vtxsigmazrunfiterror = -1.;
436 TH1F* vtxz = (TH1F*)castat.getObject(
"vtxzrun");
437 if (vtxz && vtxz->GetEntries()>0) {
438 vtxz->Fit(
"gaus",
"",
"",-3.*vtxz->GetRMS(),3.*vtxz->GetRMS());
440 if(vtxz->GetFunction(
"gaus")) {
441 vtxz->GetFunction(
"gaus")->SetLineColor(kRed);
442 vtxz->GetFunction(
"gaus")->SetLineWidth(1);
443 vtxsigmazrunfitvalue = vtxz->GetFunction(
"gaus")->GetParameter(2);
444 vtxsigmazrunfiterror = vtxz->GetFunction(
"gaus")->GetParError(2);
448 int bin = vtxzmeansum->Fill(runlabel,vtxz->GetMean());
449 vtxzmeansum->SetBinError(bin,vtxz->GetMeanError());
451 bin = vtxzsigmasum->Fill(runlabel,vtxz->GetRMS());
452 vtxzsigmasum->SetBinError(bin,vtxz->GetRMSError());
454 vtxsigmazrunvalue = vtxz->GetRMS();
455 vtxsigmazrunerror = vtxz->GetRMSError();
458 plotfilename += outtrunk;
461 plotfilename += labfull;
462 plotfilename +=
"/pvtxz_";
463 plotfilename += labfull;
467 plotfilename += runpath;
468 plotfilename +=
".gif";
469 gPad->Print(plotfilename.c_str());
475 TH1F* vtxxvsorb = (TH1F*)castat.getObject(
"vtxxvsorbrun");
476 TH1F* bsxvsorb = (TH1F*)cabs.getObject(
"bsxvsorbrun");
477 TH1F* onlbsxvsorb = (TH1F*)cabsonl.getObject(
"bsxvsorbrun");
478 TH1F* testbsxvsorb = (TH1F*)cabstest.getObject(
"bsxvsorbrun");
479 if (vtxxvsorb && vtxxvsorb->GetEntries()>0) {
483 bsxvsorb->SetMarkerColor(kGreen); bsxvsorb->SetLineColor(kGreen); bsxvsorb->SetLineWidth(2);
484 bsxvsorb->Draw(
"esame");
487 onlbsxvsorb->SetMarkerColor(kRed); onlbsxvsorb->SetLineColor(kRed);
488 onlbsxvsorb->Draw(
"esame");
491 testbsxvsorb->SetMarkerColor(kBlue); testbsxvsorb->SetLineColor(kBlue);
492 testbsxvsorb->Draw(
"esame");
495 plotfilename += outtrunk;
498 plotfilename += labfull;
499 plotfilename +=
"/pvtxxvsorb_";
500 plotfilename += labfull;
504 plotfilename += runpath;
505 plotfilename +=
".gif";
506 gPad->Print(plotfilename.c_str());
507 delete vtxxvsorb;
delete bsxvsorb;
delete onlbsxvsorb;
delete testbsxvsorb;
509 TH1F* vtxyvsorb = (TH1F*)castat.getObject(
"vtxyvsorbrun");
510 TH1F* bsyvsorb = (TH1F*)cabs.getObject(
"bsyvsorbrun");
511 TH1F* onlbsyvsorb = (TH1F*)cabsonl.getObject(
"bsyvsorbrun");
512 TH1F* testbsyvsorb = (TH1F*)cabstest.getObject(
"bsyvsorbrun");
513 if (vtxyvsorb && vtxyvsorb->GetEntries()>0) {
517 bsyvsorb->SetMarkerColor(kGreen); bsyvsorb->SetLineColor(kGreen); bsyvsorb->SetLineWidth(2);
518 bsyvsorb->Draw(
"esame");
521 onlbsyvsorb->SetMarkerColor(kRed); onlbsyvsorb->SetLineColor(kRed);
522 onlbsyvsorb->Draw(
"esame");
525 testbsyvsorb->SetMarkerColor(kCyan); testbsyvsorb->SetLineColor(kCyan);
526 testbsyvsorb->Draw(
"esame");
529 plotfilename += outtrunk;
532 plotfilename += labfull;
533 plotfilename +=
"/pvtxyvsorb_";
534 plotfilename += labfull;
538 plotfilename += runpath;
539 plotfilename +=
".gif";
540 gPad->Print(plotfilename.c_str());
541 delete vtxyvsorb;
delete bsyvsorb;
delete onlbsyvsorb;
delete testbsyvsorb;
543 TH1F* vtxzvsorb = (TH1F*)castat.getObject(
"vtxzvsorbrun");
544 TH1F* bszvsorb = (TH1F*)cabs.getObject(
"bszvsorbrun");
545 TH1F* onlbszvsorb = (TH1F*)cabsonl.getObject(
"bszvsorbrun");
546 TH1F* testbszvsorb = (TH1F*)cabstest.getObject(
"bszvsorbrun");
547 if (vtxzvsorb && vtxzvsorb->GetEntries()>0) {
550 bszvsorb->SetMarkerColor(kGreen); bszvsorb->SetLineColor(kGreen); bszvsorb->SetLineWidth(2);
551 bszvsorb->Draw(
"esame");
554 onlbszvsorb->SetMarkerColor(kRed); onlbszvsorb->SetLineColor(kRed);
555 onlbszvsorb->Draw(
"esame");
558 testbszvsorb->SetMarkerColor(kCyan); testbszvsorb->SetLineColor(kCyan);
559 testbszvsorb->Draw(
"esame");
562 plotfilename += outtrunk;
565 plotfilename += labfull;
566 plotfilename +=
"/pvtxzvsorb_";
567 plotfilename += labfull;
571 plotfilename += runpath;
572 plotfilename +=
".gif";
573 gPad->Print(plotfilename.c_str());
574 delete vtxzvsorb;
delete bszvsorb;
delete onlbszvsorb;
delete testbszvsorb;
577 TProfile* bssigmazvsorb = (TProfile*)cabs.getObject(
"bssigmazvsorbrun");
578 TProfile* onlbssigmazvsorb = (TProfile*)cabsonl.getObject(
"bssigmazvsorbrun");
579 TProfile* testbssigmazvsorb = (TProfile*)cabstest.getObject(
"bssigmazvsorbrun");
580 TGraphErrors gr;TGraphErrors grfit;
581 if ( bssigmazvsorb || onlbssigmazvsorb || testbssigmazvsorb) {
583 bssigmazvsorb->SetMarkerColor(kGreen); bssigmazvsorb->SetLineColor(kGreen); bssigmazvsorb->SetLineWidth(2);
584 bssigmazvsorb->Draw();
585 bssigmazvsorb->GetYaxis()->SetRangeUser(0.,7.);
586 if(vtxsigmazrunvalue >= 0.) {
588 int lastbin= bssigmazvsorb->GetNbinsX()+1;
590 for(
int ibin=bssigmazvsorb->GetNbinsX()+1;ibin>0;--ibin) {
591 if(bssigmazvsorb->GetBinEntries(ibin)!=0) {
596 for(
int ibin=1;ibin<=bssigmazvsorb->GetNbinsX()+1;++ibin) {
597 if(bssigmazvsorb->GetBinEntries(ibin)!=0) {
602 gr.SetMarkerStyle(20);
603 gr.SetPoint(1,(bssigmazvsorb->GetBinCenter(firstbin)+bssigmazvsorb->GetBinCenter(lastbin))/2.,vtxsigmazrunvalue);
604 gr.SetPointError(1,(bssigmazvsorb->GetBinCenter(lastbin)-bssigmazvsorb->GetBinCenter(firstbin))/2.,vtxsigmazrunerror);
606 grfit.SetMarkerStyle(24);grfit.SetMarkerColor(kBlue);grfit.SetLineColor(kBlue);
607 grfit.SetPoint(1,(bssigmazvsorb->GetBinCenter(firstbin)+bssigmazvsorb->GetBinCenter(lastbin))/2.,vtxsigmazrunfitvalue);
608 grfit.SetPointError(1,(bssigmazvsorb->GetBinCenter(lastbin)-bssigmazvsorb->GetBinCenter(firstbin))/2.,vtxsigmazrunfiterror);
612 if(onlbssigmazvsorb) {
613 onlbssigmazvsorb->SetMarkerColor(kRed); onlbssigmazvsorb->SetLineColor(kRed);
614 onlbssigmazvsorb->Draw(
"esame");
616 if(testbssigmazvsorb) {
617 testbssigmazvsorb->SetMarkerColor(kCyan); testbssigmazvsorb->SetLineColor(kCyan);
618 testbssigmazvsorb->Draw(
"esame");
621 plotfilename += outtrunk;
624 plotfilename += labfull;
625 plotfilename +=
"/pvtxsigmazvsorb_";
626 plotfilename += labfull;
630 plotfilename += runpath;
631 plotfilename +=
".gif";
632 gPad->Print(plotfilename.c_str());
633 delete bssigmazvsorb;
delete onlbssigmazvsorb;
delete testbssigmazvsorb;
641 TProfile* nvtxvsorb = (TProfile*)castat.getObject(
"nvtxvsorbrun");
645 plotfilename += outtrunk;
648 plotfilename += labfull;
649 plotfilename +=
"/nvtxvsorb_";
650 plotfilename += labfull;
654 plotfilename += runpath;
655 plotfilename +=
".gif";
656 gPad->Print(plotfilename.c_str());
660 TProfile* nvtxvsbx = (TProfile*)castat.getObject(
"nvtxvsbxrun");
662 nvtxvsbx->SetLineColor(kRed); nvtxvsbx->SetMarkerColor(kRed); nvtxvsbx->SetMarkerStyle(20); nvtxvsbx->SetMarkerSize(.5);
665 plotfilename += outtrunk;
668 plotfilename += labfull;
669 plotfilename +=
"/nvtxvsbx_";
670 plotfilename += labfull;
674 plotfilename += runpath;
675 plotfilename +=
".gif";
676 gPad->Print(plotfilename.c_str());
680 TH2D* nvtxvsbxvsorb = (TH2D*)castat.getObject(
"nvtxvsbxvsorbrun");
683 nvtxvsbxvsorb->Draw(
"colz");
685 plotfilename += outtrunk;
688 plotfilename += labfull;
689 plotfilename +=
"/nvtxvsbxvsorb_";
690 plotfilename += labfull;
694 plotfilename += runpath;
695 plotfilename +=
".gif";
696 gPad->Print(plotfilename.c_str());
700 cname =
"slice_run_";
702 new TCanvas(cname.c_str(),cname.c_str());
706 for(
unsigned int bx=0;bx<3564;++bx) {
708 sprintf(hname,
"bx_%d",bx);
709 TH1D* slice = nvtxvsbxvsorb->ProjectionY(hname,bx+1,bx+1);
712 if(slice->GetEntries()) {
713 std::cout <<
"slice " << bx <<
" ready " << std::endl;
714 slice->SetMarkerStyle(mcount);
715 slice->SetMarkerColor(ccount);
716 slice->SetLineColor(ccount);
717 slice->SetMarkerSize(.4);
718 if(first) {slice->SetMaximum(4.); slice->Draw(
"e");}
719 else {slice->Draw(
"same");}
722 if(mcount==28) {mcount=20; ++ccount;}
727 plotfilename = outtrunk;
730 plotfilename += labfull;
731 plotfilename +=
"/nvtxvsorbsliced_";
732 plotfilename += labfull;
736 plotfilename += runpath;
737 plotfilename +=
".gif";
738 gPad->Print(plotfilename.c_str());
740 delete nvtxvsbxvsorb;
748 plotfilename = outtrunk;
751 plotfilename += labfull;
752 plotfilename +=
"/vtxxsum_";
753 plotfilename += labfull;
756 plotfilename +=
".gif";
758 TCanvas * cwidevtxx =
new TCanvas(plotfilename.c_str(),plotfilename.c_str(),1500,500);
760 vtxxmeansum->GetYaxis()->SetRangeUser(.05,.15);
761 vtxxmeansum->GetYaxis()->SetTitle(
"x (cm)");
765 gPad->Print(plotfilename.c_str());
768 plotfilename = outtrunk;
771 plotfilename += labfull;
772 plotfilename +=
"/vtxysum_";
773 plotfilename += labfull;
776 plotfilename +=
".gif";
778 TCanvas * cwidevtxy =
new TCanvas(plotfilename.c_str(),plotfilename.c_str(),1500,500);
780 vtxymeansum->GetYaxis()->SetRangeUser(-0.05,.05);
781 vtxymeansum->GetYaxis()->SetTitle(
"y (cm)");
785 gPad->Print(plotfilename.c_str());
788 plotfilename = outtrunk;
791 plotfilename += labfull;
792 plotfilename +=
"/vtxzsum_";
793 plotfilename += labfull;
796 plotfilename +=
".gif";
798 TCanvas * cwidevtxz =
new TCanvas(plotfilename.c_str(),plotfilename.c_str(),1500,500);
800 vtxzmeansum->GetYaxis()->SetRangeUser(-2.,2.);
801 vtxzmeansum->GetYaxis()->SetTitle(
"z (cm)");
805 gPad->Print(plotfilename.c_str());
808 plotfilename = outtrunk;
811 plotfilename += labfull;
812 plotfilename +=
"/vtxsigmazsum_";
813 plotfilename += labfull;
816 plotfilename +=
".gif";
818 TCanvas * cwidevtxsigmaz =
new TCanvas(plotfilename.c_str(),plotfilename.c_str(),1500,500);
820 vtxzsigmasum->GetYaxis()->SetRangeUser(0.,15.);
821 vtxzsigmasum->GetYaxis()->SetTitle(
"z (cm)");
822 vtxzsigmasum->Draw();
825 gPad->Print(plotfilename.c_str());
826 delete cwidevtxsigmaz;
bin
set the eta bin as selection string.