Skip to content

Commit 9b64f44

Browse files
authored
Merge pull request cms-sw#34006 from borzari/borzari_exohltval_fix
Issue fix in Exotica HLT validation code
2 parents ab1815f + 88516a5 commit 9b64f44

File tree

2 files changed

+45
-7
lines changed

2 files changed

+45
-7
lines changed

HLTriggerOffline/Exotica/src/HLTExoticaPlotter.cc

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -126,9 +126,14 @@ void HLTExoticaPlotter::analyze(const bool &isPassTrigger,
126126
totalobjectssize++;
127127
totalobjectssize *= countobjects.size();
128128
// Fill the histos if pass the trigger (just the two with higher pt)
129+
unsigned int jaux = 0;
130+
// jaux is being used as a dedicated counter to avoid getting
131+
// a non-existent element inside dxys
132+
// more information in the issue https://github.com/cms-sw/cmssw/issues/32550
129133
for (size_t j = 0; j < matches.size(); ++j) {
130134
// Is this object owned by this trigger? If not we are not interested...
131135
if (_objectsType.find(matches[j].pdgId()) == _objectsType.end()) {
136+
++jaux;
132137
continue;
133138
}
134139

@@ -149,8 +154,10 @@ void HLTExoticaPlotter::analyze(const bool &isPassTrigger,
149154
}
150155

151156
if (!dxys.empty() &&
152-
(objType == EVTColContainer::ELEC || objType == EVTColContainer::MUON || objType == EVTColContainer::MUTRK))
153-
this->fillHist(isPassTrigger, source, objTypeStr, "Dxy", dxys[j]);
157+
(objType == EVTColContainer::ELEC || objType == EVTColContainer::MUON || objType == EVTColContainer::MUTRK)) {
158+
this->fillHist(isPassTrigger, source, objTypeStr, "Dxy", dxys[jaux]);
159+
++jaux;
160+
}
154161

155162
if (countobjects[objType] == 0) {
156163
if (!(TString(objTypeStr).Contains("MET") || TString(objTypeStr).Contains("MHT")) || source != "gen") {
@@ -208,8 +215,15 @@ void HLTExoticaPlotter::bookHist(DQMStore::IBooker &iBooker,
208215
double max = _parametersDxy[2];
209216
h = new TH1F(name.c_str(), title.c_str(), nBins, min, max);
210217
} else if (variable.find("MaxPt") != std::string::npos) {
211-
std::string desc =
212-
(variable == "MaxPt1") ? "Leading" : (variable == "MaxPt2") ? "Next-to-Leading" : "Next-to-next-to-Leading";
218+
std::string desc; //=
219+
// (variable == "MaxPt1") ? "Leading" : (variable == "MaxPt2") ? "Next-to-Leading" : "Next-to-next-to-Leading";
220+
if (variable == "MaxPt1") {
221+
desc = "Leading";
222+
} else if (variable == "MaxPt2") {
223+
desc = "Next-to-Leading";
224+
} else {
225+
desc = "Next-to-next-to-Leading";
226+
}
213227
std::string title = "pT of " + desc + " " + sourceUpper + " " + objType +
214228
" "
215229
"where event pass the " +

HLTriggerOffline/Exotica/src/HLTExoticaSubAnalysis.cc

Lines changed: 27 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -659,9 +659,18 @@ void HLTExoticaSubAnalysis::analyze(const edm::Event &iEvent, const edm::EventSe
659659
}
660660
}
661661

662+
int jel = 0;
663+
int jmu = 0;
664+
int jmutrk = 0;
665+
666+
// jel, jmu and jmutrk are being used as a dedicated counters to avoid getting
667+
// non-existent elements inside trkObjs[11], trkObjs[13] and trkObjs[130], respectively
668+
// more information in the issue https://github.com/cms-sw/cmssw/issues/32550
669+
662670
for (size_t j = 0; (j != matchesReco.size()) && isPassedLeadingCut; ++j) {
663671
const unsigned int objType = matchesReco[j].pdgId();
664-
// std::cout << "(4) Gonna call with " << objType << std::endl;
672+
//std::cout << "(4) Gonna call with " << objType << std::endl;
673+
665674
const std::string objTypeStr = EVTColContainer::getTypeString(objType);
666675

667676
float pt = matchesReco[j].pt();
@@ -703,10 +712,25 @@ void HLTExoticaSubAnalysis::analyze(const edm::Event &iEvent, const edm::EventSe
703712
this->fillHist("rec", objTypeStr, "SumEt", theSumEt[objType]);
704713
}
705714

706-
if (trkObjs[objType].size() >= j + 1) {
707-
float dxyRec = trkObjs[objType].at(j)->dxy(cols->bs->position());
715+
if (objType == 11) {
716+
float dxyRec = trkObjs[objType].at(jel)->dxy(cols->bs->position());
717+
this->fillHist("rec", objTypeStr, "Dxy", dxyRec);
718+
dxys.push_back(dxyRec);
719+
++jel;
720+
}
721+
722+
if (objType == 13) {
723+
float dxyRec = trkObjs[objType].at(jmu)->dxy(cols->bs->position());
724+
this->fillHist("rec", objTypeStr, "Dxy", dxyRec);
725+
dxys.push_back(dxyRec);
726+
++jmu;
727+
}
728+
729+
if (objType == 130) {
730+
float dxyRec = trkObjs[objType].at(jmutrk)->dxy(cols->bs->position());
708731
this->fillHist("rec", objTypeStr, "Dxy", dxyRec);
709732
dxys.push_back(dxyRec);
733+
++jmutrk;
710734
}
711735

712736
} // Closes loop in reco

0 commit comments

Comments
 (0)