-
Notifications
You must be signed in to change notification settings - Fork 0
/
BestTandLLH.cpp
68 lines (54 loc) · 1.58 KB
/
BestTandLLH.cpp
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
#include <TH3D.h>
#include <TCanvas.h>
#include "TFile.h"
#include "TColor.h"
#include <string>
#include <iostream>
void PlotAll(TString fname){
TFile *f = TFile::Open(fname);
TCanvas* c1 = new TCanvas("c1", "c1", 1600,800);
c1->SetRightMargin(0.12);
TCanvas* c2 = new TCanvas("c2", "c2", 1600,800);
c2->SetRightMargin(0.12);
TH3* h_t;
TH3* h_llh;
for(int i=0; i<80; i++){
int t = i-40;
//double n = 236.524347 + 80*i;
//double n = 3180.681152 + 80*i;
TString hname = Form("h_%d", i);
std::cout << "getting " << hname << std::endl;
TH3D* h = (TH3D*)f->Get(hname)->Clone();
std::cout << "got " << hname << std::endl;
if(i==0){
h_t = (TH3D*)f->Get(hname)->Clone();
h_t->SetName("h_t");
h_t->SetTitle("Emission Time");
h_t->Reset();
h_llh = (TH3D*)f->Get(hname)->Clone();
h_llh->Reset();
h_llh->SetName("h_llh");
h_llh->SetTitle("");
std::cout << "done 0 " << std::endl;
}
for(int j=0; j<h->GetXaxis()->GetNbins(); j++){
for(int k=0; k<h->GetYaxis()->GetNbins(); k++){
for(int l=0; l<h->GetZaxis()->GetNbins(); l++){
if(h->GetBinContent(j, k, l) > h_llh->GetBinContent(j, k, l)){
h_llh->SetBinContent(j, k, l, h->GetBinContent(j,k,l));
if(h->GetBinContent(j, k, l) > 600)
h_t->SetBinContent(j, k, l, t);
}
}
}
}
}
//TColor::InvertPalette();
c1->cd();
h_t->Draw("box2Z");
c2->cd();
h_llh->Draw("box2Z");
TFile fout("output.root","RECREATE");
h_t->Write("h_t");
h_llh->Write("h_llh");
}