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 90 of file bookConverter.py.

Referenced by compute().

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

Definition at line 82 of file bookConverter.py.

Referenced by compute().

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

Definition at line 106 of file bookConverter.py.

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

Referenced by DTCalibValidation.analyze(), DTCalibValidationFromMuons.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(), GsfMaterialEffectsUpdator.updateState(), RPCRecHitBaseAlgo.~RPCRecHitBaseAlgo(), VariableComputer.~VariableComputer(), and VariableComputerTest.~VariableComputerTest().

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

Definition at line 76 of file bookConverter.py.

References edm.print().

Referenced by priorities().

77  co = comb[cid]
78  print("Declaration to apply:", co)
79  for k in comb[cid]:
80  print(keys[k]['name'], '=', keys[k]['value'])
81 
S & print(S &os, JobReport::InputFile const &f)
Definition: JobReport.cc:66
def create_declaration(cid)
def bookConverter.create_xsd ( )

Definition at line 58 of file bookConverter.py.

Referenced by priorities().

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

Definition at line 96 of file bookConverter.py.

Referenced by compute().

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

Definition at line 119 of file bookConverter.py.

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

Referenced by TrackAlgoPriorityOrder.TrackAlgoPriorityOrder().

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

Definition at line 17 of file bookConverter.py.

References objects.autophobj.float, createfilelist.int, and edm.print().

Referenced by priorities().

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