ATLAS Offline Software
Loading...
Searching...
No Matches
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
10import sys
11from math import sqrt, atan2
12
13# ROOT setup
14from 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
16from ROOT import TPolyLine3D, TPolyMarker3D, TAxis3D
17
18include("InDetSimpleVisual/rootlogon.py")
19gROOT.Reset()
20gStyle.SetOptStat(0)
21gStyle.SetMarkerStyle(7)
22
23# Setup needed functions
24include("InDetSimpleVisual/comparisonUtils.py")
25
26# Output file
27rootFile = TFile(outputFile,"RECREATE")
28
29# Open the inputFiles
30inputfile1 = open(inputFile1,"r")
31inputfile2 = open(inputFile2,"r")
32
33# Seting the ranges
34# ==================
35if not "deltaR" in dir():
36 deltaR = 1.5
37if not "deltaPhiTrans" in dir():
38 deltaPhiTrans = 2
39if not "deltaPhi" in dir():
40 deltaPhi = 0.0008
41if not "deltaX" in dir():
42 deltaX = 2
43if not "deltaY" in dir():
44 deltaY = 2
45if not "deltaZ" in dir():
46 deltaZ = 2
47if not "deltaXY" in dir():
48 deltaXY = 3
49if not "TRASL_FACTOR" in dir():
50 TRASL_FACTOR = 200
51if not "drawPix" in dir():
52 drawPix = True
53if not "drawSCT" in dir():
54 drawSCT = True
55if not "drawTRT" in dir():
56 drawTRT = True
57if not "drawIBL" in dir():
58 drawIBL = True
59
60# Setting the detailed TRT defaults
61if not "drawTRTModules" in dir():
62 drawTRTModules = []
63
64# Getting the first geometry
65geometry1 = readInData(inputfile1)
66iblElements1 = geometry1[0]
67pixelElements1 = geometry1[1]
68sctElements1 = geometry1[2]
69trtElements1 = geometry1[3]
70
71# Getting the second geometry
72geometry2 = readInData(inputfile2)
73iblElements2 = geometry2[0]
74pixelElements2 = geometry2[1]
75sctElements2 = geometry2[2]
76trtElements2 = geometry2[3]
77
78# Setup the Histograms
79include("InDetSimpleVisual/makeHists.py")
80include("InDetSimpleVisual/makeTransCanvas.py")
81include("InDetSimpleVisual/make3DCanvas.py")
82
83# IBL
84#=============
85if 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#=============
100if 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#=============
115if 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#=============
130trtDir = rootFile.mkdir("TRT misalignments")
131if 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
159include("InDetSimpleVisual/makeTRTBarrelCans.py")
160
161# Write out the plots
162# ====================
163include("InDetSimpleVisual/writePlots.py")
164
165# Exit
166sys.exit()