3 from PhysicsTools.Heppy.analyzers.core.Analyzer
import Analyzer
4 from PhysicsTools.Heppy.analyzers.core.AutoHandle
import AutoHandle
5 from PhysicsTools.HeppyCore.framework.event
import Event
6 from PhysicsTools.HeppyCore.statistics.counter
import Counter, Counters
8 from DataFormats.FWLite
import Events, Handle,Lumis
15 def __init__(self, cfg_ana, cfg_comp, looperName):
16 super(ProvenanceAnalyzer, self).
__init__(cfg_ana, cfg_comp, looperName)
24 vpieces = release.split(
"_")[1:]
25 vnums = [ int(v)
for v
in vpieces[:3] ]
27 if "patch" in vpieces[3]:
28 vnums.append(int(vpieces[3].
replace(
"patch",
"")))
29 elif "pre" in vpieces[3]:
30 vnums.append(-100+int(vpieces[3].
replace(
"pre",
"")))
35 if vnums[:2] == (7,4):
36 if vnums >= (7,4,14,0):
return (2015,2.1)
37 if vnums >= (7,4,12,0):
return (2015,2.0)
38 if vnums >= (7,4, 8,1):
return (2015,1.1)
40 elif vnums[:2] == (7,2):
42 elif vnums[:2] == (7,0):
43 if vnums >= (7,0,9,1):
return (2014,2.0)
49 eid = ( event.input.eventAuxiliary().id().
run(),
50 event.input.eventAuxiliary().id().luminosityBlock() )
53 history = event.input.object().processHistory()
54 for i
in reversed(range(history.size())):
56 release = conf.releaseVersion().
replace(
'"',
"")
58 if conf.processName()
in (
"PAT",
"RECO",
"REC2"):
59 print "processing step %d: process %s, release %r %s, miniAOD %s" % (i, conf.processName(), release, vnums, self.
miniAODVersion(vnums))
62 (
'releaseVersion', vnums),
68 setattr(event, key, value)
71 import PhysicsTools.HeppyCore.framework.config
as cfg
72 setattr(ProvenanceAnalyzer,
"defaultConfig", cfg.Analyzer(
73 class_object = ProvenanceAnalyzer