ATLAS Offline Software
Classes | Functions | Variables
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 4019 of file TRTCalib_makeplots.cxx.

4020 {
4021  if (!histo)
4022  return nullptr;
4023  int const nxbins = histo->GetNbinsX();
4024  TGraphErrors *Means = new TGraphErrors(nxbins);
4025  float mean = 0;
4026  float rms = 0;
4027  TF1 *ff = new TF1("ff", "gaus");
4028  for (int i = 0; i < nxbins; i++)
4029  {
4030  TH1D *slice = histo->ProjectionY("slice", i + 1, i + 1);
4031  mean = slice->GetEntries();
4032  rms = sqrt(mean);
4033  float x = histo->GetBinCenter(i + 1);
4034  Means->SetPoint(i, x, mean);
4035  Means->SetPointError(i, 0.5 * histo->GetBinWidth(i), rms);
4036  delete slice;
4037  }
4038  delete ff;
4039  return Means;
4040 }

◆ GetMean()

TGraphErrors* GetMean ( TH2F *  histo)

Definition at line 3907 of file TRTCalib_makeplots.cxx.

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

◆ GetMeanE()

TGraphErrors* GetMeanE ( TH2F *  histo)

Definition at line 3936 of file TRTCalib_makeplots.cxx.

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

◆ GetPn()

TGraphErrors* GetPn ( TH2F *  histo)

Definition at line 3960 of file TRTCalib_makeplots.cxx.

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

◆ GetPWidth()

TGraphErrors* GetPWidth ( TH2F *  histo)

Definition at line 4042 of file TRTCalib_makeplots.cxx.

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

◆ GetWidth()

TGraphErrors* GetWidth ( TH2F *  histo)

Definition at line 3983 of file TRTCalib_makeplots.cxx.

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

◆ itersum()

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

Definition at line 5113 of file TRTCalib_makeplots.cxx.

