ROOT logo
/**
 * @file   DrawBeforeAfter.C
 * @author Christian Holm Christensen <cholm@nbi.dk>
 * @date   Thu Nov 17 11:18:18 2011
 * 
 * @brief  Script to draw the before/after merging energy loss spectra 
 * 
 * @deprecated Use QATrender instead 
 * @ingroup pwglf_forward_scripts_qa
 */
#ifndef __CINT__
# include <TH1.h>
# include <TH2.h>
# include <TList.h>
# include <TFile.h>
# include <TString.h>
# include <TError.h>
# include <TPad.h>
# include <TCanvas.h>
# include <TLine.h>
# include <TLatex.h>
# include <TStyle.h>
#else
class TList;
#endif

/** 
 * Draw the before/after merging image for a single ring
 * 
 * @param p  Parent list
 * @param d  Detector 
 * @param r  Ring 
 *
 * @deprecated Use QATrender instead 
 * @ingroup pwglf_forward_scripts_qa
 */
void
DrawRingBeforeAfter(TList* p, UShort_t d, Char_t r)
{
  if (!p) return;

  TList* ring = static_cast<TList*>(p->FindObject(Form("FMD%d%c",d,r)));
  if (!ring) { 
    Error("DrawBeforeAfter", "List FMD%d%c not found in %s",d,r,p->GetName());
    return;
  }
  
  TH2* corr = static_cast<TH2D*>(ring->FindObject("beforeAfter"));
  if (!corr) { 
    Error("DrawRingBeforeAfter", "Histogram esdEloss not found in FMD%d%c",
	  d, r);
    return;
  }
  // gPad->SetLogz();
  gPad->SetFillColor(0);
  corr->SetTitle(Form("FMD%d%c",d,r));
  corr->Draw("colz");

  corr->GetXaxis()->SetRangeUser(-.5, 4);
  corr->GetYaxis()->SetRangeUser(-.5, 4);
  gPad->cd();
}


/** 
 * Draw the before/after sharing image for all rings 
 * 
 * @param filename Input file name  
 * @param folder   Input folder in file 
 *
 * @deprecated Use QATrender instead 
 * @ingroup pwglf_forward_scripts_qa
 */
