ATLAS Offline Software
TrackingGeometryValidation.py
Go to the documentation of this file.
1 from __future__ import print_function
2 from array import array
3 import math
4 from LayerMaterialUtils import *
5 from TrackingVolumeUtils import *
6 from ROOT import *
7 
8 # the ATLAS style
9 atlasStyle = TStyle('ATLAS','Atlas style')
10 # use plain black on white colors
11 icol=0
12 atlasStyle.SetFrameBorderMode(icol)
13 atlasStyle.SetCanvasBorderMode(icol)
14 atlasStyle.SetPadBorderMode(icol)
15 atlasStyle.SetPadColor(icol)
16 atlasStyle.SetCanvasColor(icol)
17 atlasStyle.SetStatColor(icol)
18 # do not display any of the standard histogram decorations
19 atlasStyle.SetOptTitle(0)
20 atlasStyle.SetOptStat(0)
21 atlasStyle.SetOptFit(0)
22 # put tick marks on top and RHS of plots
23 atlasStyle.SetPadTickX(1)
24 atlasStyle.SetPadTickY(1)
25 atlasStyle.SetPadRightMargin(0.2)
26 atlasStyle.SetPalette(1)
27 # default palette, looks cool
28 ncontours = 999
29 ncontours = 999
30 stops = [0.00, 0.34, 0.61, 0.84, 1.00]
31 red = [0.00, 0.00, 0.87, 1.00, 0.51]
32 green = [0.00, 0.81, 1.00, 0.20, 0.00]
33 blue = [0.51, 1.00, 0.12, 0.00, 0.00]
34 s = array('d', stops)
35 r = array('d', red)
36 g = array('d', green)
37 b = array('d', blue)
38 npoints = len(s)
39 TColor.CreateGradientColorTable(npoints, s, r, g, b, ncontours)
40 atlasStyle.SetNumberContours(ncontours)
41 gROOT.SetStyle('ATLAS')
42 
43 
44 DetDescrVersion = 'ATLAS-GEO-16-00-00'
45 
46 # tracking geometry files
47 tgMapFile = TFile('AtlasMaterialMap-'+DetDescrVersion+'.root')
48 lmiDirectory = tgMapFile.Get('LayerMaterialInspector')
49 lmiListOfKeys = lmiDirectory.GetListOfKeys()
50 
51 for key in lmiListOfKeys :
52  curLayerMap = lmiDirectory.Get(key.GetName())
53  print ('Processing: ', curLayerMap.GetName())
54  if curLayerMap.GetName().find('CylinderLayer') > -1 :
55  layershname = curLayerMap.GetName().split('Cylinder')[1]
56  g4Tree = TChain(layershname)
57  g4Tree.Add('AtlasMaterialG4-*.root')
58  tgTree = TChain(layershname)
59  tgTree.Add('AtlasMaterialTG-*.root')
60  drawCylinderLayer(g4Tree,curLayerMap,tgTree,'img/')
61  if curLayerMap.GetName().find('DiscLayer') > -1 :
62  layershname = curLayerMap.GetName().split('Disc')[1]
63  g4Tree = TChain(layershname)
64  g4Tree.Add('AtlasMaterialG4-*.root')
65  tgTree = TChain(layershname)
66  tgTree.Add('AtlasMaterialTG-*.root')
67  drawDiscLayer(g4Tree,curLayerMap,tgTree,'img/')
68 
69 
70 tvFile = TFile('AtlasMaterialG4-'+DetDescrVersion+'.root')
71 tvListOfKeys = tvFile.GetListOfKeys()
72 for key in tvListOfKeys :
73  if key.GetName().find('TVolume') > -1 :
74  g4Tree = TChain(key.GetName())
75  g4Tree.Add('AtlasMaterialG4-*.root')
76  tgTree = TChain(key.GetName())
77  tgTree.Add('AtlasMaterialTG-*.root')
78  drawTrackingVolume(g4Tree,tgTree,'img/')
79 
find
std::string find(const std::string &s)
return a remapped string
Definition: hcg.cxx:135
LayerMaterialUtils.drawCylinderLayer
def drawCylinderLayer(g4CylTree, cylLayer, tgCylTree, saveLocation)
Definition: LayerMaterialUtils.py:6
array
TrackingVolumeUtils.drawTrackingVolume
def drawTrackingVolume(g4Tree, tgTree, saveLocation)
Definition: TrackingVolumeUtils.py:5
LayerMaterialUtils.drawDiscLayer
def drawDiscLayer(g4DiscTree, discLayer, tgDiscTree, saveLocation)
Definition: LayerMaterialUtils.py:178
Trk::split
@ split
Definition: LayerMaterialProperties.h:38