36 _analysisname(analysisname),
40 _hltProcessName(
pset.getParameter<
std::
string>(
"hltProcessName")),
41 _histDirectory(
pset.getParameter<
std::
string>(
"histDirectory")),
45 pset.getUntrackedParameter<
std::
string>(
"recoHtJetLabel",
"ak4PFJetsCHS"))),
46 _parametersEta(
pset.getParameter<
std::
vector<double>>(
"parametersEta")),
47 _parametersPhi(
pset.getParameter<
std::
vector<double>>(
"parametersPhi")),
48 _parametersPu(
pset.getParameter<
std::
vector<double>>(
"parametersPu")),
50 _parametersTurnOn(
pset.getParameter<
std::
vector<double>>(
"parametersTurnOn")),
52 _genJetSelector(nullptr),
53 _recMuonSelector(nullptr),
54 _recElecSelector(nullptr),
55 _recCaloMETSelector(nullptr),
56 _recPFMETSelector(nullptr),
57 _recPFTauSelector(nullptr),
58 _recPhotonSelector(nullptr),
59 _recPFJetSelector(nullptr),
60 _recTrackSelector(nullptr),
62 _useNminOneCuts(
false) {
67 if (anpset.
exists(
"parametersTurnOn")) {
73 for (std::map<unsigned int, std::string>::const_iterator it =
_recLabels.begin(); it !=
_recLabels.end(); ++it) {
77 _cutMinPt[it->first] =
pset.getParameter<
double>(objStr +
"_cutMinPt");
78 _cutMaxEta[it->first] =
pset.getParameter<
double>(objStr +
"_cutMaxEta");
81 for (std::map<unsigned int, std::string>::const_iterator it =
_recLabels.begin(); it !=
_recLabels.end(); ++it) {
89 if (anpset.
existsAs<
double>(objStr +
"_cutMinPt",
false)) {
92 if (anpset.
existsAs<
double>(objStr +
"_cutMaxEta",
false)) {
99 std::vector<double> default_parametersHt;
100 default_parametersHt.push_back(100);
101 default_parametersHt.push_back(0);
102 default_parametersHt.push_back(1000);
103 _parametersHt =
pset.getUntrackedParameter<std::vector<double>>(
"parametersHt", default_parametersHt);
113 if (
pset.exists(
"pileUpInfoLabel")) {
117 if (anpset.
existsAs<std::vector<double>>(
"NminOneCuts",
false)) {
120 edm::LogError(
"HiggsValidation") <<
"In HLTHiggsSubAnalysis::HLTHiggsSubAnalysis, "
121 <<
"Incoherence found in the python configuration file!!\nThe SubAnalysis '"
123 <<
_NminOneCuts.size() <<
", while it needs to be at least of size "
128 edm::LogError(
"HiggsValidation") <<
"In HLTHiggsSubAnalysis::HLTHiggsSubAnalysis, "
129 <<
"Incoherence found in the python configuration file!!\nThe SubAnalysis '"
131 <<
"' has a vector NminOneCuts with a dEtaqq of mqq cut on the least b-tagged "
132 "jets of the first 4 jets while only requiring "
137 edm::LogError(
"HiggsValidation") <<
"In HLTHiggsSubAnalysis::HLTHiggsSubAnalysis, "
138 <<
"Incoherence found in the python configuration file!!\nThe SubAnalysis '"
140 <<
"' has a vector NminOneCuts with a CSV3 cut while only requiring "
145 edm::LogError(
"HiggsValidation") <<
"In HLTHiggsSubAnalysis::HLTHiggsSubAnalysis, "
146 <<
"Incoherence found in the python configuration file!!\nThe SubAnalysis '"
148 <<
"' has a vector NminOneCuts with a dPhibb or CSV2 cut using the second most "
149 "b-tagged jet while only requiring "
169 it->second =
nullptr;
197 edm::LogError(
"HiggsValidations") <<
"HLTHiggsSubAnalysis::beginRun: "
198 <<
"Initializtion of HLTConfigProvider failed!!";
209 if (TString(thetriggername).Contains(
pattern)) {
223 for (std::set<std::string>::iterator iPath =
_hltPaths.begin(); iPath !=
_hltPaths.end(); ++iPath) {
228 if (
path.rfind(
"_v") <
path.length()) {
229 shortpath =
path.substr(0,
path.rfind(
"_v"));
234 const std::vector<unsigned int> objsNeedHLT = this->
getObjectsType(shortpath);
237 std::vector<unsigned int> userInstantiate;
238 for (std::map<unsigned int, std::string>::iterator it =
_recLabels.begin(); it !=
_recLabels.end(); ++it) {
239 userInstantiate.push_back(it->first);
241 for (std::vector<unsigned int>::const_iterator it = objsNeedHLT.begin(); it != objsNeedHLT.end(); ++it) {
242 if (
std::find(userInstantiate.begin(), userInstantiate.end(), *it) == userInstantiate.end()) {
243 edm::LogError(
"HiggsValidation") <<
"In HLTHiggsSubAnalysis::beginRun, "
244 <<
"Incoherence found in the python configuration file!!\nThe SubAnalysis '"
245 <<
_analysisname <<
"' has been asked to evaluate the trigger path '"
246 << shortpath <<
"' (found it in 'hltPathsToCheck') BUT this path"
248 <<
"' which has not been instantiate ('recVariableLabels'"
253 LogTrace(
"HiggsValidation") <<
" --- " << shortpath;
266 std::vector<std::string>
sources(2);
270 for (std::map<unsigned int, std::string>::const_iterator it =
_recLabels.begin(); it !=
_recLabels.end(); ++it) {
311 for (std::vector<HLTHiggsPlotter>::iterator it =
_analyzers.begin(); it !=
_analyzers.end(); ++it) {
321 std::string nameGlobalEfficiencyPassing = nameGlobalEfficiency +
"_passingHLT";
322 _elements[nameGlobalEfficiencyPassing] = ibooker.
book1D(nameGlobalEfficiencyPassing.c_str(),
323 nameGlobalEfficiencyPassing.c_str(),
328 std::string titlePu =
"nb of interations in the event";
331 int nBinsPu = (
int)paramsPu[0];
332 double minPu = paramsPu[1];
333 double maxPu = paramsPu[2];
335 std::string titleHt =
"sum of jet pT in the event";
338 int nBinsHt = (
int)paramsHt[0];
339 double minHt = paramsHt[1];
340 double maxHt = paramsHt[2];
345 _elements[nameHtPlot] = ibooker.
book1D(nameHtPlot.c_str(), titleHt.c_str(), nBinsHt,
minHt, maxHt);
350 if (
path.rfind(
"_v") <
path.length()) {
351 shortpath =
path.substr(0,
path.rfind(
"_v"));
353 std::string titlePassingPu =
"nb of interations in the event passing path " + shortpath;
355 _elements[nameVtxPlot +
"_" + shortpath] =
356 ibooker.
book1D(nameVtxPlot +
"_" + shortpath, titlePassingPu.c_str(), nBinsPu,
minPu,
maxPu);
358 std::string titlePassingHt =
"sum of jet pT in the event passing path " + shortpath;
360 _elements[nameHtPlot +
"_" + shortpath] =
361 ibooker.
book1D(nameHtPlot +
"_" + shortpath, titlePassingHt.c_str(), nBinsHt,
minHt, maxHt);
364 _elements[nameGlobalEfficiency]->setBinLabel(
j + 1, shortpath);
365 _elements[nameGlobalEfficiencyPassing]->setBinLabel(
j + 1, shortpath);
374 std::map<unsigned int, std::string> u2str;
378 std::map<unsigned int, double> Htmap;
386 std::vector<PileupSummaryInfo>::const_iterator PVI;
387 for (PVI = puInfo->begin(); PVI != puInfo->end(); ++PVI) {
388 if (PVI->getBunchCrossing() == 0) {
389 nbMCvtx = PVI->getPU_NumInteractions();
399 std::vector<MatchStruct>*
matches =
new std::vector<MatchStruct>;
401 for (std::map<unsigned int, std::string>::iterator it =
_recLabels.begin(); it !=
_recLabels.end(); ++it) {
410 for (
size_t i = 0;
i < cols->
genJets->size(); ++
i) {
444 std::map<unsigned int, std::vector<MatchStruct>> sourceMatchMap;
453 std::map<std::string, bool> nMinOne;
454 std::map<std::string, bool> jetCutResult;
461 bool passAllCuts =
false;
474 this->
passJetCuts(matches, jetCutResult, dEtaqq, mqq, dPhibb, CSV1, CSV2, CSV3);
478 for (std::map<unsigned int, std::string>::iterator it =
_recLabels.begin(); it !=
_recLabels.end(); ++it) {
494 for (std::map<std::string, bool>::const_iterator it = jetCutResult.begin(); it != jetCutResult.end(); ++it) {
495 nMinOne[it->first] =
true;
496 for (std::map<std::string, bool>::const_iterator it2 = jetCutResult.begin(); it2 != jetCutResult.end(); ++it2) {
498 if (it->first ==
"CSV1" && it2->first ==
"CSV3")
500 if (it->first ==
"CSV1" && it2->first ==
"CSV2")
504 if (it->first ==
"CSV2" && it2->first ==
"CSV3")
507 if (it->first != it2->first && !(it2->second)) {
508 nMinOne[it->first] =
false;
514 for (std::map<std::string, bool>::const_iterator it = nMinOne.begin(); it != nMinOne.end(); ++it) {
515 if (
temp && it->second) {
536 for (reco::PFJetCollection::const_iterator iJet = recoJet->begin(); iJet != recoJet->end(); iJet++) {
537 double pt = iJet->pt();
538 double eta = iJet->eta();
548 for (reco::GenJetCollection::const_iterator iJet = genJet->begin(); iJet != genJet->end(); iJet++) {
549 double pt = iJet->pt();
550 double eta = iJet->eta();
560 for (
std::map<
unsigned int, std::vector<MatchStruct>>::iterator it = sourceMatchMap.begin();
561 it != sourceMatchMap.end();
571 std::map<unsigned int, int>* countobjects =
new std::map<unsigned int, int>;
575 countobjects->insert(std::pair<unsigned int, int>(
co->first, 0));
578 const int totalobjectssize2 =
NptPlots * countobjects->size();
579 for (
size_t j = 0;
j < it->second.size(); ++
j) {
580 const unsigned int objType = it->second[
j].objType;
583 float pt = (it->second)[
j].
pt;
584 float eta = (it->second)[
j].
eta;
585 float phi = (it->second)[
j].
phi;
597 if (nMinOne[
maxPt.Data()]) {
617 this->
fillHist(u2str[it->first], objTypeStr,
"Eta",
eta);
618 this->
fillHist(u2str[it->first], objTypeStr,
"Phi",
phi);
621 this->
fillHist(u2str[it->first], objTypeStr,
"Eta",
eta);
622 this->
fillHist(u2str[it->first], objTypeStr,
"Phi",
phi);
626 if (counttotal == totalobjectssize2) {
645 nameCSVplot =
"maxCSV";
646 if (nMinOne[nameCSVplot])
665 _elements[nameHtPlot]->Fill(Htmap[it->first]);
670 for (std::vector<HLTHiggsPlotter>::iterator an =
_analyzers.begin(); an !=
_analyzers.end(); ++an) {
672 const std::string fillShortPath = an->gethltpath();
676 an->analyze(ispassTrigger,
source, it->second, nMinOne, dEtaqq, mqq, dPhibb, CSV1, CSV2, CSV3, passAllCuts);
681 int refOfThePath = -1;
687 _elements[SummaryName]->Fill(refOfThePath);
689 _elements[SummaryName +
"_passingHLT"]->Fill(refOfThePath, 1);
691 _elements[nameVtxPlot +
"_" + fillShortPath]->Fill(nbMCvtx);
693 _elements[nameHtPlot +
"_" + fillShortPath]->Fill(Htmap[it->first]);
695 _elements[SummaryName +
"_passingHLT"]->Fill(refOfThePath, 0);
703 static const unsigned int objSize = 7;
713 std::set<unsigned int> objsType;
715 for (
unsigned int i = 0;
i < objSize; ++
i) {
718 if (!TString(
hltPath).Contains(objTypeStr)) {
720 TString(
hltPath).Contains(
"WHbbBoost")) ||
724 objsType.insert(objtriggernames[
i]);
729 (TString(
hltPath).Contains(
"PFMET") || TString(
hltPath).Contains(
"MHT"))) ||
731 !TString(
hltPath).Contains(TRegexp(
"Jet[^I]"))) ||
737 objsType.insert(objtriggernames[
i]);
740 return std::vector<unsigned int>(objsType.begin(), objsType.end());
745 if (anpset.
exists(
"recMuonLabel")) {
750 if (anpset.
exists(
"recElecLabel")) {
755 if (anpset.
exists(
"recPhotonLabel")) {
760 if (anpset.
exists(
"recCaloMETLabel")) {
765 if (anpset.
exists(
"recPFMETLabel")) {
770 if (anpset.
exists(
"recPFTauLabel")) {
775 if (anpset.
exists(
"recJetLabel")) {
778 if (anpset.
exists(
"jetTagLabel"))
789 edm::LogError(
"HiggsValidation") <<
"HLTHiggsSubAnalysis::bookobjects, "
790 <<
"Not included any object (recMuonLabel, recElecLabel, ...) "
802 if (!
col->isCommonInit()) {
818 for (std::map<unsigned int, std::string>::iterator it =
_recLabels.begin(); it !=
_recLabels.end(); ++it) {
855 edm::LogError(
"HiggsValidation") <<
"HLTHiggsSubAnalysis::initobjects "
856 <<
" NOT IMPLEMENTED (yet) ERROR: '" << it->second <<
"'";
867 sourceUpper[0] = std::toupper(sourceUpper[0]);
871 if (
variable.find(
"MaxPt") != std::string::npos) {
876 desc =
"Next-to-Leading";
881 size_t nBins = nBinsStandard;
882 float*
edges =
new float[nBinsStandard + 1];
883 for (
size_t i = 0;
i < nBinsStandard + 1;
i++) {
889 const size_t nBinsJets = 25;
892 edges =
new float[nBinsJets + 1];
893 for (
size_t i = 0;
i < nBinsJets + 1;
i++) {
898 const size_t nBinsJets = 30;
901 edges =
new float[nBinsJets + 1];
902 for (
size_t i = 0;
i < nBinsJets + 1;
i++) {
968 const float&
value) {
970 sourceUpper[0] = toupper(sourceUpper[0]);
1005 std::vector<MatchStruct>*
matches) {
1015 for (reco::PFJetCollection::const_iterator it = PFJetHandle->begin(); it != PFJetHandle->end(); ++it) {
1021 float bTag = (*(JetTagHandle.
product()))[jetBaseRef];
1031 std::vector<MatchStruct>*
matches,
1032 std::map<std::string, bool>& jetCutResult,
1047 jetCutResult[
maxPt.Data()] =
true;
1049 jetCutResult[
maxPt.Data()] =
false;
1059 jetCutResult[
"dEtaqq"] =
false;
1063 jetCutResult[
"dEtaqq"] =
true;
1068 jetCutResult[
"mqq"] =
false;
1070 mqq = ((*matches)[2].lorentzVector + (*matches)[3].lorentzVector).M();
1072 jetCutResult[
"mqq"] =
true;
1077 jetCutResult[
"dPhibb"] =
false;
1081 jetCutResult[
"dPhibb"] =
true;
1087 jetCutResult[nameCSV2plot] =
false;
1089 CSV2 = (*matches)[1].bTag;
1091 jetCutResult[nameCSV2plot] =
true;
1097 jetCutResult[nameCSV3plot] =
false;
1099 CSV3 = (*matches)[2].bTag;
1101 jetCutResult[nameCSV3plot] =
true;
1106 CSV1 = (*matches)[0].bTag;
1109 nameCSVplot =
"maxCSV";
1112 jetCutResult[nameCSVplot] =
true;
1114 jetCutResult[nameCSVplot] =
false;
1119 CSV1 = (*matches)[0].bTag;
1123 for (
unsigned int i = 1;
i < (
unsigned int)
Njets; ++
i) {
1132 std::map<std::string, bool>& jetCutResult) {
1134 jetCutResult[
"PFMET"] =
false;
1135 for (std::vector<MatchStruct>::const_iterator it =
matches.begin(); it !=
matches.end(); ++it) {
1138 jetCutResult[
"PFMET"] =
true;
1147 std::vector<MatchStruct>*
matches) {
1149 for (
size_t i = 0;
i < cols->
muons->size();
i++) {
1161 for (
size_t i = 0;
i < cols->
photons->size();
i++) {
1167 for (
size_t i = 0;
i < cols->
caloMETs->size();
i++) {
1173 for (
size_t i = 0;
i < cols->
pfMETs->size();
i++) {
1179 for (
size_t i = 0;
i < cols->
pfTaus->size();
i++) {