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 241 of file MatrixUtil.py.

References update.

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

Definition at line 229 of file MatrixUtil.py.

References python.rootplot.root2matplotlib.replace().

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

Definition at line 47 of file MatrixUtil.py.

References dcsonly_json_2012.findFileInPath(), and FastTimerService_cff.range.

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

Definition at line 246 of file MatrixUtil.py.

References python.rootplot.root2matplotlib.replace().

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

Standard release validation samples ####.

Definition at line 224 of file MatrixUtil.py.

Referenced by relval_steps.gen2018HiMix(), relval_steps.gen2018hiprod(), relval_steps.genS(), relval_steps.identitySim(), relval_steps.lhegensim2018(), and relval_steps.lhegensim2018ml().

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

Definition at line 226 of file MatrixUtil.py.

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

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

Definition at line 194 of file MatrixUtil.py.

References SiStripPI.max, and edm.print().

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

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

Definition at line 63 of file MatrixUtil.py.

References mps_setup.append, edm.print(), and str.

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