335{
336
337
338 nlohmann::json MC2MC_exceptions_DSID;
339 ATH_CHECK(
load_json(MC2MC_exceptions_DSID,
"JetCalibTools/MC2MC_exceptions_DSID.json") );
340 if( MC2MC_exceptions_DSID.contains(std::to_string(mcDSID)) ){
341 showerModel = MC2MC_exceptions_DSID[std::to_string(mcDSID)];
342 ATH_MSG_INFO(
"Sample DSID " << mcDSID <<
" is in the MC2MC_exceptions_DSID list, will be forcing the showerModel " << showerModel);
343 return StatusCode::SUCCESS;
344 }
345
346 if(generatorsInfo == ""){
347 showerModel="";
348 ATH_MSG_DEBUG(
"No generatorsInfo string provided, cannot parse showerModel.");
349 return StatusCode::SUCCESS;
350 }
351
352
353 TObjArray *generatorsInfo_fields = generatorsInfo.Tokenize("+");
354 float n_fields = generatorsInfo_fields->GetEntries();
355 std::string this_substr = ((TObjString *)(generatorsInfo_fields->At(n_fields-1)))->String().Data();
356
357
358 while( n_fields > 0 &&
359 (this_substr.starts_with("EvtGen") ||
360 this_substr.starts_with("Photos") ||
361 this_substr.starts_with("Tauola") ) ) {
362 generatorsInfo_fields->RemoveAt(n_fields-1);
363 n_fields--;
364
365 if ( n_fields == 0 ){
366 ATH_MSG_FATAL(
"No valid PS/Had model found in generatorsInfo string: " << generatorsInfo);
367 return StatusCode::FAILURE;
368 }
369
370 this_substr = ((TObjString *)(generatorsInfo_fields->At(n_fields-1)))->String().Data();
371 }
372 std::string full_pshadInfo = this_substr;
373
374
375 std::string genType = "";
376 std::string psType = "";
377 std::string hadType = "";
379 if (this_substr.starts_with("Herwigpp")){
380 genType = "Herwigpp";
381 psType = "angular";
382 hadType = "cluster";
383 } else if (this_substr.starts_with("Herwig")){
384 genType = "Herwig";
385 psType = "angular";
386 hadType = "cluster";
387 } else if (this_substr.starts_with("Sherpa")){
388 genType = "Sherpa";
389 psType = "dipole";
390 hadType = "cluster";
391 } else if (this_substr.starts_with("Pythia8B")){
392 genType = "PythiaB";
393 psType = "dipole";
394 hadType = "cluster";
396 } else if (this_substr.starts_with("Pythia")){
397 genType = "Pythia";
398 psType = "dipole";
399 hadType = "cluster";
400 } else {
401 ATH_MSG_FATAL(
"No valid generator type found in generatorsInfo string: " << generatorsInfo);
402 return StatusCode::FAILURE;
403 }
404
405
406 this_substr = this_substr.substr(this_substr.find("(v.") + 3);
407 if( full_pshadInfo.starts_with("Pythia8") && !this_substr.starts_with("8")){
409 }
410
411
412 std::vector<std::string> version_exceptions = {"alpha", "p", "bbb", "atlas", "beta", ")"};
413 for (const auto& exception : version_exceptions) {
414 if (this_substr.find(exception) != std::string::npos) {
415 this_substr.resize(this_substr.find(exception));
416 }
417 }
418
419
420 this_substr.erase(
std::remove(this_substr.begin(), this_substr.end(),
'.'), this_substr.end());
421
422
424
425
426 showerModel = genType+
"-"+
version+
"-"+psType+
"-"+hadType;
427
428
429
430 nlohmann::json MC2MC_showerRemap;
432
433 if( MC2MC_showerRemap.contains( genType+"-"+version+"-"+psType+"-"+hadType ) ){
434 std::string replaced_showerModel = MC2MC_showerRemap[ genType+
"-"+
version+
"-"+psType+
"-"+hadType ];
435 ATH_MSG_INFO(
"Sample with identified showerModel " << genType+
"-"+version+
"-"+psType+
"-"+hadType <<
" is in the MC2MC_showerRemap list, will be forcing the showerModel " << replaced_showerModel);
436 showerModel = replaced_showerModel;
437 } else if (MC2MC_showerRemap.contains( genType+"-"+version ) ){
438 std::string replaced_showerModel = MC2MC_showerRemap[ genType+
"-"+
version ];
439 replaced_showerModel += "-"+psType+"-"+hadType;
440 ATH_MSG_INFO(
"Sample with identified showerModel " << genType+
"-"+version+
"-"+psType+
"-"+hadType <<
" is in the MC2MC_showerRemap list, will be forcing the showerModel " << replaced_showerModel);
441 showerModel = replaced_showerModel;
442 }
443
444 return StatusCode::SUCCESS;
445}
StatusCode load_json(nlohmann::json &json_object, const std::string &json_filepath) const
DataModel_detail::iterator< DVL > remove(typename DataModel_detail::iterator< DVL > beg, typename DataModel_detail::iterator< DVL > end, const T &value)
Specialization of remove for DataVector/List.