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