5114 {
5115 
5116  string inputfile = string(argv[2]);
5117  TFile *datafile = new TFile(argv[2]);
5118  if (datafile->IsZombie())
5119  {
5120  cout << "ERROR! INPUT FILE DOES NOT EXIST!" << endl;
5121  exit(-1);
5122  }
5123 
5124  bool isAr = false;
5125  if (datafile->FindKey("TRT_Ar_all"))
5126  {
5127  isAr = true;
5128  cout << " This run contains straws with Argon" << endl;
5129  }
5130  if (!datafile->FindKey("Chip_Artuple"))
5131  {
5132  isAr = false;
5133  cout << " This run contains does not have Argon ntuples" << endl;
5134  }
5135 
5136  // Here we have to do the fix, because the trees are duplicated
5137 
5138  TFile *refdatafile;
5139  bool useref = false;
5140  if (argc > 4)
5141  {
5142  useref = true;
5143  refdatafile = new TFile(argv[4]);
5144  if (refdatafile->IsZombie())
5145  {
5146  cout << "INPUT REFERENCE FILE DOES NOT EXIST! RUNNING WITHOUT IT!" << endl;
5147  useref = false;
5148  }
5149  else
5150  cout << "INPUT REFERENCE FILE OK!" << endl;
5151  }
5152 
5153  // First page on Shifter report, general information
5154  cout << "MAKING FirstPage" << endl;
5155  FirstPage *firstpage = nullptr;
5156  try
5157  {
5158  firstpage = new FirstPage(argv[2], datafile);
5159  }
5160  catch (string e)
5161  {
5162  cout << e << endl;
5163  }
5164 
5165  // Add a page with the settings:
5166  cout << "MAKING Settings" << endl;
5167  SettingsInfo *settings = nullptr;
5168  // if (argv[3]) try { settings = new SettingsInfo(argv[3]); } catch (string e) { cout << e << endl; }
5169 
5170  // Tracktuple info
5171  cout << "MAKING TracktupleInfo" << endl;
5172  TrackTupleInfo *tracktupleinfo = nullptr;
5173  try
5174  {
5175  tracktupleinfo = new TrackTupleInfo(datafile);
5176  }
5177  catch (string e)
5178  {
5179  cout << e << endl;
5180  }
5181 
5182  // Hit statistics
5183  HitStatistics *hitstat = nullptr;
5184  cout << "MAKING HitStatistics" << endl;
5185  hitstat = new HitStatistics(argv[2]);
5186 
5187  HitStatistics *hitstatAr = nullptr;
5188  if (isAr)
5189  {
5190  cout << "MAKING Ar HitStatistics" << endl;
5191  hitstatAr = new HitStatistics(argv[2], true);
5192  }
5193 
5194  // TRT Global Results:
5195  cout << "MAKING TRTPlots" << endl;
5196  // SERGI - What is the purpose of the lines commented below? (TRTPlots *TRTresplots and *TRTresplotsAr are not used at anywhere)
5197  // TRTPlots *TRTresplots = nullptr;
5198  // try
5199  // {
5200  // TRTresplots = new TRTPlots(datafile);
5201  // }
5202  // catch (string e)
5203  // {
5204  // cout << e << endl;
5205  // }
5206  // TRTPlots *TRTresplotsAr = nullptr;
5207  if (isAr)
5208  // try
5209  // {
5210  // TRTresplotsAr = new TRTPlots(datafile, true);
5211  // }
5212  // catch (string e)
5213  // {
5214  // cout << e << endl;
5215  // }
5216 
5217  // Residual and time residual (TRT and both barrels)
5218  cout << "MAKING ResidualPlots" << endl;
5219  ResidualPlots *resplots = nullptr;
5220  try
5221  {
5222  resplots = new ResidualPlots(datafile);
5223  }
5224  catch (string e)
5225  {
5226  cout << e << endl;
5227  }
5228  ResidualPlots *resplotsAr = nullptr;
5229  if (isAr)
5230  try
5231  {
5232  resplotsAr = new ResidualPlots(datafile, true);
5233  }
5234  catch (string e)
5235  {
5236  cout << e << endl;
5237  }
5238 
5239  // Do t0 calibration type:
5240  cout << "MAKING T0CalibTypeXY" << endl;
5241  T0CalibTypeXY *hitstatxy = new T0CalibTypeXY(argv[2]);
5242  T0CalibTypeXY *hitstatxyAr = nullptr;
5243  if (isAr)
5244  hitstatxyAr = new T0CalibTypeXY(argv[2], true);
5245 
5246  // Do hits plots:
5247  cout << "MAKING XYMaps(nt0)" << endl;
5248  XYMaps *nhits = new XYMaps(argv[2], "nt0");
5249  XYMaps *nhitsAr = nullptr;
5250  if (isAr)
5251  nhitsAr = new XYMaps(argv[2], "nt0", true);
5252  // Do res plot:
5253  cout << "MAKING XYMaps(res)" << endl;
5254  XYMaps *resxy0 = new XYMaps(argv[2], "res");
5255  XYMaps *resxy0Ar = nullptr;
5256  if (isAr)
5257  resxy0Ar = new XYMaps(argv[2], "res", true);
5258  // Do residual center plot:
5259  cout << "MAKING XYMaps(resmean)" << endl;
5260  XYMaps *resxy = new XYMaps(argv[2], "abs(resMean)");
5261  XYMaps *resxyAr = nullptr;
5262  if (isAr)
5263  resxyAr = new XYMaps(argv[2], "abs(resMean)", true);
5264  // Do t0s plots:
5265  cout << "MAKING XYMaps(t0)" << endl;
5266  XYMaps *xymap = new XYMaps(argv[2], "t0");
5267  XYMaps *xymapAr = nullptr;
5268  if (isAr)
5269  xymapAr = new XYMaps(argv[2], "t0", true);
5270  // Do Oldt0plots:
5271  cout << "MAKING XYMaps(oldt0)" << endl;
5272  XYMaps *oldt0 = new XYMaps(argv[2], "oldt0");
5273  XYMaps *oldt0Ar = nullptr;
5274  if (isAr)
5275  oldt0Ar = new XYMaps(argv[2], "oldt0", true);
5276  // Do t0 diff:
5277  cout << "MAKING XYMaps(t0-oldt0)" << endl;
5278  XYMaps *oldt01 = new XYMaps(argv[2], "abs(t0-oldt0)");
5279  XYMaps *oldt01Ar = nullptr;
5280  if (isAr)
5281  oldt01Ar = new XYMaps(argv[2], "abs(t0-oldt0)", true); // changed from t0-old-t0
5282  // Do t0 diff mean:
5283  cout << "MAKING XYMaps(tresMean)" << endl;
5284  XYMaps *oldt0111 = new XYMaps(argv[2], "abs(tresMean)");
5285  XYMaps *oldt0111Ar = nullptr;
5286  if (isAr)
5287  oldt0111Ar = new XYMaps(argv[2], "abs(tresMean)", true);
5288  // Do t0 width:
5289  cout << "MAKING XYMaps(tres)" << endl;
5290  XYMaps *oldt011 = new XYMaps(argv[2], "(tres)");
5291  XYMaps *oldt011Ar = nullptr;
5292  if (isAr)
5293  oldt011Ar = new XYMaps(argv[2], "(tres)", true);
5294 
5295  // Add the plot for Chip T0 (board offset) variations
5296  ChipVariations *chipgraphA = nullptr;
5297  ChipVariations *chipgraphC = nullptr;
5298  if (datafile->FindKey("TRT_all"))
5299  {
5300  cout << "MAKING ChipVariations" << endl;
5301  chipgraphA = new ChipVariations(argv[2], 1);
5302  chipgraphC = new ChipVariations(argv[2], -1);
5303  }
5304 
5305  // Add the plot for Board T0 variations
5306  BoardVariationsOldT0 *refboardgraphA = nullptr;
5307  BoardVariationsOldT0 *refboardgraphC = nullptr;
5308  BoardVariationsDiff *boarddiffgraphA = nullptr;
5309  BoardVariationsDiff *boarddiffgraphC = nullptr;
5310  if (useref)
5311  {
5312  cout << "MAKING BoardVariationsOldT0" << endl;
5313  refboardgraphA = new BoardVariationsOldT0(argv[4], 1);
5314  refboardgraphC = new BoardVariationsOldT0(argv[4], -1);
5315  refboardgraphA->SetLineColor(2);
5316  refboardgraphC->SetLineColor(2);
5317  cout << "MAKING BoardVariationsDiff" << endl;
5318  boarddiffgraphA = new BoardVariationsDiff(argv[2], argv[4], 1);
5319  boarddiffgraphC = new BoardVariationsDiff(argv[2], argv[4], -1);
5320  }
5321  // Add the plot for Board T0 variations
5322  cout << "MAKING BoardVariations" << endl;
5323  BoardVariations *boardgraphA = new BoardVariations(argv[2], 1);
5324  BoardVariations *boardgraphC = new BoardVariations(argv[2], -1);
5325  // Add the plot for the residual
5326  cout << "MAKING BoardVariationsRes" << endl;
5327  BoardVariationsRes *boardgraphA1 = new BoardVariationsRes(argv[2], 1);
5328  BoardVariationsRes *boardgraphC1 = new BoardVariationsRes(argv[2], -1);
5329  // Add the plot for the Time residual
5330  cout << "MAKING BoardVariationsTRes" << endl;
5331  BoardVariationsTRes *boardgraphA2 = new BoardVariationsTRes(argv[2], 1);
5332  BoardVariationsTRes *boardgraphC2 = new BoardVariationsTRes(argv[2], -1);
5333  // Add the plot for the sigma Time residual
5334  cout << "MAKING BoardVariationsTRes1" << endl;
5335  BoardVariationsTRes1 *boardgraphA3 = new BoardVariationsTRes1(argv[2], 1);
5336  BoardVariationsTRes1 *boardgraphC3 = new BoardVariationsTRes1(argv[2], -1);
5337 
5338  // RtGraphs* rtrelation11=nullptr;
5339  RtGraphs *rtrelation_bar = nullptr;
5340  RtGraphs *rtrelation21 = nullptr;
5341  RtGraphs *rtrelation31 = nullptr;
5342  RtGraphs *rtrelation41 = nullptr;
5343  RtGraphs *rtrelation51 = nullptr;
5344  RtBinning *rtbinning_bar = nullptr;
5345  RtBinning *rtbinning1 = nullptr;
5346  RtBinning *rtbinning2 = nullptr;
5347  RtBinning *rtbinning3 = nullptr;
5348  RtBinning *rtbinning4 = nullptr;
5349  if (datafile->FindKey("TRT_all"))
5350  {
5351  cout << "MAKING RtGraphs" << endl;
5352  TDirectory *trt = (TDirectory *)datafile->FindKey("TRT_all")->ReadObj();
5353 
5354  if (trt->FindKey("WholeBarrel_1"))
5355  {
5356  try
5357  {
5358  rtrelation_bar = new RtGraphs(argv[2], "WholeBarrel_1");
5359  }
5360  catch (string e)
5361  {
5362  cout << e << endl;
5363  }
5364  }
5365  if (trt->FindKey("Detector_-1"))
5366  {
5367  try
5368  {
5369  rtrelation21 = new RtGraphs(argv[2], "Detector_-1");
5370  }
5371  catch (string e)
5372  {
5373  cout << e << endl;
5374  }
5375  }
5376  if (trt->FindKey("Detector_1"))
5377  {
5378  try
5379  {
5380  rtrelation31 = new RtGraphs(argv[2], "Detector_1");
5381  }
5382  catch (string e)
5383  {
5384  cout << e << endl;
5385  }
5386  }
5387  if (trt->FindKey("Detector_-2"))
5388  {
5389  try
5390  {
5391  rtrelation41 = new RtGraphs(argv[2], "Detector_-2");
5392  }
5393  catch (string e)
5394  {
5395  cout << e << endl;
5396  }
5397  }
5398  if (trt->FindKey("Detector_2"))
5399  {
5400  try
5401  {
5402  rtrelation51 = new RtGraphs(argv[2], "Detector_2");
5403  }
5404  catch (string e)
5405  {
5406  cout << e << endl;
5407  }
5408  }
5409  // r plots for each t-bin
5410  cout << "MAKING Rt binning" << endl;
5411 
5412  // No Xenon for Barrel in Run3
5413  // rtbinning_bar=new RtBinning(trt,"WholeBarrel_1");
5414  // cout << "MAKING Rt binning for Detector_-1" << endl;
5415  // rtbinning1=new RtBinning(trt,"Detector_-1");
5416  // cout << "MAKING Rt binning for Detector_1" << endl;
5417  // rtbinning2=new RtBinning(trt,"Detector_1");
5418  cout << "MAKING Rt binning for Detector_-2" << endl;
5419  rtbinning3 = new RtBinning(trt, "Detector_-2");
5420  cout << "MAKING Rt binning for Detector_2" << endl;
5421  rtbinning4 = new RtBinning(trt, "Detector_2");
5422  }
5423 
5424  // Binned residual plots
5425  RresTbin *binres_bar = nullptr;
5426  RresTbin *binres1 = nullptr;
5427  RresTbin *binres2 = nullptr;
5428  RresTbin *binres3 = nullptr;
5429  RresTbin *binres4 = nullptr;
5430  TBinnedRes *tbinnedres_bar = nullptr;
5431  TBinnedRes *tbinnedres1 = nullptr;
5432  TBinnedRes *tbinnedres2 = nullptr;
5433  TBinnedRes *tbinnedres3 = nullptr;
5434  TBinnedRes *tbinnedres4 = nullptr;
5435 
5436  cout << "MAKING Binned Residual" << endl;
5437  // No Xenon hists for Barrel in Run3
5438  // binres_bar=new RresTbin(datafile,"WholeBarrel_1",4);
5439  // tbinnedres_bar=new TBinnedRes(datafile,binres_bar->reshists);
5440  // cout << "MAKING Binned Residual for Detector_-1" << endl;
5441  // binres1=new RresTbin(datafile,"Detector_-1",-1);
5442  // tbinnedres1=new TBinnedRes(datafile,binres1->reshists);
5443  // cout << "MAKING Binned Residual for Detector_1" << endl;
5444  // binres2=new RresTbin(datafile,"Detector_1",1);
5445  // tbinnedres2=new TBinnedRes(datafile,binres2->reshists);
5446  cout << "MAKING Binned Residual for Detector_-2" << endl;
5447  binres3 = new RresTbin(datafile, "Detector_-2", -2);
5448  tbinnedres3 = new TBinnedRes(datafile, binres3->reshists);
5449  cout << "MAKING Binned Residual for Detector_2" << endl;
5450  binres4 = new RresTbin(datafile, "Detector_2", 2);
5451  tbinnedres4 = new TBinnedRes(datafile, binres4->reshists);
5452 
5453  RtColor *rtcol = nullptr;
5454  RtColor *rtcol1 = nullptr;
5455  RtColor *rtcol2 = nullptr;
5456  RtColor *rtcol3 = nullptr;
5457  RtColor *rtcol4 = nullptr;
5458  RtColor *rtcol5 = nullptr;
5459  // Rt relation, default plot
5460  cout << "MAKING RtColor" << endl;
5461 
5462  if (datafile->FindKey("TRT_all"))
5463  {
5464  cout << " found TRT_all " << endl;
5465 
5466  // no Xenon RtColor plot for entire TRT
5467  // rtcol= new RtColor(argv[2],"");
5468 
5469  TDirectory *trt = (TDirectory *)datafile->FindKey("TRT_all")->ReadObj();
5470 
5471  // No Xenon Rt plots for barrel in Run3
5472  /*
5473  if (trt->FindKey("WholeBarrel_1")){
5474  cout << " MAKING RtColor WholeBarrel" << endl;
5475  try {rtcol1= new RtColor(argv[2],"WholeBarrel_1");}
5476  catch (string e){cout << e << endl;}
5477  }
5478 
5479 
5480  if (trt->FindKey("Detector_-1")){
5481  cout << " MAKING RtColor Detector_-1" << endl;
5482  try {rtcol2= new RtColor(argv[2],"Detector_-1");}
5483  catch (string e){cout << e << endl;}
5484  }
5485 
5486  if (trt->FindKey("Detector_1")){
5487  cout << " MAKING RtColor Detector_1" << endl;
5488  try {rtcol3= new RtColor(argv[2],"Detector_1");}
5489  catch (string e){cout << e << endl;}
5490  }
5491  */
5492 
5493  if (trt->FindKey("Detector_-2"))
5494  {
5495  cout << " MAKING RtColor Detector_-2" << endl;
5496  try
5497  {
5498  rtcol4 = new RtColor(argv[2], "Detector_-2");
5499  }
5500  catch (string e)
5501  {
5502  cout << e << endl;
5503  }
5504  }
5505 
5506  if (trt->FindKey("Detector_2"))
5507  {
5508  cout << " MAKING RtColor Detector_2" << endl;
5509  try
5510  {
5511  rtcol5 = new RtColor(argv[2], "Detector_2");
5512  }
5513  catch (string e)
5514  {
5515  cout << e << endl;
5516  }
5517  }
5518  }
5519  // ARGON!!
5520  // SERGI - Is this actually used for something????
5521  // RtGraphs *rtArrelation_bar = nullptr;
5522  // RtGraphs *rtArrelation21 = nullptr;
5523  // RtGraphs *rtArrelation31 = nullptr;
5524  // RtGraphs *rtArrelation41 = nullptr;
5525  // RtGraphs *rtArrelation51 = nullptr;
5526  // RtBinning *rtArbinning_bar = nullptr;
5527  // RtBinning *rtArbinning1 = nullptr;
5528  // RtBinning *rtArbinning2 = nullptr;
5529  // RtBinning *rtArbinning3 = nullptr;
5530  // RtBinning *rtArbinning4 = nullptr;
5531  // if (datafile->FindKey("TRT_Ar_all"))
5532  // {
5533  // cout << "MAKING AR RtGraphs" << endl;
5534  // TDirectory *trtAr = (TDirectory *)datafile->FindKey("TRT_Ar_all")->ReadObj();
5535 
5536  // if (trtAr->FindKey("Detector_Ar_-1/binhist"))
5537  // {
5538  // cout << " Found Detector_Ar_-1/binhist" << endl;
5539  // rtArbinning1 = new RtBinning(trtAr, "Detector_Ar_-1");
5540  // try
5541  // {
5542  // rtArrelation21 = new RtGraphs(argv[2], "Detector_Ar_-1", true);
5543  // }
5544  // catch (string e)
5545  // {
5546  // cout << e << endl;
5547  // }
5548  // }
5549 
5550  // if (trtAr->FindKey("Detector_Ar_1/binhist"))
5551  // {
5552  // cout << " Found Detector_Ar_1/binhist" << endl;
5553  // rtArbinning2 = new RtBinning(trtAr, "Detector_Ar_1");
5554  // try
5555  // {
5556  // rtArrelation31 = new RtGraphs(argv[2], "Detector_Ar_1", true);
5557  // }
5558  // catch (string e)
5559  // {
5560  // cout << e << endl;
5561  // }
5562  // }
5563 
5564  // if (trtAr->FindKey("Detector_Ar_-2/binhist"))
5565  // {
5566  // cout << " Found Detector_Ar_-2/binhist" << endl;
5567  // rtArbinning3 = new RtBinning(trtAr, "Detector_Ar_-2");
5568  // try
5569  // {
5570  // rtArrelation41 = new RtGraphs(argv[2], "Detector_Ar_-2", true);
5571  // }
5572  // catch (string e)
5573  // {
5574  // cout << e << endl;
5575  // }
5576  // }
5577  // if (trtAr->FindKey("Detector_Ar_2/binhist"))
5578  // {
5579 
5580  // TDirectory *test = (TDirectory *)(((TDirectory *)trtAr->Get("Detector_Ar_2")));
5581  // if (test->FindKey("binhist"))
5582  // {
5583  // cout << " Found Detector_Ar_2/binhist" << endl;
5584  // rtArbinning4 = new RtBinning(trtAr, "Detector_Ar_2");
5585  // try
5586  // {
5587  // rtArrelation51 = new RtGraphs(argv[2], "Detector_Ar_2", true);
5588  // }
5589  // catch (string e)
5590  // {
5591  // cout << e << endl;
5592  // }
5593  // }
5594  // }
5595  // // r plots for each t-bin
5596  // cout << " MAKING AR Rt binning" << endl;
5597  // }
5598 
5599  // Binned residual plots
5600  // RresTbin *binresAr_bar_bar = nullptr;
5601  // RresTbin *binresAr_bar1 = nullptr;
5602  // RresTbin *binresAr_bar2 = nullptr;
5603  // RresTbin *binresAr_bar3 = nullptr;
5604  // RresTbin *binresAr_bar4 = nullptr;
5605  // TBinnedRes *tbinnedArres_bar = nullptr;
5606  // TBinnedRes *tbinnedArres1 = nullptr;
5607  // TBinnedRes *tbinnedArres2 = nullptr;
5608  // TBinnedRes *tbinnedArres3 = nullptr;
5609  // TBinnedRes *tbinnedArres4 = nullptr;
5610 
5611  cout << "MAKING RT Binned Residual for Ar" << endl;
5612 
5613  TDirectory *trtAr = (TDirectory *)datafile->FindKey("TRT_Ar_all")->ReadObj();
5614  // if (trtAr->FindKey("WholeBarrel_Ar_1")) binresAr_bar_bar = new RresTbin(datafile,"WholeBarrel_Ar_1",4);
5615  // if (trtAr->FindKey("Detector_Ar_-1"))
5616  // binresAr_bar1 = new RresTbin(datafile, "Detector_Ar_-1", -1);
5617  // if (trtAr->FindKey("Detector_Ar_1"))
5618  // binresAr_bar2 = new RresTbin(datafile, "Detector_Ar_1", 1);
5619  // if (trtAr->FindKey("Detector_Ar_-2"))
5620  // binresAr_bar3 = new RresTbin(datafile, "Detector_Ar_-2", -2);
5621  // if (trtAr->FindKey("Detector_Ar_2"))
5622  // binresAr_bar4 = new RresTbin(datafile, "Detector_Ar_2", 2);
5623 
5624  cout << "MAKING RT Binned Abs Residual for Ar" << endl;
5625 
5626  // tbinnedArres_bar = new TBinnedRes(datafile,binresAr_bar_bar->reshists);
5627  // tbinnedArres1 = new TBinnedRes(datafile, binresAr_bar1->reshists);
5628  // tbinnedArres2 = new TBinnedRes(datafile, binresAr_bar2->reshists);
5629  // tbinnedArres3 = new TBinnedRes(datafile, binresAr_bar3->reshists);
5630  // tbinnedArres4 = new TBinnedRes(datafile, binresAr_bar4->reshists);
5631 
5632  // RtColor *rtArcol = nullptr;
5633  // RtColor *rtArcol1 = nullptr;
5634  RtColor *rtArcol2 = nullptr;
5635  RtColor *rtArcol3 = nullptr;
5636  RtColor *rtArcol4 = nullptr;
5637  RtColor *rtArcol5 = nullptr;
5638  // Rt relation, default plot
5639  // if (datafile->FindKey("TRT_Ar_all/rt-relation"))
5640  // {
5641  // cout << "MAKING AR RtColor all TRT" << endl;
5642  // try
5643  // {
5644  // rtArcol = new RtColor(argv[2], "", true);
5645  // }
5646  // catch (string e)
5647  // {
5648  // cout << e << endl;
5649  // }
5650  // }
5651 
5652  if (trtAr->FindKey("Detector_Ar_-1"))
5653  {
5654  cout << " MAKING AR RtColor det -1" << endl;
5655  try
5656  {
5657  rtArcol2 = new RtColor(argv[2], "Detector_Ar_-1", true);
5658  }
5659  catch (string e)
5660  {
5661  cout << e << endl;
5662  }
5663  }
5664  if (trtAr->FindKey("Detector_Ar_1"))
5665  {
5666  cout << " MAKING AR RtColor det 1" << endl;
5667  try
5668  {
5669  rtArcol3 = new RtColor(argv[2], "Detector_Ar_1", true);
5670  }
5671  catch (string e)
5672  {
5673  cout << e << endl;
5674  }
5675  }
5676  if (trtAr->FindKey("Detector_Ar_-2"))
5677  {
5678  cout << " MAKING AR RtColor det -2" << endl;
5679  try
5680  {
5681  rtArcol4 = new RtColor(argv[2], "Detector_Ar_-2", true);
5682  }
5683  catch (string e)
5684  {
5685  cout << e << endl;
5686  }
5687  }
5688  if (trtAr->FindKey("Detector_Ar_2"))
5689  {
5690  cout << " MAKING AR RtColor det 2" << endl;
5691  try
5692  {
5693  rtArcol5 = new RtColor(argv[2], "Detector_Ar_2", true);
5694  }
5695  catch (string e)
5696  {
5697  cout << e << endl;
5698  }
5699  }
5700  // Add the plot for Board T0 variations
5701  BoardVariationsOldT0 *refboardECgraphA = nullptr;
5702  BoardVariationsOldT0 *refboardECgraphC = nullptr;
5703  BoardVariationsDiff *boarddiffECgraphA = nullptr;
5704  BoardVariationsDiff *boarddiffECgraphC = nullptr;
5705  if (useref)
5706  {
5707  cout << "MAKING BoardVariationsOldT0 for Ar" << endl;
5708  refboardECgraphA = new BoardVariationsOldT0(argv[4], 2);
5709  refboardECgraphC = new BoardVariationsOldT0(argv[4], -2);
5710  cout << "MAKING BoardVariationsDiff Ar" << endl;
5711  boarddiffECgraphA = new BoardVariationsDiff(argv[2], argv[4], 2);
5712  boarddiffECgraphC = new BoardVariationsDiff(argv[2], argv[4], -2);
5713  boarddiffECgraphA->SetLineColor(2);
5714  boarddiffECgraphC->SetLineColor(2);
5715  }
5716  // Add the plot for Board T0 variations
5717  cout << "MAKING BoardVariations Ar" << endl;
5718  BoardVariations *boardECgraphA = new BoardVariations(argv[2], 2);
5719  BoardVariations *boardECgraphC = new BoardVariations(argv[2], -2);
5720  // Add the plot for the residual
5721  cout << "MAKING BoardVariationsRes Ar" << endl;
5722  BoardVariationsRes *boardECgraphA1 = new BoardVariationsRes(argv[2], 2);
5723  BoardVariationsRes *boardECgraphC1 = new BoardVariationsRes(argv[2], -2);
5724  // Add the plot for the Time residual
5725  cout << "MAKING BoardVariationsTRes Ar" << endl;
5726  BoardVariationsTRes *boardECgraphA2 = new BoardVariationsTRes(argv[2], 2);
5727  BoardVariationsTRes *boardECgraphC2 = new BoardVariationsTRes(argv[2], -2);
5728  // Add the plot for the sigma Time residual
5729  cout << "MAKING BoardVariationsTRes1" << endl;
5730  BoardVariationsTRes1 *boardECgraphA3 = new BoardVariationsTRes1(argv[2], 2);
5731  BoardVariationsTRes1 *boardECgraphC3 = new BoardVariationsTRes1(argv[2], -2);
5732 
5733  cout << " Start printing itersum.ps" << endl;
5734 
5735  TCanvas *textpage;
5736 
5737  TCanvas *c1 = new TCanvas();
5738  c1->Print("itersum.ps[");
5739  c1->cd();
5740 
5741  if (firstpage)
5742  firstpage->Print("itersum.ps");
5743  c1->Clear();
5744  if (settings)
5745  settings->Print("itersum.ps");
5746  c1->Clear();
5747  if (tracktupleinfo)
5748  tracktupleinfo->Print("itersum.ps");
5749  c1->Clear();
5750  if (hitstat)
5751  hitstat->Print("itersum.ps");
5752  c1->Clear();
5753  if (hitstatAr)
5754  hitstatAr->Print("itersum.ps");
5755  c1->Clear();
5756 
5757  gStyle->SetOptStat(0);
5758  if (resplots)
5759  resplots->Print("itersum.ps");
5760  c1->Clear();
5761  if (resplotsAr)
5762  resplotsAr->Print("itersum.ps");
5763  c1->Clear();
5764 
5765  textpage = new TextPage(" BARREL PLOTS ");
5766  textpage->Print("itersum.ps");
5767  c1->Clear();
5768 
5769  hitstatxy->Print("itersum.ps");
5770  c1->Clear();
5771  if (isAr)
5772  hitstatxyAr->Print("itersum.ps");
5773  c1->Clear();
5774  nhits->Print("itersum.ps");
5775  c1->Clear();
5776  if (isAr)
5777  nhitsAr->Print("itersum.ps");
5778  c1->Clear();
5779  resxy0->Print("itersum.ps");
5780  c1->Clear();
5781  if (isAr)
5782  resxy0Ar->Print("itersum.ps");
5783  c1->Clear();
5784  resxy->Print("itersum.ps");
5785  c1->Clear();
5786  if (isAr)
5787  resxyAr->Print("itersum.ps");
5788  c1->Clear();
5789  xymap->Print("itersum.ps");
5790  c1->Clear();
5791  if (isAr)
5792  xymapAr->Print("itersum.ps");
5793  c1->Clear();
5794  if (do_expert)
5795  {
5796  oldt0->Print("itersum.ps");
5797  c1->Clear();
5798  if (isAr)
5799  oldt0Ar->Print("itersum.ps");
5800  c1->Clear();
5801  }
5802  oldt01->Print("itersum.ps");
5803  c1->Clear();
5804  if (isAr)
5805  oldt01Ar->Print("itersum.ps");
5806  c1->Clear();
5807  if (do_expert)
5808  {
5809  oldt0111->Print("itersum.ps");
5810  c1->Clear();
5811  if (isAr)
5812  oldt0111Ar->Print("itersum.ps");
5813  c1->Clear();
5814  }
5815  oldt011->Print("itersum.ps");
5816  c1->Clear();
5817  if (isAr)
5818  oldt011Ar->Print("itersum.ps");
5819  c1->Clear();
5820 
5821  // textpage = new TextPage(" T0 PLOTS "); textpage->Print("itersum.ps"); c1->Clear();
5822 
5823  double lowe = -3.5, upe = 3.5;
5824  if (do_expert)
5825  if (chipgraphA && chipgraphC)
5826  {
5827  chipgraphA->GetYaxis()->SetRangeUser(lowe, upe);
5828  chipgraphC->GetYaxis()->SetRangeUser(lowe, upe);
5829  c1->cd();
5830  c1->Divide(1, 2, 0.01, 0.01);
5831  c1->cd(1);
5832  chipgraphA->Draw();
5833  chipgraphA->DrawLines(lowe, upe);
5834  c1->cd(2);
5835  chipgraphC->Draw();
5836  chipgraphC->DrawLines(lowe, upe);
5837  c1->Print("itersum.ps");
5838  c1->Clear();
5839  }
5840 
5841  c1->cd();
5842  c1->Divide(1, 2, 0.01, 0.01);
5843  c1->cd(1);
5844  boardgraphA->Draw("apl");
5845  boardgraphA->DrawLines();
5846  if (refboardgraphA)
5847  refboardgraphA->Draw("pl");
5848  TLegend *leg = new TLegend(0.8, 0.8, 0.98, 0.95);
5849  leg->AddEntry(boardgraphA, "data", "l");
5850  if (refboardgraphA)
5851  leg->AddEntry(refboardgraphA, "ref (input to 1st it)", "l");
5852  leg->SetTextSize(0.03);
5853  leg->Draw();
5854  c1->cd(2);
5855  boardgraphC->Draw("apl");
5856  boardgraphC->DrawLines();
5857  if (refboardgraphC)
5858  refboardgraphC->Draw("pl");
5859  c1->Print("itersum.ps");
5860  c1->Clear();
5861 
5862  // Add the plot for Board T0 variations differenses
5863  if (useref)
5864  {
5865  c1->cd();
5866  c1->Divide(1, 2, 0.01, 0.01);
5867  c1->cd(1);
5868  boarddiffgraphA->Draw("ap");
5869  boarddiffgraphA->DrawLines();
5870 
5871  c1->cd(2);
5872  boarddiffgraphC->Draw("ap");
5873  boarddiffgraphC->DrawLines();
5874  if (do_expert)
5875  c1->Print("itersum.ps");
5876  c1->Clear();
5877  }
5878 
5879  c1->cd();
5880  c1->Divide(1, 2, 0.01, 0.01);
5881  c1->cd(1);
5882  boardgraphA1->Draw("apl");
5883  boardgraphA1->DrawLines();
5884  c1->cd(2);
5885  boardgraphC1->Draw("apl");
5886  boardgraphC1->DrawLines();
5887  c1->Print("itersum.ps");
5888  c1->Clear();
5889 
5890  c1->cd();
5891  c1->Divide(1, 2, 0.01, 0.01);
5892  c1->cd(1);
5893  boardgraphA2->Draw("apl");
5894  boardgraphA2->DrawLines();
5895  c1->cd(2);
5896  boardgraphC2->Draw("apl");
5897  boardgraphC2->DrawLines();
5898  c1->Print("itersum.ps");
5899  c1->Clear();
5900 
5901  c1->cd();
5902  c1->Divide(1, 2, 0.01, 0.01);
5903  c1->cd(1);
5904  boardgraphA3->Draw("apl");
5905  boardgraphA3->DrawLines();
5906  c1->cd(2);
5907  boardgraphC3->Draw("apl");
5908  boardgraphC3->DrawLines();
5909  c1->Print("itersum.ps");
5910  c1->Clear();
5911 
5912  // ################################################################ ADD PLOTS FOR ENDCAPS:
5913 
5914  c1->Clear();
5915  textpage = new TextPage("ENDCAP PLOTS");
5916  textpage->Print("itersum.ps");
5917  c1->Clear();
5918 
5919  cout << "MAKING PLOTS FOR ENDCAPS" << endl;
5920 
5921  // Do hits fit type:
5922  XYMapsEC *ntypeEC = new XYMapsEC(argv[2], "ftype");
5923  ntypeEC->Print("itersum.ps");
5924  XYMapsEC *ntypeECAr = nullptr;
5925  if (isAr)
5926  {
5927  ntypeECAr = new XYMapsEC(argv[2], "ftype", true);
5928  ntypeECAr->Print("itersum.ps");
5929  }
5930 
5931  // Do hits plots:
5932  XYMapsEC *nhitsEC = new XYMapsEC(argv[2], "nt0");
5933  nhitsEC->Print("itersum.ps");
5934  XYMapsEC *nhitsECAr = nullptr;
5935  if (isAr)
5936  {
5937  nhitsECAr = new XYMapsEC(argv[2], "nt0", true);
5938  nhitsECAr->Print("itersum.ps");
5939  }
5940  // Do res plot:
5941  XYMapsEC *resxy0EC = new XYMapsEC(argv[2], "res");
5942  resxy0EC->Print("itersum.ps");
5943  XYMapsEC *resxy0ECAr = nullptr;
5944  if (isAr)
5945  {
5946  resxy0ECAr = new XYMapsEC(argv[2], "res", true);
5947  resxy0ECAr->Print("itersum.ps");
5948  }
5949 
5950  XYMapsEC *resxyM0EC = new XYMapsEC(argv[2], "abs(resMean)");
5951  resxyM0EC->Print("itersum.ps");
5952  XYMapsEC *resxyM0ECAr = nullptr;
5953  if (isAr)
5954  {
5955  resxyM0ECAr = new XYMapsEC(argv[2], "abs(resMean)", true);
5956  resxyM0ECAr->Print("itersum.ps");
5957  }
5958 
5959  // Do t0s plots:
5960  XYMapsEC *xymapEC = new XYMapsEC(argv[2], "t0");
5961  xymapEC->Print("itersum.ps");
5962  XYMapsEC *xymapECAr = nullptr;
5963  if (isAr)
5964  {
5965  xymapECAr = new XYMapsEC(argv[2], "t0", true);
5966  xymapECAr->Print("itersum.ps");
5967  }
5968 
5969  // Do Oldt0plots
5970  XYMapsEC *oldt0EC = nullptr;
5971  if (do_expert)
5972  oldt0EC = new XYMapsEC(argv[2], "oldt0");
5973  if (do_expert)
5974  oldt0EC->Print("itersum.ps");
5975  XYMapsEC *oldt0ECAr = nullptr;
5976  if (do_expert)
5977  {
5978  if (isAr)
5979  {
5980  oldt0ECAr = new XYMapsEC(argv[2], "oldt0", true);
5981  oldt0ECAr->Print("itersum.ps");
5982  }
5983  }
5984 
5985  // Do t0 diff:
5986  XYMapsEC *oldt01EC = new XYMapsEC(argv[2], "abs(t0-oldt0)");
5987  oldt01EC->Print("itersum.ps");
5988  XYMapsEC *oldt01ECAr = nullptr;
5989  if (isAr)
5990  {
5991  oldt01ECAr = new XYMapsEC(argv[2], "abs(t0-oldt0)", true);
5992  oldt01ECAr->Print("itersum.ps");
5993  }
5994 
5995  // Do t0 widht:
5996 
5997  XYMapsEC *oldt0111EC = nullptr;
5998  if (do_expert)
5999  oldt0111EC = new XYMapsEC(argv[2], "abs(tresMean)");
6000  if (do_expert)
6001  oldt0111EC->Print("itersum.ps");
6002  XYMapsEC *oldt0111ECAr = nullptr;
6003  if (do_expert)
6004  {
6005  if (isAr)
6006  {
6007  oldt0111ECAr = new XYMapsEC(argv[2], "abs(tresMean)", true);
6008  oldt0111ECAr->Print("itersum.ps");
6009  }
6010  }
6011  // Do t0 widht:
6012  XYMapsEC *oldt011EC = new XYMapsEC(argv[2], "tres");
6013  oldt011EC->Print("itersum.ps");
6014  XYMapsEC *oldt011ECAr = nullptr;
6015  if (isAr)
6016  {
6017  oldt011ECAr = new XYMapsEC(argv[2], "tres", true);
6018  oldt011ECAr->Print("itersum.ps");
6019  }
6020 
6021  // Do board variations for Ar
6022  c1->cd();
6023  c1->Divide(1, 2, 0.01, 0.01);
6024  c1->cd(1);
6025  boardECgraphA->Draw("apl");
6026  boardECgraphA->DrawLines();
6027  if (refboardECgraphA)
6028  refboardECgraphA->Draw("pl");
6029  TLegend *legAr = new TLegend(0.8, 0.8, 0.98, 0.95);
6030  legAr->AddEntry(boardECgraphA, "data", "l");
6031  if (refboardECgraphA)
6032  leg->AddEntry(refboardECgraphA, "ref (input to 1st it)", "l");
6033  legAr->SetTextSize(0.03);
6034  legAr->Draw();
6035  c1->cd(2);
6036  boardECgraphC->Draw("apl");
6037  boardECgraphC->DrawLines();
6038  if (refboardECgraphC)
6039  refboardECgraphC->Draw("pl");
6040  c1->Print("itersum.ps");
6041  c1->Clear();
6042 
6043  // Add the plot for Board T0 variations differenses
6044  if (useref)
6045  {
6046  c1->cd();
6047  c1->Divide(1, 2, 0.01, 0.01);
6048  c1->cd(1);
6049  boarddiffECgraphA->Draw("ap");
6050  boarddiffECgraphA->DrawLines();
6051  c1->cd(2);
6052  boarddiffECgraphC->Draw("ap");
6053  boarddiffECgraphC->DrawLines();
6054  if (do_expert)
6055  c1->Print("itersum.ps");
6056  c1->Clear();
6057  }
6058 
6059  c1->cd();
6060  c1->Divide(1, 2, 0.01, 0.01);
6061  c1->cd(1);
6062  boardECgraphA1->Draw("apl");
6063  boardECgraphA1->DrawLines();
6064  c1->cd(2);
6065  boardECgraphC1->Draw("apl");
6066  boardECgraphC1->DrawLines();
6067  c1->Print("itersum.ps");
6068  c1->Clear();
6069 
6070  c1->cd();
6071  c1->Divide(1, 2, 0.01, 0.01);
6072  c1->cd(1);
6073  boardECgraphA2->Draw("apl");
6074  boardECgraphA2->DrawLines();
6075  c1->cd(2);
6076  boardECgraphC2->Draw("apl");
6077  boardECgraphC2->DrawLines();
6078  c1->Print("itersum.ps");
6079  c1->Clear();
6080 
6081  c1->cd();
6082  c1->Divide(1, 2, 0.01, 0.01);
6083  c1->cd(1);
6084  boardECgraphA3->Draw("apl");
6085  boardECgraphA3->DrawLines();
6086  c1->cd(2);
6087  boardECgraphC3->Draw("apl");
6088  boardECgraphC3->DrawLines();
6089  c1->Print("itersum.ps");
6090  c1->Clear();
6091 
6092  // ################################### RT PLOTS: ########################################################
6093 
6094  textpage = new TextPage(" RT PLOTS ");
6095  textpage->Print("itersum.ps");
6096  c1->Clear();
6097 
6098  gStyle->SetOptStat(1);
6099  gStyle->SetOptFit(0);
6100  if (do_expert)
6101  if (rtrelation_bar)
6102  rtrelation_bar->Print("itersum.ps");
6103  c1->Clear();
6104  if (do_expert)
6105  if (rtbinning_bar)
6106  rtbinning_bar->Print("itersum.ps");
6107  c1->Clear();
6108  if (do_expert)
6109  if (rtrelation21)
6110  rtrelation21->Print("itersum.ps");
6111  c1->Clear();
6112  if (do_expert)
6113  if (rtbinning1)
6114  rtbinning1->Print("itersum.ps");
6115  c1->Clear();
6116  if (do_expert)
6117  if (rtrelation31)
6118  rtrelation31->Print("itersum.ps");
6119  c1->Clear();
6120  if (do_expert)
6121  if (rtbinning2)
6122  rtbinning2->Print("itersum.ps");
6123  c1->Clear();
6124  if (do_expert)
6125  if (rtrelation41)
6126  rtrelation41->Print("itersum.ps");
6127  c1->Clear();
6128  if (do_expert)
6129  if (rtbinning3)
6130  rtbinning3->Print("itersum.ps");
6131  c1->Clear();
6132  if (do_expert)
6133  if (rtrelation51)
6134  rtrelation51->Print("itersum.ps");
6135  c1->Clear();
6136  if (do_expert)
6137  if (rtbinning4)
6138  rtbinning4->Print("itersum.ps");
6139  c1->Clear();
6140 
6141  if (do_expert)
6142  if (binres_bar)
6143  binres_bar->Print("itersum.ps");
6144  c1->Clear();
6145  if (do_expert)
6146  if (tbinnedres_bar)
6147  tbinnedres_bar->Print("itersum.ps");
6148  c1->Clear();
6149  if (do_expert)
6150  if (binres1)
6151  binres1->Print("itersum.ps");
6152  c1->Clear();
6153  if (do_expert)
6154  if (tbinnedres1)
6155  tbinnedres1->Print("itersum.ps");
6156  c1->Clear();
6157  if (do_expert)
6158  if (binres2)
6159  binres2->Print("itersum.ps");
6160  c1->Clear();
6161  if (do_expert)
6162  if (tbinnedres2)
6163  tbinnedres2->Print("itersum.ps");
6164  c1->Clear();
6165  if (do_expert)
6166  binres3->Print("itersum.ps");
6167  c1->Clear();
6168  if (do_expert)
6169  if (tbinnedres3)
6170  tbinnedres3->Print("itersum.ps");
6171  c1->Clear();
6172  if (do_expert)
6173  binres4->Print("itersum.ps");
6174  c1->Clear();
6175  if (do_expert)
6176  if (tbinnedres4)
6177  tbinnedres4->Print("itersum.ps");
6178  c1->Clear();
6179 
6180  gStyle->SetOptStat(0);
6181  if (do_expert)
6182  if (rtcol)
6183  rtcol->Print("itersum.ps");
6184  c1->Clear();
6185  if (do_expert)
6186  if (rtcol1)
6187  rtcol1->Print("itersum.ps");
6188  c1->Clear();
6189  if (rtcol2)
6190  rtcol2->Print("itersum.ps");
6191  c1->Clear();
6192  if (isAr && rtArcol2)
6193  rtArcol2->Print("itersum.ps");
6194  c1->Clear();
6195  if (rtcol3)
6196  rtcol3->Print("itersum.ps");
6197  c1->Clear();
6198  if (isAr && rtArcol3)
6199  rtArcol3->Print("itersum.ps");
6200  c1->Clear();
6201  if (rtcol4)
6202  rtcol4->Print("itersum.ps");
6203  c1->Clear();
6204  if (isAr && rtArcol4)
6205  rtArcol4->Print("itersum.ps");
6206  c1->Clear();
6207  if (rtcol5)
6208  rtcol5->Print("itersum.ps");
6209  c1->Clear();
6210  if (isAr && rtArcol5)
6211  rtArcol5->Print("itersum.ps");
6212  c1->Clear();
6213 
6214  // Plot all RTs together....
6215 
6216  DGraph *dgraph0 = nullptr; // trt
6217  DGraph *dgraph1 = nullptr; // -1
6218  DGraph *dgraph2 = nullptr; // 1
6219  DGraph *dgraph3 = nullptr; // -2
6220  DGraph *dgraph4 = nullptr; // 2
6221  DGraph *dgraph5 = nullptr; // whole barrel
6222  bool isinverted = false;
6223  if (datafile->FindKey("TRT_all"))
6224  {
6225  TDirectory *trt = (TDirectory *)datafile->FindKey("TRT_all")->ReadObj();
6226  cout << "MAKING DGraphs" << endl;
6227  c1->cd();
6228  c1->SetGrid();
6229  dgraph0 = new DGraph(argv[2], "-2,-1", "", -2, -1, isinverted);
6230  if (trt->FindKey("WholeBarrel_1"))
6231  {
6232  dgraph5 = new DGraph(argv[2], "-2,-1", "WholeBarrel_1", -1, -1, isinverted);
6233  }
6234  else
6235  {
6236  cout << " did not find WholeBarrel_1" << endl;
6237  if (trt->FindKey("Detector_1"))
6238  dgraph1 = new DGraph(argv[2], "-2,-1", "Detector_1", 1, -1, isinverted);
6239  if (trt->FindKey("Detector_-1"))
6240  dgraph2 = new DGraph(argv[2], "-2,-1", "Detector_-1", 1, -1, isinverted);
6241  }
6242  if (trt->FindKey("Detector_2"))
6243  dgraph3 = new DGraph(argv[2], "-2,-1", "Detector_2", 1, -1, isinverted);
6244  if (trt->FindKey("Detector_-2"))
6245  dgraph4 = new DGraph(argv[2], "-2,-1", "Detector_-2", 1, -1, isinverted);
6246 
6247 
6248  TLegend *leg = new TLegend(0.8, 0.8, 0.98, 0.95);
6249  if (dgraph0 != nullptr)
6250  {
6251  dgraph0->GetXaxis()->SetRangeUser(-5, 45);
6252  cout << " found TRT_all" << endl;
6253  dgraph0->SetLineWidth(3);
6254  dgraph0->SetLineColor(1);
6255  dgraph0->SetTitle("r(t)");
6256 
6257  dgraph0->GetXaxis()->SetTitle("t/ns");
6258 
6259  dgraph0->GetYaxis()->SetTitle("R / (mm)");
6260 
6261  if (dgraph0->rtgraph)
6262  dgraph0->Draw("apl");
6263  if (dgraph0->rtgraph)
6264  leg->AddEntry(dgraph0, "Whole TRT", "l");
6265  }
6266  if (dgraph1 != nullptr)
6267  {
6268  cout << " found Detector_1" << endl;
6269  dgraph1->SetLineWidth(3);
6270  dgraph1->SetLineColor(3);
6271  if (dgraph1->rtgraph)
6272  dgraph1->Draw("pl");
6273  if (dgraph1->rtgraph)
6274  leg->AddEntry(dgraph1, "Barrel C Side", "l");
6275  }
6276 
6277  if (dgraph2 != nullptr)
6278  {
6279  cout << " found Detector_-1" << endl;
6280  dgraph2->SetLineWidth(3);
6281  dgraph2->SetLineColor(2);
6282  if (dgraph2->rtgraph)
6283  dgraph2->Draw("pl");
6284  if (dgraph2->rtgraph)
6285  leg->AddEntry(dgraph2, "Barrel A Side", "l");
6286  }
6287 
6288  if (dgraph3 != nullptr)
6289  {
6290  dgraph3->SetLineWidth(3);
6291  cout << " found Detector_2" << endl;
6292  dgraph3->SetLineColor(6);
6293  if (dgraph3->rtgraph)
6294  dgraph3->Draw("pl");
6295  if (dgraph3->rtgraph)
6296  leg->AddEntry(dgraph3, "Endcap C side", "l");
6297  }
6298 
6299  if (dgraph4 != nullptr)
6300  {
6301  cout << " found Detector_-2" << endl;
6302  dgraph4->SetLineWidth(3);
6303  dgraph4->SetLineColor(7);
6304  if (dgraph4->rtgraph)
6305  dgraph4->Draw("pl");
6306  if (dgraph4->rtgraph)
6307  leg->AddEntry(dgraph4, "Endcap A side", "l");
6308  }
6309  if (dgraph5 != nullptr)
6310  {
6311  cout << " found WholeBarrel_1" << endl;
6312  dgraph5->SetLineWidth(3);
6313  dgraph5->SetLineColor(8);
6314  if (dgraph5->rtgraph)
6315  dgraph5->Draw("pl");
6316  if (dgraph5->rtgraph)
6317  leg->AddEntry(dgraph5, "Whole Barrel", "l");
6318  }
6319 
6320  leg->SetTextSize(0.03);
6321  leg->Draw();
6322  c1->Print("itersum.ps");
6323  c1->Clear();
6324  }
6325 
6326  // Plot drift velocity:
6327  DvGraph *dvgraph0 = nullptr; // trt
6328  DvGraph *dvgraph1 = nullptr; // -1
6329  DvGraph *dvgraph2 = nullptr; // 1
6330  DvGraph *dvgraph3 = nullptr; // -2
6331  DvGraph *dvgraph4 = nullptr; // 2
6332  DvGraph *dvgraph5 = nullptr; // whole barrel
6333  if (do_expert)
6334  {
6335  // bool isinverted=false;
6336  if (datafile->FindKey("TRT_all"))
6337  {
6338  cout << " do_expert: found TRT_all" << endl;
6339  TDirectory *trt = (TDirectory *)datafile->FindKey("TRT_all")->ReadObj();
6340  cout << "MAKING DvGraphs" << endl;
6341  c1->cd();
6342  c1->SetGrid();
6343  dvgraph0 = new DvGraph(argv[2], "-2,-1", "", -2, -1, isinverted);
6344  if (trt->FindKey("WholeBarrel_1"))
6345  dvgraph5 = new DvGraph(argv[2], "-2,-1", "WholeBarrel_1", -1, -1, isinverted);
6346  else
6347  {
6348  if (trt->FindKey("Detector_1"))
6349  dvgraph1 = new DvGraph(argv[2], "-2,-1", "Detector_1", 1, -1, isinverted);
6350  if (trt->FindKey("Detector_-1"))
6351  dvgraph2 = new DvGraph(argv[2], "-2,-1", "Detector_-1", 1, -1, isinverted);
6352  }
6353  if (trt->FindKey("Detector_2"))
6354  dvgraph3 = new DvGraph(argv[2], "-2,-1", "Detector_2", 1, -1, isinverted);
6355  if (trt->FindKey("Detector_-2"))
6356  dvgraph4 = new DvGraph(argv[2], "-2,-1", "Detector_-2", 1, -1, isinverted);
6357 
6358 
6359  TLegend *leg = new TLegend(0.8, 0.8, 0.98, 0.95);
6360  if (dvgraph0 != nullptr)
6361  {
6362  dvgraph0->GetXaxis()->SetRangeUser(0, 2);
6363  cout << " do_expert: found -2-1" << endl;
6364  dvgraph0->SetLineWidth(3);
6365  dvgraph0->SetLineColor(1);
6366  if (isinverted)
6367  dvgraph0->SetTitle("dt/dr");
6368  else
6369  dvgraph0->SetTitle("dr/dt");
6370  dvgraph0->GetXaxis()->SetTitle("r/mm");
6371  if (isinverted)
6372  dvgraph0->GetYaxis()->SetTitle("dt/dr / (ns/mm)");
6373  else
6374  dvgraph0->GetYaxis()->SetTitle("dr/dt / (mm/ns)");
6375  if (dvgraph0->rtgraph)
6376  dvgraph0->Draw("apl");
6377  if (dvgraph0->rtgraph)
6378  leg->AddEntry(dvgraph0, "Whole TRT", "l");
6379  }
6380  if (dvgraph1 != nullptr)
6381  {
6382  cout << " do_expert: found Detector_1" << endl;
6383  dvgraph1->SetLineWidth(3);
6384  dvgraph1->SetLineColor(3);
6385  if (dvgraph1->rtgraph)
6386  dvgraph1->Draw("pl");
6387  if (dvgraph1->rtgraph)
6388  leg->AddEntry(dvgraph1, "Barrel C Side", "l");
6389  }
6390 
6391  if (dvgraph2 != nullptr)
6392  {
6393  dvgraph2->SetLineWidth(3);
6394  dvgraph2->SetLineColor(2);
6395  if (dvgraph2->rtgraph)
6396  dvgraph2->Draw("pl");
6397  if (dvgraph2->rtgraph)
6398  leg->AddEntry(dvgraph2, "Barrel A Side", "l");
6399  }
6400 
6401  if (dvgraph3 != nullptr)
6402  {
6403  dvgraph3->SetLineWidth(3);
6404  dvgraph3->SetLineColor(6);
6405  if (dvgraph3->rtgraph)
6406  dvgraph3->Draw("pl");
6407  if (dvgraph3->rtgraph)
6408  leg->AddEntry(dvgraph3, "Endcap C side", "l");
6409  }
6410 
6411  if (dvgraph4 != nullptr)
6412  {
6413  dvgraph4->SetLineWidth(3);
6414  dvgraph4->SetLineColor(7);
6415  if (dvgraph4->rtgraph)
6416  dvgraph4->Draw("pl");
6417  if (dvgraph4->rtgraph)
6418  leg->AddEntry(dvgraph4, "Endcap A side", "l");
6419  }
6420  if (dvgraph5 != nullptr)
6421  {
6422  dvgraph5->SetLineWidth(3);
6423  dvgraph5->SetLineColor(8);
6424  if (dvgraph5->rtgraph)
6425  dvgraph5->Draw("pl");
6426  if (dvgraph5->rtgraph)
6427  leg->AddEntry(dvgraph5, "Whole Barrel", "l");
6428  }
6429 
6430  leg->SetTextSize(0.03);
6431  leg->Draw();
6432  c1->Print("itersum.ps");
6433  c1->Clear();
6434  }
6435  }
6436 
6437  // ################################### ADD PLOTS FOR TRACKING #######################################33
6438  c1->Clear();
6439  textpage = new TextPage("Track plots: Only for Experts!!!");
6440  textpage->Print("itersum.ps");
6441  c1->Clear();
6442 
6443  bool istracktuple = false;
6444  TNtuple *Tracktuple = nullptr;
6445  if (datafile->FindKey("tracktuple"))
6446  {
6447  Tracktuple = (TNtuple *)datafile->Get("tracktuple");
6448  istracktuple = true;
6449  }
6450 
6451  cout << "MAKING TRACK PLOTS" << endl;
6452  c1->Clear();
6453  if (istracktuple)
6454  {
6455  // first Residuals:
6456  if (Tracktuple->GetListOfBranches()->FindObject("trackres"))
6457  {
6458  c1->cd();
6459  c1->Divide(2, 1, 0.01, 0.01);
6460  c1->cd(1);
6461  Tracktuple->Draw("trackres>>histRes(100,0,1.5)");
6462  TH1F *histRes = (TH1F *)gPad->GetPrimitive("histRes");
6463  histRes->SetTitle("Residual on track");
6464  histRes->GetXaxis()->SetTitle("Residual (mm)");
6465  histRes->Draw();
6466 
6467  c1->cd(2);
6468  Tracktuple->Draw("trackres:t-ttrack-t0>>histRes2d(100,-12,12,100,0,1)", "", "colz");
6469  TH2F *histRes2d = (TH2F *)gPad->GetPrimitive("histRes2d");
6470  histRes2d->SetTitle("Track time residual VS track residual");
6471  histRes2d->GetXaxis()->SetTitle("Time residual (ns)");
6472  histRes2d->GetYaxis()->SetTitle("Track Residual (mm)");
6473  histRes2d->Draw("colz");
6474  TProfile *res2d = histRes2d->ProfileX();
6475  res2d->Draw("same");
6476 
6477  c1->Print("itersum.ps");
6478  c1->Clear();
6479  }
6480 
6481  // first pt:
6482  if (Tracktuple->GetListOfBranches()->FindObject("pt"))
6483  {
6484  c1->cd();
6485  c1->Divide(2, 1, 0.01, 0.01);
6486  c1->cd(1);
6487  Tracktuple->Draw("pt/1000>>histPt(100,0,20)");
6488  TH1F *histPt = (TH1F *)gPad->GetPrimitive("histPt");
6489  histPt->SetTitle("Transverse momentum on track");
6490  histPt->GetXaxis()->SetTitle("Pt (GeV)");
6491  histPt->Draw();
6492 
6493  c1->cd(2);
6494  Tracktuple->Draw("trackres:pt/1000>>histPt2d(100,0,20,100,0,1.5)", "", "colz");
6495  TH2F *histPt2d = (TH2F *)gPad->GetPrimitive("histPt2d");
6496  histPt2d->SetTitle("Transverse momentum on track VS track residual");
6497  histPt2d->GetXaxis()->SetTitle("Pt (GeV)");
6498  histPt2d->GetYaxis()->SetTitle("Track Residual (mm)");
6499  histPt2d->Draw("COLZ");
6500  TProfile *pt2d = histPt2d->ProfileX();
6501  pt2d->Draw("same");
6502  c1->Print("itersum.ps");
6503  c1->Clear();
6504  }
6505  // first theta:
6506  if (Tracktuple->GetListOfBranches()->FindObject("theta"))
6507  {
6508  c1->cd();
6509  c1->Divide(2, 1, 0.01, 0.01);
6510  c1->cd(1);
6511  Tracktuple->Draw("theta>>histTheta(100,0,4)");
6512  TH1F *histTheta = (TH1F *)gPad->GetPrimitive("histTheta");
6513  histTheta->SetTitle("Theta distribution on track");
6514  histTheta->GetXaxis()->SetTitle("Theta (rad)");
6515  histTheta->Draw();
6516 
6517  c1->cd(2);
6518  Tracktuple->Draw("trackres:theta>>histTheta2d(100,0,4,100,0,1.5)", "", "colz");
6519  TH2F *histTheta2d = (TH2F *)gPad->GetPrimitive("histTheta2d");
6520  histTheta2d->SetTitle("Theta distrib. on track VS track residual");
6521  histTheta2d->GetXaxis()->SetTitle("Theta (rad)");
6522  histTheta2d->GetYaxis()->SetTitle("Track Residual (mm)");
6523  histTheta2d->Draw("COLZ");
6524  TProfile *theta2d = histTheta2d->ProfileX();
6525  theta2d->Draw("same");
6526  c1->Print("itersum.ps");
6527  c1->Clear();
6528  }
6529  // first phi:
6530  if (Tracktuple->GetListOfBranches()->FindObject("phi"))
6531  {
6532  c1->cd();
6533  c1->Divide(2, 1, 0.01, 0.01);
6534  c1->cd(1);
6535  Tracktuple->Draw("phi>>histPhi(100,-3.5,0)");
6536  TH1F *histPhi = (TH1F *)gPad->GetPrimitive("histPhi");
6537  histPhi->SetTitle("Phi distribution on track");
6538  histPhi->GetXaxis()->SetTitle("Phi (rad)");
6539  histPhi->Draw();
6540 
6541  c1->cd(2);
6542  Tracktuple->Draw("trackres:phi>>histPhi2d(100,-3.5,0,100,0,1.5)", "", "colz");
6543  TH2F *histPhi2d = (TH2F *)gPad->GetPrimitive("histPhi2d");
6544  histPhi2d->SetTitle("Phi distrib. on track VS track residual");
6545  histPhi2d->GetXaxis()->SetTitle("Phi (rad)");
6546  histPhi2d->GetYaxis()->SetTitle("Track Residual (mm)");
6547  histPhi2d->Draw("COLZ");
6548  TProfile *phi2d = histPhi2d->ProfileX();
6549  phi2d->Draw("same");
6550  c1->Print("itersum.ps");
6551  c1->Clear();
6552  }
6553  // first d0:
6554  if (Tracktuple->GetListOfBranches()->FindObject("d0"))
6555  {
6556  c1->cd();
6557  c1->Divide(2, 1, 0.01, 0.01);
6558  c1->cd(1);
6559  Tracktuple->Draw("d0>>histD0(100,-5,5)");
6560  TH1F *histD0 = (TH1F *)gPad->GetPrimitive("histD0");
6561  histD0->SetTitle("D0 distribution on track");
6562  histD0->GetXaxis()->SetTitle("D0 (mm)");
6563  histD0->Draw();
6564 
6565  c1->cd(2);
6566  Tracktuple->Draw("trackres:d0>>histD02d(100,-5,5,100,0,1.5)", "", "colz");
6567  TH2F *histD02d = (TH2F *)gPad->GetPrimitive("histD02d");
6568  histD02d->SetTitle("D0 distrib. on track VS track residual");
6569  histD02d->GetXaxis()->SetTitle("D0 (rad)");
6570  histD02d->GetYaxis()->SetTitle("Track Residual (mm)");
6571  histD02d->Draw("COLZ");
6572  TProfile *d02d = histD02d->ProfileX();
6573  d02d->Draw("same");
6574  c1->Print("itersum.ps");
6575  c1->Clear();
6576  }
6577  }
6578 
6579  // ################################### ADD PLOTS FOR Pulls and Errors #######################################33
6580 
6581  // Skip all this for now (PH)
6582  cout << " Skipping plots for Pulls and Errors " << endl;
6583 
6584  // SERGI - Another block not used :). Firewalls below previously commented... useless block of code
6585  // bool iserrors = false;
6586  // TDirectory *errors = nullptr;
6587  // if (datafile->FindKey("Errors"))
6588  // {
6589  // errors = (TDirectory *)datafile->FindKey("Errors")->ReadObj();
6590  // if (errors != nullptr)
6591  // iserrors = true;
6592  // }
6593 
6594  c1->Clear();
6595  /*
6596  textpage = new TextPage(" Error Plots and Pt dependence. Only for Experts!!!");
6597  textpage->Print("itersum.ps");
6598  c1->Clear();
6599 
6600  cout << "Making Error/Pt plots:" << endl;
6601  c1->Clear();
6602  if (iserrors){
6603  //first Residuals:
6604  cout << "Start with Pt plots:" << endl;
6605  errors->cd();
6606 
6607  PtDependence* ptstuff = new PtDependence(datafile);
6608  ptstuff->Print("itersum.ps");
6609 
6610  TBDependence* tbstuff = new TBDependence(datafile);
6611  tbstuff->Print("itersum.ps");
6612 
6613 
6614 
6615  }
6616 
6617 
6618  */
6619 
6620  // ################################### ADD PLOTS FOR ToT and HT #######################################33
6621 
6622  // Skip all this for now (PH)
6623  cout << " Skipping plots for ToT and HT " << endl;
6624 
6625  // SERGI - Firewalls below previously commented... useless block of code
6626  // bool iscorrections = false;
6627  // TDirectory *corrections = nullptr;
6628  // if (datafile->FindKey("Correction"))
6629  // {
6630  // corrections = (TDirectory *)datafile->FindKey("Correction")->ReadObj();
6631  // if (corrections != nullptr)
6632  // iscorrections = true;
6633  // }
6634 
6635  c1->Clear();
6636  textpage = new TextPage(" ToT Corrections and HT corrections: ");
6637  textpage->Print("itersum.pdf");
6638  c1->Clear();
6639 
6640  cout << "Making ToT / HT Plots" << endl;
6641  c1->Clear();
6642  /*
6643  if (iscorrections){
6644  //first Residuals:
6645  cout << "Start with ToT plots:" << endl;
6646  corrections->cd();
6647 
6648  ToTDependence* totstuff = new ToTDependence(datafile, true); // Barrels:
6649  totstuff->Print("itersum.ps");
6650 
6651  ToTDependence* totstuff2 = new ToTDependence(datafile, false); // Barrels:
6652  totstuff2->Print("itersum.ps");
6653 
6654  cout << "Start with HT plots:" << endl;
6655 
6656  ToTDependence* htstuff = new ToTDependence(datafile, true, true ); // Barrels:
6657  htstuff->Print("itersum.ps");
6658 
6659  ToTDependence* htstuff2 = new ToTDependence(datafile, false, true); // Barrels:
6660  htstuff2->Print("itersum.ps");
6661 
6662  cout << "Start with sin(theta) / p plots:" << endl;
6663 
6664  SinDependence* sinstuff = new SinDependence(datafile, true); // Barrels:
6665  sinstuff->Print("itersum.ps");
6666 
6667  SinDependence* sinstuff2 = new SinDependence(datafile, false); // Barrels:
6668  sinstuff2->Print("itersum.ps");
6669 
6670  cout << "Start with cos(theta) / p plots:" << endl;
6671 
6672  SinDependence* cosstuff = new SinDependence(datafile, true, true); // Barrels:
6673  cosstuff->Print("itersum.ps");
6674 
6675  SinDependence* cosstuff2 = new SinDependence(datafile, false, true); // Barrels:
6676  cosstuff2->Print("itersum.ps");
6677 
6678 
6679  }
6680 
6681 
6682  */
6683 
6684  // ################################### ADD PLOTS FOR ToT and HT ARGON #######################################33
6685 
6686  // bool iscorrectionsAr = false;
6687  // TDirectory *correctionsAr = nullptr;
6688  // if (datafile->FindKey("CorrectionAr"))
6689  // {
6690  // correctionsAr = (TDirectory *)datafile->FindKey("CorrectionAr")->ReadObj();
6691  // if (correctionsAr != nullptr)
6692  // iscorrectionsAr = true;
6693  // }
6694 
6695  /*
6696  if (iscorrectionsAr){
6697  c1->Clear();
6698  textpage = new TextPage(" ToT Corrections and HT corrections: ARGON");
6699  textpage->Print("itersum.ps");
6700  c1->Clear();
6701 
6702  cout << "Making ToT / HT Plots ARGON" << endl;
6703  c1->Clear();
6704  //first Residuals:
6705  cout << "Start with ToT plots:" << endl;
6706  corrections->cd();
6707 
6708  ToTDependence* totstuff = new ToTDependence(datafile, true, false, true); // Barrels:
6709  totstuff->Print("itersum.ps");
6710 
6711  ToTDependence* totstuff2 = new ToTDependence(datafile, false, false, true); // Barrels:
6712  totstuff2->Print("itersum.ps");
6713 
6714  cout << "Start with HT plots:" << endl;
6715 
6716  ToTDependence* htstuff = new ToTDependence(datafile, true, true, true ); // Barrels:
6717  htstuff->Print("itersum.ps");
6718 
6719  ToTDependence* htstuff2 = new ToTDependence(datafile, false, true, true); // Barrels:
6720  htstuff2->Print("itersum.ps");
6721 
6722  cout << "Start with sin(theta) / p plots:" << endl;
6723 
6724  SinDependence* sinstuff = new SinDependence(datafile, true, false, true); // Barrels:
6725  sinstuff->Print("itersum.ps");
6726 
6727  // SinDependence* sinstuff2 = new SinDependence(datafile, false, false, true); // Barrels:
6728  // sinstuff2->Print("itersum.ps");
6729 
6730  cout << "Start with cos(theta) / p plots:" << endl;
6731 
6732  // SinDependence* cosstuff = new SinDependence(datafile, true, true, true); // Barrels:
6733  // cosstuff->Print("itersum.ps");
6734 
6735  SinDependence* cosstuff2 = new SinDependence(datafile, false, true, true); // Barrels:
6736  cosstuff2->Print("itersum.ps");
6737 
6738 
6739  }
6740 
6741  c1->Print("itersum.ps]");
6742  */
6743 
6744  datafile->Close();
6745  if (useref)
6746  refdatafile->Close();
6747 
6748  // cout << "RDIFF -1 ";
6749  // for (map<double,double>::iterator rtpoint = rtrelation21->rtmap.begin(); rtpoint != rtrelation21->rtmap.end(); rtpoint++){
6750  // cout << binres1->resmap[rtpoint->second] << " ";
6751  // }
6752  // cout << endl;
6753  // cout << "RDIFF 1 ";
6754  // for (map<double,double>::iterator rtpoint = rtrelation31->rtmap.begin(); rtpoint != rtrelation31->rtmap.end(); rtpoint++){
6755  // cout << binres2->resmap[rtpoint->second] << " ";
6756  // }
6757  // cout << endl;
6758 
6759  // cout << "RDIFF -2 ";
6760  // for (map<double,double>::iterator rtpoint = rtrelation41->rtmap.begin(); rtpoint != rtrelation41->rtmap.end(); rtpoint++){
6761  // cout << binres3->resmap[rtpoint->second] << " ";
6762  // }
6763  // cout << endl;
6764 
6765  // cout << "RDIFF 2 ";
6766  // for (map<double,double>::iterator rtpoint = rtrelation51->rtmap.begin(); rtpoint != rtrelation51->rtmap.end(); rtpoint++){
6767  // cout << binres4->resmap[rtpoint->second] << " ";
6768  // }
6769  // cout << endl;
6770 
6771  // add some extra info to each page
6772  if (settings && firstpage)
6773  {
6774  string fixfloat, fieldonoff;
6775  if (settings->set["UsePol0"].find("True") != string::npos)
6776  fixfloat = " - floating";
6777  else
6778  fixfloat = " - fixed";
6779  if (settings->set["RtRelation"].find("binned") != string::npos)
6780  fixfloat = "";
6781  if (settings->set["Solenoid"].find("True") != string::npos)
6782  fieldonoff = "ON";
6783  else
6784  fieldonoff = "OFF";
6785 
6786  string pmarking =
6787  string("/Helvetica-Bold findfont 36 scalefont setfont 40 2190 moveto (Run:) show ") +
6788  string(Form("/Helvetica findfont 36 scalefont setfont 240 2190 moveto (%i) show ", (int)firstpage->runnumber)) +
6789 
6790  string("/Helvetica-Bold findfont 36 scalefont setfont 40 2150 moveto (Iteration:) show ") +
6791  string(Form("/Helvetica findfont 36 scalefont setfont 240 2150 moveto (%02i) show ", firstpage->iter)) +
6792 
6793  string("/Helvetica-Bold findfont 36 scalefont setfont 40 2110 moveto (Rt relation:) show ") +
6794  string(Form("/Helvetica findfont 36 scalefont setfont 240 2110 moveto (%s%s) show ", settings->set["RtRelation"].data(), fixfloat.data())) +
6795 
6796  string("/Helvetica-Bold findfont 36 scalefont setfont 540 2190 moveto (Rt binning:) show ") +
6797  string(Form("/Helvetica findfont 36 scalefont setfont 740 2190 moveto (%s) show ", settings->set["RtBinning"].data())) +
6798 
6799  string("/Helvetica-Bold findfont 36 scalefont setfont 540 2150 moveto (Rt level:) show ") +
6800 
6801  string("/Helvetica-Bold findfont 36 scalefont setfont 540 2110 moveto (T0 level:) show ") +
6802 
6803  string("/Helvetica-Bold findfont 36 scalefont setfont 1040 2190 moveto (Solenoid:) show ") +
6804  string(Form("/Helvetica findfont 36 scalefont setfont 1260 2190 moveto (%s) show ", fieldonoff.data())) +
6805 
6806  string("/Helvetica-Bold findfont 36 scalefont setfont 1040 2150 moveto (SW release:) show ") +
6807  string(Form("/Helvetica findfont 36 scalefont setfont 1260 2150 moveto (%s) show ", settings->set["ReleaseRec"].data())) +
6808 
6809  string("/Helvetica-Bold findfont 36 scalefont setfont 1040 2110 moveto (T0 Offset:) show ") +
6810  string(Form("/Helvetica findfont 36 scalefont setfont 1260 2110 moveto (%s) show ", settings->set["T0Offset"].data())) +
6811 
6812  string("/Helvetica-Bold findfont 30 scalefont setfont 40 2060 moveto (Data:) show ") +
6813  string(Form("/Helvetica findfont 30 scalefont setfont 240 2060 moveto (%s) show ", settings->set["Inputdir"].data())) +
6814 
6815  string("/Helvetica-Bold findfont 30 scalefont setfont 40 2020 moveto (Start const:) show ") +
6816  string(Form("/Helvetica findfont 30 scalefont setfont 240 2020 moveto (%s) show ", settings->set["StartConst"].data()));
6817  system((string("sed -i 's?showpage?" + pmarking + "showpage?g' itersum.ps")).data());
6818  }
6819 
6820  // Add some graphs in a new direcrory "analysis"
6821  datafile = new TFile(argv[2], "UPDATE");
6822  datafile->cd();
6823  if (datafile->FindKey("analysis"))
6824  datafile->rmdir("analysis");
6825  TDirectory *adir = datafile->mkdir("analysis", "analysis");
6826  adir->cd();
6827  if (chipgraphA)
6828  chipgraphA->Write();
6829  if (chipgraphC)
6830  chipgraphC->Write();
6831  boardgraphA->Write();
6832  boardgraphC->Write();
6833  if (refboardgraphA)
6834  refboardgraphA->Write();
6835  if (refboardgraphC)
6836  refboardgraphC->Write();
6837  if (dvgraph0)
6838  dvgraph0->Write();
6839  if (dvgraph1)
6840  dvgraph1->Write();
6841  if (dvgraph2)
6842  dvgraph2->Write();
6843  datafile->Write();
6844  datafile->Close();
6845 
6846  return 0;
6847 }

