CMS 3D CMS Logo

Classes | Functions
bookConverter Namespace Reference

Classes

class  OptionParser
 

Functions

def ccopy (a)
 
def cexists (s, c)
 
def compute (min, max)
 
def create_declaration (cid)
 
def create_xsd ()
 
def kpermutation (vfrom, vto, min, max)
 
def priorities ()
 
def read_data ()
 

Function Documentation

def bookConverter.ccopy (   a)

Definition at line 89 of file bookConverter.py.

Referenced by compute().

89 def ccopy(a):
90  r = []
91  for v in a:
92  r.append(v)
93  return r
94 
def bookConverter.cexists (   s,
  c 
)

Definition at line 81 of file bookConverter.py.

Referenced by compute().

81 def cexists(s, c):
82  d = len(c)
83  for v1 in s:
84  for v2 in c:
85  if v1 == v2:
86  d = d - 1
87  return (d == 0)
88 
def cexists(s, c)
def bookConverter.compute (   min,
  max 
)

Definition at line 105 of file bookConverter.py.

References mps_setup.append, ccopy(), cexists(), and kpermutation().

Referenced by DTCalibValidation.analyze(), ClosestApproachInRPhi.calculate(), Basic2DGenericPFlowPositionCalc.calculateAndSetPositionActual(), ClosestApproachInRPhi.clone(), DTRecHitQuality.dqmAnalyze(), IPTagPlotter< Container, Base >.finalize(), TrackCountingTagPlotter.finalize(), TrackProbabilityTagPlotter.finalize(), PhysicsTools::MVATrainer.getTrainCalibration(), PhysicsTools::MVATrainer.makeTrainCalibration(), MaterialEffectsUpdator.mass(), magfieldparam::BCycl< float >.operator()(), priorities(), DTRecHitBaseAlgo.reconstruct(), GsfMaterialEffectsUpdator.updateState(), RPCRecHitBaseAlgo.~RPCRecHitBaseAlgo(), VariableComputer.~VariableComputer(), and VariableComputerTest.~VariableComputerTest().

105 def compute(min, max):
106  print "Computing permutations"
107  for v in kpermutation(0, len(keys), min, max):
108  ci = -1
109  for h in histograms:
110  if cexists(h, v):
111  if ci == -1:
112  ci = len(comb)
113  comb[ci] = ccopy(v)
114  results[ci] = [h]
115  else:
116  results[ci].append(h)
117 
def kpermutation(vfrom, vto, min, max)
def cexists(s, c)
def compute(min, max)
def bookConverter.create_declaration (   cid)

Definition at line 75 of file bookConverter.py.

Referenced by priorities().

76  co = comb[cid]
77  print "Declaration to apply:", co
78  for k in comb[cid]:
79  print keys[k]['name'], '=', keys[k]['value']
80 
def create_declaration(cid)
def bookConverter.create_xsd ( )

Definition at line 57 of file bookConverter.py.

Referenced by priorities().

57 def create_xsd():
58  for k in keys.keys():
59  name = keys[k]['name']
60 
61  root = resdoc.createElement("xs:complexType")
62  root.setAttribute("name", "HistogramType")
63  resdoc.appendChild(root)
64  seq = resdoc.createElement("xs:all")
65  root.appendChild(seq)
66  for e in sorted(elements.keys()):
67  el = resdoc.createElement("xs:element")
68  el.setAttribute("name", e)
69  el.setAttribute("type", elements[e]['type'])
70  if elements[e]['count'] < len(histograms):
71  el.setAttribute("minOccurs", '0')
72  el.setAttribute("maxOccurs", '1')
73  seq.appendChild(el)
74 
def bookConverter.kpermutation (   vfrom,
  vto,
  min,
  max 
)

Definition at line 95 of file bookConverter.py.

Referenced by compute().

95 def kpermutation(vfrom, vto, min, max):
96  vto = vto + 1
97  queue = []
98  for i in range(vfrom, vto):
99  for j in range(i, vto):
100  queue.append(j)
101  if len(queue) >= min and len(queue) <= max:
102  yield queue
103  queue = []
104 
def kpermutation(vfrom, vto, min, max)
def bookConverter.priorities ( )

Definition at line 118 of file bookConverter.py.

References mps_setup.append, compute(), create_declaration(), create_xsd(), and read_data().

Referenced by TrackAlgoPriorityOrder.TrackAlgoPriorityOrder().

119  for ci in comb.keys():
120  l = len(results[ci])
121  if l == 1:
122  continue
123  if l not in prior:
124  prior[l] = [ci]
125  else:
126  prior[l].append(ci)
127 
def bookConverter.read_data ( )

Definition at line 16 of file bookConverter.py.

References objects.autophobj.float, and createfilelist.int.

Referenced by priorities().

16 def read_data():
17  print "Reading histogram file"
18  n = 0
19  histos = srcdoc.getElementsByTagName("Histogram")
20  for histo in histos:
21  h = []
22  for key in histo.childNodes:
23  if key.nodeType == key.ELEMENT_NODE:
24  name = key.localName
25  value = key.childNodes[0].nodeValue
26  found = 0
27 
28  if name not in elements:
29  elements[name] = {'type': '', 'count': 0}
30  elements[name]['count'] = elements[name]['count'] + 1
31 
32  try:
33  i = int(value)
34  if elements[name]['type'] == '':
35  elements[name]['type'] = 'xs:integer'
36  except ValueError:
37  try:
38  i = float(value)
39  if elements[name]['type'] in ('', 'xs:integer'):
40  elements[name]['type'] = 'xs:double'
41  except ValueError:
42  elements[name]['type'] = 'xs:string'
43 
44  for k in keys.keys():
45  if keys[k]['name'] == name and keys[k]['value'] == value:
46  keys[k]['count'] = keys[k]['count'] + 1
47  h.append(k)
48  found = 1
49  break
50  if found == 0:
51  keys[n] = {'name': name, 'value': value, 'count': 1}
52  h.append(n)
53  n += 1
54  h.sort()
55  histograms.append(h)
56