ATLAS Offline Software
makeComparison.py
Go to the documentation of this file.
1 #!/usr/bin/python
2 #==============================================================
3 # Runs the comparison configured in CompareGeometries.py
4 # Author: John Alison (johnda@hep.upenn.edu)
5 #
6 # Date: 11 Nov 2008
7 #==============================================================
8 
9 # python setup
10 import sys
11 from math import sqrt, atan2
12 
13 # ROOT setup
14 from ROOT import TFile, gROOT,gStyle, TH2F, TH1F, kRed, kGreen, kBlue, kYellow, kMagenta, TCanvas, gPad, TArrow, TText, TFile,TLine, TColor, TLatex
15 # includes for 3D plots
16 from ROOT import TPolyLine3D, TPolyMarker3D, TAxis3D
17 
18 include("InDetSimpleVisual/rootlogon.py")
19 gROOT.Reset()
20 gStyle.SetOptStat(0)
21 gStyle.SetMarkerStyle(7)
22 
23 # Setup needed functions
24 include("InDetSimpleVisual/comparisonUtils.py")
25 
26 # Output file
27 rootFile = TFile(outputFile,"RECREATE")
28 
29 # Open the inputFiles
30 inputfile1 = open(inputFile1,"r")
31 inputfile2 = open(inputFile2,"r")
32 
33 # Seting the ranges
34 # ==================
35 if not "deltaR" in dir():
36  deltaR = 1.5
37 if not "deltaPhiTrans" in dir():
38  deltaPhiTrans = 2
39 if not "deltaPhi" in dir():
40  deltaPhi = 0.0008
41 if not "deltaX" in dir():
42  deltaX = 2
43 if not "deltaY" in dir():
44  deltaY = 2
45 if not "deltaZ" in dir():
46  deltaZ = 2
47 if not "deltaXY" in dir():
48  deltaXY = 3
49 if not "TRASL_FACTOR" in dir():
50  TRASL_FACTOR = 200
51 if not "drawPix" in dir():
52  drawPix = True
53 if not "drawSCT" in dir():
54  drawSCT = True
55 if not "drawTRT" in dir():
56  drawTRT = True
57 if not "drawIBL" in dir():
58  drawIBL = True
59 
60 # Setting the detailed TRT defaults
61 if not "drawTRTModules" in dir():
62  drawTRTModules = []
63 
64 # Getting the first geometry
65 geometry1 = readInData(inputfile1)
66 iblElements1 = geometry1[0]
67 pixelElements1 = geometry1[1]
68 sctElements1 = geometry1[2]
69 trtElements1 = geometry1[3]
70 
71 # Getting the second geometry
72 geometry2 = readInData(inputfile2)
73 iblElements2 = geometry2[0]
74 pixelElements2 = geometry2[1]
75 sctElements2 = geometry2[2]
76 trtElements2 = geometry2[3]
77 
78 # Setup the Histograms
79 include("InDetSimpleVisual/makeHists.py")
80 include("InDetSimpleVisual/makeTransCanvas.py")
81 include("InDetSimpleVisual/make3DCanvas.py")
82 
83 # IBL
84 #=============
85 if drawIBL:
86  include("InDetSimpleVisual/fillIBLHists.py")
87 
88  iblDir = rootFile.mkdir("IBL misalignments")
89  for i in range(len(iblTransCan)):
90  iblDir.cd()
91  iblTransCan[i].Write()
92  for i in range(0,14):
93  iblDir.cd()
94  ibl3DStaves[i].Write()
95  rootFile.cd()
96  ibl3DCan.Write()
97 
98 # Pixels
99 #=============
100 if drawPix:
101  include("InDetSimpleVisual/fillPixelHists.py")
102 
103  pixelDir = rootFile.mkdir("Pixel misalignments")
104  for i in range(len(pixelTransCan)):
105  pixelDir.cd()
106  pixelTransCan[i].Write()
107  for i in range(0,3):
108  pixelDir.cd()
109  pix3DLayers[i].Write()
110  rootFile.cd()
111  pix3DCan.Write()
112 
113 # SCT
114 #=============
115 if drawSCT:
116  include("InDetSimpleVisual/fillSCTHists.py")
117 
118  sctDir = rootFile.mkdir("SCT misalignments")
119  for i in range(len(sctTransCan)):
120  sctDir.cd()
121  sctTransCan[i].Write()
122  for i in range(0,4):
123  sctDir.cd()
124  sct3DLayers[i].Write()
125  rootFile.cd()
126  sct3DCan.Write()
127 
128 # TRT
129 #=============
130 trtDir = rootFile.mkdir("TRT misalignments")
131 if drawTRT:
132  include("InDetSimpleVisual/fillTRTHists.py")
133 
134  #trtDir = rootFile.mkdir("TRT misalignments")
135  for i in range(len(trtTransCan)):
136  trtDir.cd()
137  trtTransCan[i].Write()
138  rootFile.cd()
139 
140  for pair in trtModTransCan:
141  thisCanPair = trtModTransCan[pair]
142  trtDir.cd()
143  thisCanPair[0].Write()
144  thisCanPair[1].Write()
145  rootFile.cd()
146 
147  EA_strawPlanDir = trtDir.mkdir("Endcap A Straw Planes")
148  for i in range(len(trtEndcapAStrawPlanes)):
149  EA_strawPlanDir.cd()
150  trtEndcapAStrawPlanes[i].Write()
151  rootFile.cd()
152 
153  EC_strawPlanDir = trtDir.mkdir("Endcap C Straw Planes")
154  for i in range(len(trtEndcapCStrawPlanes)):
155  EC_strawPlanDir.cd()
156  trtEndcapCStrawPlanes[i].Write()
157  rootFile.cd()
158 
159 include("InDetSimpleVisual/makeTRTBarrelCans.py")
160 
161 # Write out the plots
162 # ====================
163 include("InDetSimpleVisual/writePlots.py")
164 
165 # Exit
166 sys.exit()
comparisonUtils.readInData
def readInData(inputfile)
Definition: comparisonUtils.py:234
plotBeamSpotVxVal.range
range
Definition: plotBeamSpotVxVal.py:195
python.Include.include
include
Definition: Include.py:318
beamspotman.dir
string dir
Definition: beamspotman.py:623
Trk::open
@ open
Definition: BinningType.h:40