@@ -95,6 +95,7 @@ struct JetSpectraCharged {
9595 float configSwitchHigh = 9998.0 ;
9696
9797 float ptHardCalcMethodSwitch = 999.0 ;
98+ static constexpr float kBrokenPtHardSentinel = 1 .0f ;
9899
99100 enum AcceptSplitCollisionsOptions {
100101 NonSplitOnly = 0 ,
@@ -921,15 +922,24 @@ struct JetSpectraCharged {
921922 void processSpectraMCDWeighted (soa::Filtered<aod::JetCollisionsMCD>::iterator const & collision,
922923 soa::Join<aod::ChargedMCDetectorLevelJets, aod::ChargedMCDetectorLevelJetConstituents> const & jets,
923924 aod::JetTracks const &,
924- aod::JetMcCollisions const &)
925+ aod::JetMcCollisions const & mccollisions )
925926 {
926927 bool fillHistograms = false ;
927928 bool isWeighted = true ;
928929 float eventWeight = collision.weight ();
929930 if (!applyCollisionCuts (collision, fillHistograms, isWeighted, eventWeight)) {
930931 return ;
931932 }
932- float pTHat = collision.has_mcCollision () && collision.mcCollision ().ptHard () < ptHardCalcMethodSwitch ? collision.mcCollision ().ptHard () : simPtRef / (std::pow (eventWeight, 1.0 / pTHatExponent));
933+ // collision.mcCollision() auto-resolves to the wrong JMcCollisions binding here; bind via rawIteratorAt.
934+ float ptHardFromMc = ptHardCalcMethodSwitch;
935+ if (collision.mcCollisionId () >= 0 ) {
936+ float storedPtHard = mccollisions.rawIteratorAt (collision.mcCollisionId ()).ptHard ();
937+ // LHC26b5 ships placeholder ptHard=1.0; fall back to weight-derived.
938+ if (storedPtHard > kBrokenPtHardSentinel && storedPtHard < ptHardCalcMethodSwitch) {
939+ ptHardFromMc = storedPtHard;
940+ }
941+ }
942+ float pTHat = ptHardFromMc < ptHardCalcMethodSwitch ? ptHardFromMc : simPtRef / (std::pow (eventWeight, 1.0 / pTHatExponent));
933943 float centrality = -1.0 ;
934944 checkCentFT0M ? centrality = collision.centFT0M () : (centrality = (useFT0CVariant ? collision.centFT0CVariant1 () : collision.centFT0C ()));
935945
@@ -948,15 +958,24 @@ struct JetSpectraCharged {
948958 void processSpectraAreaSubMCDWeighted (soa::Filtered<soa::Join<aod::JetCollisionsMCD, aod::BkgChargedRhos>>::iterator const & collision,
949959 soa::Join<aod::ChargedMCDetectorLevelJets, aod::ChargedMCDetectorLevelJetConstituents> const & jets,
950960 aod::JetTracks const &,
951- aod::JetMcCollisions const &)
961+ aod::JetMcCollisions const & mccollisions )
952962 {
953963 bool fillHistograms = false ;
954964 bool isWeighted = true ;
955965 float eventWeight = collision.weight ();
956966 if (!applyCollisionCuts (collision, fillHistograms, isWeighted, eventWeight)) {
957967 return ;
958968 }
959- float pTHat = collision.has_mcCollision () && collision.mcCollision ().ptHard () < ptHardCalcMethodSwitch ? collision.mcCollision ().ptHard () : simPtRef / (std::pow (eventWeight, 1.0 / pTHatExponent));
969+ // See note in processSpectraMCDWeighted: avoid the wrong-type bind by
970+ // looking the MC collision up explicitly via the named subscribed table.
971+ float ptHardFromMc = ptHardCalcMethodSwitch;
972+ if (collision.mcCollisionId () >= 0 ) {
973+ float storedPtHard = mccollisions.rawIteratorAt (collision.mcCollisionId ()).ptHard ();
974+ if (storedPtHard > kBrokenPtHardSentinel && storedPtHard < ptHardCalcMethodSwitch) {
975+ ptHardFromMc = storedPtHard;
976+ }
977+ }
978+ float pTHat = ptHardFromMc < ptHardCalcMethodSwitch ? ptHardFromMc : simPtRef / (std::pow (eventWeight, 1.0 / pTHatExponent));
960979 float centrality = -1.0 ;
961980 checkCentFT0M ? centrality = collision.centFT0M () : (centrality = (useFT0CVariant ? collision.centFT0CVariant1 () : collision.centFT0C ()));
962981
@@ -1199,7 +1218,8 @@ struct JetSpectraCharged {
11991218 if (!applyMCCollisionCuts (mccollision, collisions, fillHistograms, isWeighted, eventWeight)) {
12001219 return ;
12011220 }
1202- float pTHat = mccollision.ptHard () < ptHardCalcMethodSwitch ? mccollision.ptHard () : simPtRef / (std::pow (eventWeight, 1.0 / pTHatExponent));
1221+ // LHC26b5 ships placeholder ptHard=1.0; fall back to weight-derived.
1222+ float pTHat = (mccollision.ptHard () > kBrokenPtHardSentinel && mccollision.ptHard () < ptHardCalcMethodSwitch) ? mccollision.ptHard () : simPtRef / (std::pow (eventWeight, 1.0 / pTHatExponent));
12031223 for (auto const & jet : jets) {
12041224 if (!jetfindingutilities::isInEtaAcceptance (jet, jetEtaMin, jetEtaMax, trackEtaMin, trackEtaMax)) {
12051225 continue ;
@@ -1231,7 +1251,9 @@ struct JetSpectraCharged {
12311251 if (!applyMCCollisionCuts (mccollision, collisions, fillHistograms, isWeighted, eventWeight)) {
12321252 return ;
12331253 }
1234- float pTHat = mccollision.ptHard () < ptHardCalcMethodSwitch ? mccollision.ptHard () : simPtRef / (std::pow (eventWeight, 1.0 / pTHatExponent));
1254+ // See note in processSpectraMCPWeighted re: ptHard=1.0 placeholder in
1255+ // current LHC26b5-class MC.
1256+ float pTHat = (mccollision.ptHard () > kBrokenPtHardSentinel && mccollision.ptHard () < ptHardCalcMethodSwitch) ? mccollision.ptHard () : simPtRef / (std::pow (eventWeight, 1.0 / pTHatExponent));
12351257 registry.fill (HIST (" h_mccollisions_rho" ), mccollision.rho (), eventWeight);
12361258
12371259 for (auto const & jet : jets) {
@@ -1314,15 +1336,24 @@ struct JetSpectraCharged {
13141336 ChargedMCDMatchedJets const & mcdjets,
13151337 ChargedMCPMatchedJets const &,
13161338 aod::JetTracks const &, aod::JetParticles const &,
1317- aod::JetMcCollisions const &)
1339+ aod::JetMcCollisions const & mccollisions )
13181340 {
13191341 bool fillHistograms = false ;
13201342 bool isWeighted = true ;
13211343 float eventWeight = collision.weight ();
13221344 if (!applyCollisionCuts (collision, fillHistograms, isWeighted, eventWeight)) {
13231345 return ;
13241346 }
1325- float pTHat = collision.has_mcCollision () && collision.mcCollision ().ptHard () < ptHardCalcMethodSwitch ? collision.mcCollision ().ptHard () : simPtRef / (std::pow (eventWeight, 1.0 / pTHatExponent));
1347+ // See note in processSpectraMCDWeighted: avoid the wrong-type bind by
1348+ // looking the MC collision up explicitly via the named subscribed table.
1349+ float ptHardFromMc = ptHardCalcMethodSwitch;
1350+ if (collision.mcCollisionId () >= 0 ) {
1351+ float storedPtHard = mccollisions.rawIteratorAt (collision.mcCollisionId ()).ptHard ();
1352+ if (storedPtHard > kBrokenPtHardSentinel && storedPtHard < ptHardCalcMethodSwitch) {
1353+ ptHardFromMc = storedPtHard;
1354+ }
1355+ }
1356+ float pTHat = ptHardFromMc < ptHardCalcMethodSwitch ? ptHardFromMc : simPtRef / (std::pow (eventWeight, 1.0 / pTHatExponent));
13261357 for (const auto & mcdjet : mcdjets) {
13271358 if (!isAcceptedJet<aod::JetTracks>(mcdjet)) {
13281359 continue ;
@@ -1365,9 +1396,21 @@ struct JetSpectraCharged {
13651396 if (!applyCollisionCuts (collision, fillHistograms, isWeighted, eventWeight)) {
13661397 return ;
13671398 }
1368- float pTHat = collision.has_mcCollision () && collision.mcCollision ().ptHard () < ptHardCalcMethodSwitch ? collision.mcCollision ().ptHard () : simPtRef / (std::pow (eventWeight, 1.0 / pTHatExponent));
1399+ // Here we already have JetBkgRhoMcCollisions explicitly subscribed; use the
1400+ // mcCollision_as<JetBkgRhoMcCollisions>() cast to dodge the wrong-type bind
1401+ // (same root cause as processSpectraMCDWeighted) and also guard against the
1402+ // ptHard=1.0 placeholder seen in current LHC26b5-class MC.
1403+ bool hasMc = collision.has_mcCollision ();
1404+ float ptHardFromMc = ptHardCalcMethodSwitch;
1405+ if (hasMc) {
1406+ float storedPtHard = collision.mcCollision_as <JetBkgRhoMcCollisions>().ptHard ();
1407+ if (storedPtHard > kBrokenPtHardSentinel && storedPtHard < ptHardCalcMethodSwitch) {
1408+ ptHardFromMc = storedPtHard;
1409+ }
1410+ }
1411+ float pTHat = ptHardFromMc < ptHardCalcMethodSwitch ? ptHardFromMc : simPtRef / (std::pow (eventWeight, 1.0 / pTHatExponent));
13691412
1370- double mcrho = collision. has_mcCollision () ? collision.mcCollision_as <JetBkgRhoMcCollisions>().rho () : -1 ;
1413+ double mcrho = hasMc ? collision.mcCollision_as <JetBkgRhoMcCollisions>().rho () : -1 ;
13711414
13721415 for (const auto & mcdjet : mcdjets) {
13731416 if (!isAcceptedJet<aod::JetTracks>(mcdjet)) {
0 commit comments