1 from __future__
import print_function
4 from PhysicsTools.Heppy.analyzers.core.Analyzer
import Analyzer
5 from PhysicsTools.Heppy.analyzers.core.AutoHandle
import AutoHandle
6 from PhysicsTools.HeppyCore.framework.event
import Event
7 from PhysicsTools.HeppyCore.statistics.counter
import Counter, Counters
9 from DataFormats.FWLite
import Events, Handle,Lumis
16 def __init__(self, cfg_ana, cfg_comp, looperName):
17 super(ProvenanceAnalyzer, self).
__init__(cfg_ana, cfg_comp, looperName)
25 vpieces = release.split(
"_")[1:]
26 vnums = [
int(v)
for v
in vpieces[:3] ]
28 if "patch" in vpieces[3]:
29 vnums.append(
int(vpieces[3].
replace(
"patch",
"")))
30 elif "pre" in vpieces[3]:
31 vnums.append(-100+
int(vpieces[3].
replace(
"pre",
"")))
36 if vnums[:2] == (7,4):
37 if vnums >= (7,4,14,0):
return (2015,2.1)
38 if vnums >= (7,4,12,0):
return (2015,2.0)
39 if vnums >= (7,4, 8,1):
return (2015,1.1)
41 elif vnums[:2] == (7,2):
43 elif vnums[:2] == (7,0):
44 if vnums >= (7,0,9,1):
return (2014,2.0)
50 eid = ( event.input.eventAuxiliary().
id().
run(),
51 event.input.eventAuxiliary().
id().luminosityBlock() )
54 history = event.input.object().processHistory()
55 for i
in reversed(range(history.size())):
57 release = conf.releaseVersion().
replace(
'"',
"")
59 if conf.processName()
in (
"PAT",
"RECO",
"REC2"):
60 print(
"processing step %d: process %s, release %r %s, miniAOD %s" % (i, conf.processName(), release, vnums, self.
miniAODVersion(vnums)))
63 (
'releaseVersion', vnums),
69 setattr(event, key, value)
72 import PhysicsTools.HeppyCore.framework.config
as cfg
73 setattr(ProvenanceAnalyzer,
"defaultConfig", cfg.Analyzer(
74 class_object = ProvenanceAnalyzer
def replace(string, replacements)
S & print(S &os, JobReport::InputFile const &f)
def miniAODVersion(self, vnums)
def __init__(self, cfg_ana, cfg_comp, looperName)
def cmsswVNums(self, release)