44 return StatusCode::SUCCESS;
49 const std::string grl_tool_name =
"GoodRunsListSelectionTool";
50 if (asg::ToolStore::contains<IGRLTool>(grl_tool_name)) {
51 m_grlTool = asg::ToolStore::get<IGRLTool>(grl_tool_name);
55 ATH_MSG_WARNING(
"No GRL files provided -> Will NOT setup GoodRunsListSelectionTool.");
56 return StatusCode::SUCCESS;
60 std::vector<std::string>
names = {};
61 std::string grlDir =
m_config->grlDir();
62 if (grlDir.size()) grlDir +=
"/";
63 for (
const std::string&
grl :
m_config->grlFile()) {
68 "GRLSelector failed to set GRL");
70 "Failed to initialize GRLSelectionTool");
73 return StatusCode::SUCCESS;
77 const std::string prw_tool_name =
"PileupReweightingTool";
79 auto GetDefaultPRW = [
this](
bool isFS) {
81 std::string
path =
"dev/PileupReweighting/share/DSID";
89 path += isFS ?
"FS" :
"AFII";
93 if (!this->
m_config->isMC()) path =
"dev/PileupReweighting/share/DSID410xxx/pileup_mc20e_dsid410470_FS.root";
100 if (asg::ToolStore::contains<CP::IPileupReweightingTool>(prw_tool_name)) {
106 std::vector<std::string> pileup_config =
m_config->PileupConfig();
107 for (std::string&
s : pileup_config)
110 std::vector<std::string> pileup_lumi_calc =
m_config->PileupLumiCalc();
111 for (std::string&
s : pileup_lumi_calc)
114 std::vector<std::string> pileup_config_FS =
m_config->PileupConfig_FS();
115 if (pileup_config_FS.empty() && !
m_config->isAFII()) {
118 for (std::string&
s : pileup_config_FS) {
123 std::vector<std::string> pileup_config_AF =
m_config->PileupConfig_AF();
124 if (pileup_config_AF.empty() &&
m_config->isAFII()) {
127 for (std::string&
s : pileup_config_AF)
131 std::vector<std::string> actual_mu_FS =
m_config->PileupActualMu_FS();
132 for (std::string&
s : actual_mu_FS)
135 std::vector<std::string> actual_mu_AF =
m_config->PileupActualMu_AF();
136 for (std::string&
s : actual_mu_AF)
140 if ((pileup_config_AF.size() > 0 || pileup_config_FS.size() > 0) && (pileup_config.size() > 0)) {
141 ATH_MSG_ERROR(
"You have used PRWConfigFiles as well as PRWConfigFiles_FS and/or PRWConfigFiles_AF");
142 ATH_MSG_ERROR(
"We do not know how to configure with all these options");
143 return StatusCode::FAILURE;
147 "Failed to give GRLtool to pileup reweighting tool");
153 if (pileup_config.size() > 0) {
154 ATH_MSG_INFO(
"PRW tool is being configured without any FS/AF information");
155 top::check(asg::setProperty(pileupReweightingTool,
"ConfigFiles", pileup_config),
156 "Failed to set pileup reweighting config files");
157 }
else if (
m_config->isAFII() && pileup_config_AF.size() > 0) {
159 std::vector<std::string> final_config_AF = pileup_config_AF;
160 final_config_AF.insert(final_config_AF.end(), actual_mu_AF.begin(), actual_mu_AF.end());
162 ATH_MSG_INFO(
"PRW tool is being configured only with fast simulation (AF) config files");
163 top::check(asg::setProperty(pileupReweightingTool,
"ConfigFiles", final_config_AF),
164 "Failed to set pileup reweighting config files");
165 }
else if (!
m_config->isAFII() && pileup_config_FS.size() > 0) {
167 std::vector<std::string> final_config_FS = pileup_config_FS;
168 final_config_FS.insert(final_config_FS.end(), actual_mu_FS.begin(), actual_mu_FS.end());
170 ATH_MSG_INFO(
"PRW tool is being configured only with full simulation (FS) config files");
171 top::check(asg::setProperty(pileupReweightingTool,
"ConfigFiles", final_config_FS),
172 "Failed to set pileup reweighting config files");
174 ATH_MSG_ERROR(
"There are not any PRW config files provided with any allowed options");
175 return StatusCode::FAILURE;
179 double SF_nominal = 1.0 / 1.03;
180 double SF_up = 1.0 / 0.99;
181 double SF_down = 1.0 / 1.07;
184 if (
m_config->PileUpCustomScaleFactors().size() != 0) {
185 SF_nominal =
m_config->PileUpCustomScaleFactors()[0];
186 SF_up =
m_config->PileUpCustomScaleFactors()[1];
187 SF_down =
m_config->PileUpCustomScaleFactors()[2];
188 ATH_MSG_INFO(
"Using custom Data Scale-Factors for pile-up reweighting");
189 std::ostringstream oss;
190 oss <<
"Nominal:" << SF_nominal <<
" up:" << SF_up <<
" down:" << SF_down << std::endl;
194 top::check(asg::setProperty(pileupReweightingTool,
"LumiCalcFiles", pileup_lumi_calc),
195 "Failed to set pileup reweighting lumicalc files");
197 top::check(asg::setProperty(pileupReweightingTool,
"DataScaleFactor",
static_cast<Float_t
>(SF_nominal)),
198 "Failed to set pileup reweighting data scale factor");
199 top::check(asg::setProperty(pileupReweightingTool,
"DataScaleFactorUP", SF_up),
200 "Failed to set pileup reweighting data scale factor up");
201 top::check(asg::setProperty(pileupReweightingTool,
"DataScaleFactorDOWN", SF_down),
202 "Failed to set pileup reweighting data scale factor down");
204 top::check(asg::setProperty(pileupReweightingTool,
"UnrepresentedDataThreshold",
m_config->PileupDataTolerance()),
205 "Failed to set pileup reweighting data tolerance");
206 if (
m_config->PileupPeriodAssignments().size() > 0) {
208 top::check(asg::setProperty(pileupReweightingTool,
"PeriodAssignments",
m_config->PileupPeriodAssignments()),
209 "Failed to set pileup reweighting period assignments");
211 top::check(pileupReweightingTool->initialize(),
212 "Failed to initialize pileup reweighting tool");
216 return StatusCode::SUCCESS;
223 const std::string
name =
"PMGSherpa22VJetsWeightTool";
226 if (asg::ToolStore::contains<PMGTools::PMGSherpa22VJetsWeightTool>(
name)) {
227 tool = asg::ToolStore::get<PMGTools::PMGSherpa22VJetsWeightTool>(
name);
232 "Failed to set TruthJetContainer to " +
name);
238 const std::string truthWeightToolName =
"PMGTruthWeightTool";
246 delete truthweightTool;
247 ATH_MSG_WARNING(
"Failed to initialize " << truthWeightToolName <<
". Any features depending on PMGTruthWeightTool will not work!");
250 return StatusCode::SUCCESS;