CMS 3D CMS Logo

Functions | Variables
dqmiodatasetharvest Namespace Reference

Functions

def check_interesting (mename)
 
def dasquery (dataset)
 
def harvestfile (fname)
 
def tosqlite (x)
 

Variables

 args
 
 ctr
 
 db
 
 default
 
 description
 
 dumpmes
 
 end
 
 files
 
 help
 
 inf
 
 insertinto
 
 int
 
 interesting_mes
 
 interesting_types
 
 makeindex
 
 maketable
 
 nan
 
 parser
 
 pool
 
 processes
 
 ROOTPREFIX
 
 sqlite2tree
 
 treenames
 
 type
 

Function Documentation

◆ check_interesting()

def dqmiodatasetharvest.check_interesting (   mename)

Definition at line 41 of file dqmiodatasetharvest.py.

41 def check_interesting(mename):
42  for pattern in interesting_mes:
43  if fnmatch.fnmatch(mename,pattern):
44  return True
45  return False
46 

Referenced by harvestfile().

◆ dasquery()

def dqmiodatasetharvest.dasquery (   dataset)

Definition at line 70 of file dqmiodatasetharvest.py.

70 def dasquery(dataset):
71  if not dataset.endswith("DQMIO"):
72  raise Exception("This tool probably cannot read the dataset you specified. The name should end with DQMIO.")
73  dasquery = ["dasgoclient", "-query=file dataset=%s" % dataset]
74  print("Querying das ... %s" % dasquery)
75  files = subprocess.check_output(dasquery)
76  files = files.splitlines()
77  print("Got %d files." % len(files))
78  return files
79 
80 

References edm.print().

◆ harvestfile()

def dqmiodatasetharvest.harvestfile (   fname)

Definition at line 123 of file dqmiodatasetharvest.py.

123 def harvestfile(fname):
124  f = ROOT.TFile.Open(ROOTPREFIX + fname)
125  idxtree = getattr(f, "Indices")
126  #idxtree.GetEntry._threaded = True # now the blocking call should release the GIL...
127 
128  # we have no good way to find out which lumis where processed in a job.
129  # so we watch the per-lumi indices and assume that all mentioned lumis
130  # are covered in the end-of-job MEs. This might fail if there are no
131  # per-lumi MEs.
132  knownlumis = set()
133  mes_to_store = []
134 
135  for i in range(idxtree.GetEntries()):
136  idxtree.GetEntry(i)
137  run, lumi, metype = idxtree.Run, idxtree.Lumi, idxtree.Type
138  if lumi != 0:
139  knownlumis.add(lumi)
140 
141  if not treenames[metype] in interesting_types:
142  continue
143 
144  endrun = run # assume no multi-run files for now
145  if lumi == 0: # per-job ME
146  endlumi = max(knownlumis)
147  lumi = min(knownlumis)
148  else:
149  endlumi = lumi
150 
151  # inclusive range -- for 0 entries, row is left out
152  firstidx, lastidx = idxtree.FirstIndex, idxtree.LastIndex
153  metree = getattr(f, treenames[metype])
154  metree.GetEntry(0)
155  metree.SetBranchStatus("*",0)
156  metree.SetBranchStatus("FullName",1)
157 
158  for x in range(firstidx, lastidx+1):
159  metree.GetEntry(x)
160  mename = str(metree.FullName)
161 
162  if mename.find("AlCaReco") != -1:
163  continue
164 
165  if mename.find("Isolated") != -1:
166  continue
167 
168  if mename.find("HLT") != -1:
169  continue
170 
171  if not ((mename.find("SiStrip") >= 0) or (mename.find("OfflinePV") >= 0) or (mename.find("PixelPhase1") >= 0) or (mename.find("Tracking") >= 0 )):
172  continue
173 
174  if check_interesting(mename):
175  metree.GetEntry(x, 1)
176  value = metree.Value
177 
178  mes_to_store.append((
179  mename,
180  run, lumi, endrun, endlumi,
181  metype,
182  tosqlite(value),
183  ))
184 
185  return mes_to_store
186 

References check_interesting(), SiStripPI.max, min(), FastTimerService_cff.range, str, and tosqlite().

◆ tosqlite()

def dqmiodatasetharvest.tosqlite (   x)

Definition at line 47 of file dqmiodatasetharvest.py.

47 def tosqlite(x):
48  if isinstance(x, ROOT.string):
49  try:
50  return unicode(x.data())
51  except:
52  return buffer(x.data())
53  if isinstance(x, int):
54  return x
55  if isinstance(x, float):
56  return x
57  if isinstance(x, long):
58  return x
59  else:
60  try:
61  rootobj = unicode(ROOT.TBufferJSON.ConvertToJSON(x))
62  # turns out ROOT does not generate valid JSON for NaN/inf
63  clean = nan.sub('\\g<1>0\\g<2>', inf.sub('\\g<1>1e38\\g<2>', rootobj))
64  obj = json.loads(clean)
65  jsonobj = json.dumps(obj, allow_nan=False)
66  return jsonobj
67  except Exception as e:
68  return json.dumps({"root2sqlite_error": e.__repr__(), "root2sqlite_object": x.__repr__()})
69 

References edmScanValgrind.buffer, and betterConfigParser.unicode.

Referenced by harvestfile().

Variable Documentation

◆ args

dqmiodatasetharvest.args

Definition at line 21 of file dqmiodatasetharvest.py.

◆ ctr

dqmiodatasetharvest.ctr

◆ db

dqmiodatasetharvest.db

Definition at line 119 of file dqmiodatasetharvest.py.