◆ main()

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

Definition at line 6872 of file TRTCalib_makeplots.cxx.

6873 {
6874 
6875  gErrorIgnoreLevel = kFatal; // Explicitly remove all messages
6876 
6877  if ((string(argv[1])).find("itersum") != std::string::npos)
6878  {
6879  cout << "GENERATING ITERATION SUMMARY PLOTS" << endl;
6880  itersum(argc, argv);
6881  }
6882 
6883  if ((string(argv[1])).find("restore") != std::string::npos)
6884  {
6885  cout << "REMOVING THE TRACKTUPLE, BINHIST AND ANALYSE DIRECTORY" << endl;
6886  tt_remove(argc, argv);
6887  }
6888 
6889  return 0;
6890 }

◆ 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){
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 6849 of file TRTCalib_makeplots.cxx.

6850 {
6851 
6852  TFile *itersumfile = new TFile(argv[2], "UPDATE");
6853  if (itersumfile->FindKey("tracktuple"))
6854  {
6855  itersumfile->Delete("tracktuple;*");
6856  }
6857  if (itersumfile->FindKey("binhist"))
6858  {
6859  itersumfile->rmdir("binhist");
6860  }
6861  if (itersumfile->FindKey("analysis"))
6862  {
6863  itersumfile->rmdir("analysis");
6864  }
6865 
6866  itersumfile->Write();
6867  itersumfile->Close();
6868 
6869  return 0;
6870 }

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.

◆ do_expert

bool do_expert = false

Definition at line 45 of file TRTCalib_makeplots.cxx.

AllowedVariables::e
e
Definition: AsgElectronSelectorTool.cxx:37
temp
Definition: JetEventDict.h:21
XYMaps
Definition: TRTCalib_makeplots.cxx:280
data
char data[hepevt_bytes_allocation_ATLAS]
Definition: HepEvt.cxx:11
python.SystemOfUnits.s
int s
Definition: SystemOfUnits.py:131
mean
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="")
Definition: dependence.cxx:254
max
#define max(a, b)
Definition: cfImp.cxx:41
ResidualPlots
Definition: TRTCalib_makeplots.cxx:2935
find
std::string find(const std::string &s)
return a remapped string
Definition: hcg.cxx:135
FirstPage::iter
int iter
Definition: TRTCalib_makeplots.cxx:3533
RresTbin
Definition: TRTCalib_makeplots.cxx:3325
BoardVariationsTRes
Definition: TRTCalib_makeplots.cxx:1632
PixelAthClusterMonAlgCfg.zmin
zmin
Definition: PixelAthClusterMonAlgCfg.py:169
DGraph::rtgraph
TGraph * rtgraph
Definition: TRTCalib_makeplots.cxx:1931
RresTbin::reshists
vector< TH1D * > reshists
Definition: TRTCalib_makeplots.cxx:3328
plotmaker.hist
hist
Definition: plotmaker.py:148
extractSporadic.c1
c1
Definition: extractSporadic.py:134
FirstPage::runnumber
float runnumber
Definition: TRTCalib_makeplots.cxx:3532
DvGraph::rtgraph
TGraph * rtgraph
Definition: TRTCalib_makeplots.cxx:1802
TBinnedRes
Definition: TRTCalib_makeplots.cxx:3264
python.TrigEgammaMonitorHelper.TH2F
def TH2F(name, title, nxbins, bins_par2, bins_par3, bins_par4, bins_par5=None, bins_par6=None, path='', **kwargs)
Definition: TrigEgammaMonitorHelper.py:45
x
#define x
BoardVariationsRes::DrawLines
void DrawLines()
Definition: TRTCalib_makeplots.cxx:1432
RtColor
Definition: TRTCalib_makeplots.cxx:2706
perfmonmt-refit.slice
slice
Definition: perfmonmt-refit.py:52
lumiFormat.i
int i
Definition: lumiFormat.py:85
D3PDSizeSummary.ff
ff
Definition: D3PDSizeSummary.py:305
python.TrigEgammaMonitorHelper.TProfile
def TProfile(*args, **kwargs)
Definition: TrigEgammaMonitorHelper.py:81
LArCellNtuple.argv
argv
Definition: LArCellNtuple.py:152
RtGraphs
Definition: TRTCalib_makeplots.cxx:2053
TextPage
Definition: TRTCalib_makeplots.cxx:85
BoardVariationsTRes::DrawLines
void DrawLines()
Definition: TRTCalib_makeplots.cxx:1765
PixelAthClusterMonAlgCfg.zmax
zmax
Definition: PixelAthClusterMonAlgCfg.py:169
FirstPage
Definition: TRTCalib_makeplots.cxx:3529
compute_lumi.leg
leg
Definition: compute_lumi.py:95
HitStatistics
Definition: TRTCalib_makeplots.cxx:145
ChipVariations
Definition: TRTCalib_makeplots.cxx:741
DQHistogramMergeRegExp.argc
argc
Definition: DQHistogramMergeRegExp.py:20
calibdata.exit
exit
Definition: calibdata.py:236
min
#define min(a, b)
Definition: cfImp.cxx:40
do_expert
bool do_expert
Definition: TRTCalib_makeplots.cxx:45
T0CalibTypeXY
Definition: TRTCalib_makeplots.cxx:662
SettingsInfo
Definition: TRTCalib_makeplots.cxx:3766
DvGraph
Definition: TRTCalib_makeplots.cxx:1798
tt_remove
int tt_remove(int, char *argv[])
Definition: TRTCalib_makeplots.cxx:6849
gErrorIgnoreLevel
int gErrorIgnoreLevel
BoardVariationsTRes1
Definition: TRTCalib_makeplots.cxx:1457
TrackTupleInfo
Definition: TRTCalib_makeplots.cxx:3820
BoardVariationsDiff
Definition: TRTCalib_makeplots.cxx:1029
DGraph
Definition: TRTCalib_makeplots.cxx:1927
FullCPAlgorithmsTest_CA.inputfile
dictionary inputfile
Definition: FullCPAlgorithmsTest_CA.py:59
itersum
int itersum(int argc, char *argv[])
Definition: TRTCalib_makeplots.cxx:5113
SettingsInfo::set
map< string, string > set
Definition: TRTCalib_makeplots.cxx:3769
beamspotnt.rms
rms
Definition: bin/beamspotnt.py:1266
BoardVariations::DrawLines
void DrawLines()
Definition: TRTCalib_makeplots.cxx:1003
python.TrigEgammaMonitorHelper.TH1F
def TH1F(name, title, nxbins, bins_par2, bins_par3=None, path='', **kwargs)
Definition: TrigEgammaMonitorHelper.py:24
ChipVariations::DrawLines
void DrawLines(float, float)
Definition: TRTCalib_makeplots.cxx:831
plotBeamSpotCompare.histo
histo
Definition: plotBeamSpotCompare.py:415
BoardVariations
Definition: TRTCalib_makeplots.cxx:862
BoardVariationsRes
Definition: TRTCalib_makeplots.cxx:1293
RtBinning
Definition: TRTCalib_makeplots.cxx:3293
BoardVariationsDiff::DrawLines
void DrawLines()
Definition: TRTCalib_makeplots.cxx:1111
BoardVariationsTRes1::DrawLines
void DrawLines()
Definition: TRTCalib_makeplots.cxx:1598
BoardVariationsOldT0
Definition: TRTCalib_makeplots.cxx:1137
XYMapsEC
Definition: TRTCalib_makeplots.cxx:2395