46def _parseJetCollection(jetCollection):
47 """Parse a jet collection name into its components.
48
49 Returns (radius, jetInput, trim, hasBTag) where:
50 radius -- the jet radius parameter (2, 4, 6, or 10)
51 jetInput -- the input type string (e.g. 'EMPFlow', 'UFO', ...)
52 trim -- the trimming suffix string, or None
53 hasBTag -- whether the original collection name had a '_BTagging' suffix
54 """
55 hasBTag = False
56 btIndex = jetCollection.find('_BTagging')
57 if btIndex != -1:
58 jetCollection = jetCollection[:btIndex]
59 hasBTag = True
60
61 jetCollectionName = _resolveJetCollectionName(jetCollection)
62
63 collection_pattern = re.compile(
64 r"AntiKt(\d+)(EMTopo|EMPFlow|LCTopo|TrackCaloCluster|UFO|Track|HI)"
65 r"(TrimmedPtFrac5SmallR20|CSSKSoftDropBeta100Zcut10)?Jets")
66 match = collection_pattern.match(jetCollectionName)
67 if not match:
68 raise ValueError(
69 f"Jet collection {jetCollectionName} does not match expected pattern!")
70 radius = int(match.group(1))
71 if radius not in [2, 4, 6, 10]:
72 raise ValueError(
73 f"Jet collection has unsupported radius '{radius}'!")
74 jetInput = match.group(2)
75 trim = match.group(3)
76 return radius, jetInput, trim, hasBTag
77
78