LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
cmpR.C File Reference
#include "TH1D.h"
#include "TFile.h"
#include "THStack.h"
#include "TCanvas.h"
#include "TString.h"
#include "TLegend.h"

Go to the source code of this file.

Functions

TCanvas * cmpR ()
 

Function Documentation

TCanvas* cmpR ( )

Definition at line 11 of file cmpR.C.

References col, f, legend, and tmp.

11  {
12 
13  //TString dataDir("/net/llrdata1.in2p3.fr/data/DATA/data.harpo/BH5D/");
14  TString dataDir("./");
15 
16  TString dataFile[2];
17  dataFile[0] = "gflash00.root";
18  dataFile[1] = "gflash01.root";
19 
20 
21  TFile *f[2];
22  TProfile *p[2];
23  // UInt_t col[] = { kRed, kBlue, kGreen, kViolet };
24  UInt_t col[] = { kRed, kGreen, kBlue, kViolet };
25  // UInt_t mark[] = { 20, 32, 21, 22};
26  UInt_t mark[] = { 20, 21, 32, 22};
27 //
28  THStack *hs = new THStack("hs","");
29 
30  for (UInt_t i = 0; i < 2; i++) {
31  TString tmp = dataDir + dataFile[i];
32  f[i] = TFile::Open(tmp);
33  if (!f[i]) return 0;
34  p[i] = (TProfile *) (f[i])->Get("p1");
35  //ShiftUp(p[i],0.0);
36  // histogram
37  p[i]->SetFillColor(col[i]);
38  p[i]->SetLineStyle(i+2);
39  p[i]->SetLineColor(col[i]);
40  p[i]->SetLineWidth(2);
41  p[i]->SetMarkerStyle(mark[i]);
42  p[i]->SetMarkerColor(col[i]);
43  p[i]->SetMarkerSize(1.5);
44  hs->Add(p[i]);
45  }
46  TCanvas *cst = new TCanvas("cst","stacked hists",10,10,800,700);
47  //gPad->SetGrid();
48  hs->Draw("p,nostack");
49  hs->SetTitle("Radial Profile");
50  hs->GetXaxis()->SetTitle("Radius (RadLen)");
51  hs->GetYaxis()->SetTitle("E/E_{tot} (%/RadLen)");
52 
53  cst->RedrawAxis();
54  cst->Update();
55 
56  TLegend* legend = new TLegend(0.79,0.84,0.94,0.94);
57  legend->AddEntry(p[0],"full ","p");
58  legend->AddEntry(p[1],"gflash","p");
59  legend->Draw();
60  cst->Update();
61 
62  //img->FromPad(c, 10, 10, 300, 200);
63 
64  // TImage *img = TImage::Create();
65 
66  // img->FromPad(cst);
67 
68  // img->WriteImage("hist0-640MeV-p.png");
69 
70  // for (UInt_t i = 0; i < 4; i++) {
71  // f[i]->Close();
72  // }
73  return cst;
74 }
Float_t tmp
Definition: plot.C:35
TFile f
Definition: plotHisto.C:6
Int_t col[ntarg]
Definition: Style.C:29
TLegend * legend
Definition: egs.C:40