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 check_dups (input)
 
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

◆ addForAll()

def MatrixUtil.addForAll (   steps,
  d 
)

Definition at line 262 of file MatrixUtil.py.

References update.

262 def addForAll(steps,d):
263  for s in steps:
264  steps[s].update(d)
265 
266 
def addForAll(steps, d)
Definition: MatrixUtil.py:262
#define update(a, b)

◆ changeRefRelease()

def MatrixUtil.changeRefRelease (   steps,
  listOfPairs 
)

Definition at line 250 of file MatrixUtil.py.

References python.rootplot.root2matplotlib.replace().

Referenced by MatrixReader.MatrixReader.readMatrix().

250 def changeRefRelease(steps,listOfPairs):
251  for s in steps:
252  if ('INPUT' in steps[s]):
253  oldD=steps[s]['INPUT'].dataSet
254  for (ref,newRef) in listOfPairs:
255  if ref in oldD:
256  steps[s]['INPUT'].dataSet=oldD.replace(ref,newRef)
257  if '--pileup_input' in steps[s]:
258  for (ref,newRef) in listOfPairs:
259  if ref in steps[s]['--pileup_input']:
260  steps[s]['--pileup_input']=steps[s]['--pileup_input'].replace(ref,newRef)
261 
def replace(string, replacements)
def changeRefRelease(steps, listOfPairs)
Definition: MatrixUtil.py:250

◆ check_dups()

def MatrixUtil.check_dups (   input)

Definition at line 279 of file MatrixUtil.py.

279 def check_dups(input):
280  seen = set()
281  dups = set(x for x in input if x in seen or seen.add(x))
282 
283  return dups
284 
def check_dups(input)
Definition: MatrixUtil.py:279

◆ expandLsInterval()

def MatrixUtil.expandLsInterval (   lumis)

Definition at line 48 of file MatrixUtil.py.

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

48 def expandLsInterval(lumis):
49  return range(lumis[0],(lumis[1]+1))
50 
def expandLsInterval(lumis)
Definition: MatrixUtil.py:48

◆ genvalid()

def MatrixUtil.genvalid (   fragment,
  d,
  suffix = 'all',
  fi = '',
  dataSet = '' 
)

Definition at line 267 of file MatrixUtil.py.

References python.rootplot.root2matplotlib.replace().

267 def genvalid(fragment,d,suffix='all',fi='',dataSet=''):
268  import copy
269  c=copy.copy(d)
270  if suffix:
271  c['-s']=c['-s'].replace('genvalid','genvalid_'+suffix)
272  if fi:
273  c['--filein']='lhe:%d'%(fi,)
274  if dataSet:
275  c['--filein']='das:%s'%(dataSet,)
276  c['cfg']=fragment
277  return c
278 
def genvalid(fragment, d, suffix='all', fi='', dataSet='')
Definition: MatrixUtil.py:267
def replace(string, replacements)

◆ Kby()

def MatrixUtil.Kby (   N,
  s 
)

Standard release validation samples ####.

Definition at line 245 of file MatrixUtil.py.

Referenced by relval_steps.gen2018RD(), relval_steps.gen2024HiMix(), relval_steps.gen2024hiprod(), relval_steps.genS(), relval_steps.identitySim(), and relval_steps.lhegensim2018ml().

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

◆ Mby()

def MatrixUtil.Mby (   N,
  s 
)

Definition at line 247 of file MatrixUtil.py.

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

247 def Mby(N,s):
248  return {'--relval':'%s000000,%s'%(N,s)}
249 
def Mby(N, s)
Definition: MatrixUtil.py:247

◆ merge()

def MatrixUtil.merge (   dictlist,
  TELL = False 
)

Definition at line 215 of file MatrixUtil.py.

References SiStripPI.max, and print().

215 def merge(dictlist,TELL=False):
216  import copy
217  last=len(dictlist)-1
218  if TELL: print(last,dictlist)
219  if last==0:
220  # ONLY ONE ITEM LEFT
221  return copy.copy(dictlist[0])
222  else:
223  reducedlist=dictlist[0:max(0,last-1)]
224  if TELL: print(reducedlist)
225  # make a copy of the last item
226  d=copy.copy(dictlist[last])
227  # update with the last but one item
228  d.update(dictlist[last-1])
229  # and recursively do the rest
230  reducedlist.append(d)
231  return merge(reducedlist,TELL)
232 
Definition: merge.py:1
void print(TMatrixD &m, const char *label=nullptr, bool mathematicaFormat=false)
Definition: Utilities.cc:47
def merge(dictlist, TELL=False)
Definition: MatrixUtil.py:215

◆ remove()

def MatrixUtil.remove (   d,
  key,
  TELL = False 
)

Definition at line 233 of file MatrixUtil.py.

References print().

Referenced by Mixins._Parameterizable.__delattr__(), DictTypes.SortedKeysDict.__delitem__(), tkal_create_file_lists.FileListCreator._fulfill_iov_eventcount(), SequenceTypes.Schedule._replaceIfHeldDirectly(), BTagDifferentialPlot.bookHisto(), EtaPtBin.buildDescriptionString(), gen::BaseHadronizer.cleanLHE(), ValidationMatrix_v2.ReleaseComparison.compare(), edm::shared_memory::ControllerChannel::ConditionRemover.ConditionRemover(), PixelThresholdClusterizer.copy_to_buffer(), edmStreamStallGrapher.createPDFImage(), AlignmentParameterBuilder.decodeParamSel(), edm.defaultModuleLabel(), edm::WorkerManager.deleteModuleIfExists(), relval_steps.gen2024HiMix(), evf::EvFDaqDirector.grabNextJsonFileAndUnlock(), SpecificationBuilder_cfi.Specification.groupBy(), Pythia8HepMC3Hadronizer.initializeForExternalPartons(), Pythia8Hadronizer.initializeForExternalPartons(), Pythia8HepMC3Hadronizer.initializeForInternalPartons(), Pythia8Hadronizer.initializeForInternalPartons(), edm::shared_memory::ControllerChannel::MutexRemover.MutexRemover(), edm::shared_memory::WriteBuffer::SMOwner.operator=(), trigger_results_based_event_selector_utils.remove_whitespace(), helpers.removeIfInSequence(), AlCaRecoTriggerBitsRcdUpdate.removePathsFromMap(), edm::UnscheduledCallProducer.removeWorker(), Phase1PixelMaps.retrieveCorners(), gen::Pythia6Service.setSLHAFromHeader(), edm::shared_memory::ControllerChannel::SMORemover.SMORemover(), edm::shared_memory::WriteBuffer::SMOwner.SMOwner(), edm::shared_memory::ControllerChannel::ConditionRemover.~ConditionRemover(), InputFile.~InputFile(), edm::shared_memory::ControllerChannel::MutexRemover.~MutexRemover(), edm::shared_memory::ControllerChannel::SMORemover.~SMORemover(), and edm::shared_memory::WriteBuffer::SMOwner.~SMOwner().

233 def remove(d,key,TELL=False):
234  import copy
235  e = copy.deepcopy(d)
236  if TELL: print("original dict, BEF: %s"%d)
237  del e[key]
238  if TELL: print("copy-removed dict, AFT: %s"%e)
239  return e
240 
241 
void print(TMatrixD &m, const char *label=nullptr, bool mathematicaFormat=false)
Definition: Utilities.cc:47
def remove(d, key, TELL=False)
Definition: MatrixUtil.py:233

◆ selectedLS()

def MatrixUtil.selectedLS (   list_runs = [],
  maxNum = -1,
  l_json = data_json2015 
)

Definition at line 64 of file MatrixUtil.py.

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

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