Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
InttQA.C
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file InttQA.C
1 #include "../CommonTools.h"
2 #include <sPhenixStyle.C>
3 
4 TCanvas* Draw( TFile* qa_file_new, TFile* qa_file_ref, const TString& hist_name_prefix, const TString& tag );
5 
6 const char *hist_name_prefix = "QAG4SimulationIntt";
7 
8 // assume INTT layers are 3 to 6
9 static constexpr int first_layer_intt = 3;
10 static constexpr int nlayers_intt = 4;
11 
13 {
15  TFile *reff = TFile::Open(reffile.c_str());
16  TFile *newf = TFile::Open(newfile.c_str());
17 
18  auto c1 = Draw( newf, reff, hist_name_prefix, "drphi" );
19  auto c2 = Draw( newf, reff, hist_name_prefix, "rphi_error" );
20  auto c3 = Draw( newf, reff, hist_name_prefix, "phi_pulls" );
21  auto c4 = Draw( newf, reff, hist_name_prefix, "dz" );
22  auto c5 = Draw( newf, reff, hist_name_prefix, "z_error" );
23  auto c6 = Draw( newf, reff, hist_name_prefix, "z_pulls" );
24  auto c7 = Draw( newf, reff, hist_name_prefix, "clus_size" );
25  auto c8 = Draw( newf, reff, hist_name_prefix, "clus_size_phi" );
26  auto c9 = Draw( newf, reff, hist_name_prefix, "clus_size_z" );
27 
28  TFile *outfilef = new TFile(outfile.c_str(), "recreate");
29  c1->Write();
30  c2->Write();
31  c3->Write();
32  c4->Write();
33  c5->Write();
34  c6->Write();
35  c7->Write();
36  c8->Write();
37  c9->Write();
38  outfilef->Close();
39 
40 
41 }
42 
43 TCanvas* Draw( TFile* qa_file_new, TFile* qa_file_ref, const TString& hist_name_prefix, const TString& tag )
44 {
45 
46  const TString prefix = TString("h_") + hist_name_prefix + TString("_");
47 
48  auto cv = new TCanvas(
49  TString("QA_Draw_Intt_") + tag + TString("_") + hist_name_prefix,
50  TString("QA_Draw_Intt_") + tag + TString("_") + hist_name_prefix,
51  1800, 1000);
52 
54  for( int ilayer = 0; ilayer < nlayers_intt; ++ilayer )
55  {
56 
57  const int layer = ilayer + first_layer_intt;
58 
59  // get histograms
60  auto hnew = static_cast<TH1*>( qa_file_new->GetObjectChecked( Form( "%s%s_%i", prefix.Data(), tag.Data(), layer ), "TH1" ) );
61  hnew->Scale( 1./hnew->GetEntries() );
62  hnew->SetMinimum(0);
63 
64  // reference
65  auto href = qa_file_ref ? static_cast<TH1*>( qa_file_ref->GetObjectChecked( Form( "%s%s_%i", prefix.Data(), tag.Data(), layer ), "TH1" ) ) : nullptr;
66  if( href )
67  {
68  href->Scale( 1./href->GetEntries() );
69  href->SetMinimum(0);
70  }
71 
72  // draw
73  cv->cd( ilayer+1 );
74  DrawReference(hnew, href);
75 
76  auto line = VerticalLine( gPad, 0 );
77  line->Draw();
78  }
79 
80  return cv;
81 
82 }