-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGeneratorOverlay2D.cpp~
More file actions
146 lines (94 loc) · 4.17 KB
/
GeneratorOverlay2D.cpp~
File metadata and controls
146 lines (94 loc) · 4.17 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
#include <TFile.h>
#include <TTree.h>
#include <TString.h>
using namespace std;
#include <iostream>
#include <sstream>
#include <vector>
#include <string>
#include <fstream>
#include <stdlib.h>
void GeneratorOverlay2D() {
//------------------------------//
TH1D::SetDefaultSumw2();
TH2D::SetDefaultSumw2();
gStyle->SetOptStat(0);
int FontStyle = 132;
double TextSize = 0.06;
TString OutFilePath = "/uboone/app/users/maxd/BuildEventGenerators/FlatTreeAnalyzer/OutputFiles/";
// Event generators
std::vector<TString> Names; std::vector<TString> Labels; std::vector<int> Colors;
Names.push_back(OutFilePath+"FlatTreeAnalyzerOutput_GENIE.root");
Labels.push_back("GENIE");
Colors.push_back(kBlue+2);
Names.push_back(OutFilePath+"FlatTreeAnalyzerOutput_NuWro.root");
Labels.push_back("NuWro");
Colors.push_back(kRed+1);
Names.push_back(OutFilePath+"FlatTreeAnalyzerOutput_NEUT.root");
Labels.push_back("NEUT");
Colors.push_back(kOrange+7);
Names.push_back(OutFilePath+"FlatTreeAnalyzerOutput_GiBUU.root");
Labels.push_back("GiBUU");
Colors.push_back(kGreen+1);
const int NSamples = Names.size();
std::vector<TFile*> Files; Files.resize(NSamples);
// Plots to overlay
std::vector<TString> PlotNames;
//PlotNames.push_back("RecoMagnitudeNeutronPlot");
PlotNames.push_back("QERecoMagnitudeNeutronPlot");
PlotNames.push_back("MECRecoMagnitudeNeutronPlot");
PlotNames.push_back("RESRecoMagnitudeNeutronPlot");
//PlotNames.push_back("RecoCosThetaNeutronPlot");
PlotNames.push_back("QERecoCosThetaNeutronPlot");
PlotNames.push_back("MECRecoCosThetaNeutronPlot");
PlotNames.push_back("RESRecoCosThetaNeutronPlot");
//PlotNames.push_back("DISRecoCosThetaNeutronPlot");
//PlotNames.push_back("COHRecoCosThetaNeutronPlot");
const int NPlots = PlotNames.size();
// Loop over the samples to open the files and the TTree
for (int iSample = 0; iSample < NSamples; iSample++) {
Files[iSample] = new TFile(Names[iSample],"readonly");
} // End of the loop over the samples
// Loop over the plots to be compared
for (int iPlot = 0; iPlot < NPlots; iPlot++) {
// Loop over the samples to open the files and to get the corresponding plot
std::vector<TH2D*> Histos; Histos.resize(NSamples);
for (int iSample = 0; iSample < NSamples; iSample++) {
TString CanvasName = "Canvas_" + PlotNames[iPlot] +Labels[iSample];
TCanvas* PlotCanvas = new TCanvas(CanvasName,CanvasName,205,34,1024,768);
PlotCanvas->cd();
PlotCanvas->SetTopMargin(0.12);
PlotCanvas->SetLeftMargin(0.15);
PlotCanvas->SetBottomMargin(0.15);
PlotCanvas->Draw();
Histos[iSample] = (TH2D*)(Files[iSample]->Get(PlotNames[iPlot]));
// Histos[iSample]->SetLineWidth(4);
// Histos[iSample]->SetLineColor( Colors.at(iSample) );
Histos[iSample]->GetXaxis()->SetTitleFont(FontStyle);
Histos[iSample]->GetXaxis()->SetLabelFont(FontStyle);
// Histos[iSample]->GetXaxis()->SetNdivisions(8);
Histos[iSample]->GetXaxis()->SetLabelSize(TextSize);
Histos[iSample]->GetXaxis()->SetTitleSize(TextSize);
Histos[iSample]->GetXaxis()->SetTitleOffset(1.1);
Histos[iSample]->GetXaxis()->CenterTitle();
Histos[iSample]->GetYaxis()->SetTitleFont(FontStyle);
Histos[iSample]->GetYaxis()->SetLabelFont(FontStyle);
//Histos[iSample]->GetYaxis()->SetNdivisions(6);
Histos[iSample]->GetYaxis()->SetLabelSize(TextSize);
Histos[iSample]->GetYaxis()->SetTitleSize(TextSize);
Histos[iSample]->GetYaxis()->SetTitleOffset(1.3);
Histos[iSample]->GetYaxis()->SetTickSize(0);
Histos[iSample]->GetYaxis()->CenterTitle();
Histos[iSample]->SetLogz();
//double imax = TMath::Max(Histos[iSample]->GetMaximum(),Histos[0]->GetMaximum());
//Histos[iSample]->GetYaxis()->SetRangeUser(0.,1.1*imax);
//Histos[0]->GetYaxis()->SetRangeUser(0.,1.1*imax);
PlotCanvas->cd();
Histos[iSample]->Draw("colz");
//Histos[0]->Draw("colz");
// leg->AddEntry(Histos[iSample],Labels[iSample],"l");
PlotCanvas->cd();
} // End of the loop over the samples grabing the plots
} // End of the loop over the plots
//------------------------------//
} // End of the program