13 <input>TRGValidationGen.root</input>
14 <output>TRGValidation.root</output>
15 <contact>yinjh2012@korea.ac.kr</contact>
16 <description>makes validation plots for TRG</description>
23 from ROOT
import Belle2, TH1F, TFile, TNamed
24 from math
import pi
as PI
31 Make validation histograms for trg ecl/cdc/klm
36 Sets description, check and contact to validation histogram.
37 :param h validation histogram
38 :param Descr description text
41 descr = TNamed(
"Description", description)
42 histogram.GetListOfFunctions().Add(descr)
43 Check = TNamed(
"Check", check)
44 histogram.GetListOfFunctions().Add(Check)
45 contact = TNamed(
"Contact",
"yinjh2012@korea.ac.kr")
46 histogram.GetListOfFunctions().Add(contact)
47 Meta = TNamed(
"MetaOptions",
"shifter")
48 histogram.GetListOfFunctions().Add(Meta)
52 Sets x-y titles, and sets histogram style.
53 :param xtitle X-axis title
54 :param xtitle Y-axis title
57 histogram.GetXaxis().SetTitle(xtitle)
58 histogram.GetYaxis().SetTitle(ytitle)
59 histogram.GetYaxis().SetTitleOffset(1.4)
60 histogram.GetXaxis().SetTitleSize(0.045)
61 histogram.GetYaxis().SetLabelSize(0.020)
62 histogram.SetLineColor(ROOT.kBlack)
66 self.
tfiletfile = TFile(
"TRGValidation.root",
"recreate")
70 n_inbit = m_dbinput.getninbit()
71 n_outbit = m_dbftdl.getnoutbit()
73 mc_px =
"MCParticles.m_momentum_x"
74 mc_py =
"MCParticles.m_momentum_y"
75 trk2d_omega =
"TRGCDC2DFinderTracks.m_omega"
76 trk2d_phi =
"TRGCDC2DFinderTracks.m_phi0"
78 ROOT.gStyle.SetOptStat(ROOT.kFALSE)
81 self.
hist_inbithist_inbit = TH1F(
"hin",
"trigger input bits", 320, 0, 320)
82 self.
hist_inbithist_inbit.GetXaxis().SetRangeUser(0, n_inbit)
83 self.
hist_inbithist_inbit.GetXaxis().SetLabelSize(0.02)
86 self.
hist_outbithist_outbit = TH1F(
"hout",
"trigger output bits", 320, 0, 320)
87 self.
hist_outbithist_outbit.GetXaxis().SetRangeUser(0, n_outbit)
88 self.
hist_outbithist_outbit.GetXaxis().SetLabelSize(0.02)
91 inbitname = m_dbinput.getinbitname(i)
92 outbitname = m_dbftdl.getoutbitname(i)
93 self.
hist_inbithist_inbit.GetXaxis().SetBinLabel(
94 self.
hist_inbithist_inbit.GetXaxis().FindBin(i + 0.5), inbitname)
96 self.
hist_outbithist_outbit.GetXaxis().FindBin(i + 0.5), outbitname)
99 self.
h_E_ECLh_E_ECL = TH1F(
"h_E_ECL",
"ECL cluster energy [50 MeV]", 200, 0, 10)
101 self.
set_styleset_style(self.
h_E_ECLh_E_ECL,
"ECL cluster energy (GeV)",
"Events/(50 MeV)")
104 self.
h_Esum_ECLh_Esum_ECL = TH1F(
"h_Esum_ECL",
"sum of ECL cluster energy [50 MeV]", 200, 0, 10)
106 self.
set_styleset_style(self.
h_Esum_ECLh_Esum_ECL,
"sum of ECL cluster energy (GeV)",
"Events/(50 MeV)")
109 self.
h_theta_ECLh_theta_ECL = TH1F(
"h_theta_ECL",
"TRG ECL cluster #theta [1.4 degrees]", 128, 0, 180)
110 self.
set_descrset_descr(self.
h_theta_ECLh_theta_ECL,
"TRG ECL cluster polar angle",
"unform in barrel")
111 self.
set_styleset_style(self.
h_theta_ECLh_theta_ECL,
"TRG ECL cluster polar angle (degree)",
"Events/(1.4 degree)")
114 self.
h_thetaID_ECLh_thetaID_ECL = TH1F(
"h_thetaID_ECL",
"ECL cluster TC ID", 610, 0, 610)
119 self.
h_phi_ECLh_phi_ECL = TH1F(
"h_phi_ECL",
"TRG ECL cluster phi [2.0 degrees]", 180, -180, 180)
120 self.
set_descrset_descr(self.
h_phi_ECLh_phi_ECL,
"TRG ECL cluster phi distribution",
"distribute unformly")
121 self.
set_styleset_style(self.
h_phi_ECLh_phi_ECL,
"ECL cluster #phi (degree) ",
"Events/(2.0 degrees)")
124 self.
h_sector_BKLMh_sector_BKLM = TH1F(
"h_sector_BKLM",
"BKLM TRG hit sector", 10, 0, 10)
129 self.
h_sector_EKLMh_sector_EKLM = TH1F(
"h_sector_EKLM",
"EKLM TRG hit sector", 10, 0, 10)
133 mc =
"abs(MCParticles.m_pdg)==11&&MCParticles.m_status==11"
134 tree = ROOT.TChain(
"tree")
135 tree.Add(
"../TRGValidationGen.root")
138 self.
d_wd_w = TH1F(
"d_w",
"#Deltaw of CDC 2D finder, w = 0.00449/p_{t}", 50, -0.02, 0.02)
139 self.
d_w_2d_w_2 = TH1F(
"d_w_2",
"d_w_2", 50, -0.02, 0.02)
140 tree.Draw(
"({0} - 0.00449)/sqrt({1}*{1} + {2}*{2})>> d_w".format(trk2d_omega, mc_px, mc_py),
141 "MCParticles.m_pdg<0&&" + mc)
142 tree.Draw(
"({0} + 0.00449)/sqrt({1}*{1} + {2}*{2}) >> d_w_2".format(trk2d_omega, mc_px, mc_py),
143 "MCParticles.m_pdg>0 && " + mc)
145 self.
set_descrset_descr(self.
d_wd_w,
"Comparison on w (=0.00449/pt) of a track between CDC 2D finder output and MC.",
146 "A clear peak at 0 with tail.")
147 self.
set_styleset_style(self.
d_wd_w,
"#Deltaw",
"Events/(0.08)")
150 self.
d_phid_phi = TH1F(
"d_phi",
"#Delta#phi of CDC 2D finder", 50, -0.5, 0.5)
151 tree.Draw(
"{0}-atan({1}/{2})>>d_phi".format(trk2d_phi, mc_py, mc_px),
152 "MCParticles.m_status==11&&abs(MCParticles.m_pdg)==11",
153 "fabs({0}-atan({1}/{2}))<{3}&&".format(trk2d_phi, mc_py, mc_px, PI) + mc)
155 self.
d_phi_2d_phi_2 = TH1F(
"d_phi_2",
"d_phi_2", 50, -0.5, 0.5)
156 tree.Draw(
"{0}-atan({1}/{2})-{3}>>d_phi_2".format(trk2d_phi, mc_py, mc_px, PI),
157 "MCParticles.m_status==11&&abs(MCParticles.m_pdg)==11",
158 "{0}-atan({1}/{2})>={3} &&".format(trk2d_phi, mc_py, mc_px, PI) + mc)
160 self.
d_phi_3d_phi_3 = TH1F(
"d_phi_3",
"d_phi_3", 50, -0.5, 0.5)
161 tree.Draw(
"{0}-atan({1}/{2})+{3}>>d_phi_2".format(trk2d_phi, mc_py, mc_px, PI),
162 "MCParticles.m_status==11&&abs(MCParticles.m_pdg)==11",
163 "{0}-atan({1}/{2})<=-{3}&&".format(trk2d_phi, mc_py, mc_px, PI) + mc)
167 self.
set_descrset_descr(self.
d_phid_phi,
"Comparison on phi_i of a track between CDC 2D finder output and MC.",
168 "A Gaussian peak at 0.")
169 self.
set_styleset_style(self.
d_phid_phi,
"#Delta#phi [rad]",
"Events/(0.02 rad)")
172 self.
d_z0_3dd_z0_3d = TH1F(
"d_z0_3d",
"#Deltaz0 of CDC 3D fitter", 60, -30, 30)
173 tree.Draw(
"TRGCDC3DFitterTracks.m_z0-MCParticles.m_productionVertex_z>>d_z0_3d", mc)
174 self.
set_descrset_descr(self.
d_z0_3dd_z0_3d,
"Comparison on z0 of a track between CDC 2D fitter output and MC.",
175 "A Gaussian peak at 0 with small tail.")
176 self.
set_styleset_style(self.
d_z0_3dd_z0_3d,
"#Deltaz0 [cm]",
"Events/(1 cm)")
179 self.
d_z0_nnd_z0_nn = TH1F(
"d_z0_nn",
"#Deltaz0 of CDC Neuro", 60, -30, 30)
180 tree.Draw(
"TRGCDCNeuroTracks.m_z0-MCParticles.m_productionVertex_z>>d_z0_nn", mc)
181 self.
set_descrset_descr(self.
d_z0_nnd_z0_nn,
"Comparison on z0 of a track between CDC Neuro output and MC.",
182 "A Gaussian peak at 0 with small tail.")
183 self.
set_styleset_style(self.
d_z0_nnd_z0_nn,
"#Deltaz0 [cm]",
"Events/(1 cm)")
186 self.
d_E_ECLd_E_ECL = TH1F(
"d_E_ECL",
"#DeltaE of ECL clustering", 100, -6, 6)
187 tree.Draw(
"TRGECLClusters.m_edep-MCParticles.m_energy>>d_E_ECL", mc)
188 self.
set_descrset_descr(self.
d_E_ECLd_E_ECL,
"Comparison on deposit energy between ECL cluster output and MC.",
189 "A peak around -0.5 ~ 0 with a tail toward -6.")
190 self.
set_styleset_style(self.
d_E_ECLd_E_ECL,
"#DeltaE [GeV]",
"Events/(0.12 GeV)")
208 if trg_summary.testInput(i):
210 if trg_summary.testFtdl(i):
214 for cluster
in clusters:
215 x = cluster.getPositionX()
216 y = cluster.getPositionY()
217 z = cluster.getPositionZ()
218 e = cluster.getEnergyDep()
221 vec = ROOT.TVector3(x, y, z)
222 self.
h_theta_ECLh_theta_ECL.Fill(vec.Theta() * Fac)
224 self.
h_phi_ECLh_phi_ECL.Fill(vec.Phi() * Fac)
229 self.
h_sector_BKLMh_sector_BKLM.Fill(klmSummary.getBKLM_n_trg_sectors())
230 self.
h_sector_EKLMh_sector_EKLM.Fill(klmSummary.getEKLM_n_trg_sectors())
247 self.
d_phid_phi.Write()
251 self.
tfiletfile.Close()
255 main = basf2.create_path()
258 root_input = basf2.register_module(
"RootInput")
259 root_input.param(
"inputFileName",
"../TRGValidationGen.root")
260 main.add_module(root_input)
Class to access a DBObjPtr from Python.
a (simplified) python wrapper for StoreArray.
a (simplified) python wrapper for StoreObjPtr.
h_Esum_ECL
validation histogram
h_sector_BKLM
validation histogram
hist_outbit
validation histogram
h_E_ECL
validation histogram
d_E_ECL
validation histogram
h_thetaID_ECL
validation histogram
def set_style(self, histogram, xtitle, ytitle)
hist_inbit
validation histogram
d_z0_nn
validation histogram
h_theta_ECL
validation histogram
def set_descr(self, histogram, description, check)
h_sector_EKLM
validation histogram
h_phi_ECL
validation histogram
d_z0_3d
validation histogram
d_phi
validation histogram