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

248 def addForAll(steps,d):
249  for s in steps:
250  steps[s].update(d)
251 
252 

References update.

◆ changeRefRelease()

def MatrixUtil.changeRefRelease (   steps,
  listOfPairs 
)

Definition at line 236 of file MatrixUtil.py.

236 def changeRefRelease(steps,listOfPairs):
237  for s in steps:
238  if ('INPUT' in steps[s]):
239  oldD=steps[s]['INPUT'].dataSet
240  for (ref,newRef) in listOfPairs:
241  if ref in oldD:
242  steps[s]['INPUT'].dataSet=oldD.replace(ref,newRef)
243  if '--pileup_input' in steps[s]:
244  for (ref,newRef) in listOfPairs:
245  if ref in steps[s]['--pileup_input']:
246  steps[s]['--pileup_input']=steps[s]['--pileup_input'].replace(ref,newRef)
247 

References python.rootplot.root2matplotlib.replace().

Referenced by MatrixReader.MatrixReader.readMatrix().

◆ expandLsInterval()

def MatrixUtil.expandLsInterval (   lumis)

Definition at line 48 of file MatrixUtil.py.

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

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

◆ genvalid()

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

Definition at line 253 of file MatrixUtil.py.

253 def genvalid(fragment,d,suffix='all',fi='',dataSet=''):
254  import copy
255  c=copy.copy(d)
256  if suffix:
257  c['-s']=c['-s'].replace('genvalid','genvalid_'+suffix)
258  if fi:
259  c['--filein']='lhe:%d'%(fi,)
260  if dataSet:
261  c['--filein']='das:%s'%(dataSet,)
262  c['cfg']=fragment
263  return c
264 
265 

References python.rootplot.root2matplotlib.replace().

◆ Kby()

def MatrixUtil.Kby (   N,
  s 
)

Standard release validation samples ####.

Definition at line 231 of file MatrixUtil.py.

231 def Kby(N,s):
232  return {'--relval':'%s000,%s'%(N,s)}

Referenced by relval_steps.gen2018RD(), relval_steps.gen2021HiMix(), relval_steps.gen2021hiprod(), relval_steps.genS(), relval_steps.identitySim(), and relval_steps.lhegensim2018ml().

◆ Mby()

def MatrixUtil.Mby (   N,
  s 
)

Definition at line 233 of file MatrixUtil.py.

233 def Mby(N,s):
234  return {'--relval':'%s000000,%s'%(N,s)}
235 

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

◆ merge()

def MatrixUtil.merge (   dictlist,
  TELL = False 
)

Definition at line 201 of file MatrixUtil.py.

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

References SiStripPI.max, and print().

Referenced by CaloTowersCreationAlgo.assignHitHcal(), edm::EventProcessor.beginJob(), edm::SubProcess.keepOnlyConsumedUnscheduledModules(), tmtt::HTrphi.mergedCell(), DDI::LogicalPart.mergedSpecificsV(), DDExpandedView.mergedSpecificsV(), DAClusterizerInZ.vertices(), DAClusterizerInZ_vect.vertices(), and DAClusterizerInZT_vect.vertices().

◆ remove()

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

Definition at line 219 of file MatrixUtil.py.

219 def remove(d,key,TELL=False):
220  import copy
221  e = copy.deepcopy(d)
222  if TELL: print("original dict, BEF: %s"%d)
223  del e[key]
224  if TELL: print("copy-removed dict, AFT: %s"%e)
225  return e
226 
227 

References print().

Referenced by Mixins._Parameterizable.__delattr__(), DictTypes.SortedKeysDict.__delitem__(), BeautifulSoup.Tag.__delitem__(), tkal_create_file_lists.FileListCreator._fulfill_iov_eventcount(), EcalHexDisplay.analyze(), edmtest::DQMReferenceHistogramRootFileEventSetupAnalyzer.beginRun(), BTagDifferentialPlot.bookHisto(), BTagEntry.BTagEntry(), EtaPtBin.buildDescriptionString(), gen::BaseHadronizer.cleanLHE(), ValidationMatrix_v2.ReleaseComparison.compare(), edmStreamStallGrapher.createPDFImage(), AlignmentParameterBuilder.decodeParamSel(), edm.defaultModuleLabel(), edm::WorkerManager.deleteModuleIfExists(), evf::RecoEventOutputModuleForFU< Consumer >.endLuminosityBlock(), reco::ExpressionEvaluator.ExpressionEvaluator(), relval_steps.gen2021HiMix(), evf::EvFOutputModule.globalEndLuminosityBlock(), evf::EvFDaqDirector.grabNextJsonFileAndUnlock(), SpecificationBuilder_cfi.Specification.groupBy(), edm::shared_memory::WriteBuffer.growBuffer(), Pythia8Hadronizer.initializeForExternalPartons(), Pythia8Hadronizer.initializeForInternalPartons(), reco::details.loadTMVAWeights(), FFTJetPFPileupCleaner.produce(), evf::EvFDaqDirector.removeFile(), helpers.removeIfInSequence(), edm::UnscheduledCallProducer.removeWorker(), Phase1PixelMaps.retrieveCorners(), gen::Pythia6Service.setSLHAFromHeader(), edm::shared_memory::ControllerChannel.~ControllerChannel(), reco::ExpressionEvaluator.~ExpressionEvaluator(), InputFile.~InputFile(), and edm::shared_memory::WriteBuffer.~WriteBuffer().

◆ selectedLS()

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

Definition at line 64 of file MatrixUtil.py.

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

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

FastTimerService_cff.range
range
Definition: FastTimerService_cff.py:34
MatrixUtil.expandLsInterval
def expandLsInterval(lumis)
Definition: MatrixUtil.py:48
str
#define str(s)
Definition: TestProcessor.cc:52
MatrixUtil.addForAll
def addForAll(steps, d)
Definition: MatrixUtil.py:248
print
void print(TMatrixD &m, const char *label=nullptr, bool mathematicaFormat=false)
Definition: Utilities.cc:46
SiStripPI::max
Definition: SiStripPayloadInspectorHelper.h:169
MatrixUtil.changeRefRelease
def changeRefRelease(steps, listOfPairs)
Definition: MatrixUtil.py:236
mps_setup.append
append
Definition: mps_setup.py:85
MatrixUtil.selectedLS
def selectedLS(list_runs=[], maxNum=-1, l_json=data_json2015)
Definition: MatrixUtil.py:64
MatrixUtil.Mby
def Mby(N, s)
Definition: MatrixUtil.py:233
MatrixUtil.remove
def remove(d, key, TELL=False)
Definition: MatrixUtil.py:219
MatrixUtil.merge
def merge(dictlist, TELL=False)
Definition: MatrixUtil.py:201
MatrixUtil.genvalid
def genvalid(fragment, d, suffix='all', fi='', dataSet='')
Definition: MatrixUtil.py:253
MatrixUtil.Kby
def Kby(N, s)
Standard release validation samples ####.
Definition: MatrixUtil.py:231
merge
Definition: merge.py:1
update
#define update(a, b)
Definition: TrackClassifier.cc:10
python.rootplot.root2matplotlib.replace
def replace(string, replacements)
Definition: root2matplotlib.py:444