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