CMS 3D CMS Logo

Classes | Functions
MatrixUtil Namespace Reference

Classes

class  InputInfo
 
class  Matrix
 
class  Steps
 
class  WF
 

Functions

def addForAll (steps, d)
 
def changeRefRelease (steps, listOfPairs)
 
def expandLsInterval (lumis)
 
def genvalid (fragment, d, suffix='all', fi='', dataSet='')
 
def Kby (N, s)
 Standard release validation samples ####. More...
 
def Mby (N, s)
 
def merge (dictlist, TELL=False)
 
def remove (d, key, TELL=False)
 
def selectedLS (list_runs=[], maxNum=-1, l_json=data_json2015)
 

Function Documentation

def MatrixUtil.addForAll (   steps,
  d 
)

Definition at line 240 of file MatrixUtil.py.

References update.

240 def addForAll(steps,d):
241  for s in steps:
242  steps[s].update(d)
243 
244 
def addForAll(steps, d)
Definition: MatrixUtil.py:240
#define update(a, b)
def MatrixUtil.changeRefRelease (   steps,
  listOfPairs 
)

Definition at line 228 of file MatrixUtil.py.

References python.rootplot.root2matplotlib.replace().

228 def changeRefRelease(steps,listOfPairs):
229  for s in steps:
230  if ('INPUT' in steps[s]):
231  oldD=steps[s]['INPUT'].dataSet
232  for (ref,newRef) in listOfPairs:
233  if ref in oldD:
234  steps[s]['INPUT'].dataSet=oldD.replace(ref,newRef)
235  if '--pileup_input' in steps[s]:
236  for (ref,newRef) in listOfPairs:
237  if ref in steps[s]['--pileup_input']:
238  steps[s]['--pileup_input']=steps[s]['--pileup_input'].replace(ref,newRef)
239 
def replace(string, replacements)
def changeRefRelease(steps, listOfPairs)
Definition: MatrixUtil.py:228
def MatrixUtil.expandLsInterval (   lumis)

Definition at line 46 of file MatrixUtil.py.

References dcsonly_json_2012.findFileInPath().

46 def expandLsInterval(lumis):
47  return range(lumis[0],(lumis[1]+1))
48 
def expandLsInterval(lumis)
Definition: MatrixUtil.py:46
def MatrixUtil.genvalid (   fragment,
  d,
  suffix = 'all',
  fi = '',
  dataSet = '' 
)

Definition at line 245 of file MatrixUtil.py.

References python.rootplot.root2matplotlib.replace().

245 def genvalid(fragment,d,suffix='all',fi='',dataSet=''):
246  import copy
247  c=copy.copy(d)
248  if suffix:
249  c['-s']=c['-s'].replace('genvalid','genvalid_'+suffix)
250  if fi:
251  c['--filein']='lhe:%d'%(fi,)
252  if dataSet:
253  c['--filein']='das:%s'%(dataSet,)
254  c['cfg']=fragment
255  return c
256 
257 
258 
def genvalid(fragment, d, suffix='all', fi='', dataSet='')
Definition: MatrixUtil.py:245
def replace(string, replacements)
def MatrixUtil.Kby (   N,
  s 
)

Standard release validation samples ####.

Definition at line 223 of file MatrixUtil.py.

Referenced by relval_steps.gen2018HiMix(), relval_steps.gen2018prod(), relval_steps.genS(), relval_steps.identitySim(), and relval_steps.lhegensim2017().

223 def Kby(N,s):
224  return {'--relval':'%s000,%s'%(N,s)}
def Kby(N, s)
Standard release validation samples ####.
Definition: MatrixUtil.py:223
def MatrixUtil.Mby (   N,
  s 
)

Definition at line 225 of file MatrixUtil.py.

Referenced by relval_steps.gen2018prod(), relval_steps.genS(), and relval_steps.identitySim().

225 def Mby(N,s):
226  return {'--relval':'%s000000,%s'%(N,s)}
227 
def Mby(N, s)
Definition: MatrixUtil.py:225
def MatrixUtil.merge (   dictlist,
  TELL = False 
)

Definition at line 193 of file MatrixUtil.py.

References SiStripPI.max.

Referenced by CaloTowersCreationAlgo.assignHitHcal(), DDI::LogicalPart.mergedSpecificsV(), DDExpandedView.mergedSpecificsV(), DAClusterizerInZ.vertices(), DAClusterizerInZ_vect.vertices(), and DAClusterizerInZT_vect.vertices().

193 def merge(dictlist,TELL=False):
194  import copy
195  last=len(dictlist)-1
196  if TELL: print last,dictlist
197  if last==0:
198  # ONLY ONE ITEM LEFT
199  return copy.copy(dictlist[0])
200  else:
201  reducedlist=dictlist[0:max(0,last-1)]
202  if TELL: print reducedlist
203  # make a copy of the last item
204  d=copy.copy(dictlist[last])
205  # update with the last but one item
206  d.update(dictlist[last-1])
207  # and recursively do the rest
208  reducedlist.append(d)
209  return merge(reducedlist,TELL)
210 
Definition: merge.py:1
def merge(dictlist, TELL=False)
Definition: MatrixUtil.py:193
def MatrixUtil.selectedLS (   list_runs = [],
  maxNum = -1,
  l_json = data_json2015 
)

Definition at line 62 of file MatrixUtil.py.

References mps_setup.append, and str.

62 def selectedLS(list_runs=[],maxNum=-1,l_json=data_json2015):
63  # print "maxNum is %s"%(maxNum)
64  if not isinstance(list_runs[0], int):
65  print "ERROR: list_runs must be a list of intergers"
66  return None
67  local_dict = {}
68  ls_count = 0
69 
70  for run in list_runs:
71  if str(run) in l_json.keys():
72  # print "run %s is there"%(run)
73  runNumber = run
74  # print "Doing lumi-section selection for run %s: "%(run)
75  for LSsegment in l_json[str(run)] :
76  # print LSsegment
77  ls_count += (LSsegment[-1] - LSsegment[0] + 1)
78  if (ls_count > maxNum) & (maxNum != -1):
79  break
80  # return local_dict
81  if runNumber in local_dict.keys():
82  local_dict[runNumber].append(LSsegment)
83  else:
84  local_dict[runNumber] = [LSsegment]
85  # print "total LS so far %s - grow %s"%(ls_count,local_dict)
86  #local_dict[runNumber] = [1,2,3]
87  else:
88  print "run %s is NOT present in json %s\n\n"%(run, l_json)
89  # print "++ %s"%(local_dict)
90 
91  if ( len(local_dict) > 0 ) :
92  return local_dict
93  else :
94  print "No luminosity section interval passed the json and your selection; returning None"
95  return None
96 
97 # print "\n\n\n THIS IS WHAT I RETURN: %s \n\n"%( selectedLS([251244,251251]) )
98 
99 
100 
101 
102 InputInfoNDefault=2000000
def selectedLS(list_runs=[], maxNum=-1, l_json=data_json2015)
Definition: MatrixUtil.py:62
#define str(s)