Classes | Functions | Variables
file_size_ana Namespace Reference

Classes

class  Node
 

Functions

def AddNodes (branch)
 
def prettyPrint (node, total, depth=100, indent='')
 
def toJSON (node, indent='')
 
def New (cons, args)
 
def RingChart (node, total, depth=1, startang=0)
 
def BarChart (node, total, depth=0, startpos=0)
 

Variables

 parser = argparse.ArgumentParser()
 
 action
 
 help
 
 default
 
 metavar
 
 opts = vars(parser.parse_args())
 
 se = sys.stderr
 
 stderr
 
 f = TFile(opts['filename.root'],"READ")
 
 isArt = bool(f.Get('Events'))
 
list treeNames
 
dictionary nodes = {}
 
bool progress = True
 Insert implicit nodes #####. More...
 
dictionary newnodes = {}
 
 node = nodes[key]
 
string parentKey = '.'
 
 label = parentKey.split('.')[-1]
 
 root = nodes[opts['focus']]
 Link up the nodes tree #####. More...
 
 title
 
 parent = nodes[parentKey]
 
list curNodes = [root]
 Display the node tree #####. More...
 
list gs = []
 
 canv = New(TCanvas, 'rings', 'rings', 1000, 1000)
 
 axes = New(TH2F, "", "", 100, 70, 330, 100, 70, 330)
 
 local
 
 banner
 

Function Documentation

def file_size_ana.AddNodes (   branch)

Definition at line 77 of file file_size_ana.py.

77 def AddNodes(branch):
78  title = branch.GetName()
79 
80  # In ART files you get type_label_instance_process.therest
81  # Transform to label.instance.type.therest
82  m = re.match('(.*)_(.*)_(.*)_(.*)\\.(.*)', title)
83  if m:
84  # Often instance is blank
85  if len(m.group(3)) > 0:
86  title = m.group(2)+'.'+m.group(3)+'.'+m.group(1)+'.'+m.group(5)
87  else:
88  title = m.group(2)+'.'+m.group(1)+'.'+m.group(5)
89 
90  label = title.split('.')[-1]
91  nodes[title] = Node(label, branch.GetZipBytes())
92  for b in branch.GetListOfBranches(): AddNodes(b)
93 
94 
def AddNodes(branch)
def file_size_ana.BarChart (   node,
  total,
  depth = 0,
  startpos = 0 
)

Definition at line 245 of file file_size_ana.py.

References min(), and New().

245 def BarChart(node, total, depth = 0, startpos = 0):
246  span = 100.*node.FullSize()/total
247  meanpos = startpos+span/2
248  meany = -(depth*20+10)
249 
250  if span < .3: return
251 
252  box = New(TBox, startpos, -depth*20, startpos+span, -(depth*20+20))
253  box.SetLineWidth(2)
254  box.SetFillStyle(0)
255 
256  for c in sorted(node.children, key = lambda n: -n.FullSize()):
257  BarChart(c, total, depth+1, startpos)
258  startpos += (100.*c.FullSize())/total
259 
260  box.Draw()
261 
262  if span > 20:
263  label = New(TLatex, meanpos, meany, node.title)
264  textscale = .4*min(20, span)/len(node.title)
265  if textscale > 2: textscale = 2
266  label.SetTextSize(label.GetTextSize()*textscale)
267  label.SetTextAlign(22)
268  label.Draw()
269  elif span > 1:
270  label = New(TLatex, meanpos, meany, node.title)
271  textscale = .4*min(20, span)/len(node.title)
272  if textscale > 1: textscale = 1
273  label.SetTextSize(label.GetTextSize()*textscale)
274  label.SetTextAlign(22)
275  label.SetTextAngle(90)
276  label.Draw()
277 
278 
def New(cons, args)
def BarChart(node, total, depth=0, startpos=0)
static float min(const float a, const float b, const float c)
Definition: absgeo.cxx:45
def file_size_ana.New (   cons,
  args 
)

Definition at line 193 of file file_size_ana.py.

Referenced by BarChart(), and RingChart().

193 def New(cons, *args):
194  ret = cons(*args)
195  gs.append(ret)
196  return ret
197 
198 
def New(cons, args)
def file_size_ana.prettyPrint (   node,
  total,
  depth = 100,
  indent = '' 
)

Definition at line 147 of file file_size_ana.py.

References makeTrainCVSamples.int, PandAna.Demos.demo1.range, and runNovaSAM.str.

147 def prettyPrint(node, total, depth = 100, indent = ''):
148  if depth == 0: return
149  if node.FullSize() == 0: return
150  percent = int((100*node.FullSize())/total+.5)
151  if percent > 0:
152  print indent, node, '\t('+str(percent)+'%)'
153  else:
154  print indent, node
155 
156  for c in sorted(node.children, key = lambda n: -n.FullSize()):
157  prettyPrint(c, node.FullSize(), depth-1, indent+'\t')
158 
159 
160 
def prettyPrint(node, total, depth=100, indent='')
def file_size_ana.RingChart (   node,
  total,
  depth = 1,
  startang = 0 
)

Definition at line 199 of file file_size_ana.py.

References std.cos(), New(), and std.sin().

