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

References update.

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

Definition at line 226 of file MatrixUtil.py.

References python.rootplot.root2matplotlib.replace().

226 def changeRefRelease(steps,listOfPairs):
227  for s in steps:
228  if ('INPUT' in steps[s]):
229  oldD=steps[s]['INPUT'].dataSet
230  for (ref,newRef) in listOfPairs:
231  if ref in oldD:
232  steps[s]['INPUT'].dataSet=oldD.replace(ref,newRef)
233  if '--pileup_input' in steps[s]:
234  for (ref,newRef) in listOfPairs:
235  if ref in steps[s]['--pileup_input']:
236  steps[s]['--pileup_input']=steps[s]['--pileup_input'].replace(ref,newRef)
237 
def replace(string, replacements)
def changeRefRelease(steps, listOfPairs)
Definition: MatrixUtil.py:226
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 243 of file MatrixUtil.py.

References python.rootplot.root2matplotlib.replace().

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

Standard release validation samples ####.

Definition at line 221 of file MatrixUtil.py.

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

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

Definition at line 223 of file MatrixUtil.py.

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

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

Definition at line 191 of file MatrixUtil.py.

References hpstanc_transforms.max.

Referenced by MuonHOAcceptance::deadIdRegion.adjacentPhi(), CaloTowersCreationAlgo.assignHitHcal(), CaloTowersCreationAlgo.makeHcalDropChMap(), DDI::LogicalPart.mergedSpecificsV(), DDExpandedView.mergedSpecificsV(), DAClusterizerInZ.vertices(), and DAClusterizerInZ_vect.vertices().

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

Definition at line 62 of file MatrixUtil.py.

References mps_alisetup.append, and harvestTrackValidationPlots.str.

62 def selectedLS(list_runs=[],maxNum=-1,l_json=data_json2015):
63  # print "maxNum is %s"%(maxNum)
64  if type(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.keys()) > 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