51 class StFgtCosmicMaker;
68 StFgtCosmicMaker *cosmicMkr = 0;
101 Int_t fgtCosmicTrackQA(
const Char_t *filename =
"testfile.sfs",
102 const Char_t *pedfilename =
"testfile.Ped.txt",
103 const Char_t *statusfilename =
"testfile.Status.txt",
110 const Char_t *runname =
"testrun",
111 const Char_t *quadname1 =
"010",
112 const Char_t *quadname2 =
"011",
113 const Char_t *quadname3 =
"013",
116 Bool_t cutShortEvents = 1,
117 Bool_t skipCor = 1 ){
119 cout <<
"Loaded libraries" << endl;
124 Float_t sansPedXmax = 500;
125 Float_t sansPedXmin = -200;
126 Int_t sansPedXbins = (sansPedXmax-sansPedXmin)/5;
130 Int_t numChannelsPerCorBin = 1;
133 Int_t canWidth = 850, canHeight = 1100;
135 Short_t timeBinMask = (1<<timeBin);
137 cout <<
"Constructing the ped plotter" << endl;
139 pedPlotter->setReadFromFile( pedfilename );
140 pedPlotter->setTimeBinMask( 1<<timeBin );
141 pedPlotter->setPlotVsStrip(
'c' );
142 pedPlotter->setDisc( disc2 );
143 pedPlotter->setQuad( quad2 );
144 pedPlotter->setQuadName( quadname2 );
145 pedPlotter->setPlotStDev( 1 );
147 cout <<
"making the ped. st. dev. plots" << endl;
148 ierr = pedPlotter->makePlots();
149 cout <<
"\tdone" << endl;
152 cerr <<
"\tError making pedestal st. dev. plot" << endl;
156 const TGraph* gr = pedPlotter->getGraph( timeBin );
158 cerr <<
"\tError making pedestal st. dev. plot" << endl;
162 cout <<
"Constructing the chain" << endl;
163 analysisChain =
new StChain(
"eemcAnalysisChain");
165 cout <<
"Constructing the cosmic maker" << endl;
166 cosmicMkr =
new StFgtCosmicMaker(
"cosmicMaker", filename );
168 cout <<
"Constructing the A2C maker" << endl;
170 adcCorrector->setPedReaderFile( pedfilename );
171 adcCorrector->setStatusReaderFile( statusfilename );
172 adcCorrector->setTimeBinMask( timeBinMask );
173 adcCorrector->setAbsThres( -10000 );
175 adcCorrector->doRemoveOtherTimeBins( 1 );
177 cout <<
"Constructing the cluster and point maker " << endl;
188 pointMkr->setPointAlgo(simplePointAlgo);
190 cout <<
"Constructing cosmic trackmaker" << endl;
192 trackMkr->setCosmicTrackAlgo(simpleCosmicTrackAlgo);
194 cout <<
"Constructing the QA makers" << endl;
198 cosmicQA1->setTimeBin( timeBin );
199 cosmicQA1->setFilenameBase(
"" );
200 cosmicQA1->setXbins( sansPedXbins );
201 cosmicQA1->setXrange( sansPedXmin, sansPedXmax );
202 cosmicQA1->setBinFactors( 1, 1 );
205 cosmicQA2->setTimeBin( timeBin );
206 cosmicQA2->setFilenameBase(
"" );
207 cosmicQA2->setXbins( sansPedXbins );
208 cosmicQA2->setXrange( sansPedXmin, sansPedXmax );
209 cosmicQA2->setBinFactors( 1, 1 );
212 cosmicQA3->setTimeBin( timeBin );
213 cosmicQA3->setFilenameBase(
"" );
214 cosmicQA3->setXbins( sansPedXbins );
215 cosmicQA3->setXrange( sansPedXmin, sansPedXmax );
216 cosmicQA3->setBinFactors( 1, 1 );
222 cosmicHistsBottom =
new StFgtCosmicTrackPlots(
"fgtTrackQABottom",
"trackMkr", disc3, quad3, quadname3 );
224 cout <<
"Initializing" << endl;
225 ierr = analysisChain->Init();
226 cout <<
"\t done initializing" << endl;
229 cout <<
"Error initializing" << endl;
236 cout <<
"Looping over events..." << endl;
237 for(
int i=0; i<nevents && !ierr; ++i ){
240 cout <<
"\n\nevent number " << i << endl;
243 analysisChain->
Clear();
246 ierr = analysisChain->
Make();
253 cout <<
"finish" << endl;
256 cout <<
"Making plots..." << endl;
263 gROOT->SetStyle(
"Plain");
264 gStyle->SetOptStat(0);
265 gStyle->SetEndErrorSize(0);
266 gStyle->SetTitleBorderSize(0);
267 gStyle->SetTitleTextColor(kRed);
268 gStyle->SetPalette(1);
269 gStyle->SetOptDate(0);
272 bool quadrantOutline =
true;
279 if(quadrantOutline) {
280 innerArc =
new TArc(0,0,10.35+1.15,0.0,90.0);
281 outerArc =
new TArc(0,0,39.40-1.15,0.0,90.0);
282 left =
new TLine( 1.15, 10.35+1.15, 1.15, 39.40-1.15 );
283 right =
new TLine( 10.35+1.15, 1.15, 39.40-1.15, 1.15 );
285 (10.35+1.15)*cos( 0.785398163 ),
286 (10.35+1.15)*sin( 0.785398163 ),
287 (39.40-1.15)*cos( 0.785398163 ),
288 (39.40-1.15)*sin( 0.785398163 )
291 (39.40-1.15)*cos( 0.190240888 ),
292 (39.40-1.15)*sin( 0.190240888 ),
293 (39.40-1.15)*cos( 0.891863248 ),
294 (39.40-1.15)*sin( 0.891863248 )
296 innerArc->SetFillStyle(0);
297 outerArc->SetFillStyle(0);
298 innerArc->SetLineWidth(2);
299 outerArc->SetLineWidth(2);
300 left->SetLineWidth(2);
301 right->SetLineWidth(2);
302 center->SetLineWidth(2);
303 weird->SetLineWidth(2);
309 gROOT->SetStyle(
"Plain");
310 TCanvas *can1 =
new TCanvas(
"fgtQAcan1",
"fgtQAcan1", canHeight, canHeight );
315 for(
int i=0;i<10;i++) {
316 TH1F* hAPV1 = cosmicQA1->getHistAPV(i);
317 TH1F* hAPV2 = cosmicQA2->getHistAPV(i);
318 TH1F* hAPV3 = cosmicQA3->getHistAPV(i);
320 gStyle->SetOptStat(100110);
322 can1->cd(can1pad+10);
323 gStyle->SetOptStat(100110);
325 can1->cd(can1pad+20);
326 gStyle->SetOptStat(100110);
332 TCanvas *can2 =
new TCanvas(
"fgtQAcan2",
"fgtQAcan2", 1300, canWidth );
333 TH1F* clusterDist1R = cosmicQA1->getHist1Dcluster(0);
334 TH1F* clusterDist2R = cosmicQA2->getHist1Dcluster(0);
335 TH1F* clusterDist3R = cosmicQA3->getHist1Dcluster(0);
336 TH1F* clusterDist1P = cosmicQA1->getHist1Dcluster(1);
337 TH1F* clusterDist2P = cosmicQA2->getHist1Dcluster(1);
338 TH1F* clusterDist3P = cosmicQA3->getHist1Dcluster(1);
344 gStyle->SetOptStat(100110);
345 clusterDist1R->Draw();
348 gStyle->SetOptStat(100110);
349 clusterDist2R->Draw();
352 gStyle->SetOptStat(100110);
353 clusterDist3R->Draw();
356 gStyle->SetOptStat(100110);
357 clusterDist1P->Draw();
360 gStyle->SetOptStat(100110);
361 clusterDist2P->Draw();
364 gStyle->SetOptStat(100110);
365 clusterDist3P->Draw();
407 TCanvas *can3 =
new TCanvas(
"fgtQAcan3",
"fgtQAcan3", 1300, canWidth );
408 TH1F* clusterDist1 = cosmicQA1->getHist1Dclusters();
409 TH1F* clusterDist2 = cosmicQA2->getHist1Dclusters();
410 TH1F* clusterDist3 = cosmicQA3->getHist1Dclusters();
416 gStyle->SetOptStat(100110);
417 clusterDist1->Draw();
420 gStyle->SetOptStat(100110);
421 clusterDist2->Draw();
424 gStyle->SetOptStat(100110);
425 clusterDist3->Draw();
428 TCanvas *can4 =
new TCanvas(
"fgtQAcan4",
"fgtQAcan4", canWidth, 1500 );
429 TH2F* pointDist1 = cosmicQA1->getHist2Dpoint();
430 TH2F* pointDist2 = cosmicQA2->getHist2Dpoint();
431 TH2F* pointDist3 = cosmicQA3->getHist2Dpoint();
433 gStyle->SetOptStat(0);
439 pointDist1->Draw(
"colz");
440 if(quadrantOutline) {
441 outerArc->Draw(
"only");
442 innerArc->Draw(
"only");
449 TPaletteAxis *palette = (TPaletteAxis*)pointDist1->GetListOfFunctions()->FindObject(
"palette");
451 palette->SetLabelSize(0.035);
454 pointDist2->Draw(
"colz");
455 if(quadrantOutline) {
456 outerArc->Draw(
"only");
457 innerArc->Draw(
"only");
464 TPaletteAxis *palette = (TPaletteAxis*)pointDist2->GetListOfFunctions()->FindObject(
"palette");
466 palette->SetLabelSize(0.035);
469 pointDist3->Draw(
"colz");
470 if(quadrantOutline) {
471 outerArc->Draw(
"only");
472 innerArc->Draw(
"only");
479 TPaletteAxis *palette = (TPaletteAxis*)pointDist3->GetListOfFunctions()->FindObject(
"palette");
481 palette->SetLabelSize(0.035);
484 TCanvas *can5 =
new TCanvas(
"fgtTrackQAcan5",
"fgtTrackQAcan5", canWidth, canHeight );
485 TH2F* trackDist = cosmicHists->getHistTracks();
490 trackDist->Draw(
"colz");
491 if(quadrantOutline) {
492 outerArc->Draw(
"only");
493 innerArc->Draw(
"only");
500 TPaletteAxis *palette = (TPaletteAxis*)trackDist->GetListOfFunctions()->FindObject(
"palette");
502 palette->SetLabelSize(0.035);
503 palette->SetX1NDC(0.87);
504 palette->SetX2NDC(0.92);
507 TCanvas *can6 =
new TCanvas(
"fgtTrackQAcan6",
"fgtTrackQAcan6", canWidth, canHeight );
508 TProfile2D* chi2Dist = cosmicHists->getProfileChi2();
513 chi2Dist->Draw(
"colz");
514 if(quadrantOutline) {
515 outerArc->Draw(
"only");
516 innerArc->Draw(
"only");
523 TPaletteAxis *palette = (TPaletteAxis*)chi2Dist->GetListOfFunctions()->FindObject(
"palette");
525 palette->SetLabelSize(0.035);
526 palette->SetX1NDC(0.87);
527 palette->SetX2NDC(0.92);
530 TCanvas *can7 =
new TCanvas(
"fgtTrackQAcan7",
"fgtTrackQAcan7", canWidth, canHeight );
531 TProfile2D* efficiencyDist = cosmicHists->getProfileEfficiency();
536 efficiencyDist->Draw(
"colz");
537 if(quadrantOutline) {
538 outerArc->Draw(
"only");
539 innerArc->Draw(
"only");
546 TPaletteAxis *palette = (TPaletteAxis*)efficiencyDist->GetListOfFunctions()->FindObject(
"palette");
548 palette->SetLabelSize(0.035);
549 palette->SetX1NDC(0.87);
550 palette->SetX2NDC(0.92);
553 TCanvas *can8 =
new TCanvas(
"fgtQAcan8",
"fgtQAcan8", 1300, canWidth );
554 TH1F* clusterDistTrack1R = cosmicHistsTop->getHist1Dcluster(0);
555 TH1F* clusterDistTrack1P = cosmicHistsTop->getHist1Dcluster(1);
556 TH1F* clusterDistTrack2R = cosmicHists->getHist1Dcluster(0);
557 TH1F* clusterDistTrack2P = cosmicHists->getHist1Dcluster(1);
558 TH1F* clusterDistTrack3R = cosmicHistsBottom->getHist1Dcluster(0);
559 TH1F* clusterDistTrack3P = cosmicHistsBottom->getHist1Dcluster(1);
565 gStyle->SetOptStat(100110);
566 clusterDistTrack1R->Draw();
569 gStyle->SetOptStat(100110);
570 clusterDistTrack2R->Draw();
573 gStyle->SetOptStat(100110);
574 clusterDistTrack3R->Draw();
577 gStyle->SetOptStat(100110);
578 clusterDistTrack1P->Draw();
581 gStyle->SetOptStat(100110);
582 clusterDistTrack2P->Draw();
585 gStyle->SetOptStat(100110);
586 clusterDistTrack3P->Draw();
590 TCanvas *can9 =
new TCanvas(
"fgtQAcan9",
"fgtQAcan9", 1300, canWidth );
591 TH1F* clusterDistTrack1 = cosmicHistsTop->getHist1Dclusters();
592 TH1F* clusterDistTrack2 = cosmicHists->getHist1Dclusters();
593 TH1F* clusterDistTrack3 = cosmicHistsBottom->getHist1Dclusters();
599 gStyle->SetOptStat(100110);
600 clusterDistTrack1->Draw();
603 gStyle->SetOptStat(100110);
604 clusterDistTrack2->Draw();
607 gStyle->SetOptStat(100110);
608 clusterDistTrack3->Draw();
612 TCanvas *can10 =
new TCanvas(
"fgtTrackQAcan10",
"fgtTrackQAcan10", canWidth, canHeight );
613 TH2F* realTrackPointDist = cosmicHists->getHist2Dcluster();
617 gStyle->SetOptStat(0);
619 realTrackPointDist->Draw(
"colz");
620 if(quadrantOutline) {
621 outerArc->Draw(
"only");
622 innerArc->Draw(
"only");
630 TCanvas *can11 =
new TCanvas(
"fgtTrackQAcan11",
"fgtTrackQAcan11", canWidth, canHeight );
631 TH2F* realtrackDist = cosmicHists->getHistRealTracks();
636 realtrackDist->Draw(
"colz");
637 if(quadrantOutline) {
638 outerArc->Draw(
"only");
639 innerArc->Draw(
"only");
646 TPaletteAxis *palette = (TPaletteAxis*)realtrackDist->GetListOfFunctions()->FindObject(
"palette");
648 palette->SetLabelSize(0.035);
649 palette->SetX1NDC(0.87);
650 palette->SetX2NDC(0.92);
654 TCanvas *can12 =
new TCanvas(
"fgtTrackQAcan12",
"fgtTrackQAcan12", canWidth, canHeight );
657 TCanvas *can13 =
new TCanvas(
"fgtTrackQAcan13",
"fgtTrackQAcan13", canWidth, canHeight );
665 for(
int i=3;i>=0;i--) {
666 for(
int j=0;j<4;j++) {
668 TH1F* hdX = cosmicHists->getHistX(i,j);
671 TH1F* hdY = cosmicHists->getHistY(i,j);
677 cout <<
"ready to save plots" << endl;
679 std::string fileOut1 =
"fgtCosmicTrackQA.page-1.";
680 std::string fileOut2 =
"fgtCosmicTrackQA.page-2.";
681 std::string fileOut3 =
"fgtCosmicTrackQA.page-3.";
682 std::string fileOut4 =
"fgtCosmicTrackQA.page-4.";
683 std::string fileOut5 =
"fgtCosmicTrackQA.page-5.";
684 std::string fileOut6 =
"fgtCosmicTrackQA.page-6.";
685 std::string fileOut7 =
"fgtCosmicTrackQA.page-7.";
686 std::string fileOut8 =
"fgtCosmicTrackQA.page-8.";
687 std::string fileOut9 =
"fgtCosmicTrackQA.page-9.";
688 std::string fileOut10 =
"fgtCosmicTrackQA.page-10.";
689 std::string fileOut11 =
"fgtCosmicTrackQA.page-11.";
690 std::string fileOut12 =
"fgtCosmicTrackQA.page-12.";
691 std::string fileOut13 =
"fgtCosmicTrackQA.page-13.";
693 std::string tail = runname;
699 cout <<
"\tsaving to '" << tail <<
"'" << endl;
700 can1->Print( (fileOut1+tail).
data() );
701 can2->Print( (fileOut2+tail).
data() );
702 can3->Print( (fileOut3+tail).
data() );
703 can4->Print( (fileOut4+tail).
data() );
704 can5->Print( (fileOut5+tail).
data() );
705 can6->Print( (fileOut6+tail).
data() );
706 can7->Print( (fileOut7+tail).
data() );
707 can8->Print( (fileOut8+tail).
data() );
708 can9->Print( (fileOut9+tail).
data() );
709 can10->Print((fileOut10+tail).
data());
710 can11->Print((fileOut11+tail).
data());
711 can12->Print((fileOut12+tail).
data());
712 can13->Print((fileOut13+tail).
data());
714 cout <<
"all done" << endl;
723 gSystem->Load(
"libPhysics");
724 gSystem->Load(
"St_base");
725 gSystem->Load(
"StChain");
726 gSystem->Load(
"StUtilities");
727 gSystem->Load(
"StFgtUtil");
728 gSystem->Load(
"StFgtRawMaker");
729 gSystem->Load(
"StEvent");
730 cout <<
"loaded StEvent library" << endl;
732 gSystem->Load(
"RTS");
733 gSystem->Load(
"StFgtDbMaker");
734 gSystem->Load(
"StFgtPedMaker");
735 gSystem->Load(
"StFgtStatusMaker");
736 gSystem->Load(
"StFgtCosmicTrackMaker");
737 gSystem->Load(
"StFgtQaMakers");
738 gSystem->Load(
"StFgtPedPlotter");
739 gSystem->Load(
"StFgtClusterMaker");
740 gSystem->Load(
"StFgtPointMaker");
741 gSystem->Load(
"StFgtA2CMaker");
void setRelThres(Float_t thres)
set to below -kFgtMaxAdc (-4096) to skip cut
virtual void Clear(Option_t *option="")
User defined functions.
Int_t setClusterAlgo(StFgtIClusterAlgo *)
clear function is empty at the moment