Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
plotTracklet.py
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file plotTracklet.py
1 #! /usr/bin/env python
2 from optparse import OptionParser
3 import sys
4 import os
5 import datetime
6 from array import *
7 from ROOT import *
8 import numpy
9 import math
10 import glob
11 from plotUtil import *
12 
13 gROOT.LoadMacro('./sPHENIXStyle/sPhenixStyle.C')
14 gROOT.ProcessLine('SetsPhenixStyle()')
15 gROOT.SetBatch(True)
16 
17 if __name__ == '__main__':
18  parser = OptionParser(usage="usage: %prog ver [options -n]")
19  parser.add_option("-f", "--histfile", dest="histfname", type="string", default='/sphenix/user/hjheng/TrackletAna/analysis_INTT/plot/hists/HIJING_ana398_xvtx-0p04cm_yvtx0p24cm_zvtx-20cm_dummyAlignParams/dRcut0p5/hists_merged.root', help="Input file name")
20  parser.add_option("-d", "--plotdir", dest="plotdir", type="string", default='./RecoTracklet/HIJING_ana398_xvtx-0p04cm_yvtx0p24cm_zvtx-20cm_dummyAlignParams/dRcut0p5/', help="Plot directory")
21  parser.add_option("-s", "--isdata", dest="isdata", action="store_true", default=False, help="Is data")
22 
23  (opt, args) = parser.parse_args()
24 
25  histfname = opt.histfname
26  plotdir = opt.plotdir
27  isdata = opt.isdata
28 
29  os.makedirs(plotdir, exist_ok=True)
30 
31  print('Plotting: [Histogram file, plot directory]=[{}, {}]'.format(histfname, plotdir))
32 
33  hM_NClusLayer1 = GetHistogram(histfname, 'hM_NClusLayer1')
34  hM_NPrototkl = GetHistogram(histfname, 'hM_NPrototkl')
35  hM_NRecotkl_Raw = GetHistogram(histfname, 'hM_NRecotkl_Raw')
36 
37  hM_dEta_proto = GetHistogram(histfname, 'hM_dEta_proto')
38  hM_dPhi_proto = GetHistogram(histfname, 'hM_dPhi_proto')
39  hM_dPhi_proto_altrange = GetHistogram(histfname, 'hM_dPhi_proto_altrange')
40  hM_dR_proto = GetHistogram(histfname, 'hM_dR_proto')
41  hM_dR_proto_altrange = GetHistogram(histfname, 'hM_dR_proto_altrange')
42  hM_dR_proto_LogX = GetHistogram(histfname, 'hM_dR_proto_LogX')
43  hM_Eta_proto = GetHistogram(histfname, 'hM_Eta_proto')
44  hM_Phi_proto = GetHistogram(histfname, 'hM_Phi_proto')
45 
46  hM_dEta_reco = GetHistogram(histfname, 'hM_dEta_reco')
47  hM_dEta_reco_altrange = GetHistogram(histfname, 'hM_dEta_reco_altrange')
48  hM_dPhi_reco = GetHistogram(histfname, 'hM_dPhi_reco')
49  hM_dPhi_reco_altrange = GetHistogram(histfname, 'hM_dPhi_reco_altrange')
50  hM_dR_reco = GetHistogram(histfname, 'hM_dR_reco')
51  hM_dR_reco_altrange = GetHistogram(histfname, 'hM_dR_reco_altrange')
52  hM_dR_reco_LogX = GetHistogram(histfname, 'hM_dR_reco_LogX')
53  hM_Eta_reco = GetHistogram(histfname, 'hM_Eta_reco')
54  hM_Phi_reco = GetHistogram(histfname, 'hM_Phi_reco')
55 
56  hM_Eta_vtxZ_proto_incl = GetHistogram(histfname, 'hM_Eta_vtxZ_proto_incl')
57  hM_Eta_vtxZ_reco_incl = GetHistogram(histfname, 'hM_Eta_vtxZ_reco_incl')
58 
59  hM_clusphi_clusphisize = GetHistogram(histfname, 'hM_clusphi_clusphisize')
60  hM_cluseta_clusphisize = GetHistogram(histfname, 'hM_cluseta_clusphisize')
61 
62  # Draw_1Dhist(hist, IsData, norm1, logy, ymaxscale, XaxisName, Ytitle_unit, outname):
63  # Do the plots
64  Draw_1Dhist(hM_NClusLayer1, isdata, False, True, 1.3, 'Number of clusters (Layer 3+4)', '', plotdir+'NClusLayer1')
65  Draw_1Dhist(hM_NPrototkl, isdata, False, True, 1.3, 'Number of proto-tracklets', '', plotdir+'NProtoTracklets')
66  Draw_1Dhist(hM_NRecotkl_Raw, isdata, False, True, 1.3, 'Number of reco-tracklets', '', plotdir+'NRecoTracklets_Raw')
67 
68  Draw_1Dhist(hM_dEta_proto, isdata, False, False, 1.3, 'Proto-tracklet #Delta#eta', '', plotdir+'ProtoTracklet_dEta')
69  Draw_1Dhist(hM_dPhi_proto, isdata, False, False, 1.3, 'Proto-tracklet #Delta#phi', '', plotdir+'ProtoTracklet_dPhi')
70  Draw_1Dhist(hM_dPhi_proto_altrange, isdata, False, False, 1.3, 'Proto-tracklet #Delta#phi', '', plotdir+'ProtoTracklet_dPhi_altrange')
71  Draw_1Dhist(hM_Eta_proto, isdata, False, False, 1.3, 'Proto-tracklet #eta', '', plotdir+'ProtoTracklet_Eta')
72  Draw_1Dhist(hM_Phi_proto, isdata, False, False, 1.3, 'Proto-tracklet #phi', '', plotdir+'ProtoTracklet_Phi')
73  Draw_1Dhist(hM_dR_proto, isdata, False, True, 1.3, 'Proto-tracklet #DeltaR', '', plotdir+'ProtoTracklet_dR')
74  Draw_1Dhist(hM_dR_proto_altrange, isdata, False, True, 1.3, 'Proto-tracklet #DeltaR', '', plotdir+'ProtoTracklet_dR_altrange')
75  Draw_1Dhist(hM_dR_proto_LogX, isdata, True, True, 1.3, 'Proto-tracklet #DeltaR', '', plotdir+'ProtoTracklet_dR_logX')
76 
77  Draw_1Dhist(hM_dEta_reco, isdata, False, True, 5, 'Reco-tracklet #Delta#eta', '', plotdir+'RecoTracklet_dEta')
78  Draw_1Dhist(hM_dEta_reco_altrange, isdata, False, True, 5, 'Reco-tracklet #Delta#eta', '', plotdir+'RecoTracklet_dEta_altrange')
79  Draw_1Dhist(hM_dPhi_reco, isdata, False, True, 10, 'Reco-tracklet #Delta#phi', '', plotdir+'RecoTracklet_dPhi')
80  Draw_1Dhist(hM_dPhi_reco_altrange, isdata, False, True, 5, 'Reco-tracklet #Delta#phi', '', plotdir+'RecoTracklet_dPhi_altrange')
81  Draw_1Dhist(hM_Eta_reco, isdata, False, False, 1.3, 'Reco-tracklet #eta', '', plotdir+'RecoTracklet_Eta')
82  Draw_1Dhist(hM_Phi_reco, isdata, False, False, 1.3, 'Reco-tracklet #phi', '', plotdir+'RecoTracklet_Phi')
83  Draw_1Dhist(hM_dR_reco, isdata, False, True, 1.3, 'Reco-tracklet #DeltaR', '', plotdir+'RecoTracklet_dR')
84  Draw_1Dhist(hM_dR_reco_altrange, isdata, False, True, 10, 'Reco-tracklet #DeltaR', '', plotdir+'RecoTracklet_dR_altrange')
85  Draw_1Dhist(hM_dR_reco_LogX, isdata, True, True, 1.3, 'Reco-tracklet #DeltaR', '', plotdir+'RecoTracklet_dR_logX')
86 
87  # Draw_2Dhist(hist, IsData, logz, norm1, rmargin, XaxisName, YaxisName, drawopt, outname):
88  Draw_2Dhist(hM_Eta_vtxZ_proto_incl, isdata, False, False, 0.16, 'Proto-tracklet #eta', 'Primary vertex V_{z} [cm]', 'colz', plotdir+'ProtoTracklet_Eta_vtxZ')
89  Draw_2Dhist(hM_Eta_vtxZ_reco_incl, isdata, False, False, 0.14, 'Reco-tracklet #eta', 'Primary vertex V_{z} [cm]', 'colz', plotdir+'RecoTracklet_Eta_vtxZ')
90  Draw_2Dhist(hM_clusphi_clusphisize, isdata, True, False, 0.16, 'Cluster #phi', 'Cluster #phi size', 'colz', plotdir+'Cluster_Phi_ClusSize')
91  Draw_2Dhist(hM_cluseta_clusphisize, isdata, True, False, 0.14, 'Cluster #eta', 'Cluster #phi size', 'colz', plotdir+'Cluster_Eta_ClusSize')