ATLAS Offline Software
Loading...
Searching...
No Matches
TRTCalib_makeplots.cxx File Reference
#include "CxxUtils/checker_macros.h"
#include <fstream>
#include <sstream>
#include <iomanip>
#include <stdlib.h>
#include <stdio.h>
#include <math.h>
#include <iostream>
#include <exception>
#include <TNtuple.h>
#include <TFile.h>
#include <TKey.h>
#include <TH1F.h>
#include <TH2F.h>
#include <TGraphErrors.h>
#include <TF1.h>
#include <TStyle.h>
#include <TCanvas.h>
#include <THStack.h>
#include <TLine.h>
#include <TLegend.h>
#include <TLegendEntry.h>
#include <TEventList.h>
#include <TPad.h>
#include <TPaveText.h>
#include <TPaveStats.h>
#include <TPaletteAxis.h>
#include <TProfile.h>
#include <TROOT.h>
#include <TError.h>
#include <TVectorD.h>
#include <map>
#include <string>
#include <vector>
#include <stdexcept>

Go to the source code of this file.

Classes

class  TextPage
class  NHitStack
class  HitStatistics
class  XYMaps
class  T0CalTypeXY
class  T0CalibTypeXY
class  ChipVariations
class  BoardVariations
class  BoardVariationsDiff
class  BoardVariationsOldT0
class  BoardVariationsRes
class  BoardVariationsTRes1
class  BoardVariationsTRes
class  DvGraph
class  DGraph
class  RtGraphs
class  XYMapsEC
class  RtColor
class  ResidualPlots
class  TRTPlots
class  TBinnedRes
class  RtBinning
class  RresTbin
class  FirstPage
class  SettingsInfo
class  TrackTupleInfo
class  PtDependence
class  TBDependence
class  ToTDependence
class  SinDependence

Functions

void SetZAxis (TH2F *reshist0)
void ResizePalette (TH2 *hist)
string trim (string s)
TGraphErrors * GetMean (TH2F *histo)
TGraphErrors * GetMeanE (TH2F *histo)
TGraphErrors * GetPn (TH2F *histo)
TGraphErrors * GetWidth (TH2F *histo)
TGraphErrors * GetEntries (TH2F *histo)
TGraphErrors * GetPWidth (TH2F *histo)
int itersum (int argc, char *argv[])
int tt_remove (int, char *argv[])
int main (int argc, char *argv[])

Variables

 ATLAS_NO_CHECK_FILE_THREAD_SAFETY
bool do_expert = false
char detlet [3] = {'C', '-', 'A'}

Function Documentation

◆ GetEntries()

TGraphErrors * GetEntries ( TH2F * histo)

Definition at line 4025 of file TRTCalib_makeplots.cxx.

4026{
4027 if (!histo)
4028 return nullptr;
4029 int const nxbins = histo->GetNbinsX();
4030 TGraphErrors *Means = new TGraphErrors(nxbins);
4031 float mean = 0;
4032 float rms = 0;
4033 TF1 *ff = new TF1("ff", "gaus");
4034 for (int i = 0; i < nxbins; i++)
4035 {
4036 TH1D *slice = histo->ProjectionY("slice", i + 1, i + 1);
4037 mean = slice->GetEntries();
4038 rms = sqrt(mean);
4039 float x = histo->GetBinCenter(i + 1);
4040 Means->SetPoint(i, x, mean);
4041 Means->SetPointError(i, 0.5 * histo->GetBinWidth(i), rms);
4042 delete slice;
4043 }
4044 delete ff;
4045 return Means;
4046}
#define x
void mean(std::vector< double > &bins, std::vector< double > &values, const std::vector< std::string > &files, const std::string &histname, const std::string &tplotname, const std::string &label="")

◆ GetMean()

TGraphErrors * GetMean ( TH2F * histo)

Definition at line 3913 of file TRTCalib_makeplots.cxx.

3914{
3915
3916 if (!histo)
3917 return nullptr;
3918 int const nxbins = histo->GetNbinsX();
3919 TGraphErrors *Means = new TGraphErrors(nxbins);
3920 float mean = 0;
3921 float rms = 0;
3922 TF1 *ff = new TF1("ff", "gaus");
3923 for (int i = 0; i < nxbins; i++)
3924 {
3925 TH1D *slice = histo->ProjectionY("slice", i + 1, i + 1);
3926 mean = slice->GetMean();
3927 rms = slice->GetRMS();
3928 ff->SetParameter(0, slice->GetEntries());
3929 ff->SetParameter(1, mean);
3930 ff->SetParameter(2, rms);
3931 mean = ff->GetParameter(1);
3932 rms = ff->GetParameter(2);
3933 float x = histo->GetBinCenter(i + 1);
3934 Means->SetPoint(i, x, mean);
3935 Means->SetPointError(i, 0.5 * histo->GetBinWidth(i), ff->GetParError(1));
3936 delete slice;
3937 }
3938 delete ff;
3939 return Means;
3940}

◆ GetMeanE()

TGraphErrors * GetMeanE ( TH2F * histo)

Definition at line 3942 of file TRTCalib_makeplots.cxx.

3943{
3944
3945 if (!histo)
3946 return nullptr;
3947 int const nxbins = histo->GetNbinsX();
3948 TGraphErrors *Means = new TGraphErrors(nxbins);
3949 float mean = 0;
3950 // float rms = 0;
3951 TF1 *ff = new TF1("ff", "gaus");
3952 for (int i = 0; i < nxbins; i++)
3953 {
3954 TH1D *slice = histo->ProjectionY("slice", i + 1, i + 1);
3955 mean = slice->GetMean();
3956 // rms = slice->GetRMS();
3957 float x = histo->GetBinCenter(i + 1);
3958 Means->SetPoint(i, x, mean);
3959 Means->SetPointError(i, 0.5 * histo->GetBinWidth(i), ff->GetParError(1));
3960 delete slice;
3961 }
3962 delete ff;
3963 return Means;
3964}

◆ GetPn()

TGraphErrors * GetPn ( TH2F * histo)

Definition at line 3966 of file TRTCalib_makeplots.cxx.

3967{
3968
3969 if (!histo)
3970 return nullptr;
3971 int const nxbins = histo->GetNbinsX();
3972 TGraphErrors *Means = new TGraphErrors(nxbins);
3973 float mean = 0;
3974 // float rms = 0;
3975 TF1 *ff = new TF1("ff", "gaus");
3976 for (int i = 0; i < nxbins; i++)
3977 {
3978 TH1D *slice = histo->ProjectionY("slice", i + 1, i + 1);
3979 mean = slice->GetEntries();
3980 float x = histo->GetBinCenter(i + 1);
3981 Means->SetPoint(i, x, mean);
3982 Means->SetPointError(i, 0.5 * histo->GetBinWidth(i), ff->GetParError(1));
3983 delete slice;
3984 }
3985 delete ff;
3986 return Means;
3987}

◆ GetPWidth()

TGraphErrors * GetPWidth ( TH2F * histo)

Definition at line 4048 of file TRTCalib_makeplots.cxx.

4049{
4050 if (!histo)
4051 return nullptr;
4052 int const nxbins = histo->GetNbinsX();
4053 TGraphErrors *Means = new TGraphErrors(nxbins);
4054 float mean = 0;
4055 float rms = 0;
4056 TF1 *ff = new TF1("ff", "gaus");
4057 for (int i = 0; i < nxbins; i++)
4058 {
4059 TH1D *slice = histo->ProjectionY("slice", i + 1, i + 1);
4060 mean = slice->GetMean();
4061 rms = slice->GetRMS();
4062 ff->SetParameter(0, slice->GetEntries());
4063 ff->SetParameter(1, mean);
4064 ff->SetParameter(2, rms);
4065 // int fitresult = slice->Fit("ff", "QR", "", -2.5, +2.5);
4066 mean = ff->GetParameter(1);
4067 rms = ff->GetParameter(2);
4068 // fitresult = slice->Fit("ff", "QR", "", -2.5, 2.5);
4069 mean = ff->GetParameter(1);
4070 rms = ff->GetParameter(2);
4071 // fitresult = slice->Fit("ff", "QR", "", -2.5, 2.5);
4072 float x = histo->GetBinCenter(i + 1);
4073 Means->SetPoint(i, x, rms);
4074 Means->SetPointError(i, 0.5 * histo->GetBinWidth(i), ff->GetParError(2));
4075 delete slice;
4076 }
4077 delete ff;
4078 return Means;
4079}

◆ GetWidth()

TGraphErrors * GetWidth ( TH2F * histo)

