test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros 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 225 of file MatrixUtil.py.

References update.

226 def addForAll(steps,d):
227  for s in steps:
228  steps[s].update(d)
229 
#define update(a, b)
def addForAll
Definition: MatrixUtil.py:225
def MatrixUtil.changeRefRelease (   steps,
  listOfPairs 
)

Definition at line 213 of file MatrixUtil.py.

References python.rootplot.root2matplotlib.replace().

214 def changeRefRelease(steps,listOfPairs):
215  for s in steps:
216  if ('INPUT' in steps[s]):
217  oldD=steps[s]['INPUT'].dataSet
218  for (ref,newRef) in listOfPairs:
219  if ref in oldD:
220  steps[s]['INPUT'].dataSet=oldD.replace(ref,newRef)
221  if '--pileup_input' in steps[s]:
222  for (ref,newRef) in listOfPairs:
223  if ref in steps[s]['--pileup_input']:
224  steps[s]['--pileup_input']=steps[s]['--pileup_input'].replace(ref,newRef)
def changeRefRelease
Definition: MatrixUtil.py:213
def MatrixUtil.expandLsInterval (   lumis)

Definition at line 46 of file MatrixUtil.py.

46 
47 def expandLsInterval(lumis):
48  return range(lumis[0],(lumis[1]+1))
def expandLsInterval
Definition: MatrixUtil.py:46
def MatrixUtil.genvalid (   fragment,
  d,
  suffix = 'all',
  fi = '',
  dataSet = '' 
)

Definition at line 230 of file MatrixUtil.py.

References python.rootplot.root2matplotlib.replace().

231 def genvalid(fragment,d,suffix='all',fi='',dataSet=''):
232  import copy
233  c=copy.copy(d)
234  if suffix:
235  c['-s']=c['-s'].replace('genvalid','genvalid_'+suffix)
236  if fi:
237  c['--filein']='lhe:%d'%(fi,)
238  if dataSet:
239  c['--filein']='das:%s'%(dataSet,)
240  c['cfg']=fragment
241  return c
242 
243 
def genvalid
Definition: MatrixUtil.py:230
def MatrixUtil.Kby (   N,
  s 
)

Definition at line 208 of file MatrixUtil.py.

Referenced by relval_steps.gen2015(), relval_steps.genS(), relval_steps.identitySim(), and relval_steps.lhegensim().

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

Definition at line 210 of file MatrixUtil.py.

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

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

Definition at line 178 of file MatrixUtil.py.

References bookConverter.max.

Referenced by HLTScalersClient.endLuminosityBlock(), DDI::LogicalPart.mergedSpecificsV(), DDExpandedView.mergedSpecificsV(), DAClusterizerInZ.vertices(), and DAClusterizerInZ_vect.vertices().

179 def merge(dictlist,TELL=False):
180  import copy
181  last=len(dictlist)-1
182  if TELL: print last,dictlist
183  if last==0:
184  # ONLY ONE ITEM LEFT
185  return copy.copy(dictlist[0])
186  else:
187  reducedlist=dictlist[0:max(0,last-1)]
188  if TELL: print reducedlist
189  # make a copy of the last item
190  d=copy.copy(dictlist[last])
191  # update with the last but one item
192  d.update(dictlist[last-1])
193  # and recursively do the rest
194  reducedlist.append(d)
195  return merge(reducedlist,TELL)
Definition: merge.py:1
def MatrixUtil.remove (   d,
  key,
  TELL = False 
)

Definition at line 196 of file MatrixUtil.py.

Referenced by HiCoreTools._removeMCMatchingForPATObject(), BTagDifferentialPlot.bookHisto(), EtaPtBin.buildDescriptionString(), gen::BaseHadronizer.cleanLHE(), ValidationMatrix_v2.ReleaseComparison.compare(), edmStreamStallGrapher.createPDFImage(), AlignmentParameterBuilder.decodeParamSel(), FedRawDataInputSource.deleteFile(), FastTimerService.findFirstLast(), FedRawDataInputSource.grabNextJsonFile(), Pythia8Hadronizer.initializeForExternalPartons(), Pythia8Hadronizer.initializeForInternalPartons(), evf::EvFDaqDirector.preGlobalEndLumi(), ora::Container.realClassName(), HiHelperTools.removeIfInSequence(), helpers.removeIfInSequence(), own_ptr< std::ifstream >.reset(), Vispa.Views.LineDecayView.LineDecayContainer.select(), gen::Pythia6Service.setSLHAFromHeader(), HiCoreTools.RemoveMCMatching.toolCode(), HiCoreTools.RemoveSpecificPATObjects.toolCode(), HiCoreTools.RemoveCleaning.toolCode(), and XMLDocument.~XMLDocument().

197 def remove(d,key,TELL=False):
198  import copy
199  e = copy.deepcopy(d)
200  if TELL: print "original dict, BEF: %s"%d
201  del e[key]
202  if TELL: print "copy-removed dict, AFT: %s"%e
203  return e
204 
def MatrixUtil.selectedLS (   list_runs = [],
  maxNum = -1,
  l_json = data_json2015 
)

Definition at line 62 of file MatrixUtil.py.

References bitset_utilities.append().

62 
63 def selectedLS(list_runs=[],maxNum=-1,l_json=data_json2015):
64  # print "maxNum is %s"%(maxNum)
65  if type(list_runs[0]) !=int:
66  print "ERROR: list_runs must be a list of intergers"
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.keys()) > 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 
InputInfoNDefault=2000000
def selectedLS
Definition: MatrixUtil.py:62
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 ...

Variable Documentation

tuple MatrixUtil.data_json2015 = json.load(data_file)

Definition at line 55 of file MatrixUtil.py.

tuple MatrixUtil.data_json2016 = json.load(data_file)

Definition at line 58 of file MatrixUtil.py.

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

Definition at line 50 of file MatrixUtil.py.

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

Definition at line 51 of file MatrixUtil.py.

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

Standard release validation samples ####.

Definition at line 207 of file MatrixUtil.py.