Skip to content

Commit

Permalink
Removing StringCutObjectSelector from Muon trigger DQM
Browse files Browse the repository at this point in the history
  • Loading branch information
caruta authored Jul 25, 2023
1 parent a8b2114 commit 348a14a
Showing 1 changed file with 34 additions and 19 deletions.
53 changes: 34 additions & 19 deletions DQMOffline/Trigger/src/HLTMuonMatchAndPlot.cc
Original file line number Diff line number Diff line change
Expand Up @@ -43,18 +43,24 @@ HLTMuonMatchAndPlot::HLTMuonMatchAndPlot(const ParameterSet& pset, string hltPat
hltPath_(std::move(hltPath)),
moduleLabel_(std::move(moduleLabel)),
isLastFilter_(islastfilter),
hasTargetRecoCuts(targetParams_.exists("recoCuts")),
hasProbeRecoCuts(probeParams_.exists("recoCuts")),
targetMuonSelector_(targetParams_.getUntrackedParameter<string>("recoCuts", "")),
//hasTargetRecoCuts(targetParams_.exists("recoCuts")),
//hasProbeRecoCuts(probeParams_.exists("recoCuts")),
targetMuonEta_(targetParams_.getUntrackedParameter<double>("recoEtaCut", 0.)),
targetIsMuonGlb_(targetParams_.getUntrackedParameter<bool>("recoGlbMuCut", false)),
//targetMuonSelector_(targetParams_.getUntrackedParameter<string>("recoCuts", "")),
targetZ0Cut_(targetParams_.getUntrackedParameter<double>("z0Cut", 0.)),
targetD0Cut_(targetParams_.getUntrackedParameter<double>("d0Cut", 0.)),
targetptCutZ_(targetParams_.getUntrackedParameter<double>("ptCut_Z", 20.)),
targetptCutJpsi_(targetParams_.getUntrackedParameter<double>("ptCut_Jpsi", 20.)),
probeMuonSelector_(probeParams_.getUntrackedParameter<string>("recoCuts", "")),
probeMuonEta_(probeParams_.getUntrackedParameter<double>("recoEtaCut", 0.)),
probeIsMuonGlb_(probeParams_.getUntrackedParameter<bool>("recoGlbMuCut", false)),
//probeMuonSelector_(probeParams_.getUntrackedParameter<string>("recoCuts", "")),
probeZ0Cut_(probeParams_.getUntrackedParameter<double>("z0Cut", 0.)),
probeD0Cut_(probeParams_.getUntrackedParameter<double>("d0Cut", 0.)),
triggerSelector_(targetParams_.getUntrackedParameter<string>("hltCuts", "")),
hasTriggerCuts_(targetParams_.exists("hltCuts")) {
//triggerSelector_(targetParams_.getUntrackedParameter<string>("hltCuts", "")),
triggerEtaCut_(targetParams_.getUntrackedParameter<double>("hltEtaCut", 0.))
//hasTriggerCuts_(targetParams_.exists("hltCuts"))
{
// Create std::map<string, T> from ParameterSets.
fillMapFromPSet(binParams_, pset, "binParams");
fillMapFromPSet(plotCuts_, pset, "plotCuts");
Expand Down Expand Up @@ -174,12 +180,15 @@ void HLTMuonMatchAndPlot::analyze(Handle<MuonCollection>& allMuons,

// Select objects based on the configuration.
MuonCollection targetMuons =
selectedMuons(*allMuons, *beamSpot, hasTargetRecoCuts, targetMuonSelector_, targetD0Cut_, targetZ0Cut_);
//selectedMuons(*allMuons, *beamSpot, hasTargetRecoCuts, targetMuonSelector_, targetD0Cut_, targetZ0Cut_);
selectedMuons(*allMuons, *beamSpot, targetMuonEta_, targetIsMuonGlb_, targetD0Cut_, targetZ0Cut_);
MuonCollection probeMuons =
selectedMuons(*allMuons, *beamSpot, hasProbeRecoCuts, probeMuonSelector_, probeD0Cut_, probeZ0Cut_);
//selectedMuons(*allMuons, *beamSpot, hasProbeRecoCuts, probeMuonSelector_, probeD0Cut_, probeZ0Cut_);
selectedMuons(*allMuons, *beamSpot, probeMuonEta_, probeIsMuonGlb_, probeD0Cut_, probeZ0Cut_);
TriggerObjectCollection allTriggerObjects = triggerSummary->getObjects();
TriggerObjectCollection hltMuons =
selectedTriggerObjects(allTriggerObjects, *triggerSummary, hasTriggerCuts_, triggerSelector_);
//selectedTriggerObjects(allTriggerObjects, *triggerSummary, hasTriggerCuts_, triggerSelector_);
selectedTriggerObjects(allTriggerObjects, *triggerSummary, triggerEtaCut_);
// Fill plots for HLT muons.

// Find the best trigger object matches for the targetMuons.
Expand Down Expand Up @@ -374,13 +383,15 @@ vector<size_t> HLTMuonMatchAndPlot::matchByDeltaR(const vector<T1>& collection1,

MuonCollection HLTMuonMatchAndPlot::selectedMuons(const MuonCollection& allMuons,
const BeamSpot& beamSpot,
bool hasRecoCuts,
const StringCutObjectSelector<reco::Muon>& selector,
double RecoMuonEta,
bool IsMuonGlb,
//bool hasRecoCuts,
//const StringCutObjectSelector<reco::Muon>& selector,
double d0Cut,
double z0Cut) {
// If there is no selector (recoCuts does not exists), return an empty collection.
if (!hasRecoCuts)
return MuonCollection();
//if (!hasRecoCuts)
// return MuonCollection();

MuonCollection reducedMuons;
for (auto const& mu : allMuons) {
Expand All @@ -389,7 +400,9 @@ MuonCollection HLTMuonMatchAndPlot::selectedMuons(const MuonCollection& allMuons
track = &*mu.innerTrack();
else if (mu.isStandAloneMuon())
track = &*mu.outerTrack();
if (track && selector(mu) && fabs(track->dxy(beamSpot.position())) < d0Cut &&
//if (track && selector(mu) && fabs(track->dxy(beamSpot.position())) < d0Cut &&
IsMuonGlb = (&mu)->isGlobalMuon();
if (track && IsMuonGlb && abs((&mu)->eta()) < RecoMuonEta && fabs(track->dxy(beamSpot.position())) < d0Cut &&
fabs(track->dz(beamSpot.position())) < z0Cut)
reducedMuons.push_back(mu);
}
Expand All @@ -400,10 +413,11 @@ MuonCollection HLTMuonMatchAndPlot::selectedMuons(const MuonCollection& allMuons
TriggerObjectCollection HLTMuonMatchAndPlot::selectedTriggerObjects(
const TriggerObjectCollection& triggerObjects,
const TriggerEvent& triggerSummary,
bool hasTriggerCuts,
const StringCutObjectSelector<TriggerObject>& triggerSelector) {
if (!hasTriggerCuts)
return TriggerObjectCollection();
//bool hasTriggerCuts,
//const StringCutObjectSelector<TriggerObject>& triggerSelector) {
double triggerEtaCut_) {
//if (!hasTriggerCuts)
//return TriggerObjectCollection();

InputTag filterTag(moduleLabel_, "", hltProcessName_);
size_t filterIndex = triggerSummary.filterIndex(filterTag);
Expand All @@ -414,7 +428,8 @@ TriggerObjectCollection HLTMuonMatchAndPlot::selectedTriggerObjects(
const Keys& keys = triggerSummary.filterKeys(filterIndex);
for (unsigned short key : keys) {
TriggerObject foundObject = triggerObjects[key];
if (triggerSelector(foundObject))
//if (triggerSelector(foundObject))
if(abs((&foundObject)->eta()) < triggerEtaCut_)
selectedObjects.push_back(foundObject);
}
}
Expand Down

0 comments on commit 348a14a

Please sign in to comment.