1 from __future__
import print_function
2 from builtins
import range
5 from PhysicsTools.Heppy.analyzers.core.Analyzer
import Analyzer
6 from PhysicsTools.Heppy.analyzers.core.AutoHandle
import AutoHandle
7 from PhysicsTools.HeppyCore.framework.event
import Event
8 from PhysicsTools.HeppyCore.statistics.counter
import Counter, Counters
10 from DataFormats.FWLite
import Events, Handle,Lumis
17 def __init__(self, cfg_ana, cfg_comp, looperName):
18 super(ProvenanceAnalyzer, self).
__init__(cfg_ana, cfg_comp, looperName)
26 vpieces = release.split(
"_")[1:]
27 vnums = [
int(v)
for v
in vpieces[:3] ]
29 if "patch" in vpieces[3]:
30 vnums.append(
int(vpieces[3].
replace(
"patch",
"")))
31 elif "pre" in vpieces[3]:
32 vnums.append(-100+
int(vpieces[3].
replace(
"pre",
"")))
37 if vnums[:2] == (7,4):
38 if vnums >= (7,4,14,0):
return (2015,2.1)
39 if vnums >= (7,4,12,0):
return (2015,2.0)
40 if vnums >= (7,4, 8,1):
return (2015,1.1)
42 elif vnums[:2] == (7,2):
44 elif vnums[:2] == (7,0):
45 if vnums >= (7,0,9,1):
return (2014,2.0)
51 eid = ( event.input.eventAuxiliary().
id().
run(),
52 event.input.eventAuxiliary().
id().luminosityBlock() )
55 history = event.input.object().processHistory()
56 for i
in reversed(list(
range(history.size()))):
58 release = conf.releaseVersion().
replace(
'"',
"")
60 if conf.processName()
in (
"PAT",
"RECO",
"REC2"):
61 print(
"processing step %d: process %s, release %r %s, miniAOD %s" % (i, conf.processName(), release, vnums, self.
miniAODVersion(vnums)))
64 (
'releaseVersion', vnums),
70 setattr(event, key, value)
73 import PhysicsTools.HeppyCore.framework.config
as cfg
74 setattr(ProvenanceAnalyzer,
"defaultConfig", cfg.Analyzer(
75 class_object = ProvenanceAnalyzer
def replace(string, replacements)
def miniAODVersion(self, vnums)
void print(TMatrixD &m, const char *label=nullptr, bool mathematicaFormat=false)
def __init__(self, cfg_ana, cfg_comp, looperName)
def cmsswVNums(self, release)