-
Notifications
You must be signed in to change notification settings - Fork 77
/
InttQA.C
82 lines (63 loc) · 2.46 KB
/
InttQA.C
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
#include "../CommonTools.h"
#include <sPhenixStyle.C>
TCanvas* Draw( TFile* qa_file_new, TFile* qa_file_ref, const TString& hist_name_prefix, const TString& tag );
const char *hist_name_prefix = "QAG4SimulationIntt";
// assume INTT layers are 3 to 6
static constexpr int first_layer_intt = 3;
static constexpr int nlayers_intt = 4;
void InttQA(std::string reffile, std::string newfile, std::string outfile)
{
SetsPhenixStyle();
TFile *reff = TFile::Open(reffile.c_str());
TFile *newf = TFile::Open(newfile.c_str());
auto c1 = Draw( newf, reff, hist_name_prefix, "drphi" );
auto c2 = Draw( newf, reff, hist_name_prefix, "rphi_error" );
auto c3 = Draw( newf, reff, hist_name_prefix, "phi_pulls" );
auto c4 = Draw( newf, reff, hist_name_prefix, "dz" );
auto c5 = Draw( newf, reff, hist_name_prefix, "z_error" );
auto c6 = Draw( newf, reff, hist_name_prefix, "z_pulls" );
auto c7 = Draw( newf, reff, hist_name_prefix, "clus_size" );
auto c8 = Draw( newf, reff, hist_name_prefix, "clus_size_phi" );
auto c9 = Draw( newf, reff, hist_name_prefix, "clus_size_z" );
TFile *outfilef = new TFile(outfile.c_str(), "recreate");
c1->Write();
c2->Write();
c3->Write();
c4->Write();
c5->Write();
c6->Write();
c7->Write();
c8->Write();
c9->Write();
outfilef->Close();
}
TCanvas* Draw( TFile* qa_file_new, TFile* qa_file_ref, const TString& hist_name_prefix, const TString& tag )
{
const TString prefix = TString("h_") + hist_name_prefix + TString("_");
auto cv = new TCanvas(
TString("QA_Draw_Intt_") + tag + TString("_") + hist_name_prefix,
TString("QA_Draw_Intt_") + tag + TString("_") + hist_name_prefix,
1800, 1000);
DivideCanvas( cv, nlayers_intt );
for( int ilayer = 0; ilayer < nlayers_intt; ++ilayer )
{
const int layer = ilayer + first_layer_intt;
// get histograms
auto hnew = static_cast<TH1*>( qa_file_new->GetObjectChecked( Form( "%s%s_%i", prefix.Data(), tag.Data(), layer ), "TH1" ) );
hnew->Scale( 1./hnew->GetEntries() );
hnew->SetMinimum(0);
// reference
auto href = qa_file_ref ? static_cast<TH1*>( qa_file_ref->GetObjectChecked( Form( "%s%s_%i", prefix.Data(), tag.Data(), layer ), "TH1" ) ) : nullptr;
if( href )
{
href->Scale( 1./href->GetEntries() );
href->SetMinimum(0);
}
// draw
cv->cd( ilayer+1 );
DrawReference(hnew, href);
auto line = VerticalLine( gPad, 0 );
line->Draw();
}
return cv;
}