Definition at line 3989 of file TRTCalib_makeplots.cxx.

3990{
3991 if (!histo)
3992 return nullptr;
3993 int const nxbins = histo->GetNbinsX();
3994 TGraphErrors *Means = new TGraphErrors(nxbins);
3995 float mean = 0;
3996 float rms = 0;
3997 TF1 *ff = new TF1("ff", "gaus");
3998 for (int i = 0; i < nxbins; i++)
3999 {
4000 TH1D *slice = histo->ProjectionY("slice", i + 1, i + 1);
4001 mean = slice->GetMean();
4002 rms = slice->GetRMS();
4003 ff->SetParameter(0, slice->GetEntries());
4004 ff->SetParameter(1, mean);
4005 ff->SetParameter(2, rms);
4006 // int fitresult = slice->Fit("ff", "QR", "", mean - 1.5 * rms, mean + 1.5 * rms);
4007 mean = ff->GetParameter(1);
4008 rms = ff->GetParameter(2);
4009 for (int j = 0; j < 6; j++)
4010 {
4011 // fitresult = slice->Fit("ff", "QR", "", mean - 1.5 * rms, mean + 1.5 * rms);
4012
4013 rms = ff->GetParameter(2);
4014 }
4015 // fitresult = slice->Fit("ff", "QR", "", mean - 1.5 * rms, mean + 1.5 * rms);
4016 float x = histo->GetBinCenter(i + 1);
4017 Means->SetPoint(i, x, rms);
4018 Means->SetPointError(i, 0.5 * histo->GetBinWidth(i), ff->GetParError(2));
4019 delete slice;
4020 }
4021 delete ff;
4022 return Means;
4023}

◆ itersum()

int itersum ( int argc,
char * argv[] )

Definition at line 5119 of file TRTCalib_makeplots.cxx.

