16def _parseJetCollection(jetCollection):
17 """Parse a jet collection name into its components.
18
19 Returns (radius, jetInput, trim, hasBTag) where:
20 radius -- the jet radius parameter (2, 4, 6, or 10)
21 jetInput -- the input type string (e.g. 'EMPFlow', 'UFO', ...)
22 trim -- the trimming suffix string, or None
23 hasBTag -- whether the original collection name had a '_BTagging' suffix
24 """
25 hasBTag = False
26 btIndex = jetCollection.find('_BTagging')
27 if btIndex != -1:
28 jetCollection = jetCollection[:btIndex]
29 hasBTag = True
30
31 jetCollectionName = jetCollection
32 if jetCollection == "AnalysisJets":
33 jetCollectionName = "AntiKt4EMPFlowJets"
34 elif jetCollection == "AnalysisLargeRJets":
35 jetCollectionName = "AntiKt10UFOCSSKSoftDropBeta100Zcut10Jets"
36
37 collection_pattern = re.compile(
38 r"AntiKt(\d+)(EMTopo|EMPFlow|LCTopo|TrackCaloCluster|UFO|Track|HI)"
39 r"(TrimmedPtFrac5SmallR20|CSSKSoftDropBeta100Zcut10)?Jets")
40 match = collection_pattern.match(jetCollectionName)
41 if not match:
42 raise ValueError(
43 "Jet collection {0} does not match expected pattern!".format(jetCollectionName))
44 radius = int(match.group(1))
45 if radius not in [2, 4, 6, 10]:
46 raise ValueError(
47 "Jet collection has unsupported radius '{0}'!".format(radius))
48 jetInput = match.group(2)
49 trim = match.group(3)
50 return radius, jetInput, trim, hasBTag
51
52