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_json2015 = 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 219 of file MatrixUtil.py.

References update.

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

Definition at line 207 of file MatrixUtil.py.

References python.rootplot.root2matplotlib.replace().

208 def changeRefRelease(steps,listOfPairs):
209  for s in steps:
210  if ('INPUT' in steps[s]):
211  oldD=steps[s]['INPUT'].dataSet
212  for (ref,newRef) in listOfPairs:
213  if ref in oldD:
214  steps[s]['INPUT'].dataSet=oldD.replace(ref,newRef)
215  if '--pileup_input' in steps[s]:
216  for (ref,newRef) in listOfPairs:
217  if ref in steps[s]['--pileup_input']:
218  steps[s]['--pileup_input']=steps[s]['--pileup_input'].replace(ref,newRef)
def changeRefRelease
Definition: MatrixUtil.py:207
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 224 of file MatrixUtil.py.

References python.rootplot.root2matplotlib.replace().

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

Definition at line 202 of file MatrixUtil.py.

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

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

Definition at line 204 of file MatrixUtil.py.

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

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

Definition at line 172 of file MatrixUtil.py.

References bookConverter.max.

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

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

Definition at line 190 of file MatrixUtil.py.

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

Definition at line 58 of file MatrixUtil.py.

References python.multivaluedict.append().

58 
59 def selectedLS(list_runs=[],maxNum=-1,l_json=data_json2015):
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  # print "Doing lumi-section selection for run %s: "%(run)
72  for LSsegment in l_json[str(run)] :
73  # print LSsegment
74  ls_count += (LSsegment[-1] - LSsegment[0] + 1)
75  if (ls_count > maxNum) & (maxNum != -1):
76  break
77  # return local_dict
78  if runNumber in local_dict.keys():
79  local_dict[runNumber].append(LSsegment)
80  else:
81  local_dict[runNumber] = [LSsegment]
82  # print "total LS so far %s - grow %s"%(ls_count,local_dict)
83  #local_dict[runNumber] = [1,2,3]
84  else:
85  print "run %s NOT present in json %s\n\n"%(run,l_json)
86  # print "++ %s"%(local_dict)
87 
88  if ( len(local_dict.keys()) > 0 ) :
89  return local_dict
90  else :
91  print "No luminosity section interval passed the json and your selection; returning None"
92  return None
93 
94 # print "\n\n\n THIS IS WHAT I RETURN: %s \n\n"%( selectedLS([251244,251251]) )
95 
96 
97 
98 
InputInfoNDefault=2000000
def selectedLS
Definition: MatrixUtil.py:58

Variable Documentation

tuple MatrixUtil.data_json2015 = 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 201 of file MatrixUtil.py.