Referenced by EcalSRCondTools.analyze(), SiStripCondObjBuilderFromDb.buildAnalysisRelatedObjects(), SiStripFedCablingBuilderFromDb.buildFecCabling(), SiStripFedCablingBuilderFromDb.buildFecCablingFromDetIds(), SiStripFedCablingBuilderFromDb.buildFecCablingFromDevices(), SiStripFedCablingBuilderFromDb.buildFecCablingFromFedConnections(), SiStripCondObjBuilderFromDb.buildFECRelatedObjects(), SiStripCondObjBuilderFromDb.buildFEDRelatedObjects(), SiStripCondObjBuilderFromDb.buildStripRelatedObjects(), l1t::CaloConfigHelper.CaloConfigHelper(), SiStripCommissioningOfflineDbClient.createHistos(), TEveEllipsoidProjectedGL.DrawRhoZ(), EcalCondDBReader.EcalCondDBReader(), EcalCondDBWriter.EcalCondDBWriter(), Fit_MaximumPoint(), HcalLutManager.get_brickSet_from_oracle(), HcalFeatureHFEMBit.getE(), HcalQIEManager.getHfQieTable(), HcalLutManager.getLutFromXml_old(), HcalQIEManager.getTableFromDb(), HcalLutManager.init(), edm::service::LoadAllDictionaries.LoadAllDictionaries(), main(), EcalUncalibRecHitFixedAlphaBetaAlgo< EBDataFrame >.PerformAnalyticFit(), PFTauElecRejectionBenchmarkAnalyzer.PFTauElecRejectionBenchmarkAnalyzer(), HiEvtPlaneFlatProducer.produce(), EvtPlaneProducer.produce(), publishObjects(), SiPixelGenError.pushfile(), SiPixelTemplate2D.pushfile(), SiPixelTemplate.pushfile(), HcalLutManager.read_luts(), SiStripCondObjBuilderFromDb.retrieveFedDescriptions(), SiStripCondObjBuilderFromDb.retrieveTimingAnalysisDescriptions(), HcalZeroSuppressionAlgo.setDbService(), SiStripCondObjBuilderFromDb.setValuesApvTiming(), HcalLutManager.test_xml_access(), TotemTimingConversions.timeOfFirstSample(), TotemTimingConversions.timePrecision(), SiStripPartition.update(), l1t::CaloConfigHelper.UpdatePayload(), TotemTimingConversions.voltSamples(), and HcalLutManager.~HcalLutManager().

◆ default

dqmiodatasetharvest.default

Definition at line 18 of file dqmiodatasetharvest.py.

◆ description

dqmiodatasetharvest.description

Definition at line 15 of file dqmiodatasetharvest.py.

◆ dumpmes

dqmiodatasetharvest.dumpmes

Definition at line 115 of file dqmiodatasetharvest.py.

◆ end

dqmiodatasetharvest.end

Definition at line 197 of file dqmiodatasetharvest.py.

◆ files

dqmiodatasetharvest.files

Definition at line 187 of file dqmiodatasetharvest.py.

◆ help

dqmiodatasetharvest.help

Definition at line 17 of file dqmiodatasetharvest.py.

◆ inf

dqmiodatasetharvest.inf

◆ insertinto

dqmiodatasetharvest.insertinto

Definition at line 106 of file dqmiodatasetharvest.py.

◆ int

dqmiodatasetharvest.int

Definition at line 19 of file dqmiodatasetharvest.py.

◆ interesting_mes

dqmiodatasetharvest.interesting_mes

Definition at line 32 of file dqmiodatasetharvest.py.

◆ interesting_types

dqmiodatasetharvest.interesting_types

Definition at line 25 of file dqmiodatasetharvest.py.

◆ makeindex

dqmiodatasetharvest.makeindex

Definition at line 103 of file dqmiodatasetharvest.py.

◆ maketable

dqmiodatasetharvest.maketable

Definition at line 96 of file dqmiodatasetharvest.py.

◆ nan

dqmiodatasetharvest.nan

◆ parser

dqmiodatasetharvest.parser

Definition at line 15 of file dqmiodatasetharvest.py.

◆ pool

dqmiodatasetharvest.pool

◆ processes

dqmiodatasetharvest.processes

◆ ROOTPREFIX

dqmiodatasetharvest.ROOTPREFIX

Definition at line 12 of file dqmiodatasetharvest.py.

◆ sqlite2tree

dqmiodatasetharvest.sqlite2tree

Definition at line 200 of file dqmiodatasetharvest.py.

◆ treenames

dqmiodatasetharvest.treenames

Definition at line 81 of file dqmiodatasetharvest.py.

◆ type

dqmiodatasetharvest.type

Definition at line 19 of file dqmiodatasetharvest.py.

FastTimerService_cff.range
range
Definition: FastTimerService_cff.py:34
min
T min(T a, T b)
Definition: MathUtil.h:58
betterConfigParser.unicode
unicode
Definition: betterConfigParser.py:13
dqmiodatasetharvest.check_interesting
def check_interesting(mename)
Definition: dqmiodatasetharvest.py:41
edmScanValgrind.buffer
buffer
Definition: edmScanValgrind.py:171
str
#define str(s)
Definition: TestProcessor.cc:48
dqmiodatasetharvest.tosqlite
def tosqlite(x)
Definition: dqmiodatasetharvest.py:47
SiStripPI::max
Definition: SiStripPayloadInspectorHelper.h:169
Exception
edm::print
S & print(S &os, JobReport::InputFile const &f)
Definition: JobReport.cc:66
dqmiodatasetharvest.harvestfile
def harvestfile(fname)
Definition: dqmiodatasetharvest.py:123
dqmiodatasetharvest.dasquery
def dasquery(dataset)
Definition: dqmiodatasetharvest.py:70