1 #ifndef RecoTauTag_RecoTau_PFTauSelectorDefinition
2 #define RecoTauTag_RecoTau_PFTauSelectorDefinition
35 std::vector<std::pair<int, double>>
rawCuts;
43 auto const&
discriminators =
cfg.getParameter<std::vector<edm::ParameterSet>>(
"discriminators");
49 newCut.
cut =
pset.getParameter<
double>(
"selectionCut");
56 auto const& rawLabels =
pset.getParameter<std::vector<std::string>>(
"rawValues");
57 auto const& rawCutValues =
pset.getParameter<std::vector<double>>(
"selectionCuts");
58 if (rawLabels.size() != rawCutValues.size()) {
60 <<
"unequal number of TauIDContainer raw value indices and cut values given to PFTauSelector.";
62 for (
size_t i = 0;
i < rawLabels.size();
i++) {
63 newCut.
rawCuts.push_back(std::pair<int, double>(-99, rawCutValues[
i]));
66 newCut.
wpLabels =
pset.getParameter<std::vector<std::string>>(
"workingPoints");
72 if (
cfg.exists(
"cut")) {
85 <<
"an invalid PFTau handle with ProductID" << hc.
id() <<
" passed to PFTauSelector.";
90 e.getByToken(
disc.inputToken,
disc.handle);
93 e.getByToken(
disc.inputToken,
disc.handle);
96 if (
phID_ !=
e.processHistoryID()) {
97 phID_ =
e.processHistoryID();
99 auto const& psetsFromProvenance =
edm::parameterSet(
disc.handle.provenance()->stable(),
e.processHistory());
101 if (psetsFromProvenance.exists(
"rawValues")) {
102 auto const idlist = psetsFromProvenance.
getParameter<std::vector<std::string>>(
"rawValues");
103 for (
size_t i = 0;
i <
disc.rawLabels.size(); ++
i) {
105 for (
size_t j = 0;
j < idlist.size(); ++
j) {
106 if (
disc.rawLabels[
i] == idlist[
j]) {
108 disc.rawCuts[
i].first =
j;
113 <<
"PFTauSelector: Requested working point '" <<
disc.rawLabels[
i] <<
"' not found!\n";
115 }
else if (psetsFromProvenance.exists(
"IDdefinitions")) {
116 auto const idlist = psetsFromProvenance.getParameter<std::vector<edm::ParameterSet>>(
"IDdefinitions");
117 for (
size_t i = 0;
i <
disc.rawLabels.size(); ++
i) {
119 for (
size_t j = 0;
j < idlist.size(); ++
j) {
122 disc.rawCuts[
i].first =
j;
127 <<
"PFTauSelector: Requested working point '" <<
disc.rawLabels[
i] <<
"' not found!\n";
130 throw cms::Exception(
"Configuration") <<
"PFTauSelector: No suitable ID list found in provenace config!\n";
132 if (psetsFromProvenance.exists(
"workingPoints")) {
133 auto const idlist = psetsFromProvenance.getParameter<std::vector<std::string>>(
"workingPoints");
134 for (
size_t i = 0;
i <
disc.wpLabels.size(); ++
i) {
136 for (
size_t j = 0;
j < idlist.size(); ++
j) {
137 if (
disc.wpLabels[
i] == idlist[
j]) {
144 <<
"PFTauSelector: Requested working point '" <<
disc.wpLabels[
i] <<
"' not found!\n";
146 }
else if (psetsFromProvenance.exists(
"IDWPdefinitions")) {
147 auto const idlist = psetsFromProvenance.getParameter<std::vector<edm::ParameterSet>>(
"IDWPdefinitions");
148 for (
size_t i = 0;
i <
disc.wpLabels.size(); ++
i) {
150 for (
size_t j = 0;
j < idlist.size(); ++
j) {
158 <<
"PFTauSelector: Requested working point '" <<
disc.wpLabels[
i] <<
"' not found!\n";
161 throw cms::Exception(
"Configuration") <<
"PFTauSelector: No suitable ID list found in provenace config!\n";
165 const size_t nTaus = hc->size();
166 for (
size_t iTau = 0; iTau < nTaus; ++iTau) {
179 for (
auto const& rawCut :
disc.rawCuts) {
180 if (!((*
disc.handle)[
tau].rawValues.at(rawCut.first) > rawCut.second)) {
187 for (
auto const& wpCut :
disc.wpCuts) {
188 if (!((*
disc.handle)[
tau].workingPoints.at(wpCut))) {
215 std::unique_ptr<StringCutObjectSelector<reco::PFTau>>
cut_;