5120{
5121
5122 string inputfile = string(argv[2]);
5123 TFile *datafile = new TFile(argv[2]);
5124 if (datafile->IsZombie())
5125 {
5126 cout << "ERROR! INPUT FILE DOES NOT EXIST!" << endl;
5127 exit(-1);
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 // Here we have to do the fix, because the trees are duplicated
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 // First page on Shifter report, general information
5160 cout << "MAKING FirstPage" << endl;
5161 FirstPage *firstpage = nullptr;
5162 try
5163 {
5164 firstpage = new FirstPage(argv[2], datafile);
5165 }
5166 catch (string e)
5167 {
5168 cout << e << endl;
5169 }
5170
5171 // Add a page with the settings:
5172 cout << "MAKING Settings" << endl;
5173 SettingsInfo *settings = nullptr;
5174 // if (argv[3]) try { settings = new SettingsInfo(argv[3]); } catch (string e) { cout << e << endl; }
5175
5176 // Tracktuple info
5177 cout << "MAKING TracktupleInfo" << endl;
5178 TrackTupleInfo *tracktupleinfo = nullptr;
5179 try
5180 {
5181 tracktupleinfo = new TrackTupleInfo(datafile);
5182 }
5183 catch (string e)
5184 {
5185 cout << e << endl;
5186 }
5187
5188 // Hit statistics
5189 HitStatistics *hitstat = nullptr;
5190 cout << "MAKING HitStatistics" << endl;
5191 hitstat = new HitStatistics(argv[2]);
5192
5193 HitStatistics *hitstatAr = nullptr;
5194 if (isAr)
5195 {
5196 cout << "MAKING Ar HitStatistics" << endl;
5197 hitstatAr = new HitStatistics(argv[2], true);
5198 }
5199
5200 // TRT Global Results:
5201 cout << "MAKING TRTPlots" << endl;
5202 // SERGI - What is the purpose of the lines commented below? (TRTPlots *TRTresplots and *TRTresplotsAr are not used at anywhere)
5203 // TRTPlots *TRTresplots = nullptr;
5204 // try
5205 // {
5206 // TRTresplots = new TRTPlots(datafile);
5207 // }
5208 // catch (string e)
5209 // {
5210 // cout << e << endl;
5211 // }
5212 // TRTPlots *TRTresplotsAr = nullptr;
5213 if (isAr)
5214 // try
5215 // {
5216 // TRTresplotsAr = new TRTPlots(datafile, true);
5217 // }
5218 // catch (string e)
5219 // {
5220 // cout << e << endl;
5221 // }
5222
5223 // Residual and time residual (TRT and both barrels)
5224 cout << "MAKING ResidualPlots" << endl;
5225 ResidualPlots *resplots = nullptr;
5226 try
5227 {
5228 resplots = new ResidualPlots(datafile);
5229 }
5230 catch (string e)
5231 {
5232 cout << e << endl;
5233 }
5234 ResidualPlots *resplotsAr = nullptr;
5235 if (isAr)
5236 try
5237 {
5238 resplotsAr = new ResidualPlots(datafile, true);
5239 }
5240 catch (string e)
5241 {
5242 cout << e << endl;
5243 }
5244
5245 // Do t0 calibration type:
5246 cout << "MAKING T0CalibTypeXY" << endl;
5247 T0CalibTypeXY *hitstatxy = new T0CalibTypeXY(argv[2]);
5248 T0CalibTypeXY *hitstatxyAr = nullptr;
5249 if (isAr)
5250 hitstatxyAr = new T0CalibTypeXY(argv[2], true);
5251
5252 // Do hits plots:
5253 cout << "MAKING XYMaps(nt0)" << endl;
5254 XYMaps *nhits = new XYMaps(argv[2], "nt0");
5255 XYMaps *nhitsAr = nullptr;
5256 if (isAr)
5257 nhitsAr = new XYMaps(argv[2], "nt0", true);
5258 // Do res plot:
5259 cout << "MAKING XYMaps(res)" << endl;
5260 XYMaps *resxy0 = new XYMaps(argv[2], "res");
5261 XYMaps *resxy0Ar = nullptr;
5262 if (isAr)
5263 resxy0Ar = new XYMaps(argv[2], "res", true);
5264 // Do residual center plot:
5265 cout << "MAKING XYMaps(resmean)" << endl;
5266 XYMaps *resxy = new XYMaps(argv[2], "abs(resMean)");
5267 XYMaps *resxyAr = nullptr;
5268 if (isAr)
5269 resxyAr = new XYMaps(argv[2], "abs(resMean)", true);
5270 // Do t0s plots:
5271 cout << "MAKING XYMaps(t0)" << endl;
5272 XYMaps *xymap = new XYMaps(argv[2], "t0");
5273 XYMaps *xymapAr = nullptr;
5274 if (isAr)
5275 xymapAr = new XYMaps(argv[2], "t0", true);
5276 // Do Oldt0plots:
5277 cout << "MAKING XYMaps(oldt0)" << endl;
5278 XYMaps *oldt0 = new XYMaps(argv[2], "oldt0");
5279 XYMaps *oldt0Ar = nullptr;
5280 if (isAr)
5281 oldt0Ar = new XYMaps(argv[2], "oldt0", true);
5282 // Do t0 diff:
5283 cout << "MAKING XYMaps(t0-oldt0)" << endl;
5284 XYMaps *oldt01 = new XYMaps(argv[2], "abs(t0-oldt0)");
5285 XYMaps *oldt01Ar = nullptr;
5286 if (isAr)
5287 oldt01Ar = new XYMaps(argv[2], "abs(t0-oldt0)", true); // changed from t0-old-t0
5288 // Do t0 diff mean:
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 // Do t0 width:
5295 cout << "MAKING XYMaps(tres)" << endl;
5296 XYMaps *oldt011 = new XYMaps(argv[2], "(tres)");
5297 XYMaps *oldt011Ar = nullptr;
5298 if (isAr)
5299 oldt011Ar = new XYMaps(argv[2], "(tres)", true);
5300
5301 // Add the plot for Chip T0 (board offset) variations
5302 ChipVariations *chipgraphA = nullptr;
5303 ChipVariations *chipgraphC = nullptr;
5304 if (datafile->FindKey("TRT_all"))
5305 {
5306 cout << "MAKING ChipVariations" << endl;
5307 chipgraphA = new ChipVariations(argv[2], 1);
5308 chipgraphC = new ChipVariations(argv[2], -1);
5309 }
5310
5311 // Add the plot for Board T0 variations
5312 BoardVariationsOldT0 *refboardgraphA = nullptr;
5313 BoardVariationsOldT0 *refboardgraphC = nullptr;
5314 BoardVariationsDiff *boarddiffgraphA = nullptr;
5315 BoardVariationsDiff *boarddiffgraphC = nullptr;
5316 if (useref)
5317 {
5318 cout << "MAKING BoardVariationsOldT0" << endl;
5319 refboardgraphA = new BoardVariationsOldT0(argv[4], 1);
5320 refboardgraphC = new BoardVariationsOldT0(argv[4], -1);
5321 refboardgraphA->SetLineColor(2);
5322 refboardgraphC->SetLineColor(2);
5323 cout << "MAKING BoardVariationsDiff" << endl;
5324 boarddiffgraphA = new BoardVariationsDiff(argv[2], argv[4], 1);
5325 boarddiffgraphC = new BoardVariationsDiff(argv[2], argv[4], -1);
5326 }
5327 // Add the plot for Board T0 variations
5328 cout << "MAKING BoardVariations" << endl;
5329 BoardVariations *boardgraphA = new BoardVariations(argv[2], 1);
5330 BoardVariations *boardgraphC = new BoardVariations(argv[2], -1);
5331 // Add the plot for the residual
5332 cout << "MAKING BoardVariationsRes" << endl;
5333 BoardVariationsRes *boardgraphA1 = new BoardVariationsRes(argv[2], 1);
5334 BoardVariationsRes *boardgraphC1 = new BoardVariationsRes(argv[2], -1);
5335 // Add the plot for the Time residual
5336 cout << "MAKING BoardVariationsTRes" << endl;
5337 BoardVariationsTRes *boardgraphA2 = new BoardVariationsTRes(argv[2], 1);
5338 BoardVariationsTRes *boardgraphC2 = new BoardVariationsTRes(argv[2], -1);
5339 // Add the plot for the sigma Time residual
5340 cout << "MAKING BoardVariationsTRes1" << endl;
5341 BoardVariationsTRes1 *boardgraphA3 = new BoardVariationsTRes1(argv[2], 1);
5342 BoardVariationsTRes1 *boardgraphC3 = new BoardVariationsTRes1(argv[2], -1);
5343
5344 // RtGraphs* rtrelation11=nullptr;
5345 RtGraphs *rtrelation_bar = nullptr;
5346 RtGraphs *rtrelation21 = nullptr;
5347 RtGraphs *rtrelation31 = nullptr;
5348 RtGraphs *rtrelation41 = nullptr;
5349 RtGraphs *rtrelation51 = nullptr;
5350 RtBinning *rtbinning_bar = nullptr;
5351 RtBinning *rtbinning1 = nullptr;
5352 RtBinning *rtbinning2 = nullptr;
5353 RtBinning *rtbinning3 = nullptr;
5354 RtBinning *rtbinning4 = 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 {
5368 cout << e << endl;
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 {
5379 cout << e << endl;
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 {
5390 cout << e << endl;
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 {
5401 cout << e << endl;
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 {
5412 cout << e << endl;
5413 }
5414 }
5415 // r plots for each t-bin
5416 cout << "MAKING Rt binning" << endl;
5417
5418 // No Xenon for Barrel in Run3
5419 // rtbinning_bar=new RtBinning(trt,"WholeBarrel_1");
5420 // cout << "MAKING Rt binning for Detector_-1" << endl;
5421 // rtbinning1=new RtBinning(trt,"Detector_-1");
5422 // cout << "MAKING Rt binning for Detector_1" << endl;
5423 // rtbinning2=new RtBinning(trt,"Detector_1");
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 // Binned residual plots
5431 RresTbin *binres_bar = nullptr;
5432 RresTbin *binres1 = nullptr;
5433 RresTbin *binres2 = nullptr;
5434 RresTbin *binres3 = nullptr;
5435 RresTbin *binres4 = nullptr;
5436 TBinnedRes *tbinnedres_bar = nullptr;
5437 TBinnedRes *tbinnedres1 = nullptr;
5438 TBinnedRes *tbinnedres2 = nullptr;
5439 TBinnedRes *tbinnedres3 = nullptr;
5440 TBinnedRes *tbinnedres4 = nullptr;
5441
5442 cout << "MAKING Binned Residual" << endl;
5443 // No Xenon hists for Barrel in Run3
5444 // binres_bar=new RresTbin(datafile,"WholeBarrel_1",4);
5445 // tbinnedres_bar=new TBinnedRes(datafile,binres_bar->reshists);
5446 // cout << "MAKING Binned Residual for Detector_-1" << endl;
5447 // binres1=new RresTbin(datafile,"Detector_-1",-1);
5448 // tbinnedres1=new TBinnedRes(datafile,binres1->reshists);
5449 // cout << "MAKING Binned Residual for Detector_1" << endl;
5450 // binres2=new RresTbin(datafile,"Detector_1",1);
5451 // tbinnedres2=new TBinnedRes(datafile,binres2->reshists);
5452 cout << "MAKING Binned Residual for Detector_-2" << endl;
5453 binres3 = new RresTbin(datafile, "Detector_-2", -2);
5454 tbinnedres3 = new TBinnedRes(datafile, binres3->reshists);
5455 cout << "MAKING Binned Residual for Detector_2" << endl;
5456 binres4 = new RresTbin(datafile, "Detector_2", 2);
5457 tbinnedres4 = new TBinnedRes(datafile, binres4->reshists);
5458
5459 RtColor *rtcol = nullptr;
5460 RtColor *rtcol1 = nullptr;
5461 RtColor *rtcol2 = nullptr;
5462 RtColor *rtcol3 = nullptr;
5463 RtColor *rtcol4 = nullptr;
5464 RtColor *rtcol5 = nullptr;
5465 // Rt relation, default plot
5466 cout << "MAKING RtColor" << endl;
5467
5468 if (datafile->FindKey("TRT_all"))
5469 {
5470 cout << " found TRT_all " << endl;
5471
5472 // no Xenon RtColor plot for entire TRT
5473 // rtcol= new RtColor(argv[2],"");
5474
5475 TDirectory *trt = (TDirectory *)datafile->FindKey("TRT_all")->ReadObj();
5476
5477 // No Xenon Rt plots for barrel in Run3
5478 /*
5479 if (trt->FindKey("WholeBarrel_1")){
5480 cout << " MAKING RtColor WholeBarrel" << endl;
5481 try {rtcol1= new RtColor(argv[2],"WholeBarrel_1");}
5482 catch (string e){cout << e << endl;}
5483 }
5484
5485
5486 if (trt->FindKey("Detector_-1")){
5487 cout << " MAKING RtColor Detector_-1" << endl;
5488 try {rtcol2= new RtColor(argv[2],"Detector_-1");}
5489 catch (string e){cout << e << endl;}
5490 }
5491
5492 if (trt->FindKey("Detector_1")){
5493 cout << " MAKING RtColor Detector_1" << endl;
5494 try {rtcol3= new RtColor(argv[2],"Detector_1");}
5495 catch (string e){cout << e << endl;}
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 {
5508 cout << e << endl;
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 {
5521 cout << e << endl;
5522 }
5523 }
5524 }
5525 // ARGON!!
5526 // SERGI - Is this actually used for something????
5527 // RtGraphs *rtArrelation_bar = nullptr;
5528 // RtGraphs *rtArrelation21 = nullptr;
5529 // RtGraphs *rtArrelation31 = nullptr;
5530 // RtGraphs *rtArrelation41 = nullptr;
5531 // RtGraphs *rtArrelation51 = nullptr;
5532 // RtBinning *rtArbinning_bar = nullptr;
5533 // RtBinning *rtArbinning1 = nullptr;
5534 // RtBinning *rtArbinning2 = nullptr;
5535 // RtBinning *rtArbinning3 = nullptr;
5536 // RtBinning *rtArbinning4 = nullptr;
5537 // if (datafile->FindKey("TRT_Ar_all"))
5538 // {
5539 // cout << "MAKING AR RtGraphs" << endl;
5540 // TDirectory *trtAr = (TDirectory *)datafile->FindKey("TRT_Ar_all")->ReadObj();
5541
5542 // if (trtAr->FindKey("Detector_Ar_-1/binhist"))
5543 // {
5544 // cout << " Found Detector_Ar_-1/binhist" << endl;
5545 // rtArbinning1 = new RtBinning(trtAr, "Detector_Ar_-1");
5546 // try
5547 // {
5548 // rtArrelation21 = new RtGraphs(argv[2], "Detector_Ar_-1", true);
5549 // }
5550 // catch (string e)
5551 // {
5552 // cout << e << endl;
5553 // }
5554 // }
5555
5556 // if (trtAr->FindKey("Detector_Ar_1/binhist"))
5557 // {
5558 // cout << " Found Detector_Ar_1/binhist" << endl;
5559 // rtArbinning2 = new RtBinning(trtAr, "Detector_Ar_1");
5560 // try
5561 // {
5562 // rtArrelation31 = new RtGraphs(argv[2], "Detector_Ar_1", true);
5563 // }
5564 // catch (string e)
5565 // {
5566 // cout << e << endl;
5567 // }
5568 // }
5569
5570 // if (trtAr->FindKey("Detector_Ar_-2/binhist"))
5571 // {
5572 // cout << " Found Detector_Ar_-2/binhist" << endl;
5573 // rtArbinning3 = new RtBinning(trtAr, "Detector_Ar_-2");
5574 // try
5575 // {
5576 // rtArrelation41 = new RtGraphs(argv[2], "Detector_Ar_-2", true);
5577 // }
5578 // catch (string e)
5579 // {
5580 // cout << e << endl;
5581 // }
5582 // }
5583 // if (trtAr->FindKey("Detector_Ar_2/binhist"))
5584 // {
5585
5586 // TDirectory *test = (TDirectory *)(((TDirectory *)trtAr->Get("Detector_Ar_2")));
5587 // if (test->FindKey("binhist"))
5588 // {
5589 // cout << " Found Detector_Ar_2/binhist" << endl;
5590 // rtArbinning4 = new RtBinning(trtAr, "Detector_Ar_2");
5591 // try
5592 // {
5593 // rtArrelation51 = new RtGraphs(argv[2], "Detector_Ar_2", true);
5594 // }
5595 // catch (string e)
5596 // {
5597 // cout << e << endl;
5598 // }
5599 // }
5600 // }
5601 // // r plots for each t-bin
5602 // cout << " MAKING AR Rt binning" << endl;
5603 // }
5604
5605 // Binned residual plots
5606 // RresTbin *binresAr_bar_bar = nullptr;
5607 // RresTbin *binresAr_bar1 = nullptr;
5608 // RresTbin *binresAr_bar2 = nullptr;
5609 // RresTbin *binresAr_bar3 = nullptr;
5610 // RresTbin *binresAr_bar4 = nullptr;
5611 // TBinnedRes *tbinnedArres_bar = nullptr;
5612 // TBinnedRes *tbinnedArres1 = nullptr;
5613 // TBinnedRes *tbinnedArres2 = nullptr;
5614 // TBinnedRes *tbinnedArres3 = nullptr;
5615 // TBinnedRes *tbinnedArres4 = nullptr;
5616
5617 cout << "MAKING RT Binned Residual for Ar" << endl;
5618
5619 TDirectory *trtAr = (TDirectory *)datafile->FindKey("TRT_Ar_all")->ReadObj();
5620 // if (trtAr->FindKey("WholeBarrel_Ar_1")) binresAr_bar_bar = new RresTbin(datafile,"WholeBarrel_Ar_1",4);
5621 // if (trtAr->FindKey("Detector_Ar_-1"))
5622 // binresAr_bar1 = new RresTbin(datafile, "Detector_Ar_-1", -1);
5623 // if (trtAr->FindKey("Detector_Ar_1"))
5624 // binresAr_bar2 = new RresTbin(datafile, "Detector_Ar_1", 1);
5625 // if (trtAr->FindKey("Detector_Ar_-2"))
5626 // binresAr_bar3 = new RresTbin(datafile, "Detector_Ar_-2", -2);
5627 // if (trtAr->FindKey("Detector_Ar_2"))
5628 // binresAr_bar4 = new RresTbin(datafile, "Detector_Ar_2", 2);
5629
5630 cout << "MAKING RT Binned Abs Residual for Ar" << endl;
5631
5632 // tbinnedArres_bar = new TBinnedRes(datafile,binresAr_bar_bar->reshists);
5633 // tbinnedArres1 = new TBinnedRes(datafile, binresAr_bar1->reshists);
5634 // tbinnedArres2 = new TBinnedRes(datafile, binresAr_bar2->reshists);
5635 // tbinnedArres3 = new TBinnedRes(datafile, binresAr_bar3->reshists);
5636 // tbinnedArres4 = new TBinnedRes(datafile, binresAr_bar4->reshists);
5637
5638 // RtColor *rtArcol = nullptr;
5639 // RtColor *rtArcol1 = nullptr;
5640 RtColor *rtArcol2 = nullptr;
5641 RtColor *rtArcol3 = nullptr;
5642 RtColor *rtArcol4 = nullptr;
5643 RtColor *rtArcol5 = nullptr;
5644 // Rt relation, default plot
5645 // if (datafile->FindKey("TRT_Ar_all/rt-relation"))
5646 // {
5647 // cout << "MAKING AR RtColor all TRT" << endl;
5648 // try
5649 // {
5650 // rtArcol = new RtColor(argv[2], "", true);
5651 // }
5652 // catch (string e)
5653 // {
5654 // cout << e << endl;
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 {
5667 cout << e << endl;
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 {
5679 cout << e << endl;
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 {
5691 cout << e << endl;
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 {
5703 cout << e << endl;
5704 }
5705 }
5706 // Add the plot for Board T0 variations
5707 BoardVariationsOldT0 *refboardECgraphA = nullptr;
5708 BoardVariationsOldT0 *refboardECgraphC = nullptr;
5709 BoardVariationsDiff *boarddiffECgraphA = nullptr;
5710 BoardVariationsDiff *boarddiffECgraphC = nullptr;
5711 if (useref)
5712 {
5713 cout << "MAKING BoardVariationsOldT0 for Ar" << endl;
5714 refboardECgraphA = new BoardVariationsOldT0(argv[4], 2);
5715 refboardECgraphC = new BoardVariationsOldT0(argv[4], -2);
5716 cout << "MAKING BoardVariationsDiff Ar" << endl;
5717 boarddiffECgraphA = new BoardVariationsDiff(argv[2], argv[4], 2);
5718 boarddiffECgraphC = new BoardVariationsDiff(argv[2], argv[4], -2);
5719 boarddiffECgraphA->SetLineColor(2);
5720 boarddiffECgraphC->SetLineColor(2);
5721 }
5722 // Add the plot for Board T0 variations
5723 cout << "MAKING BoardVariations Ar" << endl;
5724 BoardVariations *boardECgraphA = new BoardVariations(argv[2], 2);
5725 BoardVariations *boardECgraphC = new BoardVariations(argv[2], -2);
5726 // Add the plot for the residual
5727 cout << "MAKING BoardVariationsRes Ar" << endl;
5728 BoardVariationsRes *boardECgraphA1 = new BoardVariationsRes(argv[2], 2);
5729 BoardVariationsRes *boardECgraphC1 = new BoardVariationsRes(argv[2], -2);
5730 // Add the plot for the Time residual
5731 cout << "MAKING BoardVariationsTRes Ar" << endl;
5732 BoardVariationsTRes *boardECgraphA2 = new BoardVariationsTRes(argv[2], 2);
5733 BoardVariationsTRes *boardECgraphC2 = new BoardVariationsTRes(argv[2], -2);
5734 // Add the plot for the sigma Time residual
5735 cout << "MAKING BoardVariationsTRes1" << endl;
5736 BoardVariationsTRes1 *boardECgraphA3 = new BoardVariationsTRes1(argv[2], 2);
5737 BoardVariationsTRes1 *boardECgraphC3 = new BoardVariationsTRes1(argv[2], -2);
5738
5739 cout << " Start printing itersum.ps" << endl;
5740
5741 TCanvas *textpage;
5742
5743 TCanvas *c1 = new TCanvas();
5744 c1->Print("itersum.ps[");
5745 c1->cd();
5746
5747 if (firstpage)
5748 firstpage->Print("itersum.ps");
5749 c1->Clear();
5750 if (settings)
5751 settings->Print("itersum.ps");
5752 c1->Clear();
5753 if (tracktupleinfo)
5754 tracktupleinfo->Print("itersum.ps");
5755 c1->Clear();
5756 if (hitstat)
5757 hitstat->Print("itersum.ps");
5758 c1->Clear();
5759 if (hitstatAr)
5760 hitstatAr->Print("itersum.ps");
5761 c1->Clear();
5762
5763 gStyle->SetOptStat(0);
5764 if (resplots)
5765 resplots->Print("itersum.ps");
5766 c1->Clear();
5767 if (resplotsAr)
5768 resplotsAr->Print("itersum.ps");
5769 c1->Clear();
5770
5771 textpage = new TextPage(" BARREL PLOTS ");
5772 textpage->Print("itersum.ps");
5773 c1->Clear();
5774
5775 hitstatxy->Print("itersum.ps");
5776 c1->Clear();
5777 if (isAr)
5778 hitstatxyAr->Print("itersum.ps");
5779 c1->Clear();
5780 nhits->Print("itersum.ps");
5781 c1->Clear();
5782 if (isAr)
5783 nhitsAr->Print("itersum.ps");
5784 c1->Clear();
5785 resxy0->Print("itersum.ps");
5786 c1->Clear();
5787 if (isAr)
5788 resxy0Ar->Print("itersum.ps");
5789 c1->Clear();
5790 resxy->Print("itersum.ps");
5791 c1->Clear();
5792 if (isAr)
5793 resxyAr->Print("itersum.ps");
5794 c1->Clear();
5795 xymap->Print("itersum.ps");
5796 c1->Clear();
5797 if (isAr)
5798 xymapAr->Print("itersum.ps");
5799 c1->Clear();
5800 if (do_expert)
5801 {
5802 oldt0->Print("itersum.ps");
5803 c1->Clear();
5804 if (isAr)
5805 oldt0Ar->Print("itersum.ps");
5806 c1->Clear();
5807 }
5808 oldt01->Print("itersum.ps");
5809 c1->Clear();
5810 if (isAr)
5811 oldt01Ar->Print("itersum.ps");
5812 c1->Clear();
5813 if (do_expert)
5814 {
5815 oldt0111->Print("itersum.ps");
5816 c1->Clear();
5817 if (isAr)
5818 oldt0111Ar->Print("itersum.ps");
5819 c1->Clear();
5820 }
5821 oldt011->Print("itersum.ps");
5822 c1->Clear();
5823 if (isAr)
5824 oldt011Ar->Print("itersum.ps");
5825 c1->Clear();
5826
5827 // textpage = new TextPage(" T0 PLOTS "); textpage->Print("itersum.ps"); c1->Clear();
5828
5829 double lowe = -3.5, upe = 3.5;
5830 if (do_expert)
5831 if (chipgraphA && chipgraphC)
5832 {
5833 chipgraphA->GetYaxis()->SetRangeUser(lowe, upe);
5834 chipgraphC->GetYaxis()->SetRangeUser(lowe, upe);
5835 c1->cd();
5836 c1->Divide(1, 2, 0.01, 0.01);
5837 c1->cd(1);
5838 chipgraphA->Draw();
5839 chipgraphA->DrawLines(lowe, upe);
5840 c1->cd(2);
5841 chipgraphC->Draw();
5842 chipgraphC->DrawLines(lowe, upe);
5843 c1->Print("itersum.ps");
5844 c1->Clear();
5845 }
5846
5847 c1->cd();
5848 c1->Divide(1, 2, 0.01, 0.01);
5849 c1->cd(1);
5850 boardgraphA->Draw("apl");
5851 boardgraphA->DrawLines();
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);
5859 leg->Draw();
5860 c1->cd(2);
5861 boardgraphC->Draw("apl");
5862 boardgraphC->DrawLines();
5863 if (refboardgraphC)
5864 refboardgraphC->Draw("pl");
5865 c1->Print("itersum.ps");
5866 c1->Clear();
5867
5868 // Add the plot for Board T0 variations differenses
5869 if (useref)
5870 {
5871 c1->cd();
5872 c1->Divide(1, 2, 0.01, 0.01);
5873 c1->cd(1);
5874 boarddiffgraphA->Draw("ap");
5875 boarddiffgraphA->DrawLines();
5876
5877 c1->cd(2);
5878 boarddiffgraphC->Draw("ap");
5879 boarddiffgraphC->DrawLines();
5880 if (do_expert)
5881 c1->Print("itersum.ps");
5882 c1->Clear();
5883 }
5884
5885 c1->cd();
5886 c1->Divide(1, 2, 0.01, 0.01);
5887 c1->cd(1);
5888 boardgraphA1->Draw("apl");
5889 boardgraphA1->DrawLines();
5890 c1->cd(2);
5891 boardgraphC1->Draw("apl");
5892 boardgraphC1->DrawLines();
5893 c1->Print("itersum.ps");
5894 c1->Clear();
5895
5896 c1->cd();
5897 c1->Divide(1, 2, 0.01, 0.01);
5898 c1->cd(1);
5899 boardgraphA2->Draw("apl");
5900 boardgraphA2->DrawLines();
5901 c1->cd(2);
5902 boardgraphC2->Draw("apl");
5903 boardgraphC2->DrawLines();
5904 c1->Print("itersum.ps");
5905 c1->Clear();
5906
5907 c1->cd();
5908 c1->Divide(1, 2, 0.01, 0.01);
5909 c1->cd(1);
5910 boardgraphA3->Draw("apl");
5911 boardgraphA3->DrawLines();
5912 c1->cd(2);
5913 boardgraphC3->Draw("apl");
5914 boardgraphC3->DrawLines();
5915 c1->Print("itersum.ps");
5916 c1->Clear();
5917
5918 // ################################################################ ADD PLOTS FOR ENDCAPS:
5919
5920 c1->Clear();
5921 textpage = new TextPage("ENDCAP PLOTS");
5922 textpage->Print("itersum.ps");
5923 c1->Clear();
5924
5925 cout << "MAKING PLOTS FOR ENDCAPS" << endl;
5926
5927 // Do hits fit type:
5928 XYMapsEC *ntypeEC = new XYMapsEC(argv[2], "ftype");
5929 ntypeEC->Print("itersum.ps");
5930 XYMapsEC *ntypeECAr = nullptr;
5931 if (isAr)
5932 {
5933 ntypeECAr = new XYMapsEC(argv[2], "ftype", true);
5934 ntypeECAr->Print("itersum.ps");
5935 }
5936
5937 // Do hits plots:
5938 XYMapsEC *nhitsEC = new XYMapsEC(argv[2], "nt0");
5939 nhitsEC->Print("itersum.ps");
5940 XYMapsEC *nhitsECAr = nullptr;
5941 if (isAr)
5942 {
5943 nhitsECAr = new XYMapsEC(argv[2], "nt0", true);
5944 nhitsECAr->Print("itersum.ps");
5945 }
5946 // Do res plot:
5947 XYMapsEC *resxy0EC = new XYMapsEC(argv[2], "res");
5948 resxy0EC->Print("itersum.ps");
5949 XYMapsEC *resxy0ECAr = nullptr;
5950 if (isAr)
5951 {
5952 resxy0ECAr = new XYMapsEC(argv[2], "res", true);
5953 resxy0ECAr->Print("itersum.ps");
5954 }
5955
5956 XYMapsEC *resxyM0EC = new XYMapsEC(argv[2], "abs(resMean)");
5957 resxyM0EC->Print("itersum.ps");
5958 XYMapsEC *resxyM0ECAr = nullptr;
5959 if (isAr)
5960 {
5961 resxyM0ECAr = new XYMapsEC(argv[2], "abs(resMean)", true);
5962 resxyM0ECAr->Print("itersum.ps");
5963 }
5964
5965 // Do t0s plots:
5966 XYMapsEC *xymapEC = new XYMapsEC(argv[2], "t0");
5967 xymapEC->Print("itersum.ps");
5968 XYMapsEC *xymapECAr = nullptr;
5969 if (isAr)
5970 {
5971 xymapECAr = new XYMapsEC(argv[2], "t0", true);
5972 xymapECAr->Print("itersum.ps");
5973 }
5974
5975 // Do Oldt0plots
5976 XYMapsEC *oldt0EC = nullptr;
5977 if (do_expert)
5978 oldt0EC = new XYMapsEC(argv[2], "oldt0");
5979 if (do_expert)
5980 oldt0EC->Print("itersum.ps");
5981 XYMapsEC *oldt0ECAr = nullptr;
5982 if (do_expert)
5983 {
5984 if (isAr)
5985 {
5986 oldt0ECAr = new XYMapsEC(argv[2], "oldt0", true);
5987 oldt0ECAr->Print("itersum.ps");
5988 }
5989 }
5990
5991 // Do t0 diff:
5992 XYMapsEC *oldt01EC = new XYMapsEC(argv[2], "abs(t0-oldt0)");
5993 oldt01EC->Print("itersum.ps");
5994 XYMapsEC *oldt01ECAr = nullptr;
5995 if (isAr)
5996 {
5997 oldt01ECAr = new XYMapsEC(argv[2], "abs(t0-oldt0)", true);
5998 oldt01ECAr->Print("itersum.ps");
5999 }
6000
6001 // Do t0 widht:
6002
6003 XYMapsEC *oldt0111EC = nullptr;
6004 if (do_expert)
6005 oldt0111EC = new XYMapsEC(argv[2], "abs(tresMean)");
6006 if (do_expert)
6007 oldt0111EC->Print("itersum.ps");
6008 XYMapsEC *oldt0111ECAr = nullptr;
6009 if (do_expert)
6010 {
6011 if (isAr)
6012 {
6013 oldt0111ECAr = new XYMapsEC(argv[2], "abs(tresMean)", true);
6014 oldt0111ECAr->Print("itersum.ps");
6015 }
6016 }
6017 // Do t0 widht:
6018 XYMapsEC *oldt011EC = new XYMapsEC(argv[2], "tres");
6019 oldt011EC->Print("itersum.ps");
6020 XYMapsEC *oldt011ECAr = nullptr;
6021 if (isAr)
6022 {
6023 oldt011ECAr = new XYMapsEC(argv[2], "tres", true);
6024 oldt011ECAr->Print("itersum.ps");
6025 }
6026
6027 // Do board variations for Ar
6028 c1->cd();
6029 c1->Divide(1, 2, 0.01, 0.01);
6030 c1->cd(1);
6031 boardECgraphA->Draw("apl");
6032 boardECgraphA->DrawLines();
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();
6041 c1->cd(2);
6042 boardECgraphC->Draw("apl");
6043 boardECgraphC->DrawLines();
6044 if (refboardECgraphC)
6045 refboardECgraphC->Draw("pl");
6046 c1->Print("itersum.ps");
6047 c1->Clear();
6048
6049 // Add the plot for Board T0 variations differenses
6050 if (useref)
6051 {
6052 c1->cd();
6053 c1->Divide(1, 2, 0.01, 0.01);
6054 c1->cd(1);
6055 boarddiffECgraphA->Draw("ap");
6056 boarddiffECgraphA->DrawLines();
6057 c1->cd(2);
6058 boarddiffECgraphC->Draw("ap");
6059 boarddiffECgraphC->DrawLines();
6060 if (do_expert)
6061 c1->Print("itersum.ps");
6062 c1->Clear();
6063 }
6064
6065 c1->cd();
6066 c1->Divide(1, 2, 0.01, 0.01);
6067 c1->cd(1);
6068 boardECgraphA1->Draw("apl");
6069 boardECgraphA1->DrawLines();
6070 c1->cd(2);
6071 boardECgraphC1->Draw("apl");
6072 boardECgraphC1->DrawLines();
6073 c1->Print("itersum.ps");
6074 c1->Clear();
6075
6076 c1->cd();
6077 c1->Divide(1, 2, 0.01, 0.01);
6078 c1->cd(1);
6079 boardECgraphA2->Draw("apl");
6080 boardECgraphA2->DrawLines();
6081 c1->cd(2);
6082 boardECgraphC2->Draw("apl");
6083 boardECgraphC2->DrawLines();
6084 c1->Print("itersum.ps");
6085 c1->Clear();
6086
6087 c1->cd();
6088 c1->Divide(1, 2, 0.01, 0.01);
6089 c1->cd(1);
6090 boardECgraphA3->Draw("apl");
6091 boardECgraphA3->DrawLines();
6092 c1->cd(2);
6093 boardECgraphC3->Draw("apl");
6094 boardECgraphC3->DrawLines();
6095 c1->Print("itersum.ps");
6096 c1->Clear();
6097
6098 // ################################### RT PLOTS: ########################################################
6099
6100 textpage = new TextPage(" RT PLOTS ");
6101 textpage->Print("itersum.ps");
6102 c1->Clear();
6103
6104 gStyle->SetOptStat(1);
6105 gStyle->SetOptFit(0);
6106 if (do_expert)
6107 if (rtrelation_bar)
6108 rtrelation_bar->Print("itersum.ps");
6109 c1->Clear();
6110 if (do_expert)
6111 if (rtbinning_bar)
6112 rtbinning_bar->Print("itersum.ps");
6113 c1->Clear();
6114 if (do_expert)
6115 if (rtrelation21)
6116 rtrelation21->Print("itersum.ps");
6117 c1->Clear();
6118 if (do_expert)
6119 if (rtbinning1)
6120 rtbinning1->Print("itersum.ps");
6121 c1->Clear();
6122 if (do_expert)
6123 if (rtrelation31)
6124 rtrelation31->Print("itersum.ps");
6125 c1->Clear();
6126 if (do_expert)
6127 if (rtbinning2)
6128 rtbinning2->Print("itersum.ps");
6129 c1->Clear();
6130 if (do_expert)
6131 if (rtrelation41)
6132 rtrelation41->Print("itersum.ps");
6133 c1->Clear();
6134 if (do_expert)
6135 if (rtbinning3)
6136 rtbinning3->Print("itersum.ps");
6137 c1->Clear();
6138 if (do_expert)
6139 if (rtrelation51)
6140 rtrelation51->Print("itersum.ps");
6141 c1->Clear();
6142 if (do_expert)
6143 if (rtbinning4)
6144 rtbinning4->Print("itersum.ps");
6145 c1->Clear();
6146
6147 if (do_expert)
6148 if (binres_bar)
6149 binres_bar->Print("itersum.ps");
6150 c1->Clear();
6151 if (do_expert)
6152 if (tbinnedres_bar)
6153 tbinnedres_bar->Print("itersum.ps");
6154 c1->Clear();
6155 if (do_expert)
6156 if (binres1)
6157 binres1->Print("itersum.ps");
6158 c1->Clear();
6159 if (do_expert)
6160 if (tbinnedres1)
6161 tbinnedres1->Print("itersum.ps");
6162 c1->Clear();
6163 if (do_expert)
6164 if (binres2)
6165 binres2->Print("itersum.ps");
6166 c1->Clear();
6167 if (do_expert)
6168 if (tbinnedres2)
6169 tbinnedres2->Print("itersum.ps");
6170 c1->Clear();
6171 if (do_expert)
6172 binres3->Print("itersum.ps");
6173 c1->Clear();
6174 if (do_expert)
6175 if (tbinnedres3)
6176 tbinnedres3->Print("itersum.ps");
6177 c1->Clear();
6178 if (do_expert)
6179 binres4->Print("itersum.ps");
6180 c1->Clear();
6181 if (do_expert)
6182 if (tbinnedres4)
6183 tbinnedres4->Print("itersum.ps");
6184 c1->Clear();
6185
6186 gStyle->SetOptStat(0);
6187 if (do_expert)
6188 if (rtcol)
6189 rtcol->Print("itersum.ps");
6190 c1->Clear();
6191 if (do_expert)
6192 if (rtcol1)
6193 rtcol1->Print("itersum.ps");
6194 c1->Clear();
6195 if (rtcol2)
6196 rtcol2->Print("itersum.ps");
6197 c1->Clear();
6198 if (isAr && rtArcol2)
6199 rtArcol2->Print("itersum.ps");
6200 c1->Clear();
6201 if (rtcol3)
6202 rtcol3->Print("itersum.ps");
6203 c1->Clear();
6204 if (isAr && rtArcol3)
6205 rtArcol3->Print("itersum.ps");
6206 c1->Clear();
6207 if (rtcol4)
6208 rtcol4->Print("itersum.ps");
6209 c1->Clear();
6210 if (isAr && rtArcol4)
6211 rtArcol4->Print("itersum.ps");
6212 c1->Clear();
6213 if (rtcol5)
6214 rtcol5->Print("itersum.ps");
6215 c1->Clear();
6216 if (isAr && rtArcol5)
6217 rtArcol5->Print("itersum.ps");
6218 c1->Clear();
6219
6220 // Plot all RTs together....
6221
6222 DGraph *dgraph0 = nullptr; // trt
6223 DGraph *dgraph1 = nullptr; // -1
6224 DGraph *dgraph2 = nullptr; // 1
6225 DGraph *dgraph3 = nullptr; // -2
6226 DGraph *dgraph4 = nullptr; // 2
6227 DGraph *dgraph5 = nullptr; // whole barrel
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;
6233 c1->cd();
6234 c1->SetGrid();
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
6267 if (dgraph0->rtgraph)
6268 dgraph0->Draw("apl");
6269 if (dgraph0->rtgraph)
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);
6277 if (dgraph1->rtgraph)
6278 dgraph1->Draw("pl");
6279 if (dgraph1->rtgraph)
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);
6288 if (dgraph2->rtgraph)
6289 dgraph2->Draw("pl");
6290 if (dgraph2->rtgraph)
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);
6299 if (dgraph3->rtgraph)
6300 dgraph3->Draw("pl");
6301 if (dgraph3->rtgraph)
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);
6310 if (dgraph4->rtgraph)
6311 dgraph4->Draw("pl");
6312 if (dgraph4->rtgraph)
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);
6320 if (dgraph5->rtgraph)
6321 dgraph5->Draw("pl");
6322 if (dgraph5->rtgraph)
6323 leg->AddEntry(dgraph5, "Whole Barrel", "l");
6324 }
6325
6326 leg->SetTextSize(0.03);
6327 leg->Draw();
6328 c1->Print("itersum.ps");
6329 c1->Clear();
6330 }
6331
6332 // Plot drift velocity:
6333 DvGraph *dvgraph0 = nullptr; // trt
6334 DvGraph *dvgraph1 = nullptr; // -1
6335 DvGraph *dvgraph2 = nullptr; // 1
6336 DvGraph *dvgraph3 = nullptr; // -2
6337 DvGraph *dvgraph4 = nullptr; // 2
6338 DvGraph *dvgraph5 = nullptr; // whole barrel
6339 if (do_expert)
6340 {
6341 // bool isinverted=false;
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;
6347 c1->cd();
6348 c1->SetGrid();
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)");
6381 if (dvgraph0->rtgraph)
6382 dvgraph0->Draw("apl");
6383 if (dvgraph0->rtgraph)
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);
6391 if (dvgraph1->rtgraph)
6392 dvgraph1->Draw("pl");
6393 if (dvgraph1->rtgraph)
6394 leg->AddEntry(dvgraph1, "Barrel C Side", "l");
6395 }
6396
6397 if (dvgraph2 != nullptr)
6398 {
6399 dvgraph2->SetLineWidth(3);
6400 dvgraph2->SetLineColor(2);
6401 if (dvgraph2->rtgraph)
6402 dvgraph2->Draw("pl");
6403 if (dvgraph2->rtgraph)
6404 leg->AddEntry(dvgraph2, "Barrel A Side", "l");
6405 }
6406
6407 if (dvgraph3 != nullptr)
6408 {
6409 dvgraph3->SetLineWidth(3);
6410 dvgraph3->SetLineColor(6);
6411 if (dvgraph3->rtgraph)
6412 dvgraph3->Draw("pl");
6413 if (dvgraph3->rtgraph)
6414 leg->AddEntry(dvgraph3, "Endcap C side", "l");
6415 }
6416
6417 if (dvgraph4 != nullptr)
6418 {
6419 dvgraph4->SetLineWidth(3);
6420 dvgraph4->SetLineColor(7);
6421 if (dvgraph4->rtgraph)
6422 dvgraph4->Draw("pl");
6423 if (dvgraph4->rtgraph)
6424 leg->AddEntry(dvgraph4, "Endcap A side", "l");
6425 }
6426 if (dvgraph5 != nullptr)
6427 {
6428 dvgraph5->SetLineWidth(3);
6429 dvgraph5->SetLineColor(8);
6430 if (dvgraph5->rtgraph)
6431 dvgraph5->Draw("pl");
6432 if (dvgraph5->rtgraph)
6433 leg->AddEntry(dvgraph5, "Whole Barrel", "l");
6434 }
6435
6436 leg->SetTextSize(0.03);
6437 leg->Draw();
6438 c1->Print("itersum.ps");
6439 c1->Clear();
6440 }
6441 }
6442
6443 // ################################### ADD PLOTS FOR TRACKING #######################################33
6444 c1->Clear();
6445 textpage = new TextPage("Track plots: Only for Experts!!!");
6446 textpage->Print("itersum.ps");
6447 c1->Clear();
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;
6458 c1->Clear();
6459 if (istracktuple)
6460 {
6461 // first Residuals:
6462 if (Tracktuple->GetListOfBranches()->FindObject("trackres"))
6463 {
6464 c1->cd();
6465 c1->Divide(2, 1, 0.01, 0.01);
6466 c1->cd(1);
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
6473 c1->cd(2);
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");
6484 c1->Clear();
6485 }
6486
6487 // first pt:
6488 if (Tracktuple->GetListOfBranches()->FindObject("pt"))
6489 {
6490 c1->cd();
6491 c1->Divide(2, 1, 0.01, 0.01);
6492 c1->cd(1);
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
6499 c1->cd(2);
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");
6509 c1->Clear();
6510 }
6511 // first theta:
6512 if (Tracktuple->GetListOfBranches()->FindObject("theta"))
6513 {
6514 c1->cd();
6515 c1->Divide(2, 1, 0.01, 0.01);
6516 c1->cd(1);
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
6523 c1->cd(2);
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");
6533 c1->Clear();
6534 }
6535 // first phi:
6536 if (Tracktuple->GetListOfBranches()->FindObject("phi"))
6537 {
6538 c1->cd();
6539 c1->Divide(2, 1, 0.01, 0.01);
6540 c1->cd(1);
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
6547 c1->cd(2);
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");
6557 c1->Clear();
6558 }
6559 // first d0:
6560 if (Tracktuple->GetListOfBranches()->FindObject("d0"))
6561 {
6562 c1->cd();
6563 c1->Divide(2, 1, 0.01, 0.01);
6564 c1->cd(1);
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
6571 c1->cd(2);
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");
6581 c1->Clear();
6582 }
6583 }
6584
6585 // ################################### ADD PLOTS FOR Pulls and Errors #######################################33
6586
6587 // Skip all this for now (PH)
6588 cout << " Skipping plots for Pulls and Errors " << endl;
6589
6590 // SERGI - Another block not used :). Firewalls below previously commented... useless block of code
6591 // bool iserrors = false;
6592 // TDirectory *errors = nullptr;
6593 // if (datafile->FindKey("Errors"))
6594 // {
6595 // errors = (TDirectory *)datafile->FindKey("Errors")->ReadObj();
6596 // if (errors != nullptr)
6597 // iserrors = true;
6598 // }
6599
6600 c1->Clear();
6601 /*
6602 textpage = new TextPage(" Error Plots and Pt dependence. Only for Experts!!!");
6603 textpage->Print("itersum.ps");
6604 c1->Clear();
6605
6606 cout << "Making Error/Pt plots:" << endl;
6607 c1->Clear();
6608 if (iserrors){
6609 //first Residuals:
6610 cout << "Start with Pt plots:" << endl;
6611 errors->cd();
6612
6613 PtDependence* ptstuff = new PtDependence(datafile);
6614 ptstuff->Print("itersum.ps");
6615
6616 TBDependence* tbstuff = new TBDependence(datafile);
6617 tbstuff->Print("itersum.ps");
6618
6619
6620
6621 }
6622
6623
6624 */
6625
6626 // ################################### ADD PLOTS FOR ToT and HT #######################################33
6627
6628 // Skip all this for now (PH)
6629 cout << " Skipping plots for ToT and HT " << endl;
6630
6631 // SERGI - Firewalls below previously commented... useless block of code
6632 // bool iscorrections = false;
6633 // TDirectory *corrections = nullptr;
6634 // if (datafile->FindKey("Correction"))
6635 // {
6636 // corrections = (TDirectory *)datafile->FindKey("Correction")->ReadObj();
6637 // if (corrections != nullptr)
6638 // iscorrections = true;
6639 // }
6640
6641 c1->Clear();
6642 textpage = new TextPage(" ToT Corrections and HT corrections: ");
6643 textpage->Print("itersum.pdf");
6644 c1->Clear();
6645
6646 cout << "Making ToT / HT Plots" << endl;
6647 c1->Clear();
6648 /*
6649 if (iscorrections){
6650 //first Residuals:
6651 cout << "Start with ToT plots:" << endl;
6652 corrections->cd();
6653
6654 ToTDependence* totstuff = new ToTDependence(datafile, true); // Barrels:
6655 totstuff->Print("itersum.ps");
6656
6657 ToTDependence* totstuff2 = new ToTDependence(datafile, false); // Barrels:
6658 totstuff2->Print("itersum.ps");
6659
6660 cout << "Start with HT plots:" << endl;
6661
6662 ToTDependence* htstuff = new ToTDependence(datafile, true, true ); // Barrels:
6663 htstuff->Print("itersum.ps");
6664
6665 ToTDependence* htstuff2 = new ToTDependence(datafile, false, true); // Barrels:
6666 htstuff2->Print("itersum.ps");
6667
6668 cout << "Start with sin(theta) / p plots:" << endl;
6669
6670 SinDependence* sinstuff = new SinDependence(datafile, true); // Barrels:
6671 sinstuff->Print("itersum.ps");
6672
6673 SinDependence* sinstuff2 = new SinDependence(datafile, false); // Barrels:
6674 sinstuff2->Print("itersum.ps");
6675
6676 cout << "Start with cos(theta) / p plots:" << endl;
6677
6678 SinDependence* cosstuff = new SinDependence(datafile, true, true); // Barrels:
6679 cosstuff->Print("itersum.ps");
6680
6681 SinDependence* cosstuff2 = new SinDependence(datafile, false, true); // Barrels:
6682 cosstuff2->Print("itersum.ps");
6683
6684
6685 }
6686
6687
6688 */
6689
6690 // ################################### ADD PLOTS FOR ToT and HT ARGON #######################################33
6691
6692 // bool iscorrectionsAr = false;
6693 // TDirectory *correctionsAr = nullptr;
6694 // if (datafile->FindKey("CorrectionAr"))
6695 // {
6696 // correctionsAr = (TDirectory *)datafile->FindKey("CorrectionAr")->ReadObj();
6697 // if (correctionsAr != nullptr)
6698 // iscorrectionsAr = true;
6699 // }
6700
6701 /*
6702 if (iscorrectionsAr){
6703 c1->Clear();
6704 textpage = new TextPage(" ToT Corrections and HT corrections: ARGON");
6705 textpage->Print("itersum.ps");
6706 c1->Clear();
6707
6708 cout << "Making ToT / HT Plots ARGON" << endl;
6709 c1->Clear();
6710 //first Residuals:
6711 cout << "Start with ToT plots:" << endl;
6712 corrections->cd();
6713
6714 ToTDependence* totstuff = new ToTDependence(datafile, true, false, true); // Barrels:
6715 totstuff->Print("itersum.ps");
6716
6717 ToTDependence* totstuff2 = new ToTDependence(datafile, false, false, true); // Barrels:
6718 totstuff2->Print("itersum.ps");
6719
6720 cout << "Start with HT plots:" << endl;
6721
6722 ToTDependence* htstuff = new ToTDependence(datafile, true, true, true ); // Barrels:
6723 htstuff->Print("itersum.ps");
6724
6725 ToTDependence* htstuff2 = new ToTDependence(datafile, false, true, true); // Barrels:
6726 htstuff2->Print("itersum.ps");
6727
6728 cout << "Start with sin(theta) / p plots:" << endl;
6729
6730 SinDependence* sinstuff = new SinDependence(datafile, true, false, true); // Barrels:
6731 sinstuff->Print("itersum.ps");
6732
6733 // SinDependence* sinstuff2 = new SinDependence(datafile, false, false, true); // Barrels:
6734 // sinstuff2->Print("itersum.ps");
6735
6736 cout << "Start with cos(theta) / p plots:" << endl;
6737
6738 // SinDependence* cosstuff = new SinDependence(datafile, true, true, true); // Barrels:
6739 // cosstuff->Print("itersum.ps");
6740
6741 SinDependence* cosstuff2 = new SinDependence(datafile, false, true, true); // Barrels:
6742 cosstuff2->Print("itersum.ps");
6743
6744
6745 }
6746
6747 c1->Print("itersum.ps]");
6748 */
6749
6750 datafile->Close();
6751 if (useref)
6752 refdatafile->Close();
6753
6754 // cout << "RDIFF -1 ";
6755 // for (map<double,double>::iterator rtpoint = rtrelation21->rtmap.begin(); rtpoint != rtrelation21->rtmap.end(); rtpoint++){
6756 // cout << binres1->resmap[rtpoint->second] << " ";
6757 // }
6758 // cout << endl;
6759 // cout << "RDIFF 1 ";
6760 // for (map<double,double>::iterator rtpoint = rtrelation31->rtmap.begin(); rtpoint != rtrelation31->rtmap.end(); rtpoint++){
6761 // cout << binres2->resmap[rtpoint->second] << " ";
6762 // }
6763 // cout << endl;
6764
6765 // cout << "RDIFF -2 ";
6766 // for (map<double,double>::iterator rtpoint = rtrelation41->rtmap.begin(); rtpoint != rtrelation41->rtmap.end(); rtpoint++){
6767 // cout << binres3->resmap[rtpoint->second] << " ";
6768 // }
6769 // cout << endl;
6770
6771 // cout << "RDIFF 2 ";
6772 // for (map<double,double>::iterator rtpoint = rtrelation51->rtmap.begin(); rtpoint != rtrelation51->rtmap.end(); rtpoint++){
6773 // cout << binres4->resmap[rtpoint->second] << " ";
6774 // }
6775 // cout << endl;
6776
6777 // add some extra info to each page
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 // Add some graphs in a new direcrory "analysis"
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]
Definition HepEvt.cxx:11
bool do_expert
void DrawLines(float, float)
vector< TH1D * > reshists
map< string, string > set
TH1F(name, title, nxbins, bins_par2, bins_par3=None, path='', **kwargs)

◆ main()

int main ( int argc,
char * argv[] )

Definition at line 6878 of file TRTCalib_makeplots.cxx.

6879{
6880
6881 gErrorIgnoreLevel = kFatal; // Explicitly remove all messages
6882
6883 if ((string(argv[1])).find("itersum") != std::string::npos)
6884 {
6885 cout << "GENERATING ITERATION SUMMARY PLOTS" << endl;
6886 itersum(argc, argv);
6887 }
6888
6889 if ((string(argv[1])).find("restore") != std::string::npos)
6890 {
6891 cout << "REMOVING THE TRACKTUPLE, BINHIST AND ANALYSE DIRECTORY" << endl;
6892 tt_remove(argc, argv);
6893 }
6894
6895 return 0;
6896}
int tt_remove(int, char *argv[])
int itersum(int argc, char *argv[])
std::string find(const std::string &s)
return a remapped string
Definition hcg.cxx:138

◆ ResizePalette()

void ResizePalette ( TH2 * hist)

Definition at line 68 of file TRTCalib_makeplots.cxx.

69{
70 TPaletteAxis *palette = (TPaletteAxis *)hist->GetListOfFunctions()->FindObject("palette");
71 palette->SetX2NDC(0.92);
72 palette->Paint();
73 palette->SetLabelSize(0.03);
74}

◆ SetZAxis()

void SetZAxis ( TH2F * reshist0)

Definition at line 49 of file TRTCalib_makeplots.cxx.

50{
51 double zmin = 100000000;
52 double zmax = -100000000;
53 double temp = 0;
54 for (int ix = 0; ix < reshist0->GetNbinsX(); ix++)
55 {
56 for (int iy = 0; iy < reshist0->GetNbinsY(); iy++)
57 {
58 temp = reshist0->GetBinContent(ix, iy);
59 if (temp !=0){
60 zmax = std::max(temp,zmax);
61 zmin = std::min(temp,zmin);
62 }
63 }
64 }
65 reshist0->GetZaxis()->SetRangeUser(zmin, zmax);
66}

◆ trim()

string trim ( string s)

Definition at line 76 of file TRTCalib_makeplots.cxx.

77{
78 const char * whitespace = " \n\r\t";
79 s.erase(s.find_last_not_of(whitespace)+1);//rtrim
80 s.erase(0,s.find_first_not_of(whitespace));//ltrim
81 return s;
82}

◆ tt_remove()

int tt_remove ( int ,
char * argv[] )

Definition at line 6855 of file TRTCalib_makeplots.cxx.

6856{
6857
6858 TFile *itersumfile = new TFile(argv[2], "UPDATE");
6859 if (itersumfile->FindKey("tracktuple"))
6860 {
6861 itersumfile->Delete("tracktuple;*");
6862 }
6863 if (itersumfile->FindKey("binhist"))
6864 {
6865 itersumfile->rmdir("binhist");
6866 }
6867 if (itersumfile->FindKey("analysis"))
6868 {
6869 itersumfile->rmdir("analysis");
6870 }
6871
6872 itersumfile->Write();
6873 itersumfile->Close();
6874
6875 return 0;
6876}

Variable Documentation

◆ ATLAS_NO_CHECK_FILE_THREAD_SAFETY

ATLAS_NO_CHECK_FILE_THREAD_SAFETY

Definition at line 6 of file TRTCalib_makeplots.cxx.

◆ detlet

char detlet[3] = {'C', '-', 'A'}

Definition at line 47 of file TRTCalib_makeplots.cxx.

47{'C', '-', 'A'};

◆ do_expert

bool do_expert = false

Definition at line 45 of file TRTCalib_makeplots.cxx.