|
41 | 41 | label = ( |
42 | 42 | 'hltL2Muons', |
43 | 43 | 'hltL2Muons:UpdatedAtVtx', |
44 | | - 'hltIterL3OIMuonTrackSelectionHighPurity:', |
45 | | - 'hltIterL3MuonMerged:', |
46 | | - 'hltIterL3MuonAndMuonFromL1Merged:', |
47 | | - 'hltIter0IterL3FromL1MuonTrackSelectionHighPurity:', |
48 | | - 'hltIterL3GlbMuon:', |
49 | | - 'hltIterL3MuonsNoIDTracks:', |
50 | | - 'hltIterL3MuonsTracks:' |
| 44 | + 'hltIterL3OIMuonTrackSelectionHighPurity', |
| 45 | + 'hltIterL3MuonMerged', |
| 46 | + 'hltIterL3MuonAndMuonFromL1Merged', |
| 47 | + 'hltIter0IterL3FromL1MuonTrackSelectionHighPurity', |
| 48 | + 'hltIterL3GlbMuon', |
| 49 | + 'hltIterL3MuonsNoIDTracks', |
| 50 | + 'hltIterL3MuonsTracks' |
51 | 51 | ), |
52 | 52 | muonHistoParameters = ( |
53 | 53 | staMuonHistoParameters, |
@@ -119,13 +119,38 @@ def _modify_for_OI_first(validator): |
119 | 119 | (phase2L2AndL3Muons & ~phase2L3MuonsOIFirst).toModify(_hltMuonMultiTrackValidator, _modify_for_IO_first) |
120 | 120 | (phase2L2AndL3Muons & phase2L3MuonsOIFirst).toModify(_hltMuonMultiTrackValidator, _modify_for_OI_first) |
121 | 121 |
|
| 122 | +# Check that the associators and labels are consistent |
| 123 | +# All MTV clones are DQMEDAnalyzers |
| 124 | +from DQMServices.Core.DQMEDAnalyzer import DQMEDAnalyzer |
| 125 | +# Access all the global variables |
| 126 | +global_items = list(globals().items()) |
| 127 | +for _name, _obj in global_items: |
| 128 | + # Find all MTV clones |
| 129 | + if isinstance(_obj, DQMEDAnalyzer) and hasattr(_obj, 'label') and hasattr(_obj, 'associatormap') and hasattr(_obj, 'muonHistoParameters'): |
| 130 | + # Check that the size of the associators, lables and muonHistoParameters are the same |
| 131 | + if (len(_obj.label) != len(_obj.associatormap) or len(_obj.label) != len(_obj.muonHistoParameters) |
| 132 | + or len(_obj.associatormap) != len(_obj.muonHistoParameters)): |
| 133 | + raise RuntimeError(f"MuonTrackValidatorHLT -- {_name}: associatormap, label and muonHistoParameters must have the same length!") |
| 134 | + # Check that the trackCollection used in each associator corresponds to the validator's label |
| 135 | + for i in range(0, len(_obj.label)): |
| 136 | + # Dynamically import the associators module to have access to procModifiers changes |
| 137 | + associators_module = __import__('Validation.RecoMuon.associators_cff', globals(), locals(), ['associators'], 0) |
| 138 | + _assoc = getattr(associators_module, _obj.associatormap[i].value()) if isinstance(_obj.associatormap[i], cms.InputTag) else getattr(associators_module, _obj.associatormap[i]) |
| 139 | + _label = _obj.label[i].value() if isinstance(_obj.label[i], cms.InputTag) else _obj.label[i] |
| 140 | + _tracksTag = _assoc.tracksTag.value() if hasattr(_assoc, 'tracksTag') else _assoc.label_tr.value() |
| 141 | + if _tracksTag != _label: |
| 142 | + raise RuntimeError(f"MuonTrackValidatorHLT -- {_name}: associatormap and label do not match for index {i}.\n" |
| 143 | + f"Associator's tracksTag: {_tracksTag}, collection label in the validator: {_label}.\n" |
| 144 | + "Make sure to have the correct ordering!") |
| 145 | + |
| 146 | +from Configuration.Eras.Modifier_phase2_muon_cff import phase2_muon |
| 147 | +phase2_muon.toReplaceWith(hltMuonMultiTrackValidator, _hltMuonMultiTrackValidator) |
| 148 | + |
122 | 149 | # |
123 | 150 | # The full Muon HLT validation sequence |
124 | 151 | # |
125 | | -muonValidationHLT_seq = cms.Sequence(muonAssociationHLT_seq + hltMuonMultiTrackValidator) |
126 | 152 |
|
127 | | -from Configuration.Eras.Modifier_phase2_muon_cff import phase2_muon |
128 | | -phase2_muon.toReplaceWith(hltMuonMultiTrackValidator, _hltMuonMultiTrackValidator) |
| 153 | +muonValidationHLT_seq = cms.Sequence(muonAssociationHLT_seq + hltMuonMultiTrackValidator) |
129 | 154 |
|
130 | 155 | recoMuonValidationHLT_seq = cms.Sequence( |
131 | 156 | cms.SequencePlaceholder("TPmu") + |
|
0 commit comments