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

◆ addForAll()

def MatrixUtil.addForAll (   steps,
  d 
)

Definition at line 252 of file MatrixUtil.py.

References update.

252 def addForAll(steps,d):
253  for s in steps:
254  steps[s].update(d)
255 
256 
def addForAll(steps, d)
Definition: MatrixUtil.py:252
#define update(a, b)

◆ changeRefRelease()

def MatrixUtil.changeRefRelease (   steps,
  listOfPairs 
)

Definition at line 240 of file MatrixUtil.py.

References python.rootplot.root2matplotlib.replace().

Referenced by MatrixReader.MatrixReader.readMatrix().

240 def changeRefRelease(steps,listOfPairs):
241  for s in steps:
242  if ('INPUT' in steps[s]):
243  oldD=steps[s]['INPUT'].dataSet
244  for (ref,newRef) in listOfPairs:
245  if ref in oldD:
246  steps[s]['INPUT'].dataSet=oldD.replace(ref,newRef)
247  if '--pileup_input' in steps[s]:
248  for (ref,newRef) in listOfPairs:
249  if ref in steps[s]['--pileup_input']:
250  steps[s]['--pileup_input']=steps[s]['--pileup_input'].replace(ref,newRef)
251 
def replace(string, replacements)
def changeRefRelease(steps, listOfPairs)
Definition: MatrixUtil.py:240

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

References python.rootplot.root2matplotlib.replace().

257 def genvalid(fragment,d,suffix='all',fi='',dataSet=''):
258  import copy
259  c=copy.copy(d)
260  if suffix:
261  c['-s']=c['-s'].replace('genvalid','genvalid_'+suffix)
262  if fi:
263  c['--filein']='lhe:%d'%(fi,)
264  if dataSet:
265  c['--filein']='das:%s'%(dataSet,)
266  c['cfg']=fragment
267  return c
268 
269 
270 
def genvalid(fragment, d, suffix='all', fi='', dataSet='')
Definition: MatrixUtil.py:257
def replace(string, replacements)

◆ Kby()

def MatrixUtil.Kby (   N,
  s 
)

Standard release validation samples ####.

Definition at line 235 of file MatrixUtil.py.

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

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

◆ Mby()

def MatrixUtil.Mby (   N,
  s 
)

Definition at line 237 of file MatrixUtil.py.

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

237 def Mby(N,s):
238  return {'--relval':'%s000000,%s'%(N,s)}
239 
def Mby(N, s)
Definition: MatrixUtil.py:237

◆ merge()

def MatrixUtil.merge (   dictlist,
  TELL = False 
)

Definition at line 205 of file MatrixUtil.py.

References SiStripPI.max, and print().

205 def merge(dictlist,TELL=False):
206  import copy
207  last=len(dictlist)-1
208  if TELL: print(last,dictlist)
209  if last==0:
210  # ONLY ONE ITEM LEFT
211  return copy.copy(dictlist[0])
212  else:
213  reducedlist=dictlist[0:max(0,last-1)]
214  if TELL: print(reducedlist)
215  # make a copy of the last item
216  d=copy.copy(dictlist[last])
217  # update with the last but one item
218  d.update(dictlist[last-1])
219  # and recursively do the rest
220  reducedlist.append(d)
221  return merge(reducedlist,TELL)
222 
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:205

◆ remove()

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

Definition at line 223 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.gen2023HiMix(), 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().

223 def remove(d,key,TELL=False):
224  import copy
225  e = copy.deepcopy(d)
226  if TELL: print("original dict, BEF: %s"%d)
227  del e[key]
228  if TELL: print("copy-removed dict, AFT: %s"%e)
229  return e
230 
231 
void print(TMatrixD &m, const char *label=nullptr, bool mathematicaFormat=false)
Definition: Utilities.cc:47
def remove(d, key, TELL=False)
Definition: MatrixUtil.py:223

◆ 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)