5120{
5121
5123 TFile *datafile = new TFile(argv[2]);
5124 if (datafile->IsZombie())
5125 {
5126 cout << "ERROR! INPUT FILE DOES NOT EXIST!" << endl;
5128 }
5129
5130 bool isAr = false;
5131 if (datafile->FindKey("TRT_Ar_all"))
5132 {
5133 isAr = true;
5134 cout << " This run contains straws with Argon" << endl;
5135 }
5136 if (!datafile->FindKey("Chip_Artuple"))
5137 {
5138 isAr = false;
5139 cout << " This run contains does not have Argon ntuples" << endl;
5140 }
5141
5142
5143
5144 TFile *refdatafile;
5145 bool useref = false;
5146 if (argc > 4)
5147 {
5148 useref = true;
5149 refdatafile = new TFile(argv[4]);
5150 if (refdatafile->IsZombie())
5151 {
5152 cout << "INPUT REFERENCE FILE DOES NOT EXIST! RUNNING WITHOUT IT!" << endl;
5153 useref = false;
5154 }
5155 else
5156 cout << "INPUT REFERENCE FILE OK!" << endl;
5157 }
5158
5159
5160 cout << "MAKING FirstPage" << endl;
5162 try
5163 {
5164 firstpage =
new FirstPage(argv[2], datafile);
5165 }
5166 catch (string e)
5167 {
5169 }
5170
5171
5172 cout << "MAKING Settings" << endl;
5174
5175
5176
5177 cout << "MAKING TracktupleInfo" << endl;
5179 try
5180 {
5182 }
5183 catch (string e)
5184 {
5186 }
5187
5188
5190 cout << "MAKING HitStatistics" << endl;
5192
5194 if (isAr)
5195 {
5196 cout << "MAKING Ar HitStatistics" << endl;
5198 }
5199
5200
5201 cout << "MAKING TRTPlots" << endl;
5202
5203
5204
5205
5206
5207
5208
5209
5210
5211
5212
5213 if (isAr)
5214
5215
5216
5217
5218
5219
5220
5221
5222
5223
5224 cout << "MAKING ResidualPlots" << endl;
5226 try
5227 {
5229 }
5230 catch (string e)
5231 {
5233 }
5235 if (isAr)
5236 try
5237 {
5239 }
5240 catch (string e)
5241 {
5243 }
5244
5245
5246 cout << "MAKING T0CalibTypeXY" << endl;
5249 if (isAr)
5251
5252
5253 cout << "MAKING XYMaps(nt0)" << endl;
5255 XYMaps *nhitsAr =
nullptr;
5256 if (isAr)
5257 nhitsAr =
new XYMaps(argv[2],
"nt0",
true);
5258
5259 cout << "MAKING XYMaps(res)" << endl;
5261 XYMaps *resxy0Ar =
nullptr;
5262 if (isAr)
5263 resxy0Ar =
new XYMaps(argv[2],
"res",
true);
5264
5265 cout << "MAKING XYMaps(resmean)" << endl;
5267 XYMaps *resxyAr =
nullptr;
5268 if (isAr)
5269 resxyAr =
new XYMaps(argv[2],
"abs(resMean)",
true);
5270
5271 cout << "MAKING XYMaps(t0)" << endl;
5273 XYMaps *xymapAr =
nullptr;
5274 if (isAr)
5275 xymapAr =
new XYMaps(argv[2],
"t0",
true);
5276
5277 cout << "MAKING XYMaps(oldt0)" << endl;
5279 XYMaps *oldt0Ar =
nullptr;
5280 if (isAr)
5281 oldt0Ar =
new XYMaps(argv[2],
"oldt0",
true);
5282
5283 cout << "MAKING XYMaps(t0-oldt0)" << endl;
5285 XYMaps *oldt01Ar =
nullptr;
5286 if (isAr)
5287 oldt01Ar =
new XYMaps(argv[2],
"abs(t0-oldt0)",
true);
5288
5289 cout << "MAKING XYMaps(tresMean)" << endl;
5290 XYMaps *oldt0111 =
new XYMaps(argv[2],
"abs(tresMean)");
5291 XYMaps *oldt0111Ar =
nullptr;
5292 if (isAr)
5293 oldt0111Ar =
new XYMaps(argv[2],
"abs(tresMean)",
true);
5294
5295 cout << "MAKING XYMaps(tres)" << endl;
5297 XYMaps *oldt011Ar =
nullptr;
5298 if (isAr)
5299 oldt011Ar =
new XYMaps(argv[2],
"(tres)",
true);
5300
5301
5304 if (datafile->FindKey("TRT_all"))
5305 {
5306 cout << "MAKING ChipVariations" << endl;
5309 }
5310
5311
5316 if (useref)
5317 {
5318 cout << "MAKING BoardVariationsOldT0" << endl;
5321 refboardgraphA->SetLineColor(2);
5322 refboardgraphC->SetLineColor(2);
5323 cout << "MAKING BoardVariationsDiff" << endl;
5326 }
5327
5328 cout << "MAKING BoardVariations" << endl;
5331
5332 cout << "MAKING BoardVariationsRes" << endl;
5335
5336 cout << "MAKING BoardVariationsTRes" << endl;
5339
5340 cout << "MAKING BoardVariationsTRes1" << endl;
5343
5344
5345 RtGraphs *rtrelation_bar =
nullptr;
5355 if (datafile->FindKey("TRT_all"))
5356 {
5357 cout << "MAKING RtGraphs" << endl;
5358 TDirectory *trt = (TDirectory *)datafile->FindKey("TRT_all")->ReadObj();
5359
5360 if (trt->FindKey("WholeBarrel_1"))
5361 {
5362 try
5363 {
5364 rtrelation_bar =
new RtGraphs(argv[2],
"WholeBarrel_1");
5365 }
5366 catch (string e)
5367 {
5369 }
5370 }
5371 if (trt->FindKey("Detector_-1"))
5372 {
5373 try
5374 {
5375 rtrelation21 =
new RtGraphs(argv[2],
"Detector_-1");
5376 }
5377 catch (string e)
5378 {
5380 }
5381 }
5382 if (trt->FindKey("Detector_1"))
5383 {
5384 try
5385 {
5386 rtrelation31 =
new RtGraphs(argv[2],
"Detector_1");
5387 }
5388 catch (string e)
5389 {
5391 }
5392 }
5393 if (trt->FindKey("Detector_-2"))
5394 {
5395 try
5396 {
5397 rtrelation41 =
new RtGraphs(argv[2],
"Detector_-2");
5398 }
5399 catch (string e)
5400 {
5402 }
5403 }
5404 if (trt->FindKey("Detector_2"))
5405 {
5406 try
5407 {
5408 rtrelation51 =
new RtGraphs(argv[2],
"Detector_2");
5409 }
5410 catch (string e)
5411 {
5413 }
5414 }
5415
5416 cout << "MAKING Rt binning" << endl;
5417
5418
5419
5420
5421
5422
5423
5424 cout << "MAKING Rt binning for Detector_-2" << endl;
5425 rtbinning3 =
new RtBinning(trt,
"Detector_-2");
5426 cout << "MAKING Rt binning for Detector_2" << endl;
5427 rtbinning4 =
new RtBinning(trt,
"Detector_2");
5428 }
5429
5430
5441
5442 cout << "MAKING Binned Residual" << endl;
5443
5444
5445
5446
5447
5448
5449
5450
5451
5452 cout << "MAKING Binned Residual for Detector_-2" << endl;
5453 binres3 =
new RresTbin(datafile,
"Detector_-2", -2);
5455 cout << "MAKING Binned Residual for Detector_2" << endl;
5456 binres4 =
new RresTbin(datafile,
"Detector_2", 2);
5458
5465
5466 cout << "MAKING RtColor" << endl;
5467
5468 if (datafile->FindKey("TRT_all"))
5469 {
5470 cout << " found TRT_all " << endl;
5471
5472
5473
5474
5475 TDirectory *trt = (TDirectory *)datafile->FindKey("TRT_all")->ReadObj();
5476
5477
5478
5479
5480
5481
5482
5483
5484
5485
5486
5487
5488
5489
5490
5491
5492
5493
5494
5495
5496
5497
5498
5499 if (trt->FindKey("Detector_-2"))
5500 {
5501 cout << " MAKING RtColor Detector_-2" << endl;
5502 try
5503 {
5504 rtcol4 =
new RtColor(argv[2],
"Detector_-2");
5505 }
5506 catch (string e)
5507 {
5509 }
5510 }
5511
5512 if (trt->FindKey("Detector_2"))
5513 {
5514 cout << " MAKING RtColor Detector_2" << endl;
5515 try
5516 {
5517 rtcol5 =
new RtColor(argv[2],
"Detector_2");
5518 }
5519 catch (string e)
5520 {
5522 }
5523 }
5524 }
5525
5526
5527
5528
5529
5530
5531
5532
5533
5534
5535
5536
5537
5538
5539
5540
5541
5542
5543
5544
5545
5546
5547
5548
5549
5550
5551
5552
5553
5554
5555
5556
5557
5558
5559
5560
5561
5562
5563
5564
5565
5566
5567
5568
5569
5570
5571
5572
5573
5574
5575
5576
5577
5578
5579
5580
5581
5582
5583
5584
5585
5586
5587
5588
5589
5590
5591
5592
5593
5594
5595
5596
5597
5598
5599
5600
5601
5602
5603
5604
5605
5606
5607
5608
5609
5610
5611
5612
5613
5614
5615
5616
5617 cout << "MAKING RT Binned Residual for Ar" << endl;
5618
5619 TDirectory *trtAr = (TDirectory *)datafile->FindKey("TRT_Ar_all")->ReadObj();
5620
5621
5622
5623
5624
5625
5626
5627
5628
5629
5630 cout << "MAKING RT Binned Abs Residual for Ar" << endl;
5631
5632
5633
5634
5635
5636
5637
5638
5639
5644
5645
5646
5647
5648
5649
5650
5651
5652
5653
5654
5655
5656
5657
5658 if (trtAr->FindKey("Detector_Ar_-1"))
5659 {
5660 cout << " MAKING AR RtColor det -1" << endl;
5661 try
5662 {
5663 rtArcol2 =
new RtColor(argv[2],
"Detector_Ar_-1",
true);
5664 }
5665 catch (string e)
5666 {
5668 }
5669 }
5670 if (trtAr->FindKey("Detector_Ar_1"))
5671 {
5672 cout << " MAKING AR RtColor det 1" << endl;
5673 try
5674 {
5675 rtArcol3 =
new RtColor(argv[2],
"Detector_Ar_1",
true);
5676 }
5677 catch (string e)
5678 {
5680 }
5681 }
5682 if (trtAr->FindKey("Detector_Ar_-2"))
5683 {
5684 cout << " MAKING AR RtColor det -2" << endl;
5685 try
5686 {
5687 rtArcol4 =
new RtColor(argv[2],
"Detector_Ar_-2",
true);
5688 }
5689 catch (string e)
5690 {
5692 }
5693 }
5694 if (trtAr->FindKey("Detector_Ar_2"))
5695 {
5696 cout << " MAKING AR RtColor det 2" << endl;
5697 try
5698 {
5699 rtArcol5 =
new RtColor(argv[2],
"Detector_Ar_2",
true);
5700 }
5701 catch (string e)
5702 {
5704 }
5705 }
5706
5711 if (useref)
5712 {
5713 cout << "MAKING BoardVariationsOldT0 for Ar" << endl;
5716 cout << "MAKING BoardVariationsDiff Ar" << endl;
5719 boarddiffECgraphA->SetLineColor(2);
5720 boarddiffECgraphC->SetLineColor(2);
5721 }
5722
5723 cout << "MAKING BoardVariations Ar" << endl;
5726
5727 cout << "MAKING BoardVariationsRes Ar" << endl;
5730
5731 cout << "MAKING BoardVariationsTRes Ar" << endl;
5734
5735 cout << "MAKING BoardVariationsTRes1" << endl;
5738
5739 cout << " Start printing itersum.ps" << endl;
5740
5741 TCanvas *textpage;
5742
5743 TCanvas *
c1 =
new TCanvas();
5744 c1->Print(
"itersum.ps[");
5746
5747 if (firstpage)
5748 firstpage->Print("itersum.ps");
5750 if (settings)
5751 settings->Print("itersum.ps");
5753 if (tracktupleinfo)
5754 tracktupleinfo->Print("itersum.ps");
5756 if (hitstat)
5757 hitstat->Print("itersum.ps");
5759 if (hitstatAr)
5760 hitstatAr->Print("itersum.ps");
5762
5763 gStyle->SetOptStat(0);
5764 if (resplots)
5765 resplots->Print("itersum.ps");
5767 if (resplotsAr)
5768 resplotsAr->Print("itersum.ps");
5770
5771 textpage =
new TextPage(
" BARREL PLOTS ");
5772 textpage->Print("itersum.ps");
5774
5775 hitstatxy->Print("itersum.ps");
5777 if (isAr)
5778 hitstatxyAr->Print("itersum.ps");
5780 nhits->Print("itersum.ps");
5782 if (isAr)
5783 nhitsAr->Print("itersum.ps");
5785 resxy0->Print("itersum.ps");
5787 if (isAr)
5788 resxy0Ar->Print("itersum.ps");
5790 resxy->Print("itersum.ps");
5792 if (isAr)
5793 resxyAr->Print("itersum.ps");
5795 xymap->Print("itersum.ps");
5797 if (isAr)
5798 xymapAr->Print("itersum.ps");
5801 {
5802 oldt0->Print("itersum.ps");
5804 if (isAr)
5805 oldt0Ar->Print("itersum.ps");
5807 }
5808 oldt01->Print("itersum.ps");
5810 if (isAr)
5811 oldt01Ar->Print("itersum.ps");
5814 {
5815 oldt0111->Print("itersum.ps");
5817 if (isAr)
5818 oldt0111Ar->Print("itersum.ps");
5820 }
5821 oldt011->Print("itersum.ps");
5823 if (isAr)
5824 oldt011Ar->Print("itersum.ps");
5826
5827
5828
5829 double lowe = -3.5, upe = 3.5;
5831 if (chipgraphA && chipgraphC)
5832 {
5833 chipgraphA->GetYaxis()->SetRangeUser(lowe, upe);
5834 chipgraphC->GetYaxis()->SetRangeUser(lowe, upe);
5836 c1->Divide(1, 2, 0.01, 0.01);
5838 chipgraphA->Draw();
5841 chipgraphC->Draw();
5843 c1->Print(
"itersum.ps");
5845 }
5846
5848 c1->Divide(1, 2, 0.01, 0.01);
5850 boardgraphA->Draw("apl");
5852 if (refboardgraphA)
5853 refboardgraphA->Draw("pl");
5854 TLegend *
leg =
new TLegend(0.8, 0.8, 0.98, 0.95);
5855 leg->AddEntry(boardgraphA,
"data",
"l");
5856 if (refboardgraphA)
5857 leg->AddEntry(refboardgraphA,
"ref (input to 1st it)",
"l");
5858 leg->SetTextSize(0.03);
5861 boardgraphC->Draw("apl");
5863 if (refboardgraphC)
5864 refboardgraphC->Draw("pl");
5865 c1->Print(
"itersum.ps");
5867
5868
5869 if (useref)
5870 {
5872 c1->Divide(1, 2, 0.01, 0.01);
5874 boarddiffgraphA->Draw("ap");
5876
5878 boarddiffgraphC->Draw("ap");
5881 c1->Print(
"itersum.ps");
5883 }
5884
5886 c1->Divide(1, 2, 0.01, 0.01);
5888 boardgraphA1->Draw("apl");
5891 boardgraphC1->Draw("apl");
5893 c1->Print(
"itersum.ps");
5895
5897 c1->Divide(1, 2, 0.01, 0.01);
5899 boardgraphA2->Draw("apl");
5902 boardgraphC2->Draw("apl");
5904 c1->Print(
"itersum.ps");
5906
5908 c1->Divide(1, 2, 0.01, 0.01);
5910 boardgraphA3->Draw("apl");
5913 boardgraphC3->Draw("apl");
5915 c1->Print(
"itersum.ps");
5917
5918
5919
5921 textpage =
new TextPage(
"ENDCAP PLOTS");
5922 textpage->Print("itersum.ps");
5924
5925 cout << "MAKING PLOTS FOR ENDCAPS" << endl;
5926
5927
5929 ntypeEC->Print("itersum.ps");
5931 if (isAr)
5932 {
5933 ntypeECAr =
new XYMapsEC(argv[2],
"ftype",
true);
5934 ntypeECAr->Print("itersum.ps");
5935 }
5936
5937
5939 nhitsEC->Print("itersum.ps");
5941 if (isAr)
5942 {
5943 nhitsECAr =
new XYMapsEC(argv[2],
"nt0",
true);
5944 nhitsECAr->Print("itersum.ps");
5945 }
5946
5948 resxy0EC->Print("itersum.ps");
5950 if (isAr)
5951 {
5952 resxy0ECAr =
new XYMapsEC(argv[2],
"res",
true);
5953 resxy0ECAr->Print("itersum.ps");
5954 }
5955
5957 resxyM0EC->Print("itersum.ps");
5959 if (isAr)
5960 {
5961 resxyM0ECAr =
new XYMapsEC(argv[2],
"abs(resMean)",
true);
5962 resxyM0ECAr->Print("itersum.ps");
5963 }
5964
5965
5967 xymapEC->Print("itersum.ps");
5969 if (isAr)
5970 {
5971 xymapECAr =
new XYMapsEC(argv[2],
"t0",
true);
5972 xymapECAr->Print("itersum.ps");
5973 }
5974
5975
5978 oldt0EC =
new XYMapsEC(argv[2],
"oldt0");
5980 oldt0EC->Print("itersum.ps");
5983 {
5984 if (isAr)
5985 {
5986 oldt0ECAr =
new XYMapsEC(argv[2],
"oldt0",
true);
5987 oldt0ECAr->Print("itersum.ps");
5988 }
5989 }
5990
5991
5993 oldt01EC->Print("itersum.ps");
5995 if (isAr)
5996 {
5997 oldt01ECAr =
new XYMapsEC(argv[2],
"abs(t0-oldt0)",
true);
5998 oldt01ECAr->Print("itersum.ps");
5999 }
6000
6001
6002
6005 oldt0111EC =
new XYMapsEC(argv[2],
"abs(tresMean)");
6007 oldt0111EC->Print("itersum.ps");
6010 {
6011 if (isAr)
6012 {
6013 oldt0111ECAr =
new XYMapsEC(argv[2],
"abs(tresMean)",
true);
6014 oldt0111ECAr->Print("itersum.ps");
6015 }
6016 }
6017
6019 oldt011EC->Print("itersum.ps");
6021 if (isAr)
6022 {
6023 oldt011ECAr =
new XYMapsEC(argv[2],
"tres",
true);
6024 oldt011ECAr->Print("itersum.ps");
6025 }
6026
6027
6029 c1->Divide(1, 2, 0.01, 0.01);
6031 boardECgraphA->Draw("apl");
6033 if (refboardECgraphA)
6034 refboardECgraphA->Draw("pl");
6035 TLegend *legAr = new TLegend(0.8, 0.8, 0.98, 0.95);
6036 legAr->AddEntry(boardECgraphA, "data", "l");
6037 if (refboardECgraphA)
6038 leg->AddEntry(refboardECgraphA,
"ref (input to 1st it)",
"l");
6039 legAr->SetTextSize(0.03);
6040 legAr->Draw();
6042 boardECgraphC->Draw("apl");
6044 if (refboardECgraphC)
6045 refboardECgraphC->Draw("pl");
6046 c1->Print(
"itersum.ps");
6048
6049
6050 if (useref)
6051 {
6053 c1->Divide(1, 2, 0.01, 0.01);
6055 boarddiffECgraphA->Draw("ap");
6058 boarddiffECgraphC->Draw("ap");
6061 c1->Print(
"itersum.ps");
6063 }
6064
6066 c1->Divide(1, 2, 0.01, 0.01);
6068 boardECgraphA1->Draw("apl");
6071 boardECgraphC1->Draw("apl");
6073 c1->Print(
"itersum.ps");
6075
6077 c1->Divide(1, 2, 0.01, 0.01);
6079 boardECgraphA2->Draw("apl");
6082 boardECgraphC2->Draw("apl");
6084 c1->Print(
"itersum.ps");
6086
6088 c1->Divide(1, 2, 0.01, 0.01);
6090 boardECgraphA3->Draw("apl");
6093 boardECgraphC3->Draw("apl");
6095 c1->Print(
"itersum.ps");
6097
6098
6099
6100 textpage =
new TextPage(
" RT PLOTS ");
6101 textpage->Print("itersum.ps");
6103
6104 gStyle->SetOptStat(1);
6105 gStyle->SetOptFit(0);
6107 if (rtrelation_bar)
6108 rtrelation_bar->Print("itersum.ps");
6111 if (rtbinning_bar)
6112 rtbinning_bar->Print("itersum.ps");
6115 if (rtrelation21)
6116 rtrelation21->Print("itersum.ps");
6119 if (rtbinning1)
6120 rtbinning1->Print("itersum.ps");
6123 if (rtrelation31)
6124 rtrelation31->Print("itersum.ps");
6127 if (rtbinning2)
6128 rtbinning2->Print("itersum.ps");
6131 if (rtrelation41)
6132 rtrelation41->Print("itersum.ps");
6135 if (rtbinning3)
6136 rtbinning3->Print("itersum.ps");
6139 if (rtrelation51)
6140 rtrelation51->Print("itersum.ps");
6143 if (rtbinning4)
6144 rtbinning4->Print("itersum.ps");
6146
6148 if (binres_bar)
6149 binres_bar->Print("itersum.ps");
6152 if (tbinnedres_bar)
6153 tbinnedres_bar->Print("itersum.ps");
6156 if (binres1)
6157 binres1->Print("itersum.ps");
6160 if (tbinnedres1)
6161 tbinnedres1->Print("itersum.ps");
6164 if (binres2)
6165 binres2->Print("itersum.ps");
6168 if (tbinnedres2)
6169 tbinnedres2->Print("itersum.ps");
6172 binres3->Print("itersum.ps");
6175 if (tbinnedres3)
6176 tbinnedres3->Print("itersum.ps");
6179 binres4->Print("itersum.ps");
6182 if (tbinnedres4)
6183 tbinnedres4->Print("itersum.ps");
6185
6186 gStyle->SetOptStat(0);
6188 if (rtcol)
6189 rtcol->Print("itersum.ps");
6192 if (rtcol1)
6193 rtcol1->Print("itersum.ps");
6195 if (rtcol2)
6196 rtcol2->Print("itersum.ps");
6198 if (isAr && rtArcol2)
6199 rtArcol2->Print("itersum.ps");
6201 if (rtcol3)
6202 rtcol3->Print("itersum.ps");
6204 if (isAr && rtArcol3)
6205 rtArcol3->Print("itersum.ps");
6207 if (rtcol4)
6208 rtcol4->Print("itersum.ps");
6210 if (isAr && rtArcol4)
6211 rtArcol4->Print("itersum.ps");
6213 if (rtcol5)
6214 rtcol5->Print("itersum.ps");
6216 if (isAr && rtArcol5)
6217 rtArcol5->Print("itersum.ps");
6219
6220
6221
6222 DGraph *dgraph0 =
nullptr;
6223 DGraph *dgraph1 =
nullptr;
6224 DGraph *dgraph2 =
nullptr;
6225 DGraph *dgraph3 =
nullptr;
6226 DGraph *dgraph4 =
nullptr;
6227 DGraph *dgraph5 =
nullptr;
6228 bool isinverted = false;
6229 if (datafile->FindKey("TRT_all"))
6230 {
6231 TDirectory *trt = (TDirectory *)datafile->FindKey("TRT_all")->ReadObj();
6232 cout << "MAKING DGraphs" << endl;
6235 dgraph0 =
new DGraph(argv[2],
"-2,-1",
"", -2, -1, isinverted);
6236 if (trt->FindKey("WholeBarrel_1"))
6237 {
6238 dgraph5 =
new DGraph(argv[2],
"-2,-1",
"WholeBarrel_1", -1, -1, isinverted);
6239 }
6240 else
6241 {
6242 cout << " did not find WholeBarrel_1" << endl;
6243 if (trt->FindKey("Detector_1"))
6244 dgraph1 =
new DGraph(argv[2],
"-2,-1",
"Detector_1", 1, -1, isinverted);
6245 if (trt->FindKey("Detector_-1"))
6246 dgraph2 =
new DGraph(argv[2],
"-2,-1",
"Detector_-1", 1, -1, isinverted);
6247 }
6248 if (trt->FindKey("Detector_2"))
6249 dgraph3 =
new DGraph(argv[2],
"-2,-1",
"Detector_2", 1, -1, isinverted);
6250 if (trt->FindKey("Detector_-2"))
6251 dgraph4 =
new DGraph(argv[2],
"-2,-1",
"Detector_-2", 1, -1, isinverted);
6252
6253
6254 TLegend *
leg =
new TLegend(0.8, 0.8, 0.98, 0.95);
6255 if (dgraph0 != nullptr)
6256 {
6257 dgraph0->GetXaxis()->SetRangeUser(-5, 45);
6258 cout << " found TRT_all" << endl;
6259 dgraph0->SetLineWidth(3);
6260 dgraph0->SetLineColor(1);
6261 dgraph0->SetTitle("r(t)");
6262
6263 dgraph0->GetXaxis()->SetTitle("t/ns");
6264
6265 dgraph0->GetYaxis()->SetTitle("R / (mm)");
6266
6268 dgraph0->Draw("apl");
6270 leg->AddEntry(dgraph0,
"Whole TRT",
"l");
6271 }
6272 if (dgraph1 != nullptr)
6273 {
6274 cout << " found Detector_1" << endl;
6275 dgraph1->SetLineWidth(3);
6276 dgraph1->SetLineColor(3);
6278 dgraph1->Draw("pl");
6280 leg->AddEntry(dgraph1,
"Barrel C Side",
"l");
6281 }
6282
6283 if (dgraph2 != nullptr)
6284 {
6285 cout << " found Detector_-1" << endl;
6286 dgraph2->SetLineWidth(3);
6287 dgraph2->SetLineColor(2);
6289 dgraph2->Draw("pl");
6291 leg->AddEntry(dgraph2,
"Barrel A Side",
"l");
6292 }
6293
6294 if (dgraph3 != nullptr)
6295 {
6296 dgraph3->SetLineWidth(3);
6297 cout << " found Detector_2" << endl;
6298 dgraph3->SetLineColor(6);
6300 dgraph3->Draw("pl");
6302 leg->AddEntry(dgraph3,
"Endcap C side",
"l");
6303 }
6304
6305 if (dgraph4 != nullptr)
6306 {
6307 cout << " found Detector_-2" << endl;
6308 dgraph4->SetLineWidth(3);
6309 dgraph4->SetLineColor(7);
6311 dgraph4->Draw("pl");
6313 leg->AddEntry(dgraph4,
"Endcap A side",
"l");
6314 }
6315 if (dgraph5 != nullptr)
6316 {
6317 cout << " found WholeBarrel_1" << endl;
6318 dgraph5->SetLineWidth(3);
6319 dgraph5->SetLineColor(8);
6321 dgraph5->Draw("pl");
6323 leg->AddEntry(dgraph5,
"Whole Barrel",
"l");
6324 }
6325
6326 leg->SetTextSize(0.03);
6328 c1->Print(
"itersum.ps");
6330 }
6331
6332
6340 {
6341
6342 if (datafile->FindKey("TRT_all"))
6343 {
6344 cout << " do_expert: found TRT_all" << endl;
6345 TDirectory *trt = (TDirectory *)datafile->FindKey("TRT_all")->ReadObj();
6346 cout << "MAKING DvGraphs" << endl;
6349 dvgraph0 =
new DvGraph(argv[2],
"-2,-1",
"", -2, -1, isinverted);
6350 if (trt->FindKey("WholeBarrel_1"))
6351 dvgraph5 =
new DvGraph(argv[2],
"-2,-1",
"WholeBarrel_1", -1, -1, isinverted);
6352 else
6353 {
6354 if (trt->FindKey("Detector_1"))
6355 dvgraph1 =
new DvGraph(argv[2],
"-2,-1",
"Detector_1", 1, -1, isinverted);
6356 if (trt->FindKey("Detector_-1"))
6357 dvgraph2 =
new DvGraph(argv[2],
"-2,-1",
"Detector_-1", 1, -1, isinverted);
6358 }
6359 if (trt->FindKey("Detector_2"))
6360 dvgraph3 =
new DvGraph(argv[2],
"-2,-1",
"Detector_2", 1, -1, isinverted);
6361 if (trt->FindKey("Detector_-2"))
6362 dvgraph4 =
new DvGraph(argv[2],
"-2,-1",
"Detector_-2", 1, -1, isinverted);
6363
6364
6365 TLegend *
leg =
new TLegend(0.8, 0.8, 0.98, 0.95);
6366 if (dvgraph0 != nullptr)
6367 {
6368 dvgraph0->GetXaxis()->SetRangeUser(0, 2);
6369 cout << " do_expert: found -2-1" << endl;
6370 dvgraph0->SetLineWidth(3);
6371 dvgraph0->SetLineColor(1);
6372 if (isinverted)
6373 dvgraph0->SetTitle("dt/dr");
6374 else
6375 dvgraph0->SetTitle("dr/dt");
6376 dvgraph0->GetXaxis()->SetTitle("r/mm");
6377 if (isinverted)
6378 dvgraph0->GetYaxis()->SetTitle("dt/dr / (ns/mm)");
6379 else
6380 dvgraph0->GetYaxis()->SetTitle("dr/dt / (mm/ns)");
6382 dvgraph0->Draw("apl");
6384 leg->AddEntry(dvgraph0,
"Whole TRT",
"l");
6385 }
6386 if (dvgraph1 != nullptr)
6387 {
6388 cout << " do_expert: found Detector_1" << endl;
6389 dvgraph1->SetLineWidth(3);
6390 dvgraph1->SetLineColor(3);
6392 dvgraph1->Draw("pl");
6394 leg->AddEntry(dvgraph1,
"Barrel C Side",
"l");
6395 }
6396
6397 if (dvgraph2 != nullptr)
6398 {
6399 dvgraph2->SetLineWidth(3);
6400 dvgraph2->SetLineColor(2);
6402 dvgraph2->Draw("pl");
6404 leg->AddEntry(dvgraph2,
"Barrel A Side",
"l");
6405 }
6406
6407 if (dvgraph3 != nullptr)
6408 {
6409 dvgraph3->SetLineWidth(3);
6410 dvgraph3->SetLineColor(6);
6412 dvgraph3->Draw("pl");
6414 leg->AddEntry(dvgraph3,
"Endcap C side",
"l");
6415 }
6416
6417 if (dvgraph4 != nullptr)
6418 {
6419 dvgraph4->SetLineWidth(3);
6420 dvgraph4->SetLineColor(7);
6422 dvgraph4->Draw("pl");
6424 leg->AddEntry(dvgraph4,
"Endcap A side",
"l");
6425 }
6426 if (dvgraph5 != nullptr)
6427 {
6428 dvgraph5->SetLineWidth(3);
6429 dvgraph5->SetLineColor(8);
6431 dvgraph5->Draw("pl");
6433 leg->AddEntry(dvgraph5,
"Whole Barrel",
"l");
6434 }
6435
6436 leg->SetTextSize(0.03);
6438 c1->Print(
"itersum.ps");
6440 }
6441 }
6442
6443
6445 textpage =
new TextPage(
"Track plots: Only for Experts!!!");
6446 textpage->Print("itersum.ps");
6448
6449 bool istracktuple = false;
6450 TNtuple *Tracktuple = nullptr;
6451 if (datafile->FindKey("tracktuple"))
6452 {
6453 Tracktuple = (TNtuple *)datafile->Get("tracktuple");
6454 istracktuple = true;
6455 }
6456
6457 cout << "MAKING TRACK PLOTS" << endl;
6459 if (istracktuple)
6460 {
6461
6462 if (Tracktuple->GetListOfBranches()->FindObject("trackres"))
6463 {
6465 c1->Divide(2, 1, 0.01, 0.01);
6467 Tracktuple->Draw("trackres>>histRes(100,0,1.5)");
6468 TH1F *histRes = (
TH1F *)gPad->GetPrimitive(
"histRes");
6469 histRes->SetTitle("Residual on track");
6470 histRes->GetXaxis()->SetTitle("Residual (mm)");
6471 histRes->Draw();
6472
6474 Tracktuple->Draw("trackres:t-ttrack-t0>>histRes2d(100,-12,12,100,0,1)", "", "colz");
6475 TH2F *histRes2d = (TH2F *)gPad->GetPrimitive("histRes2d");
6476 histRes2d->SetTitle("Track time residual VS track residual");
6477 histRes2d->GetXaxis()->SetTitle("Time residual (ns)");
6478 histRes2d->GetYaxis()->SetTitle("Track Residual (mm)");
6479 histRes2d->Draw("colz");
6480 TProfile *res2d = histRes2d->ProfileX();
6481 res2d->Draw("same");
6482
6483 c1->Print(
"itersum.ps");
6485 }
6486
6487
6488 if (Tracktuple->GetListOfBranches()->FindObject("pt"))
6489 {
6491 c1->Divide(2, 1, 0.01, 0.01);
6493 Tracktuple->Draw("pt/1000>>histPt(100,0,20)");
6494 TH1F *histPt = (
TH1F *)gPad->GetPrimitive(
"histPt");
6495 histPt->SetTitle("Transverse momentum on track");
6496 histPt->GetXaxis()->SetTitle("Pt (GeV)");
6497 histPt->Draw();
6498
6500 Tracktuple->Draw("trackres:pt/1000>>histPt2d(100,0,20,100,0,1.5)", "", "colz");
6501 TH2F *histPt2d = (TH2F *)gPad->GetPrimitive("histPt2d");
6502 histPt2d->SetTitle("Transverse momentum on track VS track residual");
6503 histPt2d->GetXaxis()->SetTitle("Pt (GeV)");
6504 histPt2d->GetYaxis()->SetTitle("Track Residual (mm)");
6505 histPt2d->Draw("COLZ");
6506 TProfile *pt2d = histPt2d->ProfileX();
6507 pt2d->Draw("same");
6508 c1->Print(
"itersum.ps");
6510 }
6511
6512 if (Tracktuple->GetListOfBranches()->FindObject("theta"))
6513 {
6515 c1->Divide(2, 1, 0.01, 0.01);
6517 Tracktuple->Draw("theta>>histTheta(100,0,4)");
6518 TH1F *histTheta = (
TH1F *)gPad->GetPrimitive(
"histTheta");
6519 histTheta->SetTitle("Theta distribution on track");
6520 histTheta->GetXaxis()->SetTitle("Theta (rad)");
6521 histTheta->Draw();
6522
6524 Tracktuple->Draw("trackres:theta>>histTheta2d(100,0,4,100,0,1.5)", "", "colz");
6525 TH2F *histTheta2d = (TH2F *)gPad->GetPrimitive("histTheta2d");
6526 histTheta2d->SetTitle("Theta distrib. on track VS track residual");
6527 histTheta2d->GetXaxis()->SetTitle("Theta (rad)");
6528 histTheta2d->GetYaxis()->SetTitle("Track Residual (mm)");
6529 histTheta2d->Draw("COLZ");
6530 TProfile *theta2d = histTheta2d->ProfileX();
6531 theta2d->Draw("same");
6532 c1->Print(
"itersum.ps");
6534 }
6535
6536 if (Tracktuple->GetListOfBranches()->FindObject("phi"))
6537 {
6539 c1->Divide(2, 1, 0.01, 0.01);
6541 Tracktuple->Draw("phi>>histPhi(100,-3.5,0)");
6542 TH1F *histPhi = (
TH1F *)gPad->GetPrimitive(
"histPhi");
6543 histPhi->SetTitle("Phi distribution on track");
6544 histPhi->GetXaxis()->SetTitle("Phi (rad)");
6545 histPhi->Draw();
6546
6548 Tracktuple->Draw("trackres:phi>>histPhi2d(100,-3.5,0,100,0,1.5)", "", "colz");
6549 TH2F *histPhi2d = (TH2F *)gPad->GetPrimitive("histPhi2d");
6550 histPhi2d->SetTitle("Phi distrib. on track VS track residual");
6551 histPhi2d->GetXaxis()->SetTitle("Phi (rad)");
6552 histPhi2d->GetYaxis()->SetTitle("Track Residual (mm)");
6553 histPhi2d->Draw("COLZ");
6554 TProfile *phi2d = histPhi2d->ProfileX();
6555 phi2d->Draw("same");
6556 c1->Print(
"itersum.ps");
6558 }
6559
6560 if (Tracktuple->GetListOfBranches()->FindObject("d0"))
6561 {
6563 c1->Divide(2, 1, 0.01, 0.01);
6565 Tracktuple->Draw("d0>>histD0(100,-5,5)");
6566 TH1F *histD0 = (
TH1F *)gPad->GetPrimitive(
"histD0");
6567 histD0->SetTitle("D0 distribution on track");
6568 histD0->GetXaxis()->SetTitle("D0 (mm)");
6569 histD0->Draw();
6570
6572 Tracktuple->Draw("trackres:d0>>histD02d(100,-5,5,100,0,1.5)", "", "colz");
6573 TH2F *histD02d = (TH2F *)gPad->GetPrimitive("histD02d");
6574 histD02d->SetTitle("D0 distrib. on track VS track residual");
6575 histD02d->GetXaxis()->SetTitle("D0 (rad)");
6576 histD02d->GetYaxis()->SetTitle("Track Residual (mm)");
6577 histD02d->Draw("COLZ");
6578 TProfile *d02d = histD02d->ProfileX();
6579 d02d->Draw("same");
6580 c1->Print(
"itersum.ps");
6582 }
6583 }
6584
6585
6586
6587
6588 cout << " Skipping plots for Pulls and Errors " << endl;
6589
6590
6591
6592
6593
6594
6595
6596
6597
6598
6599
6601
6602
6603
6604
6605
6606
6607
6608
6609
6610
6611
6612
6613
6614
6615
6616
6617
6618
6619
6620
6621
6622
6623
6624
6625
6626
6627
6628
6629 cout << " Skipping plots for ToT and HT " << endl;
6630
6631
6632
6633
6634
6635
6636
6637
6638
6639
6640
6642 textpage =
new TextPage(
" ToT Corrections and HT corrections: ");
6643 textpage->Print("itersum.pdf");
6645
6646 cout << "Making ToT / HT Plots" << endl;
6648
6649
6650
6651
6652
6653
6654
6655
6656
6657
6658
6659
6660
6661
6662
6663
6664
6665
6666
6667
6668
6669
6670
6671
6672
6673
6674
6675
6676
6677
6678
6679
6680
6681
6682
6683
6684
6685
6686
6687
6688
6689
6690
6691
6692
6693
6694
6695
6696
6697
6698
6699
6700
6701
6702
6703
6704
6705
6706
6707
6708
6709
6710
6711
6712
6713
6714
6715
6716
6717
6718
6719
6720
6721
6722
6723
6724
6725
6726
6727
6728
6729
6730
6731
6732
6733
6734
6735
6736
6737
6738
6739
6740
6741
6742
6743
6744
6745
6746
6747
6748
6749
6750 datafile->Close();
6751 if (useref)
6752 refdatafile->Close();
6753
6754
6755
6756
6757
6758
6759
6760
6761
6762
6763
6764
6765
6766
6767
6768
6769
6770
6771
6772
6773
6774
6775
6776
6777
6778 if (settings && firstpage)
6779 {
6780 string fixfloat, fieldonoff;
6781 if (settings->
set[
"UsePol0"].find(
"True") != string::npos)
6782 fixfloat = " - floating";
6783 else
6784 fixfloat = " - fixed";
6785 if (settings->
set[
"RtRelation"].find(
"binned") != string::npos)
6786 fixfloat = "";
6787 if (settings->
set[
"Solenoid"].find(
"True") != string::npos)
6788 fieldonoff = "ON";
6789 else
6790 fieldonoff = "OFF";
6791
6792 string pmarking =
6793 string("/Helvetica-Bold findfont 36 scalefont setfont 40 2190 moveto (Run:) show ") +
6794 string(Form(
"/Helvetica findfont 36 scalefont setfont 240 2190 moveto (%i) show ", (
int)firstpage->
runnumber)) +
6795
6796 string("/Helvetica-Bold findfont 36 scalefont setfont 40 2150 moveto (Iteration:) show ") +
6797 string(Form(
"/Helvetica findfont 36 scalefont setfont 240 2150 moveto (%02i) show ", firstpage->
iter)) +
6798
6799 string("/Helvetica-Bold findfont 36 scalefont setfont 40 2110 moveto (Rt relation:) show ") +
6800 string(Form(
"/Helvetica findfont 36 scalefont setfont 240 2110 moveto (%s%s) show ", settings->
set[
"RtRelation"].data(), fixfloat.data())) +
6801
6802 string("/Helvetica-Bold findfont 36 scalefont setfont 540 2190 moveto (Rt binning:) show ") +
6803 string(Form(
"/Helvetica findfont 36 scalefont setfont 740 2190 moveto (%s) show ", settings->
set[
"RtBinning"].data())) +
6804
6805 string("/Helvetica-Bold findfont 36 scalefont setfont 540 2150 moveto (Rt level:) show ") +
6806
6807 string("/Helvetica-Bold findfont 36 scalefont setfont 540 2110 moveto (T0 level:) show ") +
6808
6809 string("/Helvetica-Bold findfont 36 scalefont setfont 1040 2190 moveto (Solenoid:) show ") +
6810 string(Form("/Helvetica findfont 36 scalefont setfont 1260 2190 moveto (%s) show ", fieldonoff.data())) +
6811
6812 string("/Helvetica-Bold findfont 36 scalefont setfont 1040 2150 moveto (SW release:) show ") +
6813 string(Form(
"/Helvetica findfont 36 scalefont setfont 1260 2150 moveto (%s) show ", settings->
set[
"ReleaseRec"].data())) +
6814
6815 string("/Helvetica-Bold findfont 36 scalefont setfont 1040 2110 moveto (T0 Offset:) show ") +
6816 string(Form(
"/Helvetica findfont 36 scalefont setfont 1260 2110 moveto (%s) show ", settings->
set[
"T0Offset"].data())) +
6817
6818 string("/Helvetica-Bold findfont 30 scalefont setfont 40 2060 moveto (Data:) show ") +
6819 string(Form(
"/Helvetica findfont 30 scalefont setfont 240 2060 moveto (%s) show ", settings->
set[
"Inputdir"].data())) +
6820
6821 string("/Helvetica-Bold findfont 30 scalefont setfont 40 2020 moveto (Start const:) show ") +
6822 string(Form(
"/Helvetica findfont 30 scalefont setfont 240 2020 moveto (%s) show ", settings->
set[
"StartConst"].data()));
6823 system((
string(
"sed -i 's?showpage?" + pmarking +
"showpage?g' itersum.ps")).
data());
6824 }
6825
6826
6827 datafile = new TFile(argv[2], "UPDATE");
6828 datafile->cd();
6829 if (datafile->FindKey("analysis"))
6830 datafile->rmdir("analysis");
6831 TDirectory *adir = datafile->mkdir("analysis", "analysis");
6832 adir->cd();
6833 if (chipgraphA)
6834 chipgraphA->Write();
6835 if (chipgraphC)
6836 chipgraphC->Write();
6837 boardgraphA->Write();
6838 boardgraphC->Write();
6839 if (refboardgraphA)
6840 refboardgraphA->Write();
6841 if (refboardgraphC)
6842 refboardgraphC->Write();
6843 if (dvgraph0)
6844 dvgraph0->Write();
6845 if (dvgraph1)
6846 dvgraph1->Write();
6847 if (dvgraph2)
6848 dvgraph2->Write();
6849 datafile->Write();
6850 datafile->Close();
6851
6852 return 0;
6853}
char data[hepevt_bytes_allocation_ATLAS]
void DrawLines(float, float)
vector< TH1D * > reshists
map< string, string > set
TH1F(name, title, nxbins, bins_par2, bins_par3=None, path='', **kwargs)