Skip to content

Commit

Permalink
Merge pull request #2 from arnobaer/muon_index_cut
Browse files Browse the repository at this point in the history
Muon index cut
  • Loading branch information
elfontan authored Apr 6, 2023
2 parents d2c9c8b + 9a77855 commit 16a6d2c
Show file tree
Hide file tree
Showing 5 changed files with 59 additions and 0 deletions.
21 changes: 21 additions & 0 deletions L1Trigger/L1TGlobal/interface/ConditionEvaluation.h
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,11 @@ namespace l1t {
const Type1& lowerR,
const Type1& upperR) const;

/// check if a value is in a given range
template <class Type1>
const bool checkRangeTfMuonIndex(const unsigned int bitNumber,
const std::vector<Type1>& windows) const;

protected:
/// maximum number of objects received for the evaluation of the condition
/// usually retrieved from event setup
Expand Down Expand Up @@ -504,5 +509,21 @@ namespace l1t {
}
}

template <class Type1>
const bool ConditionEvaluation::checkRangeTfMuonIndex(const unsigned int value,
const std::vector<Type1>& windows) const {
if (windows.empty()) {
return true;
}

for (const auto& window : windows) {
if ((window.lower <= value) and (value <= window.upper)) {
return true;
}
}

return false;
}

} // namespace l1t
#endif
7 changes: 7 additions & 0 deletions L1Trigger/L1TGlobal/interface/MuonTemplate.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,11 @@ class MuonTemplate : public GlobalCondition {
MuonTemplate& operator=(const MuonTemplate&);

public:
struct Window {
unsigned int lower;
unsigned int upper;
};

// typedef for a single object template
struct ObjectParameter {
unsigned int unconstrainedPtHigh;
Expand Down Expand Up @@ -82,6 +87,8 @@ class MuonTemplate : public GlobalCondition {
unsigned int phiWindow1Upper;
unsigned int phiWindow2Lower;
unsigned int phiWindow2Upper;

std::vector<Window> tfMuonIndexWindows;
};

// typedef for correlation parameters
Expand Down
1 change: 1 addition & 0 deletions L1Trigger/L1TGlobal/plugins/GtRecordDump.cc
Original file line number Diff line number Diff line change
Expand Up @@ -861,6 +861,7 @@ namespace l1t {
packedVal |= ((cms_uint64_t)(mu->hwCharge() & 0x1) << 34); // & 0x1) <<29);
packedVal |= ((cms_uint64_t)(mu->hwQual() & 0xf) << 19); // & 0xf) <<30);
packedVal |= ((cms_uint64_t)(mu->hwIso() & 0x3) << 32); // & 0x3) <<34);
packedVal |= ((cms_uint64_t)(mu->tfMuonIndex() & 0x7f) << 36);

// if (false) { // for debugging purposes
// std::cout << "----------------------" << std::endl;
Expand Down
24 changes: 24 additions & 0 deletions L1Trigger/L1TGlobal/plugins/TriggerMenuParser.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1147,6 +1147,8 @@ bool l1t::TriggerMenuParser::parseMuon(L1TUtmCondition condMu, unsigned int chip
int charge = -1; //default value is to ignore unless specified
int qualityLUT = 0xFFFF; //default is to ignore unless specified.

std::vector<MuonTemplate::Window> tfMuonIndexWindows;

const std::vector<L1TUtmCut>& cuts = object.getCuts();
for (size_t kk = 0; kk < cuts.size(); kk++) {
const L1TUtmCut& cut = cuts.at(kk);
Expand Down Expand Up @@ -1222,6 +1224,14 @@ bool l1t::TriggerMenuParser::parseMuon(L1TUtmCondition condMu, unsigned int chip
isolationLUT = l1tstr2int(cut.getData());

} break;

case esCutType::Index: {
tfMuonIndexWindows.push_back({
cut.getMinimum().index,
cut.getMaximum().index
});
} break;

default:
break;
} //end switch
Expand Down Expand Up @@ -1260,6 +1270,8 @@ bool l1t::TriggerMenuParser::parseMuon(L1TUtmCondition condMu, unsigned int chip
objParameter[cnt].qualityLUT = qualityLUT;
objParameter[cnt].isolationLUT = isolationLUT;

objParameter[cnt].tfMuonIndexWindows = tfMuonIndexWindows;

cnt++;
} //end loop over objects

Expand Down Expand Up @@ -1379,6 +1391,8 @@ bool l1t::TriggerMenuParser::parseMuonCorr(const L1TUtmObject* corrMu, unsigned
int charge = -1; //defaut is to ignore unless specified
int qualityLUT = 0xFFFF; //default is to ignore unless specified.

std::vector<MuonTemplate::Window> tfMuonIndexWindows;

const std::vector<L1TUtmCut>& cuts = corrMu->getCuts();
for (size_t kk = 0; kk < cuts.size(); kk++) {
const L1TUtmCut& cut = cuts.at(kk);
Expand Down Expand Up @@ -1454,6 +1468,14 @@ bool l1t::TriggerMenuParser::parseMuonCorr(const L1TUtmObject* corrMu, unsigned
isolationLUT = l1tstr2int(cut.getData());

} break;

case esCutType::Index: {
tfMuonIndexWindows.push_back({
cut.getMinimum().index,
cut.getMaximum().index
});
} break;

default:
break;
} //end switch
Expand Down Expand Up @@ -1492,6 +1514,8 @@ bool l1t::TriggerMenuParser::parseMuonCorr(const L1TUtmObject* corrMu, unsigned
objParameter[0].qualityLUT = qualityLUT;
objParameter[0].isolationLUT = isolationLUT;

objParameter[0].tfMuonIndexWindows = tfMuonIndexWindows;

// object types - all muons
std::vector<GlobalObject> objType(nrObj, gtMu);

Expand Down
6 changes: 6 additions & 0 deletions L1Trigger/L1TGlobal/src/MuCondition.cc
Original file line number Diff line number Diff line change
Expand Up @@ -487,6 +487,12 @@ const bool l1t::MuCondition::checkObjectParameter(const int iCondition,
return false;
}

// check muon TF index
if (!checkRangeTfMuonIndex(cand.tfMuonIndex(), objPar.tfMuonIndexWindows)) {
LogDebug("L1TGlobal") << "\t\t l1t::Candidate failed checkRange(tfMuonIndex)" << std::endl;
return false;
}

// A number of values is required to trigger (at least one).
// "Don't care" means that all values are allowed.
// Qual = 000 means then NO MUON (GTL module)
Expand Down

0 comments on commit 16a6d2c

Please sign in to comment.