79 auto tau_JetIDWP_to_enum = [](
const std::string&
s) {
89 const int tauJetIDWP = tau_JetIDWP_to_enum(
m_config->tauJetIDWP());
91 top::check(tauJetIDWP > 0,
m_config->tauJetIDWP() +
" is not a supported tau Jet ID WP");
94 const int tauJetIDWPLoose = tau_JetIDWP_to_enum(
m_config->tauJetIDWPLoose());
95 top::check(tauJetIDWPLoose > 0,
m_config->tauJetIDWPLoose() +
" is not a supported tau Jet ID WP");
97 auto tau_EleIDWP_to_enum = [](
const std::string&
s) {
107 const int tauEleIDWP = tau_EleIDWP_to_enum(
m_config->tauEleIDWP());
108 top::check(tauEleIDWP > 0,
m_config->tauEleIDWP() +
" is not a supported tau electron ID WP");
111 const int tauEleIDWPLoose = tau_EleIDWP_to_enum(
m_config->tauEleIDWPLoose());
112 top::check(tauEleIDWPLoose > 0,
m_config->tauEleIDWPLoose() +
" is not a supported tau electron ID WP");
114 const double absCharge = 1.;
115 const std::vector<size_t> nTracks = {
124 std::string tauJetConfigFile =
m_config->tauJetConfigFile();
125 if (tauJetConfigFile !=
"Default")
128 tauJetConfigFile.clear();
129 std::string tauJetConfigFileLoose =
m_config->tauJetConfigFileLoose();
130 if (tauJetConfigFileLoose !=
"Default")
133 tauJetConfigFileLoose.clear();
138 int iSelectionCuts = 0;
146 int iSelectionCutsLoose = iSelectionCuts;
164 const std::string tauSelName =
"TauAnalysisTools::TauSelectionTool";
165 const std::string tauEffCorrName =
"TauAnalysisTools::TauEfficiencyCorrectionsTool";
168 if (asg::ToolStore::contains<ITauSelTool>(tauSelName)) {
171 std::unique_ptr<ITauSelTool> tauSelectionTool = std::make_unique<TauAnalysisTools::TauSelectionTool>(tauSelName);
172 if (!tauJetConfigFile.empty()) {
173 top::check(asg::setProperty(tauSelectionTool,
"ConfigPath", tauJetConfigFile),
174 "Failed to set tau selection tool configuration path");
175 top::check(asg::setProperty(tauSelectionTool,
"OutputLevel", MSG::INFO),
176 "Failed to set tau OutputLevel");
179 top::check(asg::setProperty(tauSelectionTool,
"ConfigPath",
""),
180 "Failed to set tau selection tool configuration path");
181 top::check(asg::setProperty(tauSelectionTool,
"OutputLevel", MSG::INFO),
182 "Failed to set tau OutputLevel");
184 top::check(asg::setProperty(tauSelectionTool,
"SelectionCuts", iSelectionCuts),
185 "Failed to set tau SelectionCuts");
186 top::check(asg::setProperty(tauSelectionTool,
"PtMin",
static_cast<double>(
m_config->tauPtcut() / 1
e3)),
187 "Failed to set tau pT cut");
188 top::check(asg::setProperty(tauSelectionTool,
"AbsEtaRegion",
m_config->tauEtaRegions() ),
189 "Failed to set tau AbsEtaRegion");
190 top::check(asg::setProperty(tauSelectionTool,
"AbsCharge", absCharge),
191 "Failed to set tau AbsCharge");
192 top::check(asg::setProperty(tauSelectionTool,
"NTracks", nTracks),
193 "Failed to set tau NTracks");
194 top::check(asg::setProperty(tauSelectionTool,
"JetIDWP", tauJetIDWP),
195 "Failed to set tau JetIDWP");
196 top::check(asg::setProperty(tauSelectionTool,
"EleIDWP", tauEleIDWP),
197 "Failed to set tau EleIDWP");
199 "Failed to set tau MuonOLR");
201 top::check(tauSelectionTool->initialize(),
"Failed to initialize tauSelectionTool");
205 if (asg::ToolStore::contains<ITauEffCorrTool>(tauEffCorrName)) {
208 std::unique_ptr<ITauEffCorrTool> tauEffCorrTool
209 = std::make_unique<TauAnalysisTools::TauEfficiencyCorrectionsTool>(tauEffCorrName);
215 "Failed to set PileupReweightingTool for " + tauEffCorrName);
218 top::check(asg::setProperty(tauEffCorrTool,
"UseTauSubstructure",
m_config->tauSubstructureSF()),
219 "Failed to set UseTauSubstructure for " + tauEffCorrName);
222 "Failed to set isAFII for " + tauEffCorrName);
226 "Failed to set TauSelectionTool for " + tauEffCorrName);
228 top::check(tauEffCorrTool->initialize(),
"Failed to initialize");
238 const std::string tauSelNameLoose =
"TauAnalysisTools::TauSelectionToolLoose";
239 const std::string tauEffCorrNameLoose =
"TauAnalysisTools::TauEfficiencyCorrectionsToolLoose";
242 if (asg::ToolStore::contains<ITauSelTool>(tauSelNameLoose)) {
245 std::unique_ptr<ITauSelTool> tauSelectionTool = std::make_unique<TauSelTool>(tauSelNameLoose);
246 if (!tauJetConfigFileLoose.empty()) {
247 top::check(asg::setProperty(tauSelectionTool,
"ConfigPath", tauJetConfigFileLoose),
248 "Failed to set tau selection tool configuration path");
249 top::check(asg::setProperty(tauSelectionTool,
"OutputLevel", MSG::INFO),
250 "Failed to set tau OutputLevel");
253 top::check(asg::setProperty(tauSelectionTool,
"ConfigPath",
""),
254 "Failed to set tau selection tool configuration path");
255 top::check(asg::setProperty(tauSelectionTool,
"OutputLevel", MSG::INFO),
256 "Failed to set tau OutputLevel");
258 top::check(asg::setProperty(tauSelectionTool,
"SelectionCuts", iSelectionCutsLoose),
259 "Failed to set tau SelectionCuts");
260 top::check(asg::setProperty(tauSelectionTool,
"PtMin",
static_cast<double>(
m_config->tauPtcut() / 1
e3)),
261 "Failed to set tau pT cut");
262 top::check(asg::setProperty(tauSelectionTool,
"AbsEtaRegion",
m_config->tauEtaRegions()),
263 "Failed to set loose tau AbsEtaRegion");
264 top::check(asg::setProperty(tauSelectionTool,
"AbsCharge", absCharge),
265 "Failed to set loose tau AbsCharge");
266 top::check(asg::setProperty(tauSelectionTool,
"NTracks", nTracks),
267 "Failed to set loose tau NTracks");
268 top::check(asg::setProperty(tauSelectionTool,
"JetIDWP", tauJetIDWPLoose),
269 "Failed to set loose tau JetIDWP");
270 top::check(asg::setProperty(tauSelectionTool,
"EleIDWP", tauEleIDWPLoose),
271 "Failed to set loose tau EleIDWP");
273 "Failed to set tau MuonOLR");
275 top::check(tauSelectionTool->initialize(),
"Failed to initialize tauSelectionTool");
279 if (asg::ToolStore::contains<ITauEffCorrTool>(tauEffCorrNameLoose)) {
280 m_tauEffCorrTool = asg::ToolStore::get<ITauEffCorrTool>(tauEffCorrNameLoose);
282 std::unique_ptr<ITauEffCorrTool> tauEffCorrTool
283 = std::make_unique<TauEffCorrTool>(tauEffCorrNameLoose);
289 "Failed to set PileupReweightingTool for " + tauEffCorrNameLoose);
292 top::check(asg::setProperty(tauEffCorrTool,
"UseTauSubstructure",
m_config->tauSubstructureSFLoose()),
293 "Failed to set UseTauSubstructure for " + tauEffCorrNameLoose);
296 "Failed to set isAFII for " + tauEffCorrNameLoose);
300 "Failed to set TauSelectionTool for " + tauEffCorrNameLoose);
302 top::check(tauEffCorrTool->initialize(),
"Failed to initialize");
308 static const std::string tauSmearName =
"TauSmearingTool";
309 if (asg::ToolStore::contains<ITauSmearTool>(tauSmearName)) {
312 std::unique_ptr<TauSmearTool> tauSmearingTool = std::make_unique<TauSmearTool>(tauSmearName);
314 "Failed to set TauSmearingTools isAFII property");
315 top::check(tauSmearingTool->initialize(),
"Failed to initialize");
321 static const std::string tauTruthMatchingName =
"TauAnalysisTools::TauTruthMatchingTool";
322 if (asg::ToolStore::contains<ITauTruthMatchTool>(tauTruthMatchingName)) {
325 std::unique_ptr<TauTruthMatchTool> tauMatchingTool = std::make_unique<TauTruthMatchTool>(tauTruthMatchingName);
326 top::check(tauMatchingTool->setProperty(
"TruthJetContainerName",
"AntiKt4TruthDressedWZJets"),
"Failed to set truth collection for tau truth matching tool");
327 top::check(tauMatchingTool->initialize(),
"Failed to initialize");
333 return StatusCode::SUCCESS;