CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
Classes | Functions | Variables
MatrixUtil Namespace Reference

Classes

class  InputInfo
 
class  Matrix
 
class  Steps
 
class  WF
 

Functions

def addForAll
 
def changeRefRelease
 
def expandLsInterval
 
def genvalid
 
def Kby
 
def Mby
 
def merge
 
def remove
 
def selectedLS
 

Variables

tuple data_json = json.load(data_file)
 
tuple jsonFile2015 = findFileInPath("DPGAnalysis/Skims/data/Cert_246908-XXXXXX_13TeV_PromptReco_Collisions15_JSON.txt")
 
dictionary stCond = {'--conditions':'auto:run1_mc'}
 Standard release validation samples ####. More...
 

Function Documentation

def MatrixUtil.addForAll (   steps,
  d 
)

Definition at line 218 of file MatrixUtil.py.

References update.

219 def addForAll(steps,d):
220  for s in steps:
221  steps[s].update(d)
222 
#define update(a, b)
def addForAll
Definition: MatrixUtil.py:218
def MatrixUtil.changeRefRelease (   steps,
  listOfPairs 
)

Definition at line 206 of file MatrixUtil.py.

References python.rootplot.root2matplotlib.replace().

207 def changeRefRelease(steps,listOfPairs):
208  for s in steps:
209  if ('INPUT' in steps[s]):
210  oldD=steps[s]['INPUT'].dataSet
211  for (ref,newRef) in listOfPairs:
212  if ref in oldD:
213  steps[s]['INPUT'].dataSet=oldD.replace(ref,newRef)
214  if '--pileup_input' in steps[s]:
215  for (ref,newRef) in listOfPairs:
216  if ref in steps[s]['--pileup_input']:
217  steps[s]['--pileup_input']=steps[s]['--pileup_input'].replace(ref,newRef)
def changeRefRelease
Definition: MatrixUtil.py:206
def MatrixUtil.expandLsInterval (   lumis)

Definition at line 46 of file MatrixUtil.py.

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

Definition at line 223 of file MatrixUtil.py.

References python.rootplot.root2matplotlib.replace().

224 def genvalid(fragment,d,suffix='all',fi='',dataSet=''):
225  import copy
226  c=copy.copy(d)
227  if suffix:
228  c['-s']=c['-s'].replace('genvalid','genvalid_'+suffix)
229  if fi:
230  c['--filein']='lhe:%d'%(fi,)
231  if dataSet:
232  c['--filein']='das:%s'%(dataSet,)
233  c['cfg']=fragment
234  return c
235 
236 
def genvalid
Definition: MatrixUtil.py:223
def MatrixUtil.Kby (   N,
  s 
)

Definition at line 201 of file MatrixUtil.py.

Referenced by relval_steps.gen2015(), relval_steps.genS(), and relval_steps.identityFS().

202 def Kby(N,s):
return {'--relval':'%s000,%s'%(N,s)}
def MatrixUtil.Mby (   N,
  s 
)

Definition at line 203 of file MatrixUtil.py.

Referenced by relval_steps.gen2015(), and relval_steps.genS().

204 def Mby(N,s):
205  return {'--relval':'%s000000,%s'%(N,s)}
def MatrixUtil.merge (   dictlist,
  TELL = False 
)

Definition at line 171 of file MatrixUtil.py.

References bookConverter.max.

Referenced by HLTScalersClient.endLuminosityBlock(), DDI::LogicalPart.mergedSpecificsV(), DDExpandedView.mergedSpecificsV(), DAClusterizerInZ.vertices(), and DAClusterizerInZ_vect.vertices().

172 def merge(dictlist,TELL=False):
173  import copy
174  last=len(dictlist)-1
175  if TELL: print last,dictlist
176  if last==0:
177  # ONLY ONE ITEM LEFT
178  return copy.copy(dictlist[0])
179  else:
180  reducedlist=dictlist[0:max(0,last-1)]
181  if TELL: print reducedlist
182  # make a copy of the last item
183  d=copy.copy(dictlist[last])
184  # update with the last but one item
185  d.update(dictlist[last-1])
186  # and recursively do the rest
187  reducedlist.append(d)
188  return merge(reducedlist,TELL)
Definition: merge.py:1
def MatrixUtil.remove (   d,
  key,
  TELL = False 
)

Definition at line 189 of file MatrixUtil.py.

190 def remove(d,key,TELL=False):
191  import copy
192  e = copy.deepcopy(d)
193  if TELL: print "original dict, BEF: %s"%d
194  del e[key]
195  if TELL: print "copy-removed dict, AFT: %s"%e
196  return e
197 
def MatrixUtil.selectedLS (   list_runs = [],
  maxNum = -1,
  l_json = data_json 
)

Definition at line 58 of file MatrixUtil.py.

References python.multivaluedict.append().

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

Variable Documentation

tuple MatrixUtil.data_json = json.load(data_file)

Definition at line 54 of file MatrixUtil.py.

tuple MatrixUtil.jsonFile2015 = findFileInPath("DPGAnalysis/Skims/data/Cert_246908-XXXXXX_13TeV_PromptReco_Collisions15_JSON.txt")

Definition at line 50 of file MatrixUtil.py.

dictionary MatrixUtil.stCond = {'--conditions':'auto:run1_mc'}

Standard release validation samples ####.

Definition at line 200 of file MatrixUtil.py.