ATLAS Offline Software
Functions
TrackingVolumeUtils Namespace Reference

Functions

def drawTrackingVolume (g4Tree, tgTree, saveLocation)
 

Function Documentation

◆ drawTrackingVolume()

def TrackingVolumeUtils.drawTrackingVolume (   g4Tree,
  tgTree,
  saveLocation 
)

Definition at line 5 of file TrackingVolumeUtils.py.

5 def drawTrackingVolume(g4Tree,tgTree,saveLocation) :
6 
7  tvname = g4Tree.GetName()
8  print ('----------------------------------------------------------------')
9  print (' TrackingVolume: ', tvname)
10 
11  tvCanvas = TCanvas(tvname,tvname,100,100,800,1000)
12  tvCanvas.Divide(2,3)
13 
14  tgTree.SetMarkerStyle(8)
15  tgTree.SetMarkerSize(0.5)
16  tgTree.SetMarkerColor(kRed)
17  tgTree.SetLineColor(kRed)
18 
19  tvsavename = tvname.replace('::',"_")
20 
21  # x0 vs eta / phi
22  tvCanvas.cd(1)
23  try :
24  g4Tree.Draw('PathInX0:Eta>>'+tvsavename+'G4X0Eta','','prof')
25  tgTree.Draw('PathInX0:Eta>>'+tvsavename+'TGX0Eta','','prof')
26  x0etaG4 = gDirectory.Get(tvsavename+'G4X0Eta')
27  x0etaTG = gDirectory.Get(tvsavename+'TGX0Eta')
28  x0etaG4.GetXaxis().SetTitle('#eta')
29  x0etaG4.GetYaxis().SetTitle('t [X_{0}]')
30  x0etaG4.Draw('hist')
31  x0etaTG.Draw('pe,same')
32  except (ReferenceError, AttributeError):
33  pass
34  tvCanvas.cd(2)
35  try :
36  g4Tree.Draw('PathInX0:Phi>>'+tvsavename+'G4X0Phi','','prof')
37  tgTree.Draw('PathInX0:Phi>>'+tvsavename+'TGX0Phi','','prof')
38  x0phiG4 = gDirectory.Get(tvsavename+'G4X0Phi')
39  x0phiTG = gDirectory.Get(tvsavename+'TGX0Phi')
40  x0phiG4.GetXaxis().SetTitle('#phi')
41  x0phiG4.GetYaxis().SetTitle('t [X_{0}]')
42  x0phiG4.Draw('hist')
43  x0phiTG.Draw('pe,same')
44  except (ReferenceError, AttributeError):
45  pass
46  # l0 vs eta / phi
47  tvCanvas.cd(3)
48  try :
49  g4Tree.Draw('PathInL0:Eta>>'+tvsavename+'G4L0Eta','','prof')
50  tgTree.Draw('PathInL0:Eta>>'+tvsavename+'TGL0Eta','','prof')
51  l0etaG4 = gDirectory.Get(tvsavename+'G4L0Eta')
52  l0etaTG = gDirectory.Get(tvsavename+'TGL0Eta')
53  l0etaG4.GetXaxis().SetTitle('#eta')
54  l0etaG4.GetYaxis().SetTitle('t [#Lambda_{0}]')
55  l0etaG4.Draw('hist')
56  l0etaTG.Draw('pe,same')
57  except (ReferenceError, AttributeError):
58  pass
59  tvCanvas.cd(4)
60  try :
61  g4Tree.Draw('PathInL0:Phi>>'+tvsavename+'G4L0Phi','','prof')
62  tgTree.Draw('PathInL0:Phi>>'+tvsavename+'TGL0Phi','','prof')
63  l0phiG4 = gDirectory.Get(tvsavename+'G4L0Phi')
64  l0phiTG = gDirectory.Get(tvsavename+'TGL0Phi')
65  l0phiG4.GetXaxis().SetTitle('#phi')
66  l0phiG4.GetYaxis().SetTitle('t [#Lambda_{0}]')
67  l0phiG4.Draw('hist')
68  l0phiTG.Draw('pe,same')
69  except (ReferenceError, AttributeError):
70  pass
71  # AZrho vs eta / phi
72  tvCanvas.cd(5)
73  try :
74  g4Tree.Draw('Z/A*Rho*Path/Measure:Eta>>'+tvsavename+'G4ZArhoEta','','prof')
75  tgTree.Draw('Z/A*Rho*Path/Measure:Eta>>'+tvsavename+'TGZArhoEta','','prof')
76  zarhoetaG4 = gDirectory.Get(tvsavename+'G4ZArhoEta')
77  zarhoetaTG = gDirectory.Get(tvsavename+'TGZArhoEta')
78  if zarhoetaG4.GetMaximum() < zarhoetaTG.GetMaximum() :
79  zarhoetaG4.SetMaximum(zarhoetaTG.GetMaximum())
80  zarhoetaG4.GetXaxis().SetTitle('#eta')
81  zarhoetaG4.GetYaxis().SetTitle('Eff. Z/A* #rho [ g/mm^{3} ]')
82  zarhoetaG4.Draw('hist')
83  zarhoetaTG.Draw('pe,same')
84  except (ReferenceError, AttributeError):
85  pass
86  tvCanvas.cd(6)
87  try :
88  g4Tree.Draw('Z/A*Rho*Path/Measure:Phi>>'+tvsavename+'G4ZArhoPhi','','prof')
89  tgTree.Draw('Z/A*Rho*Path/Measure:Phi>>'+tvsavename+'TGZArhoPhi','','prof')
90  zarhophiG4 = gDirectory.Get(tvsavename+'G4ZArhoPhi')
91  zarhophiTG = gDirectory.Get(tvsavename+'TGZArhoPhi')
92  if zarhophiG4.GetMaximum() < zarhophiTG.GetMaximum() :
93  zarhophiG4.SetMaximum(zarhophiTG.GetMaximum())
94  zarhophiG4.GetXaxis().SetTitle('#phi')
95  zarhophiG4.GetYaxis().SetTitle('Eff. Z/A * #rho [ g/mm^{3} ]')
96  zarhophiG4.Draw('hist')
97  zarhophiTG.Draw('pe,same')
98  except (ReferenceError, AttributeError):
99  pass
100 
101  tvCanvas.SaveAs(saveLocation+tvsavename+'.png')
TrackingVolumeUtils.drawTrackingVolume
def drawTrackingVolume(g4Tree, tgTree, saveLocation)
Definition: TrackingVolumeUtils.py:5