ATLAS Offline Software
Loading...
Searching...
No Matches
G4DebuggerConfig.py
Go to the documentation of this file.
1import ROOT
2import os
3
5 z = x.copy() # start with x's keys and values
6 z.update(y) # modifies z with y's keys and values & returns None
7 return z
8
9AtlasStylePath = os.environ['HOME']+'/RootUtils/AtlasStyle'
10AtlasStyle = os.path.exists(AtlasStylePath)
11if AtlasStyle:
12 ROOT.gROOT.LoadMacro(AtlasStylePath+"/AtlasStyle.C")
13 ROOT.gROOT.LoadMacro("common/AtlasLabels.C")
14 ROOT.gROOT.LoadMacro("common/AtlasUtils.C")
15 ROOT.SetAtlasStyle()
16
17particles = ["other","gamma","e-","neutron",]
18otherParticles = ["nucleus","proton","e+"]
19# particles = ["other","nucleus","proton","neutron","gamma","e-","e+"]
20
21egamma = ["gamma","e-","e+"]
22electrons = ["e-","e+"]
23neutrons = ["neutron"]
24hadrons = ["proton","neutron","nucleus"]
25
26colors = {
27 'e-':ROOT.kRed-6,
28 'e+':ROOT.kBlack,
29 'neutron':ROOT.kBlue-9,
30 'gamma':ROOT.kGray,
31 'other':ROOT.kGray+1,
32 'proton':ROOT.kBlack,
33 'nucleus':ROOT.kCyan-4,
34 'proton':ROOT.kPink+2,
35}
36
37colorsNew = {
38 'e-':ROOT.kRed-2,
39 'e+':ROOT.kBlack,
40 'neutron':ROOT.kBlue-2,
41 'gamma':ROOT.kGray+2,
42 'other':ROOT.kGray+3,
43 'proton':ROOT.kBlack,
44 'nucleus':ROOT.kCyan,
45 'proton':ROOT.kPink+6,
46}
47
48styles = {
49'gamma': 3354,
50}
51
52samecolor = [
53'other',
54'gamma',
55'e+',
56]
57
58linecolor = {
59'neutron':ROOT.kBlue,
60'e-':ROOT.kRed+2,
61}
62
63translate = {
64'e-':'electrons',
65'e+':'positrons',
66'gamma':'photons',
67'neutron':'neutrons',
68# 'Section':'Beampipe',
69'Section':'ID services',
70'EMEC':'EM end-cap',
71'EMB':'EM barrel',
72'FC1':'FCal1',
73'FC23':'FCal2/3',
74'FCOther':'other',
75'HEC':'Had. end-cap',
76'LAr':'LAr services',
77'Cryo':'LAr services',
78'Service':'ID services',
79'other':'Other',
80}
81
82label = {
83'stepLength':'log( step length [mm] )',
84'stepEnergyDeposit':'log( energy deposit [MeV] )',
85'stepSecondaryKinetic':'log( kinetic energy of the secondary [MeV] )',
86'stepEnergyNonIonDeposit':'log( non-ionizing energy deposit [MeV] )',
87'stepKineticEnergy':'log( kinetic energy in current step [MeV] )',
88'stepPseudorapidity':'#eta in current step',
89}
90
91labelAllATLAS = {
92'numberOfSteps':'number of steps',
93'numberOfStepsPerInitialE':'log( Initial kinetic [MeV] )',
94'CumulativeNumberOfStepsPerInitialE':'log( Initial kinetic [MeV] )',
95'InitialE':'log( Initial kinetic [MeV] )',
96'CumulativeInitialE':'log( Initial kinetic [MeV] )',
97'averageNumberOfStepsPerInitialE':'log( Initial kinetic [MeV] )',
98}
99
100labelAll = merge_two_dicts(label,labelAllATLAS)
101
103 rsplit = 0.4
104 pad1TopMarin = 0.08
105 pad1BotMarin = 0.04
106 pad2TopMarin = 0.03
107 pad2BotMarin = 0.6
108 LeftMargin = 0.15
109 # yaxis = "Relative steps [%]"
110 yaxis = "Steps / Event"
111
112 def getCanvas(self, uniqueName):
113 canv = ROOT.TCanvas(uniqueName,uniqueName,700,600)
114 pad1 = ROOT.TPad("pad1"+uniqueName,"top pad"+uniqueName,0.,self.rsplit,1.,1.)
115 pad1.SetTopMargin(self.pad1TopMarin)
116 pad1.SetBottomMargin(self.pad1BotMarin)
117 pad1.SetLeftMargin(self.LeftMargin)
118 pad1.Draw()
119 pad2 = ROOT.TPad("pad2"+uniqueName,"bottom pad"+uniqueName,0,0,1,self.rsplit)
120 pad2.SetTopMargin(self.pad2TopMarin)
121 pad2.SetBottomMargin(self.pad2BotMarin)
122 pad2.SetLeftMargin(self.LeftMargin)
123 pad2.SetTicky()
124 pad2.SetTickx()
125 pad2.Draw()
126 return canv, pad1, pad2
127
128 def configureUpperPad(self,hs1):
129 hs1.GetXaxis().SetLabelSize(0)
130 hs1.GetYaxis().SetLabelSize(0.075)
131 hs1.GetYaxis().SetTitleSize(0.082)
132 hs1.GetYaxis().SetTitleOffset(0.7)
133 hs1.GetYaxis().SetTitle(self.yaxis)
134 ROOT.gPad.RedrawAxis()
135
136 def configureLowerPad(self,h2,ratiodn,ratioup,xaxis,yaxisr):
137 h2.SetFillColor(0)
138 h2.SetFillStyle(0)
139 h2.GetXaxis().SetTitle(xaxis)
140 h2.GetYaxis().SetTitle(yaxisr)
141 h2.GetYaxis().SetRangeUser(1.0 - ratiodn, 1.0 + ratioup)
142 h2.SetLineColor(ROOT.kBlack)
143 h2.GetXaxis().LabelsOption("v")
144 h2.GetXaxis().SetLabelSize(0.15)
145 h2.GetXaxis().SetLabelOffset(0.02)
146 h2.GetXaxis().SetTitleOffset(2.2)
147 h2.GetXaxis().SetTitleSize(0.14)
148 h2.GetYaxis().SetLabelSize(0.11)
149 h2.GetYaxis().SetNdivisions(3)
150 h2.GetYaxis().SetTitleOffset(0.5)
151 h2.GetYaxis().SetTitleSize(0.12)
152 ROOT.gPad.RedrawAxis()
153
155 rsplit = 0.35
156 pad1TopMarin = 0.07
157 pad1BotMarin = 0.04
158 pad2TopMarin = 0.03
159 pad2BotMarin = 0.4
160 LeftMargin = 0.15
161 yaxis = "Steps"
162
163 def getCanvas(self, uniqueName, nologx = False, nology = False):
164 canv = ROOT.TCanvas(uniqueName,uniqueName,800,600)
165 pad1 = ROOT.TPad("pad1"+uniqueName,"top pad"+uniqueName,0.,self.rsplit,1.,1.)
166 pad1.SetTopMargin(self.pad1TopMarin)
167 pad1.SetBottomMargin(self.pad1BotMarin)
168 pad1.SetLeftMargin(self.LeftMargin)
169 if not nologx:
170 pad1.SetLogx()
171 if not nology:
172 pad1.SetLogy()
173 pad1.Draw()
174 pad2 = ROOT.TPad("pad2"+uniqueName,"bottom pad"+uniqueName,0,0,1,self.rsplit)
175 pad2.SetTopMargin(self.pad2TopMarin)
176 pad2.SetBottomMargin(self.pad2BotMarin)
177 pad2.SetLeftMargin(self.LeftMargin)
178 pad2.SetTicky()
179 pad2.SetTickx()
180 if not nologx:
181 pad2.SetLogx()
182 pad2.SetGridy()
183 pad2.Draw()
184 return canv, pad1, pad2
185
186 def configureUpperPad(self,hs1, yaxis=""):
187 hs1.GetXaxis().SetLabelSize(0)
188 hs1.GetYaxis().SetLabelSize(0.06)
189 hs1.GetYaxis().SetTitleSize(0.06)
190 hs1.GetYaxis().SetTitleOffset(0.95)
191 hs1.GetYaxis().SetTitle(self.yaxis if yaxis=="" else yaxis)
192 ROOT.gPad.RedrawAxis()
193
194 def configureLowerPad(self,h2,ratio,xaxis,yaxisr):
195 h2.GetXaxis().SetTitle(xaxis)
196 h2.GetYaxis().SetTitle(yaxisr)
197 h2.GetXaxis().SetTitleSize(0.13)
198 h2.GetXaxis().SetTitleOffset(0.9)
199 h2.GetXaxis().SetLabelSize(0.10)
200 h2.GetYaxis().SetTitleSize(0.12)
201 h2.GetYaxis().SetTitleOffset(0.5)
202 h2.GetYaxis().SetLabelSize(0.10)
203 h2.GetYaxis().SetLabelOffset(0.015)
204 h2.GetYaxis().SetRangeUser(0.5,1.5)
205 h2.GetYaxis().SetNdivisions(6)
206 h2.SetMinimum(1.0 - ratio)
207 h2.SetMaximum(1.0 + ratio)
208 ROOT.gPad.RedrawAxis()
209
210
211
212
213summary = summaryDefs()
214histograms = histogramDefs()
215
getCanvas(self, uniqueName, nologx=False, nology=False)
configureLowerPad(self, h2, ratio, xaxis, yaxisr)
configureLowerPad(self, h2, ratiodn, ratioup, xaxis, yaxisr)