199 def RingChart(node, total, depth = 1, startang = 0):
200  span = 360.*node.FullSize()/total
201  meanang = (startang+span/2)*3.14159/180
202 
203  if span < .5: return
204 
205  arc = New(TArc, 200, 200, 20*depth, startang, startang+span)
206  arc.SetLineWidth(2)
207 
208  for c in sorted(node.children, key = lambda n: -n.FullSize()):
209  RingChart(c, total, depth+1, startang)
210  startang += (360.*c.FullSize())/total
211 
212  arc.Draw()
213 
214  meanr = 20*depth-10
215  if depth == 1: meanr = 0
216  if span > 10:
217  label = New(TLatex, 200+meanr*cos(meanang),
218  200+meanr*sin(meanang),
219  node.title)
220  textscale = .06*span/len(node.title)
221  if textscale > 1: textscale = 1
222  label.SetTextSize(label.GetTextSize()*textscale)
223  label.SetTextAlign(22)
224  textang = meanang*180/3.14159265358979-90
225  if textang > +90: textang -= 180
226  if textang < -90: textang += 180
227  if depth > 1: label.SetTextAngle(textang)
228  label.Draw()
229  elif span > 1:
230  label = New(TLatex, 200+meanr*cos(meanang),
231  200+meanr*sin(meanang),
232  node.title)
233  textscale = .06*span
234  if textscale > 1: textscale = 1
235  label.SetTextSize(label.GetTextSize()*textscale)
236  label.SetTextAlign(22)
237  textang = meanang*180/3.14159265358979
238  while textang > +90: textang -= 180
239  while textang < -90: textang += 180
240  if depth > 1: label.SetTextAngle(textang)
241  label.Draw()
242 
243 
244 
def New(cons, args)
T sin(T number)
Definition: d0nt_math.hpp:132
T cos(T number)
Definition: d0nt_math.hpp:78
def RingChart(node, total, depth=1, startang=0)
def file_size_ana.toJSON (   node,
  indent = '' 
)

Definition at line 170 of file file_size_ana.py.

References runNovaSAM.str.

170 def toJSON(node, indent = ''):
171  ret = ''
172 
173  if len(node.children) == 0:
174  ret += indent+'{"name": "'+node.title+'", "size": '+str(node.FullSize())+'}'
175  else:
176  ret += indent+'{"name": "'+node.title+'", "children": [\n'
177 
178  ret += ',\n'.join([toJSON(c, indent+' ') for c in sorted(node.children, key = lambda n: -n.FullSize()) if c.FullSize() > 0])
179  ret += ' ] }'
180 
181  return ret
182 
183 
def toJSON(node, indent='')

Variable Documentation

file_size_ana.action

Definition at line 11 of file file_size_ana.py.

file_size_ana.axes = New(TH2F, "", "", 100, 70, 330, 100, 70, 330)
file_size_ana.banner

Definition at line 323 of file file_size_ana.py.

file_size_ana.canv = New(TCanvas, 'rings', 'rings', 1000, 1000)

Definition at line 280 of file file_size_ana.py.

list file_size_ana.curNodes = [root]

Display the node tree #####.

Definition at line 145 of file file_size_ana.py.

file_size_ana.default

Definition at line 22 of file file_size_ana.py.

file_size_ana.f = TFile(opts['filename.root'],"READ")

Definition at line 57 of file file_size_ana.py.

list file_size_ana.gs = []

Definition at line 190 of file file_size_ana.py.

file_size_ana.help

Definition at line 12 of file file_size_ana.py.

file_size_ana.isArt = bool(f.Get('Events'))

Definition at line 60 of file file_size_ana.py.

file_size_ana.label = parentKey.split('.')[-1]

Definition at line 114 of file file_size_ana.py.

file_size_ana.local

Definition at line 323 of file file_size_ana.py.

file_size_ana.metavar

Definition at line 22 of file file_size_ana.py.

dictionary file_size_ana.newnodes = {}

Definition at line 104 of file file_size_ana.py.

file_size_ana.node = nodes[key]
dictionary file_size_ana.nodes = {}
file_size_ana.opts = vars(parser.parse_args())

Definition at line 27 of file file_size_ana.py.

file_size_ana.parent = nodes[parentKey]
string file_size_ana.parentKey = '.'

Definition at line 109 of file file_size_ana.py.

file_size_ana.parser = argparse.ArgumentParser()

Definition at line 9 of file file_size_ana.py.

bool file_size_ana.progress = True
file_size_ana.root = nodes[opts['focus']]

Link up the nodes tree #####.

Definition at line 123 of file file_size_ana.py.

Referenced by make_RHC_WrongSign_Numu_Pd4_6Data(), syst_table_fit(), and syst_table_fit_new().

file_size_ana.se = sys.stderr

Definition at line 55 of file file_size_ana.py.

Referenced by TEST().

file_size_ana.stderr

Definition at line 56 of file file_size_ana.py.

file_size_ana.title

Definition at line 127 of file file_size_ana.py.

list file_size_ana.treeNames
Initial value:
1 = ['Events', 'Runs', 'SubRuns',
2  'EventHistory', 'MetaData', 'Parentage',
3  'EventMetaData', 'SubRunMetaData', 'RunMetaData']

Definition at line 63 of file file_size_ana.py.