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

References update.

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

Definition at line 212 of file MatrixUtil.py.

References python.rootplot.root2matplotlib.replace().

213 def changeRefRelease(steps,listOfPairs):
214  for s in steps:
215  if ('INPUT' in steps[s]):
216  oldD=steps[s]['INPUT'].dataSet
217  for (ref,newRef) in listOfPairs:
218  if ref in oldD:
219  steps[s]['INPUT'].dataSet=oldD.replace(ref,newRef)
220  if '--pileup_input' in steps[s]:
221  for (ref,newRef) in listOfPairs:
222  if ref in steps[s]['--pileup_input']:
223  steps[s]['--pileup_input']=steps[s]['--pileup_input'].replace(ref,newRef)
def changeRefRelease
Definition: MatrixUtil.py:212
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 229 of file MatrixUtil.py.

References python.rootplot.root2matplotlib.replace().

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

Definition at line 207 of file MatrixUtil.py.

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

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

Definition at line 209 of file MatrixUtil.py.

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

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

Definition at line 177 of file MatrixUtil.py.

References bookConverter.max.

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

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

Definition at line 195 of file MatrixUtil.py.

Referenced by HiCoreTools._removeMCMatchingForPATObject(), BTagDifferentialPlot.bookHisto(), EtaPtBin.buildDescriptionString(), gen::BaseHadronizer.cleanLHE(), ValidationMatrix_v2.ReleaseComparison.compare(), customizeTrackingMonitorSeedNumber.customise_trackMon_IterativeTracking_PHASE1(), customizeTrackingMonitorSeedNumber.customise_trackMon_IterativeTracking_PHASE1PU140(), customizeTrackingMonitorSeedNumber.customise_trackMon_IterativeTracking_PHASE1PU70(), 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().

196 def remove(d,key,TELL=False):
197  import copy
198  e = copy.deepcopy(d)
199  if TELL: print "original dict, BEF: %s"%d
200  del e[key]
201  if TELL: print "copy-removed dict, AFT: %s"%e
202  return e
203 
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 206 of file MatrixUtil.py.