ROOT logo
/**
 * @file   DrawNeighbors.C
 * @author Christian Holm Christensen <cholm@nbi.dk>
 * @date   Thu Nov 17 11:26:12 2011
 * 
 * @brief  Draw corrlation of neighboring strips
 * 
 * @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 correlation of neighboring strips before/after merging 
 * 
 * @param p  List
 * @param d  Detector
 * @param r  Ring
 *
 * @deprecated Use QATrender instead
 * @ingroup pwglf_forward_scripts_qa
 */
void
DrawRingNeighbors(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("DrawNeighbors", "List FMD%d%c not found in %s",d,r,p->GetName());
    return;
  }
  
  TH2* before = static_cast<TH2D*>(ring->FindObject("neighborsBefore"));
  if (!before) { 
    Error("DrawRingNeighbors", "Histogram neighborsBefore not found in FMD%d%c",
	  d, r);
    return;
  }
  TH2* after = static_cast<TH2D*>(ring->FindObject("neighborsAfter"));
  if (!after) { 
    Error("DrawRingNeighbors", "Histogram neighborsAfter not found in FMD%d%c",
	  d, r);
    return;
  }
  gPad->SetLogz();
  gPad->SetFillColor(0);
  TPad* pad = (TPad*)gPad;
  if (d == 3) { 
    pad->SetPad(pad->GetXlowNDC(), pad->GetYlowNDC(), .99, 
		 pad->GetYlowNDC()+pad->GetHNDC());
    pad->SetRightMargin(0.15);
  }
  // gStyle->SetTitleY(gPad->GetBottomMargin());

  before->SetTitle(Form("FMD%d%c",d,r));
  before->Draw("colz");
  after->Draw("same box");

  before->GetXaxis()->SetRangeUser(-.5, 2);
  before->GetYaxis()->SetRangeUser(-.5, 2);

  TLatex* ltx = new TLatex(gPad->GetLeftMargin()+.01, 
			   gPad->GetBottomMargin()+.01, 
			   before->GetTitle());
  ltx->SetNDC();
  ltx->SetTextSize(.07);
  ltx->Draw();

  gPad->cd();
}

/** 
 * Draw the correlation of neighboring strips before/after merging 
 * 
 * @param filename Input file name 
 * @param folder   Input folder name in file 
 *
 * @ingroup pwglf_forward_scripts_qa
 * @deprecated Use QATrender instead
 */
void
DrawNeighbors(const char* filename="forward.root", 
	      const char* folder="ForwardResults")
{
  gStyle->SetPalette(1);
  gStyle->SetOptFit(0);
  gStyle->SetOptStat(0);
  gStyle->SetTitleW(.4);
  gStyle->SetTitleH(.1);
  gStyle->SetTitleX(.1);
  gStyle->SetTitleY(.1);
  gStyle->SetTitleColor(0);
  gStyle->SetTitleStyle(0);
  gStyle->SetTitleBorderSize(0);
  gStyle->SetOptTitle(0);

  TFile* file = TFile::Open(filename, "READ");
  if (!file) { 
    Error("DrawNeighbors", "failed to open %s", filename);
    return;
  }

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

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