CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Classes | Functions | Variables
MatrixUtil Namespace Reference

Classes

class  InputInfo
 
class  Matrix
 
class  Steps
 
class  WF
 

Functions

def addForAll
 
def changeRefRelease
 
def expandLsInterval
 
def genvalid
 
def Kby
 
def Mby
 
def merge
 
def remove
 
def selectedLS
 

Variables

tuple data_json2015 = json.load(data_file)
 
tuple data_json2016 = json.load(data_file)
 
tuple jsonFile2015 = findFileInPath("DPGAnalysis/Skims/data/Cert_13TeV_16Dec2015ReReco_Collisions15_25ns_50ns_JSON.txt")
 
tuple jsonFile2016 = findFileInPath("DPGAnalysis/Skims/data/Cert_271036-274240_13TeV_PromptReco_Collisions16_JSON.txt")
 
dictionary stCond = {'--conditions':'auto:run1_mc'}
 Standard release validation samples ####. More...
 

Function Documentation

def MatrixUtil.addForAll (   steps,
  d 
)

Definition at line 252 of file MatrixUtil.py.

References update.

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

Definition at line 240 of file MatrixUtil.py.

References python.rootplot.root2matplotlib.replace().

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

Definition at line 48 of file MatrixUtil.py.

References sistrip::SpyUtilities.range().

48 
49 def expandLsInterval(lumis):
50  return range(lumis[0],(lumis[1]+1))
def expandLsInterval
Definition: MatrixUtil.py:48
const uint16_t range(const Frame &aFrame)
def MatrixUtil.genvalid (   fragment,
  d,
  suffix = 'all',
  fi = '',
  dataSet = '' 
)

Definition at line 257 of file MatrixUtil.py.

References python.rootplot.root2matplotlib.replace().

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

Definition at line 235 of file MatrixUtil.py.

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

236 def Kby(N,s):
return {'--relval':'%s000,%s'%(N,s)}
def MatrixUtil.Mby (   N,
  s 
)

Definition at line 237 of file MatrixUtil.py.

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

238 def Mby(N,s):
239  return {'--relval':'%s000000,%s'%(N,s)}
def MatrixUtil.merge (   dictlist,
  TELL = False 
)

Definition at line 205 of file MatrixUtil.py.

References SiStripPI.max, and print().

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

206 def merge(dictlist,TELL=False):
207  import copy
208  last=len(dictlist)-1
209  if TELL: print(last,dictlist)
210  if last==0:
211  # ONLY ONE ITEM LEFT
212  return copy.copy(dictlist[0])
213  else:
214  reducedlist=dictlist[0:max(0,last-1)]
215  if TELL: print(reducedlist)
216  # make a copy of the last item
217  d=copy.copy(dictlist[last])
218  # update with the last but one item
219  d.update(dictlist[last-1])
220  # and recursively do the rest
221  reducedlist.append(d)
222  return merge(reducedlist,TELL)
Definition: merge.py:1
void print(TMatrixD &m, const char *label=nullptr, bool mathematicaFormat=false)
Definition: Utilities.cc:47
def MatrixUtil.remove (   d,
  key,
  TELL = False 
)

Definition at line 223 of file MatrixUtil.py.

References print().

Referenced by BTagDifferentialPlot.bookHisto(), EtaPtBin.buildDescriptionString(), gen::BaseHadronizer.cleanLHE(), ValidationMatrix_v2.ReleaseComparison.compare(), edmStreamStallGrapher.createPDFImage(), AlignmentParameterBuilder.decodeParamSel(), edm.defaultModuleLabel(), edm::WorkerManager.deleteModuleIfExists(), evf::EvFDaqDirector.grabNextJsonFileAndUnlock(), edm::shared_memory::WriteBuffer.growBuffer(), Pythia8Hadronizer.initializeForExternalPartons(), Pythia8Hadronizer.initializeForInternalPartons(), helpers.removeIfInSequence(), edm::UnscheduledCallProducer.removeWorker(), Phase1PixelMaps.retrieveCorners(), gen::Pythia6Service.setSLHAFromHeader(), edm::shared_memory::ControllerChannel.~ControllerChannel(), InputFile.~InputFile(), and edm::shared_memory::WriteBuffer.~WriteBuffer().

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

Definition at line 64 of file MatrixUtil.py.

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

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

Variable Documentation

tuple MatrixUtil.data_json2015 = json.load(data_file)

Definition at line 57 of file MatrixUtil.py.

tuple MatrixUtil.data_json2016 = json.load(data_file)

Definition at line 60 of file MatrixUtil.py.

tuple MatrixUtil.jsonFile2015 = findFileInPath("DPGAnalysis/Skims/data/Cert_13TeV_16Dec2015ReReco_Collisions15_25ns_50ns_JSON.txt")

Definition at line 52 of file MatrixUtil.py.

tuple MatrixUtil.jsonFile2016 = findFileInPath("DPGAnalysis/Skims/data/Cert_271036-274240_13TeV_PromptReco_Collisions16_JSON.txt")

Definition at line 53 of file MatrixUtil.py.

dictionary MatrixUtil.stCond = {'--conditions':'auto:run1_mc'}

Standard release validation samples ####.

Definition at line 234 of file MatrixUtil.py.