void
DrawBeforeAfter(const char* filename="forward.root", 
		const char* folder="ForwardResults")
{
  gStyle->SetPalette(1);
  gStyle->SetOptFit(0);
  gStyle->SetOptStat(0);
  gStyle->SetOptTitle(1);
  gStyle->SetTitleW(.4);
  gStyle->SetTitleH(.1);
  gStyle->SetTitleColor(0);
  gStyle->SetTitleStyle(0);
  gStyle->SetTitleBorderSize(0);
  gStyle->SetTitleX(.6);
  
  TFile* file = TFile::Open(filename, "READ");
  if (!file) { 
    Error("DrawBeforeAfter", "failed to open %s", filename);
    return;
  }

  TList* forward = static_cast<TList*>(file->Get(folder));
  if (!forward) { 
    Error("DrawBeforeAfter", "List %s not found in %s", folder, filename);
    return;
  }

  TList* sf = static_cast<TList*>(forward->FindObject("fmdSharingFilter"));
  if (!sf) { 
    Error("DrawBeforeAfter", "List fmdSharingFilter not found in Forward");
    return;
  }
  
  TCanvas* c = new TCanvas("beforeAfter", 
			   "Signals before and after merging", 900, 700);
  c->SetFillColor(0);
  c->SetBorderSize(0);
  c->SetLeftMargin(0.15);
  c->SetRightMargin(0.02);
  c->SetTopMargin(0.02);
  c->Divide(3, 2, 0, 0);
  
  c->cd(1); DrawRingBeforeAfter(sf, 1, 'I');
  c->cd(2); DrawRingBeforeAfter(sf, 2, 'I');
  c->cd(5); DrawRingBeforeAfter(sf, 2, 'O');
  c->cd(3); DrawRingBeforeAfter(sf, 3, 'I');
  c->cd(6); DrawRingBeforeAfter(sf, 3, 'O');
  TVirtualPad* p = c->cd(4);
  // p->SetTopMargin(0.05);
  p->SetRightMargin(0.15);
  p->SetFillColor(0);
  TH2D* highCuts = static_cast<TH2D*>(sf->FindObject("highCuts"));
  if (highCuts) highCuts->Draw("colz");
  c->cd();
  c->SaveAs("beforeAfter.png");
}
//
// EOF
//
 DrawBeforeAfter.C:1
 DrawBeforeAfter.C:2
 DrawBeforeAfter.C:3
 DrawBeforeAfter.C:4
 DrawBeforeAfter.C:5
 DrawBeforeAfter.C:6
 DrawBeforeAfter.C:7
 DrawBeforeAfter.C:8
 DrawBeforeAfter.C:9
 DrawBeforeAfter.C:10
 DrawBeforeAfter.C:11
 DrawBeforeAfter.C:12
 DrawBeforeAfter.C:13
 DrawBeforeAfter.C:14
 DrawBeforeAfter.C:15
 DrawBeforeAfter.C:16
 DrawBeforeAfter.C:17
 DrawBeforeAfter.C:18
 DrawBeforeAfter.C:19
 DrawBeforeAfter.C:20
 DrawBeforeAfter.C:21
 DrawBeforeAfter.C:22
 DrawBeforeAfter.C:23
 DrawBeforeAfter.C:24
 DrawBeforeAfter.C:25
 DrawBeforeAfter.C:26
 DrawBeforeAfter.C:27
 DrawBeforeAfter.C:28
 DrawBeforeAfter.C:29
 DrawBeforeAfter.C:30
 DrawBeforeAfter.C:31
 DrawBeforeAfter.C:32
 DrawBeforeAfter.C:33
 DrawBeforeAfter.C:34
 DrawBeforeAfter.C:35
 DrawBeforeAfter.C:36
 DrawBeforeAfter.C:37
 DrawBeforeAfter.C:38
 DrawBeforeAfter.C:39
 DrawBeforeAfter.C:40
 DrawBeforeAfter.C:41
 DrawBeforeAfter.C:42
 DrawBeforeAfter.C:43
 DrawBeforeAfter.C:44
 DrawBeforeAfter.C:45
 DrawBeforeAfter.C:46
 DrawBeforeAfter.C:47
 DrawBeforeAfter.C:48
 DrawBeforeAfter.C:49
 DrawBeforeAfter.C:50
 DrawBeforeAfter.C:51
 DrawBeforeAfter.C:52
 DrawBeforeAfter.C:53
 DrawBeforeAfter.C:54
 DrawBeforeAfter.C:55
 DrawBeforeAfter.C:56
 DrawBeforeAfter.C:57
 DrawBeforeAfter.C:58
 DrawBeforeAfter.C:59
 DrawBeforeAfter.C:60
 DrawBeforeAfter.C:61
 DrawBeforeAfter.C:62
 DrawBeforeAfter.C:63
 DrawBeforeAfter.C:64
 DrawBeforeAfter.C:65
 DrawBeforeAfter.C:66
 DrawBeforeAfter.C:67
 DrawBeforeAfter.C:68
 DrawBeforeAfter.C:69
 DrawBeforeAfter.C:70
 DrawBeforeAfter.C:71
 DrawBeforeAfter.C:72
 DrawBeforeAfter.C:73
 DrawBeforeAfter.C:74
 DrawBeforeAfter.C:75
 DrawBeforeAfter.C:76
 DrawBeforeAfter.C:77
 DrawBeforeAfter.C:78
 DrawBeforeAfter.C:79
 DrawBeforeAfter.C:80
 DrawBeforeAfter.C:81
 DrawBeforeAfter.C:82
 DrawBeforeAfter.C:83
 DrawBeforeAfter.C:84
 DrawBeforeAfter.C:85
 DrawBeforeAfter.C:86
 DrawBeforeAfter.C:87
 DrawBeforeAfter.C:88
 DrawBeforeAfter.C:89
 DrawBeforeAfter.C:90
 DrawBeforeAfter.C:91
 DrawBeforeAfter.C:92
 DrawBeforeAfter.C:93
 DrawBeforeAfter.C:94
 DrawBeforeAfter.C:95
 DrawBeforeAfter.C:96
 DrawBeforeAfter.C:97
 DrawBeforeAfter.C:98
 DrawBeforeAfter.C:99
 DrawBeforeAfter.C:100
 DrawBeforeAfter.C:101
 DrawBeforeAfter.C:102
 DrawBeforeAfter.C:103
 DrawBeforeAfter.C:104
 DrawBeforeAfter.C:105
 DrawBeforeAfter.C:106
 DrawBeforeAfter.C:107
 DrawBeforeAfter.C:108
 DrawBeforeAfter.C:109
 DrawBeforeAfter.C:110
 DrawBeforeAfter.C:111
 DrawBeforeAfter.C:112
 DrawBeforeAfter.C:113
 DrawBeforeAfter.C:114
 DrawBeforeAfter.C:115
 DrawBeforeAfter.C:116
 DrawBeforeAfter.C:117
 DrawBeforeAfter.C:118
 DrawBeforeAfter.C:119
 DrawBeforeAfter.C:120
 DrawBeforeAfter.C:121
 DrawBeforeAfter.C:122
 DrawBeforeAfter.C:123
 DrawBeforeAfter.C:124
 DrawBeforeAfter.C:125
 DrawBeforeAfter.C:126
 DrawBeforeAfter.C:127
 DrawBeforeAfter.C:128
 DrawBeforeAfter.C:129
 DrawBeforeAfter.C:130
 DrawBeforeAfter.C:131
 DrawBeforeAfter.C:132
 DrawBeforeAfter.C:133