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

241 def addForAll(steps,d):
242  for s in steps:
243  steps[s].update(d)
244 
245 

References update.

◆ changeRefRelease()

def MatrixUtil.changeRefRelease (   steps,
  listOfPairs 
)

Definition at line 229 of file MatrixUtil.py.

229 def changeRefRelease(steps,listOfPairs):
230  for s in steps:
231  if ('INPUT' in steps[s]):
232  oldD=steps[s]['INPUT'].dataSet
233  for (ref,newRef) in listOfPairs:
234  if ref in oldD:
235  steps[s]['INPUT'].dataSet=oldD.replace(ref,newRef)
236  if '--pileup_input' in steps[s]:
237  for (ref,newRef) in listOfPairs:
238  if ref in steps[s]['--pileup_input']:
239  steps[s]['--pileup_input']=steps[s]['--pileup_input'].replace(ref,newRef)
240 

References python.rootplot.root2matplotlib.replace().

Referenced by MatrixReader.MatrixReader.readMatrix().

◆ expandLsInterval()

def MatrixUtil.expandLsInterval (   lumis)

Definition at line 47 of file MatrixUtil.py.

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

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

◆ genvalid()

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

Definition at line 246 of file MatrixUtil.py.

246 def genvalid(fragment,d,suffix='all',fi='',dataSet=''):
247  import copy
248  c=copy.copy(d)
249  if suffix:
250  c['-s']=c['-s'].replace('genvalid','genvalid_'+suffix)
251  if fi:
252  c['--filein']='lhe:%d'%(fi,)
253  if dataSet:
254  c['--filein']='das:%s'%(dataSet,)
255  c['cfg']=fragment
256  return c
257 
258 

References python.rootplot.root2matplotlib.replace().

◆ Kby()

def MatrixUtil.Kby (   N,
  s 
)

Standard release validation samples ####.

Definition at line 224 of file MatrixUtil.py.

224 def Kby(N,s):
225  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 226 of file MatrixUtil.py.

226 def Mby(N,s):
227  return {'--relval':'%s000000,%s'%(N,s)}
228 

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

◆ merge()

def MatrixUtil.merge (   dictlist,
  TELL = False 
)

Definition at line 194 of file MatrixUtil.py.

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

References SiStripPI.max, and edm.print().

Referenced by CaloTowersCreationAlgo.assignHitHcal(), 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 212 of file MatrixUtil.py.

212 def remove(d,key,TELL=False):
213  import copy
214  e = copy.deepcopy(d)
215  if TELL: print("original dict, BEF: %s"%d)
216  del e[key]
217  if TELL: print("copy-removed dict, AFT: %s"%e)
218  return e
219 
220 

References edm.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(), 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(), SiPixelPI.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 63 of file MatrixUtil.py.

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

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

FastTimerService_cff.range
range
Definition: FastTimerService_cff.py:34
MatrixUtil.expandLsInterval
def expandLsInterval(lumis)
Definition: MatrixUtil.py:47
str
#define str(s)
Definition: TestProcessor.cc:48
MatrixUtil.addForAll
def addForAll(steps, d)
Definition: MatrixUtil.py:241
SiStripPI::max
Definition: SiStripPayloadInspectorHelper.h:169
MatrixUtil.changeRefRelease
def changeRefRelease(steps, listOfPairs)
Definition: MatrixUtil.py:229
mps_setup.append
append
Definition: mps_setup.py:85
MatrixUtil.selectedLS
def selectedLS(list_runs=[], maxNum=-1, l_json=data_json2015)
Definition: MatrixUtil.py:63
edm::print
S & print(S &os, JobReport::InputFile const &f)
Definition: JobReport.cc:66
MatrixUtil.Mby
def Mby(N, s)
Definition: MatrixUtil.py:226
MatrixUtil.remove
def remove(d, key, TELL=False)
Definition: MatrixUtil.py:212
MatrixUtil.merge
def merge(dictlist, TELL=False)
Definition: MatrixUtil.py:194
MatrixUtil.genvalid
def genvalid(fragment, d, suffix='all', fi='', dataSet='')
Definition: MatrixUtil.py:246
MatrixUtil.Kby
def Kby(N, s)
Standard release validation samples ####.
Definition: MatrixUtil.py:224
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