diff --git a/PWGHF/DataModel/DerivedTables.h b/PWGHF/DataModel/DerivedTables.h index eb12c71a257..f247af3e047 100644 --- a/PWGHF/DataModel/DerivedTables.h +++ b/PWGHF/DataModel/DerivedTables.h @@ -32,7 +32,7 @@ DECLARE_SOA_COLUMN(IsEventReject, isEventReject, int8_t); //! collision rejectio DECLARE_SOA_COLUMN(MultFT0M, multFT0M, float); //! FT0M multiplicity } // namespace hf_coll_base -DECLARE_SOA_TABLE(HfD0CollBases, "AOD1", "HFD0COLLBASE", //! Table with basic collision info +DECLARE_SOA_TABLE(HfD0CollBases, "AOD", "HFD0COLLBASE", //! Table with basic collision info o2::soa::Index<>, collision::NumContrib, hf_coll_base::IsEventReject, @@ -40,7 +40,7 @@ DECLARE_SOA_TABLE(HfD0CollBases, "AOD1", "HFD0COLLBASE", //! Table with basic co using HfD0CollBase = HfD0CollBases::iterator; -DECLARE_SOA_TABLE(StoredHfD0CollBases, "AOD", "HFD0COLLBASE", //! Table with basic collision info (stored version) +DECLARE_SOA_TABLE(StoredHfD0CollBases, "AOD1", "HFD0COLLBASE", //! Table with basic collision info (stored version) o2::soa::Index<>, collision::NumContrib, hf_coll_base::IsEventReject, @@ -49,10 +49,10 @@ DECLARE_SOA_TABLE(StoredHfD0CollBases, "AOD", "HFD0COLLBASE", //! Table with bas using StoredHfD0CollBase = StoredHfD0CollBases::iterator; -DECLARE_SOA_TABLE(HfD0CollIds, "AOD1", "HFD0COLLID", //! Table with global indices for collisions +DECLARE_SOA_TABLE(HfD0CollIds, "AOD", "HFD0COLLID", //! Table with global indices for collisions hf_cand::CollisionId); -DECLARE_SOA_TABLE(StoredHfD0CollIds, "AOD", "HFD0COLLID", //! Table with global indices for collisions (stored version) +DECLARE_SOA_TABLE(StoredHfD0CollIds, "AOD1", "HFD0COLLID", //! Table with global indices for collisions (stored version) hf_cand::CollisionId, soa::Marker<1>); @@ -77,9 +77,36 @@ auto y(TPt pt, TEta eta, TM m) { return std::log((RecoDecay::sqrtSumOfSquares(m, pt * std::cosh(eta)) + pt * std::sinh(eta)) / RecoDecay::sqrtSumOfSquares(m, pt)); } + +template +auto px(TPt pt, TPhi phi) +{ + return pt * std::cos(phi); +} + +template +auto py(TPt pt, TPhi phi) +{ + return pt * std::sin(phi); +} + +template +auto pz(TPt pt, TPhi eta, TM m) +{ + return std::sqrt(pt * pt + m * m) * std::sinh(y(pt, eta, m)); +} + } // namespace functions DECLARE_SOA_DYNAMIC_COLUMN(Y, y, //! D0 rapidity [](float pt, float eta) -> float { return functions::y(pt, eta, o2::constants::physics::MassD0); }); +DECLARE_SOA_DYNAMIC_COLUMN(Px, px, //! D0 px + [](float pt, float phi) -> float { return functions::px(pt, phi); }); +DECLARE_SOA_DYNAMIC_COLUMN(Py, py, //! D0 py + [](float pt, float phi) -> float { return functions::py(pt, phi); }); +DECLARE_SOA_DYNAMIC_COLUMN(Pz, pz, //! D0 px + [](float pt, float eta) -> float { return functions::pz(pt, eta, o2::constants::physics::MassD0); }); +DECLARE_SOA_DYNAMIC_COLUMN(P, p, //! D0 momentum + [](float pt, float eta, float phi) -> float { return RecoDecay::p(functions::px(pt, phi), functions::py(pt, phi), functions::pz(pt, eta, o2::constants::physics::MassD0)); }); } // namespace hf_cand_base // Candidate properties used for selection @@ -158,30 +185,38 @@ DECLARE_SOA_COLUMN(MlScorePrompt, mlScorePrompt, float); //! ML score DECLARE_SOA_COLUMN(MlScoreNonPrompt, mlScoreNonPrompt, float); //! ML score for non-prompt class } // namespace hf_cand_mc -DECLARE_SOA_TABLE(HfD0Bases, "AOD1", "HFD0BASE", //! Table with basic candidate properties used in the analyses +DECLARE_SOA_TABLE(HfD0Bases, "AOD", "HFD0BASE", //! Table with basic candidate properties used in the analyses o2::soa::Index<>, hf_cand_base::HfD0CollBaseId, hf_cand_base::Pt, hf_cand_base::Eta, hf_cand_base::Phi, hf_cand_base::M, - hf_cand_base::Y); + hf_cand_base::Y, + hf_cand_base::Px, + hf_cand_base::Py, + hf_cand_base::Pz, + hf_cand_base::P); -DECLARE_SOA_TABLE(StoredHfD0Bases, "AOD", "HFD0BASE", //! Table with basic candidate properties used in the analyses (stored version) +DECLARE_SOA_TABLE(StoredHfD0Bases, "AOD1", "HFD0BASE", //! Table with basic candidate properties used in the analyses (stored version) o2::soa::Index<>, - hf_cand_base::StoredHfD0CollBaseId, + hf_cand_base::HfD0CollBaseId, hf_cand_base::Pt, hf_cand_base::Eta, hf_cand_base::Phi, hf_cand_base::M, hf_cand_base::Y, + hf_cand_base::Px, + hf_cand_base::Py, + hf_cand_base::Pz, + hf_cand_base::P, soa::Marker<1>); // candidates for removal: // PxProng0, PyProng0, PzProng0,... (same for 1, 2), we can keep Pt, Eta, Phi instead // XY: CpaXY, DecayLengthXY, ErrorDecayLengthXY // normalised: DecayLengthNormalised, DecayLengthXYNormalised, ImpactParameterNormalised0 -DECLARE_SOA_TABLE(HfD0Pars, "AOD1", "HFD0PAR", //! Table with candidate properties used for selection +DECLARE_SOA_TABLE(HfD0Pars, "AOD", "HFD0PAR", //! Table with candidate properties used for selection hf_cand::Chi2PCA, hf_cand_par::DecayLength, hf_cand_par::DecayLengthXY, @@ -210,7 +245,7 @@ DECLARE_SOA_TABLE(HfD0Pars, "AOD1", "HFD0PAR", //! Table with candidate properti hf_cand_par::MaxNormalisedDeltaIP, hf_cand_par::ImpactParameterProduct); -DECLARE_SOA_TABLE(StoredHfD0Pars, "AOD", "HFD0PAR", //! Table with candidate properties used for selection (stored version) +DECLARE_SOA_TABLE(StoredHfD0Pars, "AOD1", "HFD0PAR", //! Table with candidate properties used for selection (stored version) hf_cand::Chi2PCA, hf_cand_par::DecayLength, hf_cand_par::DecayLengthXY, @@ -240,7 +275,7 @@ DECLARE_SOA_TABLE(StoredHfD0Pars, "AOD", "HFD0PAR", //! Table with candidate pro hf_cand_par::ImpactParameterProduct, soa::Marker<1>); -DECLARE_SOA_TABLE(HfD0ParEs, "AOD1", "HFD0PARE", //! Table with additional candidate properties used for selection +DECLARE_SOA_TABLE(HfD0ParEs, "AOD", "HFD0PARE", //! Table with additional candidate properties used for selection collision::PosX, collision::PosY, collision::PosZ, @@ -264,7 +299,7 @@ DECLARE_SOA_TABLE(HfD0ParEs, "AOD1", "HFD0PARE", //! Table with additional candi hf_cand_par::CosThetaStar, hf_cand_par::Ct); -DECLARE_SOA_TABLE(StoredHfD0ParEs, "AOD", "HFD0PARE", //! Table with additional candidate properties used for selection (stored version) +DECLARE_SOA_TABLE(StoredHfD0ParEs, "AOD1", "HFD0PARE", //! Table with additional candidate properties used for selection (stored version) collision::PosX, collision::PosY, collision::PosZ, @@ -289,43 +324,47 @@ DECLARE_SOA_TABLE(StoredHfD0ParEs, "AOD", "HFD0PARE", //! Table with additional hf_cand_par::Ct, soa::Marker<1>); -DECLARE_SOA_TABLE(HfD0Sels, "AOD1", "HFD0SEL", //! Table with candidate selection flags +DECLARE_SOA_TABLE(HfD0Sels, "AOD", "HFD0SEL", //! Table with candidate selection flags hf_cand_sel::CandidateSelFlag); -DECLARE_SOA_TABLE(StoredHfD0Sels, "AOD", "HFD0SEL", //! Table with candidate selection flags (stored version) +DECLARE_SOA_TABLE(StoredHfD0Sels, "AOD1", "HFD0SEL", //! Table with candidate selection flags (stored version) hf_cand_sel::CandidateSelFlag, soa::Marker<1>); -DECLARE_SOA_TABLE(HfD0Ids, "AOD1", "HFD0ID", //! Table with global indices for candidates +DECLARE_SOA_TABLE(HfD0Ids, "AOD", "HFD0ID", //! Table with global indices for candidates hf_cand::CollisionId, hf_track_index::Prong0Id, hf_track_index::Prong1Id); -DECLARE_SOA_TABLE(StoredHfD0Ids, "AOD", "HFD0ID", //! Table with global indices for candidates (stored version) +DECLARE_SOA_TABLE(StoredHfD0Ids, "AOD1", "HFD0ID", //! Table with global indices for candidates (stored version) hf_cand::CollisionId, hf_track_index::Prong0Id, hf_track_index::Prong1Id, soa::Marker<1>); -DECLARE_SOA_TABLE(HfD0Mcs, "AOD1", "HFD0MC", //! Table with MC candidate info +DECLARE_SOA_TABLE(HfD0Mcs, "AOD", "HFD0MC", //! Table with MC candidate info hf_cand_mc::FlagMcMatchRec, hf_cand_mc::OriginMcRec); -DECLARE_SOA_TABLE(StoredHfD0Mcs, "AOD", "HFD0MC", //! Table with MC candidate info (stored version) +DECLARE_SOA_TABLE(StoredHfD0Mcs, "AOD1", "HFD0MC", //! Table with MC candidate info (stored version) hf_cand_mc::FlagMcMatchRec, hf_cand_mc::OriginMcRec, soa::Marker<1>); -DECLARE_SOA_TABLE(HfD0PBases, "AOD1", "HFD0PBASE", //! Table with MC particle info +DECLARE_SOA_TABLE(HfD0PBases, "AOD", "HFD0PBASE", //! Table with MC particle info o2::soa::Index<>, hf_cand_base::Pt, hf_cand_base::Eta, hf_cand_base::Phi, hf_cand_mc::FlagMcMatchGen, hf_cand_mc::OriginMcGen, - hf_cand_base::Y); + hf_cand_base::Y, + hf_cand_base::Px, + hf_cand_base::Py, + hf_cand_base::Pz, + hf_cand_base::P); -DECLARE_SOA_TABLE(StoredHfD0PBases, "AOD", "HFD0PBASE", //! Table with MC particle info (stored version) +DECLARE_SOA_TABLE(StoredHfD0PBases, "AOD1", "HFD0PBASE", //! Table with MC particle info (stored version) o2::soa::Index<>, hf_cand_base::Pt, hf_cand_base::Eta, @@ -333,13 +372,17 @@ DECLARE_SOA_TABLE(StoredHfD0PBases, "AOD", "HFD0PBASE", //! Table with MC partic hf_cand_mc::FlagMcMatchGen, hf_cand_mc::OriginMcGen, hf_cand_base::Y, + hf_cand_base::Px, + hf_cand_base::Py, + hf_cand_base::Pz, + hf_cand_base::P, soa::Marker<1>); -DECLARE_SOA_TABLE(HfD0PIds, "AOD1", "HFD0PID", //! Table with global indices for MC particles +DECLARE_SOA_TABLE(HfD0PIds, "AOD", "HFD0PID", //! Table with global indices for MC particles hf_cand_base::McCollisionId, hf_cand_base::McParticleId); -DECLARE_SOA_TABLE(StoredHfD0PIds, "AOD", "HFD0PID", //! Table with global indices for MC particles (stored version) +DECLARE_SOA_TABLE(StoredHfD0PIds, "AOD1", "HFD0PID", //! Table with global indices for MC particles (stored version) hf_cand_base::McCollisionId, hf_cand_base::McParticleId, soa::Marker<1>); diff --git a/PWGJE/Core/FastJetUtilities.cxx b/PWGJE/Core/FastJetUtilities.cxx index 73bfd282d16..8e678a75130 100644 --- a/PWGJE/Core/FastJetUtilities.cxx +++ b/PWGJE/Core/FastJetUtilities.cxx @@ -11,7 +11,7 @@ #include "FastJetUtilities.h" -void FastJetUtilities::setFastJetUserInfo(std::vector& constituents, int index, int status) +void fastjetutilities::setFastJetUserInfo(std::vector& constituents, int index, int status) { fastjet_user_info* user_info = new fastjet_user_info(status, index); // FIXME: can setting this as a pointer be avoided? constituents.back().set_user_info(user_info); @@ -29,10 +29,3 @@ void FastJetUtilities::setFastJetUserInfo(std::vector& const constituents.back().set_user_index(i); // FIXME: needed for constituent subtraction, but need to be quite careful to make sure indices dont overlap between tracks, clusters and HF candidates. Current solution might not be optimal } } - -// Selector of HF candidates -fastjet::Selector FastJetUtilities::SelectorIsHFCand() -{ - // This method is applied on particles or jet constituents only !!! - return fastjet::Selector(new SW_IsHFCand()); -} diff --git a/PWGJE/Core/FastJetUtilities.h b/PWGJE/Core/FastJetUtilities.h index be853563abc..cfc0aa0671b 100644 --- a/PWGJE/Core/FastJetUtilities.h +++ b/PWGJE/Core/FastJetUtilities.h @@ -33,7 +33,7 @@ enum class JetConstituentStatus { candidateHF = 2 }; -namespace FastJetUtilities +namespace fastjetutilities { static constexpr float mPion = 0.139; // TDatabasePDG::Instance()->GetParticle(211)->Mass(); //can be removed when pion mass becomes default for unidentified tracks @@ -72,29 +72,6 @@ class fastjet_user_info : public fastjet::PseudoJet::UserInfoBase void setFastJetUserInfo(std::vector& constituents, int index = -99999999, int status = static_cast(JetConstituentStatus::track)); -// Class defined to select the HF candidate particle -// This method is applied on particles or jet constituents only !!! -class SW_IsHFCand : public fastjet::SelectorWorker -{ - public: - // default ctor - SW_IsHFCand() {} - - // the selector's description - std::string description() const - { - return "HF candidate selector"; - } - - bool pass(const fastjet::PseudoJet& p) const - { - return (p.user_info().getStatus() == static_cast(JetConstituentStatus::candidateHF)); - } -}; - -// Selector of HF candidates -fastjet::Selector SelectorIsHFCand(); - /** * Add track as a pseudojet object to the fastjet vector * @@ -135,6 +112,6 @@ void fillClusters(const T& constituent, std::vector& constit setFastJetUserInfo(constituents, index, status); } -}; // namespace FastJetUtilities +}; // namespace fastjetutilities #endif // PWGJE_CORE_FASTJETUTILITIES_H_ diff --git a/PWGJE/Core/JetBkgSubUtils.cxx b/PWGJE/Core/JetBkgSubUtils.cxx index 27445f923af..336ebf9f67c 100644 --- a/PWGJE/Core/JetBkgSubUtils.cxx +++ b/PWGJE/Core/JetBkgSubUtils.cxx @@ -20,15 +20,20 @@ #include "PWGJE/Core/JetBkgSubUtils.h" #include "PWGJE/Core/FastJetUtilities.h" -JetBkgSubUtils::JetBkgSubUtils(float jetBkgR_out, float bkgEtaMin_out, float bkgEtaMax_out, float bkgPhiMin_out, float bkgPhiMax_out, float constSubAlpha_out, float constSubRMax_out, fastjet::GhostedAreaSpec ghostAreaSpec_out, int nHardReject) : jetBkgR(jetBkgR_out), - bkgEtaMin(bkgEtaMin_out), - bkgEtaMax(bkgEtaMax_out), - bkgPhiMin(bkgPhiMin_out), - bkgPhiMax(bkgPhiMax_out), - constSubAlpha(constSubAlpha_out), - constSubRMax(constSubRMax_out), - ghostAreaSpec(ghostAreaSpec_out) +JetBkgSubUtils::JetBkgSubUtils(float jetBkgR_out, float bkgEtaMin_out, float bkgEtaMax_out, float bkgPhiMin_out, float bkgPhiMax_out, float constSubAlpha_out, float constSubRMax_out, int nHardReject_out, fastjet::GhostedAreaSpec ghostAreaSpec_out) : jetBkgR(jetBkgR_out), + bkgEtaMin(bkgEtaMin_out), + bkgEtaMax(bkgEtaMax_out), + bkgPhiMin(bkgPhiMin_out), + bkgPhiMax(bkgPhiMax_out), + constSubAlpha(constSubAlpha_out), + constSubRMax(constSubRMax_out), + nHardReject(nHardReject_out), + ghostAreaSpec(ghostAreaSpec_out) +{ +} + +void JetBkgSubUtils::initialise() { // Note: if you are using the PerpCone method you should jetBkgR to be the same as the anit_kt jets R, otherwise use R=0.2 jetDefBkg = fastjet::JetDefinition(algorithmBkg, jetBkgR, recombSchemeBkg, fastjet::Best); @@ -38,13 +43,14 @@ JetBkgSubUtils::JetBkgSubUtils(float jetBkgR_out, float bkgEtaMin_out, float bkg std::tuple JetBkgSubUtils::estimateRhoAreaMedian(const std::vector& inputParticles, bool doSparseSub) { + JetBkgSubUtils::initialise(); if (inputParticles.size() == 0) { return std::make_tuple(0.0, 0.0); } // cluster the kT jets - fastjet::ClusterSequenceArea clusterSeq(removeHFCand ? selRemoveHFCand(inputParticles) : inputParticles, jetDefBkg, areaDefBkg); + fastjet::ClusterSequenceArea clusterSeq(inputParticles, jetDefBkg, areaDefBkg); // select jets in detector acceptance std::vector alljets = selRho(clusterSeq.inclusive_jets()); @@ -67,8 +73,13 @@ std::tuple JetBkgSubUtils::estimateRhoAreaMedian(const std::vect totalAreaCovered += ijet.area(); } // calculate Rho as the median of the jet pT / jet area - double rho = TMath::Median(rhovector.size(), rhovector.data()); - double rhoM = TMath::Median(rhoMdvector.size(), rhoMdvector.data()); + + double rho = 0.0; + double rhoM = 0.0; + if (rhovector.size() != 0) { + rho = TMath::Median(rhovector.size(), rhovector.data()); + rhoM = TMath::Median(rhoMdvector.size(), rhoMdvector.data()); + } if (doSparseSub) { // calculate The ocupancy factor, which the ratio of covered area / total area @@ -83,13 +94,11 @@ std::tuple JetBkgSubUtils::estimateRhoAreaMedian(const std::vect std::tuple JetBkgSubUtils::estimateRhoPerpCone(const std::vector& inputParticles, const std::vector& jets) { + JetBkgSubUtils::initialise(); if (inputParticles.size() == 0 || jets.size() == 0) { return std::make_tuple(0.0, 0.0); } - // Select a list of particles without the HF candidate - std::vector inputPartnoHF = removeHFCand ? selRemoveHFCand(inputParticles) : inputParticles; - double perpPtDensity1 = 0; double perpPtDensity2 = 0; double perpMdDensity1 = 0; @@ -113,7 +122,7 @@ std::tuple JetBkgSubUtils::estimateRhoPerpCone(const std::vector PerpendicularConeAxisPhi1 = RecoDecay::constrainAngle(leadingJet.phi() + (M_PI / 2.)); // This will contrain the angel between 0-2Pi PerpendicularConeAxisPhi2 = RecoDecay::constrainAngle(leadingJet.phi() - (M_PI / 2.)); // This will contrain the angel between 0-2Pi - for (auto& particle : inputPartnoHF) { + for (auto& particle : inputParticles) { // sum the momentum of all paricles that fill the two cones dPhi1 = particle.phi() - PerpendicularConeAxisPhi1; dPhi1 = RecoDecay::constrainAngle(dPhi1, -M_PI); // This will contrain the angel between -pi & Pi @@ -138,7 +147,7 @@ std::tuple JetBkgSubUtils::estimateRhoPerpCone(const std::vector return std::make_tuple(perpPtDensity, perpMdDensity); } -fastjet::PseudoJet JetBkgSubUtils::doRhoAreaSub(fastjet::PseudoJet& jet, double& rhoParam, double& rhoMParam) +fastjet::PseudoJet JetBkgSubUtils::doRhoAreaSub(fastjet::PseudoJet& jet, double rhoParam, double rhoMParam) { fastjet::Subtractor sub = fastjet::Subtractor(rhoParam, rhoMParam); @@ -148,18 +157,16 @@ fastjet::PseudoJet JetBkgSubUtils::doRhoAreaSub(fastjet::PseudoJet& jet, double& return sub(jet); } -std::vector JetBkgSubUtils::doEventConstSub(std::vector& inputParticles, double& rhoParam, double& rhoMParam) +std::vector JetBkgSubUtils::doEventConstSub(std::vector& inputParticles, double rhoParam, double rhoMParam) { + JetBkgSubUtils::initialise(); fastjet::contrib::ConstituentSubtractor constituentSub(rhoParam, rhoMParam); constituentSub.set_distance_type(fastjet::contrib::ConstituentSubtractor::deltaR); /// deltaR=sqrt((y_i-y_j)^2+(phi_i-phi_j)^2)), longitudinal Lorentz invariant constituentSub.set_max_distance(constSubRMax); constituentSub.set_alpha(constSubAlpha); constituentSub.set_ghost_area(ghostAreaSpec.ghost_area()); constituentSub.set_max_eta(maxEtaEvent); - if (removeHFCand) { - constituentSub.set_particle_selector(&selRemoveHFCand); - } // by default, the masses of all particles are set to zero. With this flag the jet mass will also be subtracted if (doRhoMassSub) { @@ -169,9 +176,9 @@ std::vector JetBkgSubUtils::doEventConstSub(std::vector JetBkgSubUtils::doJetConstSub(std::vector& jets, double& rhoParam, double& rhoMParam) +std::vector JetBkgSubUtils::doJetConstSub(std::vector& jets, double rhoParam, double rhoMParam) { - + JetBkgSubUtils::initialise(); if (jets.size() == 0) { return std::vector(); } @@ -184,9 +191,6 @@ std::vector JetBkgSubUtils::doJetConstSub(std::vector doEventConstSub(std::vector& inputParticles, double& rhoParam, double& rhoMParam); + std::vector doEventConstSub(std::vector& inputParticles, double rhoParam, double rhoMParam); /// @brief method that subtracts the background from jets using the jet-wise constituent subtractor /// @param jets (all jets in the event) /// @param rhoParam the underlying evvent density vs pT (to be set) /// @param rhoParam the underlying evvent density vs jet mass (to be set) /// @return jets, a vector of background subtracted jets - std::vector doJetConstSub(std::vector& jets, double& rhoParam, double& rhoMParam); + std::vector doJetConstSub(std::vector& jets, double rhoParam, double rhoMParam); // Setters void setJetBkgR(float jetbkgR_out) { jetBkgR = jetbkgR_out; } @@ -119,7 +121,6 @@ class JetBkgSubUtils } void setMaxEtaEvent(float etaMaxEvent) { maxEtaEvent = etaMaxEvent; } void setDoRhoMassSub(bool doMSub_out = true) { doRhoMassSub = doMSub_out; } - void setRemoveHFCandidate(bool removecandidate = true) { removeHFCand = removecandidate; } void setGhostAreaSpec(fastjet::GhostedAreaSpec ghostAreaSpec_out) { ghostAreaSpec = ghostAreaSpec_out; } void setJetDefinition(fastjet::JetDefinition jetdefbkg_out) { jetDefBkg = jetdefbkg_out; } void setAreaDefinition(fastjet::AreaDefinition areaDefBkg_out) { areaDefBkg = areaDefBkg_out; } @@ -135,7 +136,6 @@ class JetBkgSubUtils float getConstSubAlpha() const { return constSubAlpha; } float getConstSubRMax() const { return constSubRMax; } float getDoRhoMassSub() const { return doRhoMassSub; } - float getRemoveHFCandidate() const { return removeHFCand; } fastjet::GhostedAreaSpec getGhostAreaSpec() const { return ghostAreaSpec; } fastjet::JetDefinition getJetDefinition() const { return jetDefBkg; } fastjet::AreaDefinition getAreaDefinition() const { return areaDefBkg; } @@ -148,13 +148,13 @@ class JetBkgSubUtils float jetBkgR = 0.2; float bkgEtaMin = -0.9; float bkgEtaMax = 0.9; - float bkgPhiMin = -99.0; - float bkgPhiMax = 99.0; + float bkgPhiMin = 0.0; + float bkgPhiMax = 2.0 * M_PI; float constSubAlpha = 1.0; - float constSubRMax = 0.6; + float constSubRMax = 0.24; float maxEtaEvent = 0.9; + int nHardReject = 2; bool doRhoMassSub = false; /// flag whether to do jet mass subtraction with the const sub - bool removeHFCand = false; /// flag whether to remove the HF candidate from the list of particles fastjet::GhostedAreaSpec ghostAreaSpec = fastjet::GhostedAreaSpec(); fastjet::JetAlgorithm algorithmBkg = fastjet::kt_algorithm; @@ -162,7 +162,6 @@ class JetBkgSubUtils fastjet::JetDefinition jetDefBkg = fastjet::JetDefinition(algorithmBkg, jetBkgR, recombSchemeBkg, fastjet::Best); fastjet::AreaDefinition areaDefBkg = fastjet::AreaDefinition(fastjet::active_area_explicit_ghosts, ghostAreaSpec); fastjet::Selector selRho = fastjet::Selector(); - fastjet::Selector selRemoveHFCand = !FastJetUtilities::SelectorIsHFCand(); }; // class JetBkgSubUtils diff --git a/PWGJE/Core/JetDerivedDataUtilities.h b/PWGJE/Core/JetDerivedDataUtilities.h index 8ba572cde6f..d197a185afa 100644 --- a/PWGJE/Core/JetDerivedDataUtilities.h +++ b/PWGJE/Core/JetDerivedDataUtilities.h @@ -22,7 +22,7 @@ #include "Common/DataModel/EventSelection.h" #include "PWGJE/Core/JetFinder.h" -namespace JetDerivedDataUtilities +namespace jetderiveddatautilities { enum JCollisionSel { @@ -273,14 +273,21 @@ uint8_t setTrackSelectionBit(T const& track) return bit; } +uint8_t setSingleTrackSelectionBit(int trackSelection) +{ + uint8_t bit = 0; + if (trackSelection != -1) { + SETBIT(bit, trackSelection); + } + return bit; +} + template float trackEnergy(T const& track, float mass = JetFinder::mPion) { return std::sqrt((track.p() * track.p()) + (mass * mass)); } -} // namespace JetDerivedDataUtilities - -// namespace JetDerivedDataUtilities +} // namespace jetderiveddatautilities #endif // PWGJE_CORE_JETDERIVEDDATAUTILITIES_H_ diff --git a/PWGJE/Core/JetFinder.cxx b/PWGJE/Core/JetFinder.cxx index 71680d70a30..940a201bb92 100644 --- a/PWGJE/Core/JetFinder.cxx +++ b/PWGJE/Core/JetFinder.cxx @@ -51,10 +51,8 @@ fastjet::ClusterSequenceArea JetFinder::findJets(std::vector { setParams(); jets.clear(); - fastjet::ClusterSequenceArea clusterSeq(inputParticles, jetDef, areaDef); jets = clusterSeq.inclusive_jets(); - jets = selJets(jets); jets = fastjet::sorted_by_pt(jets); if (isReclustering) { diff --git a/PWGJE/Core/JetFinder.h b/PWGJE/Core/JetFinder.h index b400d1fdba5..b72082440f0 100644 --- a/PWGJE/Core/JetFinder.h +++ b/PWGJE/Core/JetFinder.h @@ -86,31 +86,31 @@ class JetFinder fastjet::Selector selGhosts; /// Default constructor - explicit JetFinder(float eta_Min = -0.9, float eta_Max = 0.9, float phi_Min = 0.0, float phi_Max = 2 * M_PI) : phiMin(phi_Min), - phiMax(phi_Max), - etaMin(eta_Min), - etaMax(eta_Max), - jetR(0.4), - jetPtMin(0.0), - jetPtMax(1000.0), - jetPhiMin(phi_Min), - jetPhiMax(phi_Max), - jetEtaMin(-99.0), - jetEtaMax(99.0), - jetEtaDefault(false), - ghostEtaMin(eta_Min), - ghostEtaMax(eta_Max), - ghostArea(0.005), - ghostRepeatN(1), - ghostktMean(1e-100), // is float precise enough? - gridScatter(1.0), - ktScatter(0.1), - isReclustering(false), - isTriggering(false), - algorithm(fastjet::antikt_algorithm), - recombScheme(fastjet::E_scheme), - strategy(fastjet::Best), - areaType(fastjet::active_area) + explicit JetFinder(float eta_Min = -0.9, float eta_Max = 0.9, float phi_Min = 0.0, float phi_Max = 2.0 * M_PI) : phiMin(phi_Min), + phiMax(phi_Max), + etaMin(eta_Min), + etaMax(eta_Max), + jetR(0.4), + jetPtMin(0.0), + jetPtMax(1000.0), + jetPhiMin(phi_Min), + jetPhiMax(phi_Max), + jetEtaMin(-99.0), + jetEtaMax(99.0), + jetEtaDefault(false), + ghostEtaMin(eta_Min), + ghostEtaMax(eta_Max), + ghostArea(0.005), + ghostRepeatN(1), + ghostktMean(1e-100), // is float precise enough? + gridScatter(1.0), + ktScatter(0.1), + isReclustering(false), + isTriggering(false), + algorithm(fastjet::antikt_algorithm), + recombScheme(fastjet::E_scheme), + strategy(fastjet::Best), + areaType(fastjet::active_area) { // default constructor diff --git a/PWGJE/Core/JetFindingUtilities.h b/PWGJE/Core/JetFindingUtilities.h new file mode 100644 index 00000000000..80f5a02fc44 --- /dev/null +++ b/PWGJE/Core/JetFindingUtilities.h @@ -0,0 +1,252 @@ +// Copyright 2019-2020 CERN and copyright holders of ALICE O2. +// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders. +// All rights not expressly granted are reserved. +// +// This software is distributed under the terms of the GNU General Public +// License v3 (GPL Version 3), copied verbatim in the file "COPYING". +// +// In applying this license CERN does not waive the privileges and immunities +// granted to it by virtue of its status as an Intergovernmental Organization +// or submit itself to any jurisdiction. + +/// \file JetFindingUtilities.h +/// \brief Jet Finding related utilities +/// +/// \author Nima Zardoshti + +#ifndef PWGJE_CORE_JETFINDINGUTILITIES_H_ +#define PWGJE_CORE_JETFINDINGUTILITIES_H_ + +#include +#include +#include +#include +#include + +#include "Framework/AnalysisTask.h" +#include "Framework/AnalysisDataModel.h" +#include "Framework/ASoA.h" +#include "Framework/O2DatabasePDGPlugin.h" + +#include "Framework/Logger.h" +#include "Common/Core/TrackSelection.h" +#include "Common/Core/TrackSelectionDefaults.h" +#include "Common/DataModel/EventSelection.h" +#include "Common/DataModel/TrackSelectionTables.h" +#include "PWGJE/DataModel/EMCALClusters.h" + +#include "PWGHF/DataModel/CandidateReconstructionTables.h" +#include "PWGHF/DataModel/CandidateSelectionTables.h" + +// #include "PWGJE/Core/JetBkgSubUtils.h" +#include "PWGJE/Core/FastJetUtilities.h" +#include "PWGJE/Core/JetDerivedDataUtilities.h" +#include "PWGJE/Core/JetFinder.h" +#include "PWGJE/Core/JetHFUtilities.h" +#include "PWGJE/DataModel/Jet.h" + +namespace jetfindingutilities +{ + +/** + * Adds tracks to a fastjet inputParticles list + * + * @param inputParticles fastjet container + * @param tracks track table to be added + * @param trackSelection track selection to be applied to tracks + * @param candidate optional HF candidiate + */ + +template +void analyseTracks(std::vector& inputParticles, T const& tracks, int trackSelection, std::optional const& candidate = std::nullopt) +{ + for (auto& track : tracks) { + if (!jetderiveddatautilities::selectTrack(track, trackSelection)) { + continue; + } + if (candidate != std::nullopt) { + auto cand = candidate.value(); + if (jethfutilities::isDaughterTrack(track, cand, tracks)) { + continue; + } + } + fastjetutilities::fillTracks(track, inputParticles, track.globalIndex()); + } +} + +/** + * Adds clusters to a fastjet inputParticles list + * + * @param inputParticles fastjet container + * @param clusters track table to be added + */ +template +void analyseClusters(std::vector& inputParticles, T const& clusters) +{ + for (auto& cluster : *clusters) { + // add cluster selections + fastjetutilities::fillClusters(cluster, inputParticles, cluster.globalIndex()); + } +} + +/** + * Adds hf candidates to a fastjet inputParticles list (for data) + * + * @param inputParticles fastjet container + * @param candMass pdg mass of hf candidate + * @param candPtMin minimum pT of hf candidate + * @param candPtMax maximum pT of hf candidate + * @param candYMin minimum Y of hf candidate + * @param candYMax maximum Y of hf candidate + * @param candidate hf candidate + */ +template +bool analyseCandidate(std::vector& inputParticles, T const& candidate, float candPtMin, float candPtMax, float candYMin, float candYMax, float candMass) +{ + if (isnan(candidate.y())) { + return false; + } + if (candidate.y() < candYMin || candidate.y() > candYMax) { + return false; + } + if (candidate.pt() < candPtMin || candidate.pt() >= candPtMax) { + return false; + } + fastjetutilities::fillTracks(candidate, inputParticles, candidate.globalIndex(), static_cast(JetConstituentStatus::candidateHF), candMass); + return true; +} + +/** + * Adds hf candidates to a fastjet inputParticles list (for MC det) + * + * @param inputParticles fastjet container + * @param candMass pdg mass of hf candidate + * @param candPtMin minimum pT of hf candidate + * @param candPtMax maximum pT of hf candidate + * @param candYMin minimum Y of hf candidate + * @param candYMax maximum Y of hf candidate + * @param candidate hf candidate + * @param rejectBackgroundMCCandidates choose whether to accept background hf candidates as defined by the selection flag + */ +template +bool analyseCandidateMC(std::vector& inputParticles, T const& candidate, float candPtMin, float candPtMax, float candYMin, float candYMax, float candMass, bool rejectBackgroundMCCandidates) +{ + if (rejectBackgroundMCCandidates && !jethfutilities::isMatchedHFCandidate(candidate)) { + return false; + } + return analyseCandidate(inputParticles, candidate, candPtMin, candPtMax, candYMin, candYMax, candMass); +} + +/** + * Performs jet finding and fills jet tables + * + * @param jetFinder JetFinder object which carries jet finding parameters + * @param inputParticles fastjet container + * @param jetRadius jet finding radii + * @param collision the collision within which jets are being found + * @param jetsTable output table of jets + * @param constituentsTable output table of jet constituents + * @param doHFJetFinding set whether only jets containing a HF candidate are saved + */ +template +void findJets(JetFinder& jetFinder, std::vector& inputParticles, std::vector jetRadius, T const& collision, U& jetsTable, V& constituentsTable, bool doHFJetFinding = false) +{ + auto jetRValues = static_cast>(jetRadius); + for (auto R : jetRValues) { + jetFinder.jetR = R; + std::vector jets; + fastjet::ClusterSequenceArea clusterSeq(jetFinder.findJets(inputParticles, jets)); + for (const auto& jet : jets) { + bool isHFJet = false; + if (doHFJetFinding) { + for (const auto& constituent : jet.constituents()) { + if (constituent.template user_info().getStatus() == static_cast(JetConstituentStatus::candidateHF)) { + isHFJet = true; + break; + } + } + if (!isHFJet) { + continue; + } + } + std::vector trackconst; + std::vector candconst; + std::vector clusterconst; + jetsTable(collision.globalIndex(), jet.pt(), jet.eta(), jet.phi(), + jet.E(), jet.m(), jet.has_area() ? jet.area() : 0., std::round(R * 100)); + for (const auto& constituent : sorted_by_pt(jet.constituents())) { + if (constituent.template user_info().getStatus() == static_cast(JetConstituentStatus::track)) { + trackconst.push_back(constituent.template user_info().getIndex()); + } + if (constituent.template user_info().getStatus() == static_cast(JetConstituentStatus::cluster)) { + clusterconst.push_back(constituent.template user_info().getIndex()); + } + if (constituent.template user_info().getStatus() == static_cast(JetConstituentStatus::candidateHF)) { + candconst.push_back(constituent.template user_info().getIndex()); + } + } + constituentsTable(jetsTable.lastIndex(), trackconst, clusterconst, candconst); + } + } +} + +/** + * Adds particles to a fastjet inputParticles list + * + * @param inputParticles fastjet container + * @param particleSelection particle selection to be applied to particles + * @param jetTypeParticleLevel set whether charged particles, neutral particles or both are accepted + * @param particles particle table to be added + * @param pdgDatabase database of pdg codes + * @param candidate optional hf candidiate + */ +template +void analyseParticles(std::vector& inputParticles, std::string particleSelection, int jetTypeParticleLevel, T const& particles, o2::framework::Service pdgDatabase, std::optional const& candidate = std::nullopt) +{ + for (auto& particle : particles) { + if (particleSelection == "PhysicalPrimary" && !particle.isPhysicalPrimary()) { // CHECK : Does this exclude the HF hadron? + continue; + } else if (particleSelection == "HepMCStatus" && particle.getHepMCStatusCode() != 1) { // do we need isPhysicalPrimary as well? Note: Might give unforseen results if the generator isnt PYTHIA + continue; + } else if (particleSelection == "GenStatus" && particle.getGenStatusCode() != 1) { + continue; + } else if (particleSelection == "PhysicalPrimaryAndHepMCStatus" && (!particle.isPhysicalPrimary() || particle.getHepMCStatusCode() != 1)) { + continue; + } + if (isinf(particle.eta())) { + continue; + } + auto pdgParticle = pdgDatabase->GetParticle(particle.pdgCode()); + auto pdgCharge = pdgParticle ? std::abs(pdgParticle->Charge()) : -1.0; + if (jetTypeParticleLevel == static_cast(JetType::charged) && pdgCharge < 3.0) { + continue; + } + if (jetTypeParticleLevel == static_cast(JetType::neutral) && pdgCharge != 0.0) { + continue; + } + if constexpr (jethfutilities::isHFMcCandidate()) { + if (candidate != std::nullopt) { + auto cand = candidate.value(); + auto hfParticle = cand.template mcParticle_as(); + if (jethfutilities::isDaughterParticle(hfParticle, particles, particle.globalIndex()) || (hfParticle.globalIndex() == particle.globalIndex())) { + continue; + } + } + } + fastjetutilities::fillTracks(particle, inputParticles, particle.globalIndex(), static_cast(JetConstituentStatus::track), pdgParticle->Mass()); + } +} + +template +bool isInEtaAcceptance(T const& jet, float jetEtaMin, float jetEtaMax, float etaMin = -0.9, float etaMax = 0.9) +{ + if (jetEtaMin < -98.0) { + return (jet.eta() >= etaMin + (jet.r() / 100.0) && jet.eta() <= etaMax - (jet.r() / 100.0)); + } else { + return (jet.eta() >= jetEtaMin && jet.eta() <= jetEtaMax); + } +} + +}; // namespace jetfindingutilities + +#endif // PWGJE_CORE_JETFINDINGUTILITIES_H_ diff --git a/PWGJE/Core/JetHFUtilities.h b/PWGJE/Core/JetHFUtilities.h new file mode 100644 index 00000000000..b9b3e3c071b --- /dev/null +++ b/PWGJE/Core/JetHFUtilities.h @@ -0,0 +1,542 @@ +// Copyright 2019-2020 CERN and copyright holders of ALICE O2. +// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders. +// All rights not expressly granted are reserved. +// +// This software is distributed under the terms of the GNU General Public +// License v3 (GPL Version 3), copied verbatim in the file "COPYING". +// +// In applying this license CERN does not waive the privileges and immunities +// granted to it by virtue of its status as an Intergovernmental Organization +// or submit itself to any jurisdiction. + +/// \file JetHFUtilities.h +/// \brief Jet HF related utilities +/// +/// \author Nima Zardoshti + +#ifndef PWGJE_CORE_JETHFUTILITIES_H_ +#define PWGJE_CORE_JETHFUTILITIES_H_ + +#include +#include +#include +#include + +#include "Framework/AnalysisTask.h" +#include "Framework/AnalysisDataModel.h" +#include "Framework/ASoA.h" +#include "Framework/O2DatabasePDGPlugin.h" + +#include "Framework/Logger.h" +#include "Common/Core/TrackSelection.h" +#include "Common/Core/TrackSelectionDefaults.h" +#include "Common/DataModel/EventSelection.h" +#include "Common/DataModel/TrackSelectionTables.h" +#include "PWGJE/DataModel/EMCALClusters.h" + +#include "PWGHF/DataModel/CandidateReconstructionTables.h" +#include "PWGHF/DataModel/CandidateSelectionTables.h" +#include "PWGHF/DataModel/DerivedTables.h" + +#include "PWGJE/Core/FastJetUtilities.h" +#include "PWGJE/Core/JetDerivedDataUtilities.h" +#include "PWGJE/Core/JetFinder.h" +#include "PWGJE/DataModel/Jet.h" + +namespace jethfutilities +{ + +/** + * returns true if the candidate is from a D0 table + */ +template +constexpr bool isD0Candidate() +{ + return std::is_same_v, CandidatesD0Data::iterator> || std::is_same_v, CandidatesD0Data::filtered_iterator> || std::is_same_v, CandidatesD0MCD::iterator> || std::is_same_v, CandidatesD0MCD::filtered_iterator>; +} + +/** + * returns true if the particle is from a D0 MC table + */ +template +constexpr bool isD0McCandidate() +{ + return std::is_same_v, CandidatesD0MCP::iterator> || std::is_same_v, CandidatesD0MCP::filtered_iterator>; +} + +/** + * returns true if the table is a D0 table + */ +template +constexpr bool isD0Table() +{ + + return isD0Candidate() || isD0Candidate(); +} + +/** + * returns true if the table is a D0 MC table + */ +template +constexpr bool isD0McTable() +{ + + return isD0McCandidate() || isD0McCandidate(); +} + +/** + * returns true if the candidate is from a Lc table + */ +template +constexpr bool isLcCandidate() +{ + return std::is_same_v, CandidatesLcData::iterator> || std::is_same_v, CandidatesLcData::filtered_iterator> || std::is_same_v, CandidatesLcMCD::iterator> || std::is_same_v, CandidatesLcMCD::filtered_iterator>; +} + +/** + * returns true if the particle is from a Lc MC table + */ +template +constexpr bool isLcMcCandidate() +{ + return std::is_same_v, CandidatesLcMCP::iterator> || std::is_same_v, CandidatesLcMCP::filtered_iterator>; +} + +/** + * returns true if the table is a Lc table + */ +template +constexpr bool isLcTable() +{ + return isLcCandidate() || isLcCandidate(); +} + +/** + * returns true if the table is a Lc MC table + */ +template +constexpr bool isLcMcTable() +{ + return isLcMcCandidate() || isLcMcCandidate(); +} + +/** + * returns true if the candidate is from a Bplus table + */ +template +constexpr bool isBplusCandidate() +{ + return std::is_same_v, CandidatesBplusData::iterator> || std::is_same_v, CandidatesBplusData::filtered_iterator> || std::is_same_v, CandidatesBplusMCD::iterator> || std::is_same_v, CandidatesBplusMCD::filtered_iterator>; +} + +/** + * returns true if the particle is from a Bplus MC table + */ +template +constexpr bool isBplusMcCandidate() +{ + return std::is_same_v, CandidatesBplusMCP::iterator> || std::is_same_v, CandidatesBplusMCP::filtered_iterator>; +} + +/** + * returns true if the table is a Bplus table + */ +template +constexpr bool isBplusTable() +{ + return isBplusCandidate() || isBplusCandidate(); +} + +/** + * returns true if the table is a Bplus MC table + */ +template +constexpr bool isBplusMcTable() +{ + return isBplusMcCandidate() || isBplusMcCandidate(); +} + +/** + * returns true if the candidate is from a HF table + * * @param candidate candidate that is being checked + */ +template +constexpr bool isHFCandidate() +{ + if constexpr (isD0Candidate()) { + return true; + } else if constexpr (isLcCandidate()) { + return true; + } else if constexpr (isBplusCandidate()) { + return true; + } else { + return false; + } +} + +/** + * returns true if the candidate is from a MC HF table + * * @param candidate candidate that is being checked + */ +template +constexpr bool isHFMcCandidate() +{ + + if constexpr (isD0McCandidate()) { + return true; + } else if constexpr (isLcMcCandidate()) { + return true; + } else if constexpr (isBplusMcCandidate()) { + return true; + } else { + return false; + } +} + +/** + * returns true if the table type is a HF table + */ +template +constexpr bool isHFTable() +{ + + if constexpr (isD0Candidate() || isD0Candidate()) { + return true; + } else if constexpr (isLcCandidate() || isLcCandidate()) { + return true; + } else if constexpr (isBplusCandidate() || isBplusCandidate()) { + return true; + } else { + return false; + } +} + +/** + * returns true if the table type is a HF table + */ +template +constexpr bool isHFMcTable() +{ + + if constexpr (isD0McCandidate() || isD0McCandidate()) { + return true; + } else if constexpr (isLcMcCandidate() || isLcMcCandidate()) { + return true; + } else if constexpr (isBplusMcCandidate() || isBplusMcCandidate()) { + return true; + } else { + return false; + } +} + +/** + * returns true if the candidate is matched to a reconstructed level candidate with the correct decay + * * @param candidate candidate that is being checked + */ +template +constexpr bool isMatchedHFCandidate(T const& candidate) +{ + + if constexpr (isD0Candidate()) { + if (std::abs(candidate.flagMcMatchRec()) == 1 << o2::aod::hf_cand_2prong::DecayType::D0ToPiK) { + return true; + } else { + return false; + } + } else if constexpr (isLcCandidate()) { + if (std::abs(candidate.flagMcMatchRec()) == 1 << o2::aod::hf_cand_3prong::DecayType::LcToPKPi) { + return true; + } else { + return false; + } + } else if constexpr (isBplusCandidate()) { + if (std::abs(candidate.flagMcMatchRec()) == 1 << o2::aod::hf_cand_bplus::DecayType::BplusToD0Pi) { + return true; + } else { + return false; + } + } else if constexpr (isD0McCandidate()) { + if (std::abs(candidate.flagMcMatchGen()) == 1 << o2::aod::hf_cand_2prong::DecayType::D0ToPiK) { + return true; + } else { + return false; + } + } else if constexpr (isLcMcCandidate()) { + if (std::abs(candidate.flagMcMatchGen()) == 1 << o2::aod::hf_cand_3prong::DecayType::LcToPKPi) { + return true; + } else { + return false; + } + } else if constexpr (isBplusMcCandidate()) { + if (std::abs(candidate.flagMcMatchGen()) == 1 << o2::aod::hf_cand_bplus::DecayType::BplusToD0Pi) { + return true; + } else { + return false; + } + } else { + return false; + } +} + +/** + * returns true if the track is a daughter of the HF candidate + * + * @param track track that is being checked + * @param candidate HF candidate that is being checked + * @param tracks the track table + */ +template +bool isDaughterTrack(T& track, U& candidate, V& tracks) +{ + + if constexpr (isD0Candidate()) { + if (candidate.template prong0_as().globalIndex() == track.globalIndex() || candidate.template prong1_as().globalIndex() == track.globalIndex()) { + return true; + } else { + return false; + } + } else if constexpr (isLcCandidate()) { + if (candidate.template prong0_as().globalIndex() == track.globalIndex() || candidate.template prong1_as().globalIndex() == track.globalIndex() || candidate.template prong2_as().globalIndex() == track.globalIndex()) { + return true; + } else { + return false; + } + } else if constexpr (isBplusCandidate()) { + if (candidate.template prong0_as().template prong0_as().globalIndex() == track.globalIndex() || candidate.template prong0_as().template prong1_as().globalIndex() == track.globalIndex() || candidate.template prong1_as().globalIndex() == track.globalIndex()) { + return true; + } else { + return false; + } + } else { + return false; + } +} + +/** + * returns true if the particle has any daughters with the given global index + * + * @param candidate mother hf particle that is being checked + * @param globalIndex global index of potnetial daughter particle + */ +template +bool isDaughterParticle(T const& particle, U const& particles, int globalIndex) +{ + for (auto daughter : particle.template daughters_as()) { + if (daughter.globalIndex() == globalIndex) { + return true; + } + if (isDaughterParticle(daughter, particles, globalIndex)) { + return true; + } + } + return false; +} + +/** + * returns a slice of the table depending on the index of the candidate + * + * @param candidate HF candidate that is being checked + * @param table the table to be sliced + */ +template +auto slicedPerCandidate(T const& table, U const& candidate, V const& perD0Candidate, M const& perLcCandidate, N const& perBplusCandidate) +{ + + if constexpr (isD0Candidate()) { + return table.sliceBy(perD0Candidate, candidate.globalIndex()); + } else if constexpr (isLcCandidate()) { + return table.sliceBy(perLcCandidate, candidate.globalIndex()); + } else if constexpr (isBplusCandidate()) { + return table.sliceBy(perBplusCandidate, candidate.globalIndex()); + } else { + return table; + } +} + +template +int getCandidatePDG(T const& candidate) +{ + + if constexpr (isD0Candidate() || isD0McCandidate()) { + return static_cast(o2::constants::physics::Pdg::kD0); + } + if constexpr (isLcCandidate() || isLcMcCandidate()) { + return static_cast(o2::constants::physics::Pdg::kLambdaCPlus); + } + if constexpr (isBplusCandidate() || isBplusMcCandidate()) { + return static_cast(o2::constants::physics::Pdg::kBPlus); + } else { + return 0; + } +} + +template +int getTablePDG() +{ + + if constexpr (isD0Table() || isD0McTable()) { + return static_cast(o2::constants::physics::Pdg::kD0); + } + if constexpr (isLcTable() || isLcMcTable()) { + return static_cast(o2::constants::physics::Pdg::kLambdaCPlus); + } + if constexpr (isBplusTable() || isBplusMcTable()) { + return static_cast(o2::constants::physics::Pdg::kBPlus); + } else { + return 0; + } +} + +template +float getCandidatePDGMass(T const& candidate) +{ + + if constexpr (isD0Candidate() || isD0McCandidate()) { + return static_cast(o2::constants::physics::MassD0); + } + if constexpr (isLcCandidate() || isLcMcCandidate()) { + return static_cast(o2::constants::physics::MassLambdaCPlus); + } + if constexpr (isBplusCandidate() || isBplusMcCandidate()) { + return static_cast(o2::constants::physics::MassBPlus); + } else { + return 0.; + } +} + +template +float getTablePDGMass() +{ + + if constexpr (isD0Table() || isD0McTable()) { + return static_cast(o2::constants::physics::MassD0); + } + if constexpr (isLcTable() || isLcMcTable()) { + return static_cast(o2::constants::physics::MassLambdaCPlus); + } + if constexpr (isBplusTable() || isBplusMcTable()) { + return static_cast(o2::constants::physics::MassBPlus); + } else { + return 0.; + } +} + +template +void fillD0CollisionTable(T const& collision, U& D0CollisionTable, int32_t& D0CollisionTableIndex) +{ + + D0CollisionTable(collision.numContrib(), collision.isEventReject(), collision.runNumber()); + D0CollisionTableIndex = D0CollisionTable.lastIndex(); +} + +template +void fillHFCollisionTable(T const& collision, U const& candidates, V& HFCollisionTable, int32_t& HFCollisionTableIndex) +{ + if constexpr (isD0Table()) { + fillD0CollisionTable(collision, HFCollisionTable, HFCollisionTableIndex); + } +} + +template +void fillD0CandidateTable(T const& candidate, int32_t collisionIndex, U& D0BaseTable, V& D0ParTable, M& D0ParETable, N& D0SelectionFlagTable, O& D0MCDTable, int32_t& D0CandidateTableIndex) +{ + + D0BaseTable(collisionIndex, candidate.pt(), candidate.eta(), candidate.phi(), candidate.m()); + + D0ParTable( + candidate.chi2PCA(), + candidate.decayLength(), + candidate.decayLengthXY(), + candidate.decayLengthNormalised(), + candidate.decayLengthXYNormalised(), + candidate.ptProng0(), + candidate.ptProng1(), + candidate.impactParameter0(), + candidate.impactParameter1(), + candidate.impactParameterNormalised0(), + candidate.impactParameterNormalised1(), + candidate.nSigTpcPi0(), + candidate.nSigTpcKa0(), + candidate.nSigTofPi0(), + candidate.nSigTofKa0(), + candidate.nSigTpcTofPi0(), + candidate.nSigTpcTofKa0(), + candidate.nSigTpcPi1(), + candidate.nSigTpcKa1(), + candidate.nSigTofPi1(), + candidate.nSigTofKa1(), + candidate.nSigTpcTofPi1(), + candidate.nSigTpcTofKa1(), + candidate.cpa(), + candidate.cpaXY(), + candidate.maxNormalisedDeltaIP(), + candidate.impactParameterProduct()); + + D0ParETable( + candidate.posX(), + candidate.posY(), + candidate.posZ(), + candidate.xSecondaryVertex(), + candidate.ySecondaryVertex(), + candidate.zSecondaryVertex(), + candidate.errorDecayLength(), + candidate.errorDecayLengthXY(), + candidate.kfTopolChi2OverNdf(), + candidate.rSecondaryVertex(), + candidate.pProng0(), + candidate.pProng1(), + candidate.pxProng0(), + candidate.pyProng0(), + candidate.pzProng0(), + candidate.pxProng1(), + candidate.pyProng1(), + candidate.pzProng1(), + candidate.errorImpactParameter0(), + candidate.errorImpactParameter1(), + candidate.cosThetaStar(), + candidate.ct()); + + D0SelectionFlagTable(candidate.candidateSelFlag()); + if constexpr (isMc) { + D0MCDTable(candidate.flagMcMatchRec(), candidate.originMcRec()); + } + + D0CandidateTableIndex = D0BaseTable.lastIndex(); +} + +template +void fillCandidateTable(T const& candidate, int32_t collisionIndex, U& HFBaseTable, V& HFParTable, M& HFParETable, N& HFSelectionFlagTable, O& HFMCDTable, int32_t& HFCandidateTableIndex) +{ + if constexpr (isD0Candidate()) { + fillD0CandidateTable(candidate, collisionIndex, HFBaseTable, HFParTable, HFParETable, HFSelectionFlagTable, HFMCDTable, HFCandidateTableIndex); + } +} + +template +void fillD0CandidateMcTable(T const& candidate, U& D0PBaseTable, int32_t& D0CandidateTableIndex) +{ + D0PBaseTable(candidate.pt(), candidate.eta(), candidate.phi(), candidate.flagMcMatchGen(), candidate.originMcGen()); + D0CandidateTableIndex = D0PBaseTable.lastIndex(); +} + +template +void fillCandidateMcTable(T const& candidate, U& BaseMcTable, int32_t& candidateTableIndex) +{ + if constexpr (isD0McCandidate()) { + fillD0CandidateMcTable(candidate, BaseMcTable, candidateTableIndex); + } +} + +template +auto getCandidateCollision(T const& candidate, U const& candidateCollisions) +{ + if constexpr (isD0Candidate()) { // make sure this actually is working + return candidate.template hfD0CollBase_as(); + } else { + return candidate.template hfD0CollBase_as(); + } +} + +}; // namespace jethfutilities + +#endif // PWGJE_CORE_JETHFUTILITIES_H_ diff --git a/PWGJE/Core/JetMatchingUtilities.h b/PWGJE/Core/JetMatchingUtilities.h new file mode 100644 index 00000000000..19cf12f85cf --- /dev/null +++ b/PWGJE/Core/JetMatchingUtilities.h @@ -0,0 +1,438 @@ +// Copyright 2019-2020 CERN and copyright holders of ALICE O2. +// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders. +// All rights not expressly granted are reserved. +// +// This software is distributed under the terms of the GNU General Public +// License v3 (GPL Version 3), copied verbatim in the file "COPYING". +// +// In applying this license CERN does not waive the privileges and immunities +// granted to it by virtue of its status as an Intergovernmental Organization +// or submit itself to any jurisdiction. + +/// \file JetMatchingUtilities.h +/// \brief Jet Matching related utilities +/// +/// \author Raymond Ehlers , ORNL +/// \author Jochen Klein +/// \author Aimeric Lanodu +/// \author Nima Zardoshti + +#ifndef PWGJE_CORE_JETMATCHINGUTILITIES_H_ +#define PWGJE_CORE_JETMATCHINGUTILITIES_H_ + +#include +#include +#include +#include +#include + +#include "Framework/AnalysisTask.h" +#include "Framework/AnalysisDataModel.h" +#include "Framework/ASoA.h" +#include "Framework/O2DatabasePDGPlugin.h" + +#include "Framework/Logger.h" +#include "Common/Core/TrackSelection.h" +#include "Common/Core/TrackSelectionDefaults.h" +#include "Common/DataModel/EventSelection.h" +#include "Common/DataModel/TrackSelectionTables.h" +#include "PWGJE/DataModel/EMCALClusters.h" + +#include "PWGHF/DataModel/CandidateReconstructionTables.h" +#include "PWGHF/DataModel/CandidateSelectionTables.h" + +#include "PWGJE/DataModel/Jet.h" + +namespace jetmatchingutilities +{ + +/** + * Duplicates jets around the phi boundary which are within the matching distance. + * + * NOTE: Assumes, but does not validate, that 0 <= phi < 2pi. + * + * @param jetsPhi Jets phi + * @param jetsEta Jets eta + * @param maxMatchingDistance Maximum matching distance. Only duplicate jets within this distance of the boundary. + */ +template +std::tuple, std::vector, std::vector> DuplicateJetsAroundPhiBoundary( + std::vector& jetsPhi, + std::vector& jetsEta, + double maxMatchingDistance, + // TODO: Remove additional margin after additional testing. + double additionalMargin = 0.05) +{ + const std::size_t nJets = jetsPhi.size(); + std::vector jetsMapToJetIndex(nJets); + // We need to keep track of the map from the duplicated vector to the existing jets. + // To start, we fill this map (practically, it maps from vector index to an index, so we + // just use a standard vector) with the existing jet indices, which range from 0..nJets. + std::iota(jetsMapToJetIndex.begin(), jetsMapToJetIndex.end(), 0); + + // The full duplicated jets will be stored in a new vector to avoid disturbing the input data. + std::vector jetsPhiComparison(jetsPhi); + std::vector jetsEtaComparison(jetsEta); + + // Duplicate the jets + // When a jet is outside of the desired phi range, we make a copy of the jet, shifting it by 2pi + // as necessary. The eta value is copied directly, as is the index of the original jet, so we can + // map from index in duplicated data -> index in original collection. + // NOTE: Assumes, but does not validate, that 0 <= phi < 2pi. + for (std::size_t i = 0; i < nJets; i++) { + // Handle lower edge + if (jetsPhi[i] <= (maxMatchingDistance + additionalMargin)) { + jetsPhiComparison.emplace_back(jetsPhi[i] + 2 * M_PI); + jetsEtaComparison.emplace_back(jetsEta[i]); + jetsMapToJetIndex.emplace_back(jetsMapToJetIndex[i]); + } + // Handle upper edge + if (jetsPhi[i] >= (2 * M_PI - (maxMatchingDistance + additionalMargin))) { + jetsPhiComparison.emplace_back(jetsPhi[i] - 2 * M_PI); + jetsEtaComparison.emplace_back(jetsEta[i]); + jetsMapToJetIndex.emplace_back(jetsMapToJetIndex[i]); + } + } + + return {jetsMapToJetIndex, jetsPhiComparison, jetsEtaComparison}; +} + +/** + * Implementation of geometrical jet matching. + * + * Jets are required to match uniquely - namely: base <-> tag. Only one direction of matching isn't enough. + * Unless special conditions are required, it's better to use `MatchJetsGeometrically`, which has an + * easier to use interface. + * + * NOTE: The vectors for matching could all be const, except that SetData() doesn't take a const. + * + * @param jetsBasePhi Base jet collection phi. + * @param jetsBaseEta Base jet collection eta. + * @param jetsBasePhiForMatching Base jet collection phi to use for matching. + * @param jetsBaseEtaForMatching Base jet collection eta to use for matching. + * @param jetMapBaseToJetIndex Base jet collection index map from duplicated jets to original jets. + * @param jetsTagPhi Tag jet collection phi. + * @param jetsTagEta Tag jet collection eta. + * @param jetsTagPhiForMatching Tag jet collection phi to use for matching. + * @param jetsTagEtaForMatching Tag jet collection eta to use for matching. + * @param jetMapTagToJetIndex Tag jet collection index map from duplicated jets to original jets. + * @param maxMatchingDistance Maximum matching distance. + * + * @returns (Base to tag index map, tag to base index map) for uniquely matched jets. + */ +template +std::tuple, std::vector> MatchJetsGeometricallyImpl( + const std::vector& jetsBasePhi, + const std::vector& jetsBaseEta, + std::vector jetsBasePhiForMatching, + std::vector jetsBaseEtaForMatching, + const std::vector jetMapBaseToJetIndex, + const std::vector& jetsTagPhi, + const std::vector& jetsTagEta, + std::vector jetsTagPhiForMatching, + std::vector jetsTagEtaForMatching, + const std::vector jetMapTagToJetIndex, + double maxMatchingDistance) +{ + // Validation + // If no jets in either collection, then return immediately. + const std::size_t nJetsBase = jetsBaseEta.size(); + const std::size_t nJetsTag = jetsTagEta.size(); + if (!(nJetsBase && nJetsTag)) { + return std::make_tuple(std::vector(nJetsBase, -1), std::vector(nJetsTag, -1)); + } + // Require that the comparison vectors are greater than or equal to the standard collections. + if (jetsBasePhiForMatching.size() < jetsBasePhi.size()) { + throw std::invalid_argument("Base collection phi for matching is smaller than the input base collection."); + } + if (jetsBaseEtaForMatching.size() < jetsBaseEta.size()) { + throw std::invalid_argument("Base collection eta for matching is smaller than the input base collection."); + } + if (jetsTagPhiForMatching.size() < jetsTagPhi.size()) { + throw std::invalid_argument("Tag collection phi for matching is smaller than the input tag collection."); + } + if (jetsTagEtaForMatching.size() < jetsTagEta.size()) { + throw std::invalid_argument("Tag collection eta for matching is smaller than the input tag collection."); + } + + // Build the KD-trees using vectors + // We build two trees: + // treeBase, which contains the base collection. + // treeTag, which contains the tag collection. + // The trees are built to match in two dimensions (eta, phi) + TKDTree treeBase(jetsBaseEtaForMatching.size(), 2, 1), treeTag(jetsTagEtaForMatching.size(), 2, 1); + // By utilizing SetData, we can avoid having to copy the data again. + treeBase.SetData(0, jetsBaseEtaForMatching.data()); + treeBase.SetData(1, jetsBasePhiForMatching.data()); + treeBase.Build(); + treeTag.SetData(0, jetsTagEtaForMatching.data()); + treeTag.SetData(1, jetsTagPhiForMatching.data()); + treeTag.Build(); + + // Storage for the jet matching indices. + // matchIndexTag maps from the base index to the tag index. + // matchBaseTag maps from the tag index to the base index. + std::vector matchIndexTag(nJetsBase, -1), matchIndexBase(nJetsTag, -1); + + // Find the tag jet closest to each base jet. + for (std::size_t iBase = 0; iBase < nJetsBase; iBase++) { + Double_t point[2] = {jetsBaseEta[iBase], jetsBasePhi[iBase]}; + Int_t index(-1); + Double_t distance(-1); + treeTag.FindNearestNeighbors(point, 1, &index, &distance); + // test whether indices are matching: + if (index >= 0 && distance < maxMatchingDistance) { + LOG(debug) << "Found closest tag jet for " << iBase << " with match index " << index << " and distance " << distance << "\n"; + matchIndexTag[iBase] = index; + } else { + LOG(debug) << "Closest tag jet not found for " << iBase << ", distance to closest " << distance << "\n"; + } + } + + // Find the base jet closest to each tag jet + for (std::size_t iTag = 0; iTag < nJetsTag; iTag++) { + Double_t point[2] = {jetsTagEta[iTag], jetsTagPhi[iTag]}; + Int_t index(-1); + Double_t distance(-1); + treeBase.FindNearestNeighbors(point, 1, &index, &distance); + if (index >= 0 && distance < maxMatchingDistance) { + LOG(debug) << "Found closest base jet for " << iTag << " with match index " << index << " and distance " << distance << std::endl; + matchIndexBase[iTag] = index; + } else { + LOG(debug) << "Closest tag jet not found for " << iTag << ", distance to closest " << distance << "\n"; + } + } + + // Convert indices in the duplicated jet vectors into the original jet indices. + // First for the base -> tag map. + for (auto& v : matchIndexTag) { + // If it's -1, it means that it didn't find a matching jet. + // We have to explicitly check for it here because it would be an invalid index. + if (v != -1) { + v = jetMapTagToJetIndex[v]; + } + } + // Then for the index -> base map. + for (auto& v : matchIndexBase) { + if (v != -1) { + v = jetMapBaseToJetIndex[v]; + } + } + + // Finally, we'll check for true matches, which are pairs where the base jet is the + // closest to the tag jet and vice versa + // As the lists are linear a loop over the outer base jet is sufficient. + std::vector baseToTagMap(nJetsBase, -1); + std::vector tagToBaseMap(nJetsTag, -1); + LOG(debug) << "Starting true jet loop: nbase(" << nJetsBase << "), ntag(" << nJetsTag << ")\n"; + for (std::size_t iBase = 0; iBase < nJetsBase; iBase++) { + LOG(debug) << "base jet " << iBase << ": match index in tag jet container " << matchIndexTag[iBase] << "\n"; + if (matchIndexTag[iBase] > -1) { + LOG(debug) << "tag jet " << matchIndexTag[iBase] << ": matched base jet " << matchIndexBase[matchIndexTag[iBase]] << "\n"; + } + if (matchIndexTag[iBase] > -1 && matchIndexBase[matchIndexTag[iBase]] == static_cast(iBase)) { + LOG(debug) << "True match! base index: " << iBase << ", tag index: " << matchIndexTag[iBase] << "\n"; + baseToTagMap[iBase] = matchIndexTag[iBase]; + tagToBaseMap[matchIndexTag[iBase]] = iBase; + } + } + + return std::make_tuple(baseToTagMap, tagToBaseMap); +} + +/** + * Geometrical jet matching. + * + * Match jets in the "base" collection with those in the "tag" collection. Jets are matched within + * the provided matching distance. Jets are required to match uniquely - namely: base <-> tag. + * Only one direction of matching isn't enough. + * + * If no unique match was found for a jet, an index of -1 is stored. + * + * @param jetsBasePhi Base jet collection phi. + * @param jetsBaseEta Base jet collection eta. + * @param jetsTagPhi Tag jet collection phi. + * @param jetsTagEta Tag jet collection eta. + * @param maxMatchingDistance Maximum matching distance. + * + * @returns (Base to tag index map, tag to base index map) for uniquely matched jets. + */ +template +std::tuple, std::vector> MatchJetsGeometrically( + std::vector jetsBasePhi, + std::vector jetsBaseEta, + std::vector jetsTagPhi, + std::vector jetsTagEta, + double maxMatchingDistance) +{ + // Validation + const std::size_t nJetsBase = jetsBaseEta.size(); + const std::size_t nJetsTag = jetsTagEta.size(); + if (!(nJetsBase && nJetsTag)) { + // There are no jets, so nothing to be done. + return std::make_tuple(std::vector(nJetsBase, -1), std::vector(nJetsTag, -1)); + } + // Input sizes must match + if (jetsBasePhi.size() != jetsBaseEta.size()) { + throw std::invalid_argument("Base collection eta and phi sizes don't match. Check the inputs."); + } + if (jetsTagPhi.size() != jetsTagEta.size()) { + throw std::invalid_argument("Tag collection eta and phi sizes don't match. Check the inputs."); + } + + // To perform matching with periodic boundary conditions (ie. phi) with a KDTree, we need + // to duplicate data up to maxMatchingDistance in phi because phi is periodic. + // NOTE: vectors are modified in place to avoid copies. + auto&& [jetMapBaseToJetIndex, jetsBasePhiComparison, jetsBaseEtaComparison] = DuplicateJetsAroundPhiBoundary(jetsBasePhi, jetsBaseEta, maxMatchingDistance); + auto&& [jetMapTagToJetIndex, jetsTagPhiComparison, jetsTagEtaComparison] = DuplicateJetsAroundPhiBoundary(jetsTagPhi, jetsTagEta, maxMatchingDistance); + + // Finally, perform the actual matching. + auto&& [baseToTagMap, tagToBaseMap] = MatchJetsGeometricallyImpl( + jetsBasePhi, jetsBaseEta, jetsBasePhiComparison, jetsBaseEtaComparison, jetMapBaseToJetIndex, + jetsTagPhi, jetsTagEta, jetsTagPhiComparison, jetsTagEtaComparison, jetMapTagToJetIndex, + maxMatchingDistance); + + return std::make_tuple(baseToTagMap, tagToBaseMap); +} + +template +void MatchGeo(T const& jetsBasePerCollision, U const& jetsTagPerCollision, std::vector>& baseToTagMatchingGeo, std::vector>& tagToBaseMatchingGeo, float maxMatchingDistance) +{ + std::vector baseToTagMatchingGeoIndex; + std::vector tagToBaseMatchingGeoIndex; + std::vector jetsBasePhi; + std::vector jetsBaseEta; + for (const auto& jetBase : jetsBasePerCollision) { + jetsBasePhi.emplace_back(jetBase.phi()); + jetsBaseEta.emplace_back(jetBase.eta()); + } + std::vector jetsTagPhi; + std::vector jetsTagEta; + for (const auto& jetTag : jetsTagPerCollision) { + jetsTagPhi.emplace_back(jetTag.phi()); + jetsTagEta.emplace_back(jetTag.eta()); + } + std::tie(baseToTagMatchingGeoIndex, tagToBaseMatchingGeoIndex) = MatchJetsGeometrically(jetsBasePhi, jetsBaseEta, jetsTagPhi, jetsTagEta, maxMatchingDistance); // change max distnace to a function call + for (const auto& jetBase : jetsBasePerCollision) { + int jetTagIndex = baseToTagMatchingGeoIndex[jetBase.index()]; + int jetTagGlobalIndex; + if (jetTagIndex > -1 && jetTagIndex < jetsTagPerCollision.size()) { + jetTagGlobalIndex = jetsTagPerCollision.iteratorAt(jetTagIndex).globalIndex(); + baseToTagMatchingGeo[jetBase.globalIndex()].push_back(jetTagGlobalIndex); + } + } + for (const auto& jetTag : jetsTagPerCollision) { + int jetBaseIndex = tagToBaseMatchingGeoIndex[jetTag.index()]; + int jetBaseGlobalIndex; + if (jetBaseIndex > -1 && jetBaseIndex < jetsBasePerCollision.size()) { + jetBaseGlobalIndex = jetsBasePerCollision.iteratorAt(jetBaseIndex).globalIndex(); + tagToBaseMatchingGeo[jetTag.globalIndex()].push_back(jetBaseGlobalIndex); + } + } +} + +// function that does the HF matching of jets from jetsBasePerColl and jets from jetsTagPerColl; assumes both jetsBasePerColl and jetsTagPerColl have access to Mc information +template +void MatchHF(T const& jetsBasePerCollision, U const& jetsTagPerCollision, std::vector>& baseToTagMatchingHF, std::vector>& tagToBaseMatchingHF, V const& candidatesBase, M const& candidatesTag, N const& tracksBase, O const& tracksTag) +{ + for (const auto& jetBase : jetsBasePerCollision) { + const auto candidateBase = jetBase.template hfcandidates_first_as(); + for (const auto& jetTag : jetsTagPerCollision) { + if constexpr (jetsBaseIsMc || jetsTagIsMc) { + if (jethfutilities::isMatchedHFCandidate(candidateBase)) { + const auto candidateBaseDaughterParticle = candidateBase.template prong1_as().template mcParticle_as(); + const auto candidateBaseMcId = candidateBaseDaughterParticle.template mothers_first_as().globalIndex(); + const auto candidateTag = jetTag.template hfcandidates_first_as(); + const auto candidateTagId = candidateTag.mcParticleId(); + if (candidateBaseMcId == candidateTagId) { + baseToTagMatchingHF[jetBase.globalIndex()].push_back(jetTag.globalIndex()); + tagToBaseMatchingHF[jetTag.globalIndex()].push_back(jetBase.globalIndex()); + } + } + } else { + const auto candidateTag = jetTag.template hfcandidates_first_as(); + if (candidateBase.globalIndex() == candidateTag.globalIndex()) { + baseToTagMatchingHF[jetBase.globalIndex()].push_back(jetTag.globalIndex()); + tagToBaseMatchingHF[jetTag.globalIndex()].push_back(jetBase.globalIndex()); + } + } + } + } +} + +template +auto constexpr getTrackId(T const& track) +{ + if constexpr (isMc) { + + if (track.has_mcParticle()) { + return track.mcParticleId(); + } else { + return -1; + } + + } else { + return track.globalIndex(); + } +} + +template +float getPtSum(T const& tracksBase, U const& tracksTag) +{ + float ptSum = 0.; + for (const auto& trackBase : tracksBase) { + auto trackBaseId = getTrackId(trackBase); + for (const auto& trackTag : tracksTag) { + auto trackTagId = getTrackId(trackTag); + if (trackBaseId != -1 && trackBaseId == trackTagId) { + ptSum += trackBase.pt(); + break; + } + } + } + return ptSum; +} + +template +void MatchPt(T const& jetsBasePerCollision, U const& jetsTagPerCollision, std::vector>& baseToTagMatchingPt, std::vector>& tagToBaseMatchingPt, V const& tracksBase, M const& tracksTag, float minPtFraction) +{ + float ptSumBase; + float ptSumTag; + for (const auto& jetBase : jetsBasePerCollision) { + auto jetBaseTracks = jetBase.template tracks_as(); + for (const auto& jetTag : jetsTagPerCollision) { + auto jetTagTracks = jetTag.template tracks_as(); + + ptSumBase = getPtSum(jetBaseTracks, jetTagTracks); + ptSumTag = getPtSum(jetTagTracks, jetBaseTracks); + if (ptSumBase > jetBase.pt() * minPtFraction) { + baseToTagMatchingPt[jetBase.globalIndex()].push_back(jetTag.globalIndex()); + } + if (ptSumTag > jetTag.pt() * minPtFraction) { + tagToBaseMatchingPt[jetTag.globalIndex()].push_back(jetBase.globalIndex()); + } + } + } +} + +// function that calls all the Match functions +template +void doAllMatching(T const& jetsBasePerCollision, U const& jetsTagPerCollision, std::vector>& baseToTagMatchingGeo, std::vector>& baseToTagMatchingPt, std::vector>& baseToTagMatchingHF, std::vector>& tagToBaseMatchingGeo, std::vector>& tagToBaseMatchingPt, std::vector>& tagToBaseMatchingHF, V const& candidatesBase, M const& candidatesTag, N const& tracksBase, O const& tracksTag, bool doMatchingGeo, bool doMatchingHf, bool doMatchingPt, float maxMatchingDistance, float minPtFraction) +{ + // geometric matching + if (doMatchingGeo) { + MatchGeo(jetsBasePerCollision, jetsTagPerCollision, baseToTagMatchingGeo, tagToBaseMatchingGeo, maxMatchingDistance); + } + // pt matching + if (doMatchingPt) { + MatchPt(jetsBasePerCollision, jetsTagPerCollision, baseToTagMatchingPt, tagToBaseMatchingPt, tracksBase, tracksTag, minPtFraction); + } + // HF matching + if constexpr (jethfutilities::isHFTable()) { + if (doMatchingHf) { + MatchHF(jetsBasePerCollision, jetsTagPerCollision, baseToTagMatchingHF, tagToBaseMatchingHF, candidatesBase, candidatesTag, tracksBase, tracksTag); + } + } +} +}; // namespace jetmatchingutilities +#endif // PWGJE_CORE_JETMATCHINGUTILITIES_H_ diff --git a/PWGJE/Core/JetTaggingUtilities.h b/PWGJE/Core/JetTaggingUtilities.h index f5fa56272c7..e0edfe7e611 100644 --- a/PWGJE/Core/JetTaggingUtilities.h +++ b/PWGJE/Core/JetTaggingUtilities.h @@ -36,7 +36,7 @@ enum JetTaggingSpecies { gluon = 5 }; -namespace JetTaggingUtilities +namespace jettaggingutilities { /** * returns the globalIndex of the earliest mother of a particle in the shower. returns -1 if a suitable mother is not found @@ -180,7 +180,7 @@ int mcdJetFromHFShower(T const& jet, U const& tracks, V const& particles, float int originalHFMotherIndex = getOriginalHFMotherIndex(hfparticle); if (originalHFMotherIndex > -1.0) { - if (JetUtilities::deltaR(jet, particles.iteratorAt(originalHFMotherIndex)) < dRMax) { + if (jetutilities::deltaR(jet, particles.iteratorAt(originalHFMotherIndex)) < dRMax) { return origin; @@ -217,7 +217,7 @@ int mcpJetFromHFShower(T const& jet, U const& particles, float dRMax = 0.25) int originalHFMotherIndex = getOriginalHFMotherIndex(hfparticle); if (originalHFMotherIndex > -1.0) { - if (JetUtilities::deltaR(jet, particles.iteratorAt(originalHFMotherIndex)) < dRMax) { + if (jetutilities::deltaR(jet, particles.iteratorAt(originalHFMotherIndex)) < dRMax) { return origin; @@ -260,8 +260,8 @@ int jetOrigin(T const& jet, U const& particles, float dRMax = 0.25) } } - float dR1 = JetUtilities::deltaR(jet, parton1); - float dR2 = JetUtilities::deltaR(jet, parton2); + float dR1 = jetutilities::deltaR(jet, parton1); + float dR2 = jetutilities::deltaR(jet, parton2); if (dR1 <= dR2 && dR1 < dRMax) { @@ -275,6 +275,6 @@ int jetOrigin(T const& jet, U const& particles, float dRMax = 0.25) return 0; } -}; // namespace JetTaggingUtilities +}; // namespace jettaggingutilities #endif // PWGJE_CORE_JETTAGGINGUTILITIES_H_ diff --git a/PWGJE/Core/JetUtilities.h b/PWGJE/Core/JetUtilities.h index 83dda3030e8..a681d76bf89 100644 --- a/PWGJE/Core/JetUtilities.h +++ b/PWGJE/Core/JetUtilities.h @@ -29,256 +29,8 @@ #include "Framework/Logger.h" #include "Common/Core/RecoDecay.h" -namespace JetUtilities +namespace jetutilities { -/** - * Duplicates jets around the phi boundary which are within the matching distance. - * - * NOTE: Assumes, but does not validate, that 0 <= phi < 2pi. - * - * @param jetsPhi Jets phi - * @param jetsEta Jets eta - * @param maxMatchingDistance Maximum matching distance. Only duplicate jets within this distance of the boundary. - */ -template -std::tuple, std::vector, std::vector> DuplicateJetsAroundPhiBoundary( - std::vector& jetsPhi, - std::vector& jetsEta, - double maxMatchingDistance, - // TODO: Remove additional margin after additional testing. - double additionalMargin = 0.05) -{ - const std::size_t nJets = jetsPhi.size(); - std::vector jetsMapToJetIndex(nJets); - // We need to keep track of the map from the duplicated vector to the existing jets. - // To start, we fill this map (practically, it maps from vector index to an index, so we - // just use a standard vector) with the existing jet indices, which range from 0..nJets. - std::iota(jetsMapToJetIndex.begin(), jetsMapToJetIndex.end(), 0); - - // The full duplicated jets will be stored in a new vector to avoid disturbing the input data. - std::vector jetsPhiComparison(jetsPhi); - std::vector jetsEtaComparison(jetsEta); - - // Duplicate the jets - // When a jet is outside of the desired phi range, we make a copy of the jet, shifting it by 2pi - // as necessary. The eta value is copied directly, as is the index of the original jet, so we can - // map from index in duplicated data -> index in original collection. - // NOTE: Assumes, but does not validate, that 0 <= phi < 2pi. - for (std::size_t i = 0; i < nJets; i++) { - // Handle lower edge - if (jetsPhi[i] <= (maxMatchingDistance + additionalMargin)) { - jetsPhiComparison.emplace_back(jetsPhi[i] + 2 * M_PI); - jetsEtaComparison.emplace_back(jetsEta[i]); - jetsMapToJetIndex.emplace_back(jetsMapToJetIndex[i]); - } - // Handle upper edge - if (jetsPhi[i] >= (2 * M_PI - (maxMatchingDistance + additionalMargin))) { - jetsPhiComparison.emplace_back(jetsPhi[i] - 2 * M_PI); - jetsEtaComparison.emplace_back(jetsEta[i]); - jetsMapToJetIndex.emplace_back(jetsMapToJetIndex[i]); - } - } - - return {jetsMapToJetIndex, jetsPhiComparison, jetsEtaComparison}; -} - -/** - * Implementation of geometrical jet matching. - * - * Jets are required to match uniquely - namely: base <-> tag. Only one direction of matching isn't enough. - * Unless special conditions are required, it's better to use `MatchJetsGeometrically`, which has an - * easier to use interface. - * - * NOTE: The vectors for matching could all be const, except that SetData() doesn't take a const. - * - * @param jetsBasePhi Base jet collection phi. - * @param jetsBaseEta Base jet collection eta. - * @param jetsBasePhiForMatching Base jet collection phi to use for matching. - * @param jetsBaseEtaForMatching Base jet collection eta to use for matching. - * @param jetMapBaseToJetIndex Base jet collection index map from duplicated jets to original jets. - * @param jetsTagPhi Tag jet collection phi. - * @param jetsTagEta Tag jet collection eta. - * @param jetsTagPhiForMatching Tag jet collection phi to use for matching. - * @param jetsTagEtaForMatching Tag jet collection eta to use for matching. - * @param jetMapTagToJetIndex Tag jet collection index map from duplicated jets to original jets. - * @param maxMatchingDistance Maximum matching distance. - * - * @returns (Base to tag index map, tag to base index map) for uniquely matched jets. - */ -template -std::tuple, std::vector> MatchJetsGeometricallyImpl( - const std::vector& jetsBasePhi, - const std::vector& jetsBaseEta, - std::vector jetsBasePhiForMatching, - std::vector jetsBaseEtaForMatching, - const std::vector jetMapBaseToJetIndex, - const std::vector& jetsTagPhi, - const std::vector& jetsTagEta, - std::vector jetsTagPhiForMatching, - std::vector jetsTagEtaForMatching, - const std::vector jetMapTagToJetIndex, - double maxMatchingDistance) -{ - // Validation - // If no jets in either collection, then return immediately. - const std::size_t nJetsBase = jetsBaseEta.size(); - const std::size_t nJetsTag = jetsTagEta.size(); - if (!(nJetsBase && nJetsTag)) { - return std::make_tuple(std::vector(nJetsBase, -1), std::vector(nJetsTag, -1)); - } - // Require that the comparison vectors are greater than or equal to the standard collections. - if (jetsBasePhiForMatching.size() < jetsBasePhi.size()) { - throw std::invalid_argument("Base collection phi for matching is smaller than the input base collection."); - } - if (jetsBaseEtaForMatching.size() < jetsBaseEta.size()) { - throw std::invalid_argument("Base collection eta for matching is smaller than the input base collection."); - } - if (jetsTagPhiForMatching.size() < jetsTagPhi.size()) { - throw std::invalid_argument("Tag collection phi for matching is smaller than the input tag collection."); - } - if (jetsTagEtaForMatching.size() < jetsTagEta.size()) { - throw std::invalid_argument("Tag collection eta for matching is smaller than the input tag collection."); - } - - // Build the KD-trees using vectors - // We build two trees: - // treeBase, which contains the base collection. - // treeTag, which contains the tag collection. - // The trees are built to match in two dimensions (eta, phi) - TKDTree treeBase(jetsBaseEtaForMatching.size(), 2, 1), treeTag(jetsTagEtaForMatching.size(), 2, 1); - // By utilizing SetData, we can avoid having to copy the data again. - treeBase.SetData(0, jetsBaseEtaForMatching.data()); - treeBase.SetData(1, jetsBasePhiForMatching.data()); - treeBase.Build(); - treeTag.SetData(0, jetsTagEtaForMatching.data()); - treeTag.SetData(1, jetsTagPhiForMatching.data()); - treeTag.Build(); - - // Storage for the jet matching indices. - // matchIndexTag maps from the base index to the tag index. - // matchBaseTag maps from the tag index to the base index. - std::vector matchIndexTag(nJetsBase, -1), matchIndexBase(nJetsTag, -1); - - // Find the tag jet closest to each base jet. - for (std::size_t iBase = 0; iBase < nJetsBase; iBase++) { - Double_t point[2] = {jetsBaseEta[iBase], jetsBasePhi[iBase]}; - Int_t index(-1); - Double_t distance(-1); - treeTag.FindNearestNeighbors(point, 1, &index, &distance); - // test whether indices are matching: - if (index >= 0 && distance < maxMatchingDistance) { - LOG(debug) << "Found closest tag jet for " << iBase << " with match index " << index << " and distance " << distance << "\n"; - matchIndexTag[iBase] = index; - } else { - LOG(debug) << "Closest tag jet not found for " << iBase << ", distance to closest " << distance << "\n"; - } - } - - // Find the base jet closest to each tag jet - for (std::size_t iTag = 0; iTag < nJetsTag; iTag++) { - Double_t point[2] = {jetsTagEta[iTag], jetsTagPhi[iTag]}; - Int_t index(-1); - Double_t distance(-1); - treeBase.FindNearestNeighbors(point, 1, &index, &distance); - if (index >= 0 && distance < maxMatchingDistance) { - LOG(debug) << "Found closest base jet for " << iTag << " with match index " << index << " and distance " << distance << std::endl; - matchIndexBase[iTag] = index; - } else { - LOG(debug) << "Closest tag jet not found for " << iTag << ", distance to closest " << distance << "\n"; - } - } - - // Convert indices in the duplicated jet vectors into the original jet indices. - // First for the base -> tag map. - for (auto& v : matchIndexTag) { - // If it's -1, it means that it didn't find a matching jet. - // We have to explicitly check for it here because it would be an invalid index. - if (v != -1) { - v = jetMapTagToJetIndex[v]; - } - } - // Then for the index -> base map. - for (auto& v : matchIndexBase) { - if (v != -1) { - v = jetMapBaseToJetIndex[v]; - } - } - - // Finally, we'll check for true matches, which are pairs where the base jet is the - // closest to the tag jet and vice versa - // As the lists are linear a loop over the outer base jet is sufficient. - std::vector baseToTagMap(nJetsBase, -1); - std::vector tagToBaseMap(nJetsTag, -1); - LOG(debug) << "Starting true jet loop: nbase(" << nJetsBase << "), ntag(" << nJetsTag << ")\n"; - for (std::size_t iBase = 0; iBase < nJetsBase; iBase++) { - LOG(debug) << "base jet " << iBase << ": match index in tag jet container " << matchIndexTag[iBase] << "\n"; - if (matchIndexTag[iBase] > -1) { - LOG(debug) << "tag jet " << matchIndexTag[iBase] << ": matched base jet " << matchIndexBase[matchIndexTag[iBase]] << "\n"; - } - if (matchIndexTag[iBase] > -1 && matchIndexBase[matchIndexTag[iBase]] == static_cast(iBase)) { - LOG(debug) << "True match! base index: " << iBase << ", tag index: " << matchIndexTag[iBase] << "\n"; - baseToTagMap[iBase] = matchIndexTag[iBase]; - tagToBaseMap[matchIndexTag[iBase]] = iBase; - } - } - - return std::make_tuple(baseToTagMap, tagToBaseMap); -} - -/** - * Geometrical jet matching. - * - * Match jets in the "base" collection with those in the "tag" collection. Jets are matched within - * the provided matching distance. Jets are required to match uniquely - namely: base <-> tag. - * Only one direction of matching isn't enough. - * - * If no unique match was found for a jet, an index of -1 is stored. - * - * @param jetsBasePhi Base jet collection phi. - * @param jetsBaseEta Base jet collection eta. - * @param jetsTagPhi Tag jet collection phi. - * @param jetsTagEta Tag jet collection eta. - * @param maxMatchingDistance Maximum matching distance. - * - * @returns (Base to tag index map, tag to base index map) for uniquely matched jets. - */ -template -std::tuple, std::vector> MatchJetsGeometrically( - std::vector jetsBasePhi, - std::vector jetsBaseEta, - std::vector jetsTagPhi, - std::vector jetsTagEta, - double maxMatchingDistance) -{ - // Validation - const std::size_t nJetsBase = jetsBaseEta.size(); - const std::size_t nJetsTag = jetsTagEta.size(); - if (!(nJetsBase && nJetsTag)) { - // There are no jets, so nothing to be done. - return std::make_tuple(std::vector(nJetsBase, -1), std::vector(nJetsTag, -1)); - } - // Input sizes must match - if (jetsBasePhi.size() != jetsBaseEta.size()) { - throw std::invalid_argument("Base collection eta and phi sizes don't match. Check the inputs."); - } - if (jetsTagPhi.size() != jetsTagEta.size()) { - throw std::invalid_argument("Tag collection eta and phi sizes don't match. Check the inputs."); - } - - // To perform matching with periodic boundary conditions (ie. phi) with a KDTree, we need - // to duplicate data up to maxMatchingDistance in phi because phi is periodic. - // NOTE: vectors are modified in place to avoid copies. - auto&& [jetMapBaseToJetIndex, jetsBasePhiComparison, jetsBaseEtaComparison] = DuplicateJetsAroundPhiBoundary(jetsBasePhi, jetsBaseEta, maxMatchingDistance); - auto&& [jetMapTagToJetIndex, jetsTagPhiComparison, jetsTagEtaComparison] = DuplicateJetsAroundPhiBoundary(jetsTagPhi, jetsTagEta, maxMatchingDistance); - - // Finally, perform the actual matching. - auto&& [baseToTagMap, tagToBaseMap] = MatchJetsGeometricallyImpl( - jetsBasePhi, jetsBaseEta, jetsBasePhiComparison, jetsBaseEtaComparison, jetMapBaseToJetIndex, - jetsTagPhi, jetsTagEta, jetsTagPhiComparison, jetsTagEtaComparison, jetMapTagToJetIndex, - maxMatchingDistance); - - return std::make_tuple(baseToTagMap, tagToBaseMap); -} /** * Match clusters and tracks. @@ -395,6 +147,6 @@ float deltaR(T const& A, U const& B) return TMath::Sqrt(dEta * dEta + dPhi * dPhi); } -}; // namespace JetUtilities +}; // namespace jetutilities #endif // PWGJE_CORE_JETUTILITIES_H_ diff --git a/PWGJE/Core/PWGJECoreLinkDef.h b/PWGJE/Core/PWGJECoreLinkDef.h index a67145d1d2a..869be064e38 100644 --- a/PWGJE/Core/PWGJECoreLinkDef.h +++ b/PWGJE/Core/PWGJECoreLinkDef.h @@ -18,8 +18,8 @@ #pragma link C++ class JetFinder + ; #pragma link C++ class JetBkgSubUtils + ; -#pragma link C++ namespace JetUtilities + ; -#pragma link C++ namespace FastJetUtilities + ; -#pragma link C++ namespace JetTaggingUtilities + ; +#pragma link C++ namespace jetutilities + ; +#pragma link C++ namespace fastjetutilities + ; +#pragma link C++ namespace jettaggingutilities + ; #endif // PWGJE_CORE_PWGJECORELINKDEF_H_ diff --git a/PWGJE/DataModel/Jet.h b/PWGJE/DataModel/Jet.h index 91bc9d64012..007c885777d 100644 --- a/PWGJE/DataModel/Jet.h +++ b/PWGJE/DataModel/Jet.h @@ -27,20 +27,14 @@ #include "Framework/AnalysisDataModel.h" #include "PWGJE/DataModel/EMCALClusters.h" #include "PWGJE/DataModel/JetReducedData.h" -#include "PWGHF/DataModel/CandidateReconstructionTables.h" +#include "PWGJE/DataModel/JetReducedDataHF.h" +#include "PWGJE/DataModel/JetSubtraction.h" -namespace o2::aod -{ +#include "PWGHF/DataModel/DerivedTables.h" +#include "PWGHF/DataModel/CandidateSelectionTables.h" -namespace rho +namespace o2::aod { -DECLARE_SOA_COLUMN(Rho, rho, float); //! -DECLARE_SOA_COLUMN(RhoM, rhoM, float); //! -} // namespace rho -DECLARE_SOA_TABLE(JCollisionRhos, "AOD", "JCollisionRhos", - o2::soa::Index<>, - rho::Rho, - rho::RhoM); namespace jet { @@ -62,26 +56,6 @@ DECLARE_SOA_DYNAMIC_COLUMN(Pz, pz, //! DECLARE_SOA_DYNAMIC_COLUMN(P, p, //! absolute p [](float pt, float eta) -> float { return pt * std::cosh(eta); }); } // namespace jet - -// Constituent sub -namespace constituentssub -{ -// Jet index column will be added in the macro -DECLARE_SOA_COLUMN(Pt, pt, float); -DECLARE_SOA_COLUMN(Eta, eta, float); -DECLARE_SOA_COLUMN(Phi, phi, float); -DECLARE_SOA_COLUMN(Energy, energy, float); -DECLARE_SOA_COLUMN(Mass, mass, float); -DECLARE_SOA_COLUMN(Source, source, int); -DECLARE_SOA_DYNAMIC_COLUMN(Px, px, - [](float pt, float phi) -> float { return pt * std::cos(phi); }); -DECLARE_SOA_DYNAMIC_COLUMN(Py, py, - [](float pt, float phi) -> float { return pt * std::sin(phi); }); -DECLARE_SOA_DYNAMIC_COLUMN(Pz, pz, - [](float pt, float eta) -> float { return pt * std::sinh(eta); }); -DECLARE_SOA_DYNAMIC_COLUMN(P, p, - [](float pt, float eta) -> float { return pt * std::cosh(eta); }); -} // namespace constituentssub } // namespace o2::aod // Defines the jet table definition @@ -118,9 +92,6 @@ DECLARE_SOA_DYNAMIC_COLUMN(P, p, { \ DECLARE_SOA_ARRAY_INDEX_COLUMN_FULL(_jet_type_, matchedJetCand, int32_t, _jet_type_##s, "_hf"); \ } - // DECLARE_SOA_INDEX_COLUMN_FULL(_jet_type_, matchedJetGeo, int32_t, _jet_type_##s, "_geo"); - // DECLARE_SOA_INDEX_COLUMN_FULL(_jet_type_, matchedJetPt, int32_t, _jet_type_##s, "_pt"); - // DECLARE_SOA_INDEX_COLUMN_FULL(_jet_type_, matchedJetCand, int32_t, _jet_type_##s, "_hf"); #define DECLARE_CONSTITUENTS_TABLE(_jet_type_, _name_, _Description_, _track_type_, _cand_type_) \ namespace _name_##constituents \ @@ -130,43 +101,30 @@ DECLARE_SOA_DYNAMIC_COLUMN(P, p, DECLARE_SOA_ARRAY_INDEX_COLUMN(JCluster, clusters); \ DECLARE_SOA_ARRAY_INDEX_COLUMN_FULL(HfCandidates, hfcandidates, int32_t, _cand_type_, "_hfcand"); \ } \ - DECLARE_SOA_TABLE(_jet_type_##Constituents, "AOD", _Description_ "CONSTS", \ + DECLARE_SOA_TABLE(_jet_type_##Constituents, "AOD", _Description_ "C", \ _name_##constituents::_jet_type_##Id, \ _name_##constituents::_track_type_##Ids, \ _name_##constituents::JClusterIds, \ _name_##constituents::HfCandidatesIds); -// Defines the jet constituent sub table -// NOTE: This relies on the jet index column being defined in the constituents namespace. -// Since these are always paired together, there's no point in redefining them. -#define DECLARE_CONSTITUENTS_SUB_TABLE(_jet_type_, _name_, _Description_) \ - DECLARE_SOA_TABLE(_jet_type_##ConstituentsSub, "AOD", _Description_ "CONSTSUB", \ - _name_##constituents::_jet_type_##Id, \ - constituentssub::Pt, \ - constituentssub::Eta, \ - constituentssub::Phi, \ - constituentssub::Energy, \ - constituentssub::Mass, \ - constituentssub::Source, \ - constituentssub::Px, \ - constituentssub::Py, \ - constituentssub::Pz, \ - constituentssub::P); - -// combine definition of tables for jets, constituents, and substructure -#define DECLARE_JET_TABLES(_collision_name_, _jet_type_, _const_type_, _hfcand_type_, _description_) \ +// combine definition of tables for jets, constituents +#define DECLARE_JET_TABLES(_collision_name_, _jet_type_, _track_type_, _hfcand_type_, _description_) \ DECLARE_JET_TABLE(_collision_name_, _jet_type_##Jet, _jet_type_##jet, _description_); \ using _jet_type_##Jet = _jet_type_##Jet##s::iterator; \ - DECLARE_CONSTITUENTS_TABLE(_jet_type_##Jet, _jet_type_##jet, _description_, _const_type_, _hfcand_type_); \ - using _jet_type_##Jet##Constituent = _jet_type_##Jet##Constituents::iterator; \ - DECLARE_CONSTITUENTS_SUB_TABLE(_jet_type_##Jet, _jet_type_##jet, _description_); \ - using _jet_type_##Jet##ConstituentSub = _jet_type_##Jet##ConstituentsSub::iterator; - -#define DECLARE_JETMATCHING_TABLE(_jet_type_base_, _jet_type_tag_, _description_) \ - DECLARE_SOA_TABLE(_jet_type_base_##JetsMatchedTo##_jet_type_tag_##Jets, "AOD", _description_, \ - _jet_type_tag_##jetmatchingGeo::_jet_type_tag_##JetIds, \ - _jet_type_tag_##jetmatchingPt::_jet_type_tag_##JetIds, \ - _jet_type_tag_##jetmatchingCand::_jet_type_tag_##JetIds); \ + DECLARE_CONSTITUENTS_TABLE(_jet_type_##Jet, _jet_type_##jet, _description_, _track_type_, _hfcand_type_); \ + using _jet_type_##Jet##Constituent = _jet_type_##Jet##Constituents::iterator; + +#define DECLARE_JETMATCHING_TABLE(_jet_type_base_, _jet_type_tag_, _description_) \ + namespace _jet_type_base_##jetsmatchedto##_jet_type_tag_ \ + { \ + DECLARE_SOA_DYNAMIC_COLUMN(Dummy##_jet_type_base_##s, dummy##_jet_type_base_##s, \ + []() -> int { return 0; }); \ + } \ + DECLARE_SOA_TABLE(_jet_type_base_##JetsMatchedTo##_jet_type_tag_##Jets, "AOD", _description_, \ + _jet_type_tag_##jetmatchingGeo::_jet_type_tag_##JetIds, \ + _jet_type_tag_##jetmatchingPt::_jet_type_tag_##JetIds, \ + _jet_type_tag_##jetmatchingCand::_jet_type_tag_##JetIds, \ + _jet_type_base_##jetsmatchedto##_jet_type_tag_::Dummy##_jet_type_base_##s<>); \ using _jet_type_base_##JetsMatchedTo##_jet_type_tag_##Jet = _jet_type_base_##JetsMatchedTo##_jet_type_tag_##Jets::iterator; #define DECLARE_MCEVENTWEIGHT_TABLE(_jet_type_, _name_, _description_) \ @@ -181,26 +139,59 @@ DECLARE_SOA_DYNAMIC_COLUMN(P, p, using _jet_type_##JetEventWeight = _jet_type_##JetEventWeights::iterator; // generate tables for data-, detector- and particle-level jets -#define DECLARE_JET_TABLES_LEVELS(_jet_type_, _hfcand_type_, _shortname_) \ - DECLARE_JET_TABLES(JCollision, _jet_type_, JTrack, _hfcand_type_, _shortname_ "JET") \ - DECLARE_JET_TABLES(JCollision, _jet_type_##MCDetectorLevel, JTrack, _hfcand_type_, _shortname_ "DJET") \ - DECLARE_JET_TABLES(JMcCollision, _jet_type_##MCParticleLevel, JMcParticle, JMcParticles, _shortname_ "PJET") \ - DECLARE_JETMATCHING_TABLE(_jet_type_##MCDetectorLevel, _jet_type_##MCParticleLevel, _shortname_ "JETMD2P") \ - DECLARE_JETMATCHING_TABLE(_jet_type_##MCParticleLevel, _jet_type_##MCDetectorLevel, _shortname_ "JETMP2D") \ - DECLARE_MCEVENTWEIGHT_TABLE(_jet_type_##MCDetectorLevel, _jet_type_##MCDetectorLevel, _shortname_ "JETMDEW") \ - DECLARE_MCEVENTWEIGHT_TABLE(_jet_type_##MCParticleLevel, _jet_type_##MCParticleLevel, _shortname_ "JETMPEW") - +#define DECLARE_JET_TABLES_LEVELS(_jet_type_, _subtracted_track_type_, _hfcand_type_, _hfparticle_type_, _shortname_) \ + DECLARE_JET_TABLES(JCollision, _jet_type_, JTrack, _hfcand_type_, _shortname_ "JET") \ + DECLARE_JET_TABLES(JCollision, _jet_type_##MCDetectorLevel, JTrack, _hfcand_type_, _shortname_ "DJET") \ + DECLARE_JET_TABLES(JMcCollision, _jet_type_##MCParticleLevel, JMcParticle, _hfparticle_type_, _shortname_ "PJET") \ + DECLARE_JETMATCHING_TABLE(_jet_type_##MCDetectorLevel, _jet_type_##MCParticleLevel, _shortname_ "JETD2P") \ + DECLARE_JETMATCHING_TABLE(_jet_type_##MCParticleLevel, _jet_type_##MCDetectorLevel, _shortname_ "JETP2D") \ + DECLARE_MCEVENTWEIGHT_TABLE(_jet_type_##MCDetectorLevel, _jet_type_##MCDetectorLevel, _shortname_ "DJETMW") \ + DECLARE_MCEVENTWEIGHT_TABLE(_jet_type_##MCParticleLevel, _jet_type_##MCParticleLevel, _shortname_ "PETMPW") \ + DECLARE_JET_TABLES(JCollision, _jet_type_##EventWiseSubtracted, _subtracted_track_type_, _hfcand_type_, _shortname_ "JETEWS") \ + DECLARE_JETMATCHING_TABLE(_jet_type_, _jet_type_##EventWiseSubtracted, _shortname_ "JET2EWS") \ + DECLARE_JETMATCHING_TABLE(_jet_type_##EventWiseSubtracted, _jet_type_, _shortname_ "JETEWS2") \ + DECLARE_JET_TABLES(JCollision, _jet_type_##MCDetectorLevelEventWiseSubtracted, _subtracted_track_type_, _hfcand_type_, _shortname_ "DJETEWS") \ + DECLARE_MCEVENTWEIGHT_TABLE(_jet_type_##MCDetectorLevelEventWiseSubtracted, _jet_type_##MCDetectorLevelEventWiseSubtracted, _shortname_ "DJETEWSW") \ + DECLARE_JETMATCHING_TABLE(_jet_type_##MCDetectorLevel, _jet_type_##MCDetectorLevelEventWiseSubtracted, _shortname_ "DJET2DEWS") \ + DECLARE_JETMATCHING_TABLE(_jet_type_##MCDetectorLevelEventWiseSubtracted, _jet_type_##MCDetectorLevel, _shortname_ "JETDEWS2D") \ + DECLARE_JET_TABLES(JMcCollision, _jet_type_##MCParticleLevelEventWiseSubtracted, _subtracted_track_type_, _hfparticle_type_, _shortname_ "PJETEWS") namespace o2::aod { -DECLARE_JET_TABLES_LEVELS(Charged, HfCand2Prong, "C"); -DECLARE_JET_TABLES_LEVELS(Full, HfCand2Prong, "F"); -DECLARE_JET_TABLES_LEVELS(Neutral, HfCand2Prong, "N"); -DECLARE_JET_TABLES_LEVELS(D0Charged, HfCand2Prong, "D0"); -DECLARE_JET_TABLES_LEVELS(LcCharged, HfCand3Prong, "Lc"); -DECLARE_JET_TABLES_LEVELS(BplusCharged, HfCandBplus, "BPl"); - -// Hybrid intermediate -DECLARE_JET_TABLES(JCollision, HybridIntermediate, JTrack, HfCand2Prong, "JEHYIN"); +DECLARE_JET_TABLES_LEVELS(Charged, JTrackSub, HfD0Bases, HfD0PBases, "C"); +DECLARE_JET_TABLES_LEVELS(Full, JTrackSub, HfD0Bases, HfD0PBases, "F"); +DECLARE_JET_TABLES_LEVELS(Neutral, JTrackSub, HfD0Bases, HfD0PBases, "N"); +DECLARE_JET_TABLES_LEVELS(D0Charged, JTrackD0Sub, HfD0Bases, HfD0PBases, "D0"); +DECLARE_JET_TABLES_LEVELS(LcCharged, JTrackLcSub, HfCand3Prong, HfD0PBases, "Lc"); +DECLARE_JET_TABLES_LEVELS(BplusCharged, JTrackBplusSub, HfCandBplus, HfD0PBases, "BPl"); + } // namespace o2::aod +using JetCollisions = o2::aod::JCollisions; +using JetCollision = JetCollisions::iterator; +using JetCollisionsMCD = o2::soa::Join; +using JetTracks = o2::aod::JTracks; +using JetTracksMCD = o2::soa::Join; +using JetTracksSub = o2::aod::JTrackSubs; +using JetClusters = o2::aod::JClusters; + +using JetMcCollisions = o2::aod::JMcCollisions; +using JetMcCollision = JetMcCollisions::iterator; +using JetParticles = o2::aod::JMcParticles; + +using CandidatesD0MCP = o2::soa::Join; +using CandidatesLcMCP = o2::soa::Join; +using CandidatesBplusMCP = o2::soa::Join; + +using CandidatesD0Data = o2::soa::Join; +using CandidatesD0MCD = o2::soa::Join; +using JetTracksSubD0 = o2::aod::JTrackD0Subs; + +using CandidatesBplusData = o2::soa::Join; +using CandidatesBplusMCD = o2::soa::Join; +using JetTracksSubBplus = o2::aod::JTrackBplusSubs; + +using CandidatesLcData = o2::soa::Join; +using CandidatesLcMCD = o2::soa::Join; +using JetTracksSubLc = o2::aod::JTrackLcSubs; + #endif // PWGJE_DATAMODEL_JET_H_ diff --git a/PWGJE/DataModel/JetReducedData.h b/PWGJE/DataModel/JetReducedData.h index eb20c80a1f0..5a15023e954 100644 --- a/PWGJE/DataModel/JetReducedData.h +++ b/PWGJE/DataModel/JetReducedData.h @@ -40,7 +40,7 @@ DECLARE_SOA_TABLE(JBCs, "AOD", "JBCs", using JBC = JBCs::iterator; -DECLARE_SOA_TABLE(StoredJBCs, "DYN", "JBCs", +DECLARE_SOA_TABLE(StoredJBCs, "AOD1", "JBCs", o2::soa::Index<>, jbc::RunNumber, jbc::GlobalBC, @@ -52,7 +52,7 @@ using StoredJBC = StoredJBCs::iterator; DECLARE_SOA_TABLE(JBCPIs, "AOD", "JBCPIs", jbc::BCId); -DECLARE_SOA_TABLE(StoredJBCPIs, "DYN", "JBCPIs", +DECLARE_SOA_TABLE(StoredJBCPIs, "AOD1", "JBCPIs", jbc::BCId, o2::soa::Marker<1>); @@ -61,6 +61,7 @@ namespace jcollision DECLARE_SOA_INDEX_COLUMN(Collision, collision); DECLARE_SOA_INDEX_COLUMN(JBC, bc); DECLARE_SOA_COLUMN(PosZ, posZ, float); +DECLARE_SOA_COLUMN(Centrality, centrality, float); DECLARE_SOA_COLUMN(EventSel, eventSel, uint8_t); DECLARE_SOA_BITMAP_COLUMN(Alias, alias, 32); DECLARE_SOA_COLUMN(ChargedTriggerSel, chargedTriggerSel, uint16_t); @@ -70,14 +71,16 @@ DECLARE_SOA_COLUMN(FullTriggerSel, fullTriggerSel, uint16_t); DECLARE_SOA_TABLE(JCollisions, "AOD", "JCollisions", o2::soa::Index<>, jcollision::PosZ, + jcollision::Centrality, jcollision::EventSel, jcollision::Alias); using JCollision = JCollisions::iterator; -DECLARE_SOA_TABLE(StoredJCollisions, "DYN", "JCollisions", +DECLARE_SOA_TABLE(StoredJCollisions, "AOD1", "JCollisions", o2::soa::Index<>, jcollision::PosZ, + jcollision::Centrality, jcollision::EventSel, jcollision::Alias, o2::soa::Marker<1>); @@ -87,28 +90,28 @@ using StoredJCollision = StoredJCollisions::iterator; DECLARE_SOA_TABLE(JCollisionPIs, "AOD", "JCollisionPIs", jcollision::CollisionId); -DECLARE_SOA_TABLE(StoredJCollisionPIs, "DYN", "JCollisionPIs", +DECLARE_SOA_TABLE(StoredJCollisionPIs, "AOD1", "JCollisionPIs", jcollision::CollisionId, o2::soa::Marker<1>); DECLARE_SOA_TABLE(JChTrigSels, "AOD", "JChrgTrigSels", jcollision::ChargedTriggerSel); -DECLARE_SOA_TABLE(StoredJChTrigSels, "DYN", "JChargTrigSels", +DECLARE_SOA_TABLE(StoredJChTrigSels, "AOD1", "JChargTrigSels", jcollision::ChargedTriggerSel, o2::soa::Marker<1>); DECLARE_SOA_TABLE(JFullTrigSels, "AOD", "JFullTrigSels", jcollision::FullTriggerSel); -DECLARE_SOA_TABLE(StoredJFullTrigSels, "DYN", "JFullTrigSels", +DECLARE_SOA_TABLE(StoredJFullTrigSels, "AOD1", "JFullTrigSels", jcollision::FullTriggerSel, o2::soa::Marker<1>); DECLARE_SOA_TABLE(JCollisionBCs, "AOD", "JCollisionBcs", jcollision::JBCId); -DECLARE_SOA_TABLE(StoredJCollisionBCs, "DYN", "JCollisionBcs", +DECLARE_SOA_TABLE(StoredJCollisionBCs, "AOD1", "JCollisionBcs", jcollision::JBCId, o2::soa::Marker<1>); @@ -125,7 +128,7 @@ DECLARE_SOA_TABLE(JMcCollisions, "AOD", "JMcCollisions", using JMcCollision = JMcCollisions::iterator; -DECLARE_SOA_TABLE(StoredJMcCollisions, "DYN", "JMcCollisions", +DECLARE_SOA_TABLE(StoredJMcCollisions, "AOD1", "JMcCollisions", o2::soa::Index<>, jmccollision::PosZ, jmccollision::Weight, @@ -136,7 +139,7 @@ using StoredJMcCollision = StoredJMcCollisions::iterator; DECLARE_SOA_TABLE(JMcCollisionPIs, "AOD", "JMcCollisionPIs", jmccollision::McCollisionId); -DECLARE_SOA_TABLE(StoredJMcCollisionPIs, "DYN", "JMcCollisionPIs", +DECLARE_SOA_TABLE(StoredJMcCollisionPIs, "AOD1", "JMcCollisionPIs", jmccollision::McCollisionId, o2::soa::Marker<1>); @@ -148,7 +151,7 @@ DECLARE_SOA_INDEX_COLUMN(JMcCollision, mcCollision); DECLARE_SOA_TABLE(JMcCollisionLbs, "AOD", "JMcCollisionLbs", jmccollisionlb::JMcCollisionId); -DECLARE_SOA_TABLE(StoredJMcCollisionLbs, "DYN", "JMcCollisionLbs", +DECLARE_SOA_TABLE(StoredJMcCollisionLbs, "AOD1", "JMcCollisionLbs", jmccollisionlb::JMcCollisionId, o2::soa::Marker<1>); @@ -188,7 +191,7 @@ DECLARE_SOA_TABLE(JTracks, "AOD", "JTracks", using JTrack = JTracks::iterator; -DECLARE_SOA_TABLE(StoredJTracks, "DYN", "JTracks", +DECLARE_SOA_TABLE(StoredJTracks, "AOD1", "JTracks", o2::soa::Index<>, jtrack::JCollisionId, jtrack::Pt, @@ -208,7 +211,7 @@ using StoredJTrack = StoredJTracks::iterator; DECLARE_SOA_TABLE(JTrackPIs, "AOD", "JTrackPIs", jtrack::TrackId); -DECLARE_SOA_TABLE(StoredJTrackPIs, "DYN", "JTrackPIs", +DECLARE_SOA_TABLE(StoredJTrackPIs, "AOD1", "JTrackPIs", jtrack::TrackId, o2::soa::Marker<1>); @@ -258,7 +261,7 @@ DECLARE_SOA_TABLE(JMcParticles, "AOD", "JMcParticles", using JMcParticle = JMcParticles::iterator; -DECLARE_SOA_TABLE(StoredJMcParticles, "DYN", "JMcParticles", +DECLARE_SOA_TABLE(StoredJMcParticles, "AOD1", "JMcParticles", o2::soa::Index<>, jmcparticle::JMcCollisionId, jmcparticle::Pt, @@ -283,7 +286,7 @@ using StoredJMcParticle = StoredJMcParticles::iterator; DECLARE_SOA_TABLE(JMcParticlePIs, "AOD", "JMcParticlePIs", jmcparticle::McParticleId); -DECLARE_SOA_TABLE(StoredJMcParticlePIs, "DYN", "JMcParticlePIs", +DECLARE_SOA_TABLE(StoredJMcParticlePIs, "AOD1", "JMcParticlePIs", jmcparticle::McParticleId, o2::soa::Marker<1>); @@ -295,7 +298,7 @@ DECLARE_SOA_INDEX_COLUMN(JMcParticle, mcParticle); DECLARE_SOA_TABLE(JMcTrackLbs, "AOD", "JMcTrackLbs", //! Table joined to the track table containing the MC index jmctracklb::JMcParticleId); -DECLARE_SOA_TABLE(StoredJMcTrackLbs, "DYN", "JMcTrackLbs", //! Table joined to the track table containing the MC index +DECLARE_SOA_TABLE(StoredJMcTrackLbs, "AOD1", "JMcTrackLbs", //! Table joined to the track table containing the MC index jmctracklb::JMcParticleId, o2::soa::Marker<1>); @@ -334,7 +337,7 @@ DECLARE_SOA_TABLE(JClusters, "AOD", "JClusters", //! using JCluster = JClusters::iterator; -DECLARE_SOA_TABLE(StoredJClusters, "DYN", "JClusters", +DECLARE_SOA_TABLE(StoredJClusters, "AOD1", "JClusters", o2::soa::Index<>, jcluster::JCollisionId, jcluster::ID, jcluster::Energy, jcluster::CoreEnergy, jcluster::RawEnergy, jcluster::Eta, jcluster::Phi, jcluster::M02, jcluster::M20, jcluster::NCells, jcluster::Time, @@ -347,14 +350,14 @@ using StoredJCluster = StoredJClusters::iterator; DECLARE_SOA_TABLE(JClusterPIs, "AOD", "JClusterPIs", jcluster::EMCALClusterId); -DECLARE_SOA_TABLE(StoredJClusterPIs, "DYN", "JClusterPIs", +DECLARE_SOA_TABLE(StoredJClusterPIs, "AOD1", "JClusterPIs", jcluster::EMCALClusterId, o2::soa::Marker<1>); DECLARE_SOA_TABLE(JClusterTracks, "AOD", "JClusterTracks", //! jcluster::JTrackIds); -DECLARE_SOA_TABLE(StoredJClusterTracks, "DYN", "JClusterTracks", //! +DECLARE_SOA_TABLE(StoredJClusterTracks, "AOD1", "JClusterTracks", //! jcluster::JTrackIds, o2::soa::Marker<1>); @@ -368,7 +371,7 @@ DECLARE_SOA_TABLE(JDummys, "AOD", "JDummys", o2::soa::Index<>, jdummy::Dummy); -DECLARE_SOA_TABLE(StoredJDummys, "DYN", "JDummys", +DECLARE_SOA_TABLE(StoredJDummys, "AOD1", "JDummys", o2::soa::Index<>, jdummy::Dummy, o2::soa::Marker<1>); diff --git a/PWGJE/DataModel/JetReducedDataHF.h b/PWGJE/DataModel/JetReducedDataHF.h new file mode 100644 index 00000000000..91d71bfc760 --- /dev/null +++ b/PWGJE/DataModel/JetReducedDataHF.h @@ -0,0 +1,59 @@ +// Copyright 2019-2020 CERN and copyright holders of ALICE O2. +// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders. +// All rights not expressly granted are reserved. +// +// This software is distributed under the terms of the GNU General Public +// License v3 (GPL Version 3), copied verbatim in the file "COPYING". +// +// In applying this license CERN does not waive the privileges and immunities +// granted to it by virtue of its status as an Intergovernmental Organization +// or submit itself to any jurisdiction. + +/// +/// \brief Table definitions for reduced data model for hf jets +/// +/// \author Nima Zardoshti + +#ifndef PWGJE_DATAMODEL_JETREDUCEDDATAHF_H_ +#define PWGJE_DATAMODEL_JETREDUCEDDATAHF_H_ + +#include +#include "Framework/AnalysisDataModel.h" +#include "PWGJE/DataModel/EMCALClusters.h" +#include "PWGJE/DataModel/JetReducedData.h" + +namespace o2::aod +{ + +namespace jd0indices +{ +DECLARE_SOA_INDEX_COLUMN(JCollision, collision); +DECLARE_SOA_INDEX_COLUMN_FULL(Prong0, prong0, int, JTracks, "_0"); //! Index to first prong +DECLARE_SOA_INDEX_COLUMN_FULL(Prong1, prong1, int, JTracks, "_1"); //! Index to second prong +DECLARE_SOA_INDEX_COLUMN(JMcCollision, mcCollision); +DECLARE_SOA_INDEX_COLUMN(JMcParticle, mcParticle); +} // namespace jd0indices + +DECLARE_SOA_TABLE(JD0Ids, "AOD1", "JD0Ids", + jd0indices::JCollisionId, + jd0indices::Prong0Id, + jd0indices::Prong1Id); + +DECLARE_SOA_TABLE(StoredJD0Ids, "AOD", "JD0Ids", + jd0indices::JCollisionId, + jd0indices::Prong0Id, + jd0indices::Prong1Id, + o2::soa::Marker<1>); + +DECLARE_SOA_TABLE(JD0PIds, "AOD1", "JD0PIds", + jd0indices::JMcCollisionId, + jd0indices::JMcParticleId); + +DECLARE_SOA_TABLE(StoredJD0PIds, "AOD", "JD0PIds", + jd0indices::JMcCollisionId, + jd0indices::JMcParticleId, + o2::soa::Marker<1>); + +} // namespace o2::aod + +#endif // PWGJE_DATAMODEL_JETREDUCEDDATAHF_H_ diff --git a/PWGJE/DataModel/JetSubstructure.h b/PWGJE/DataModel/JetSubstructure.h index 2dfc5d9687a..1cd8d32622e 100644 --- a/PWGJE/DataModel/JetSubstructure.h +++ b/PWGJE/DataModel/JetSubstructure.h @@ -28,6 +28,13 @@ using namespace o2::analysis; namespace o2::aod { +namespace jetcollision +{ //! +DECLARE_SOA_COLUMN(PosZ, posZ, float); //! +DECLARE_SOA_COLUMN(Centrality, centrality, float); //! +DECLARE_SOA_COLUMN(EventSel, eventSel, uint8_t); //! +} // namespace jetcollision + namespace jetsubstructure { //! DECLARE_SOA_COLUMN(Zg, zg, float); //! @@ -37,53 +44,68 @@ DECLARE_SOA_COLUMN(Nsd, nsd, float); //! namespace jetoutput { -DECLARE_SOA_INDEX_COLUMN(Collision, collision); //! -DECLARE_SOA_INDEX_COLUMN(McCollision, mcCollision); //! -DECLARE_SOA_COLUMN(JetPt, jetPt, float); //! -DECLARE_SOA_COLUMN(JetPhi, jetPhi, float); //! -DECLARE_SOA_COLUMN(JetEta, jetEta, float); //! -DECLARE_SOA_COLUMN(JetR, jetR, float); //! -DECLARE_SOA_COLUMN(JetNConstituents, jetNConstituents, int); //! +DECLARE_SOA_COLUMN(JetPt, jetPt, float); //! +DECLARE_SOA_COLUMN(JetPhi, jetPhi, float); //! +DECLARE_SOA_COLUMN(JetEta, jetEta, float); //! +DECLARE_SOA_COLUMN(JetR, jetR, float); //! +DECLARE_SOA_COLUMN(JetNConstituents, jetNConstituents, int); //! } // namespace jetoutput // Defines the jet substrcuture table definition -#define JETSUBSTRUCTURE_TABLE_DEF(_collision_type_, _jet_type_, _matched_jet_type_, _cand_type_, _name_, _description_) \ - namespace _name_##substructure \ - { \ - DECLARE_SOA_INDEX_COLUMN(_jet_type_, jet); \ - DECLARE_SOA_INDEX_COLUMN_FULL(Candidate, candidate, int, _cand_type_, "_0"); \ - DECLARE_SOA_DYNAMIC_COLUMN(Dummy##_jet_type_, dummy##_jet_type_, []() -> int { return 0; }); \ - } \ - \ - namespace _name_##geomatched \ - { \ - DECLARE_SOA_ARRAY_INDEX_COLUMN_FULL(_matched_jet_type_, matchedJetGeo, int32_t, _matched_jet_type_##s, "_geo"); \ - } \ - \ - namespace _name_##ptmatched \ - { \ - DECLARE_SOA_ARRAY_INDEX_COLUMN_FULL(_matched_jet_type_, matchedJetPt, int32_t, _matched_jet_type_##s, "_pt"); \ - } \ - \ - namespace _name_##candmatched \ - { \ - DECLARE_SOA_ARRAY_INDEX_COLUMN_FULL(_matched_jet_type_, matchedJetCand, int32_t, _matched_jet_type_##s, "_hf"); \ - } \ - \ - DECLARE_SOA_TABLE(_jet_type_##Substructures, "AOD", _description_ "SS", jetsubstructure::Zg, jetsubstructure::Rg, jetsubstructure::Nsd, _name_##substructure::Dummy##_jet_type_<>); \ - DECLARE_SOA_TABLE(_jet_type_##Output, "AOD", _description_ "O", jetoutput::_collision_type_##Id, _name_##substructure::_jet_type_##Id, _name_##substructure::Candidate##Id, _name_##geomatched::_matched_jet_type_##Ids, _name_##ptmatched::_matched_jet_type_##Ids, _name_##candmatched::_matched_jet_type_##Ids, jetoutput::JetPt, jetoutput::JetPhi, jetoutput::JetEta, jetoutput::JetR, jetoutput::JetNConstituents); \ - DECLARE_SOA_TABLE(_jet_type_##SubstructureOutput, "AOD", _description_ "SSO", _name_##substructure::_jet_type_##Id, jetsubstructure::Zg, jetsubstructure::Rg, jetsubstructure::Nsd); +#define JETSUBSTRUCTURE_TABLE_DEF(_collision_type_, _jet_type_, _matched_jet_type_, _cand_type_, _name_, _description_) \ + \ + namespace _name_##collisionoutput \ + { \ + DECLARE_SOA_DYNAMIC_COLUMN(Dummy##_collision_type_, dummy##_collision_type_, []() -> int { return 0; }); \ + } \ + \ + DECLARE_SOA_TABLE(_jet_type_##CollisionOutputs, "AOD", _description_ "CO", jetcollision::PosZ, jetcollision::Centrality, jetcollision::EventSel, _name_##collisionoutput::Dummy##_collision_type_<>); \ + using _jet_type_##CollisionOutput = _jet_type_##CollisionOutputs::iterator; \ + \ + namespace _name_##geomatched \ + { \ + DECLARE_SOA_ARRAY_INDEX_COLUMN_FULL(_matched_jet_type_, matchedJetGeo, int32_t, _matched_jet_type_##s, "_geo"); \ + } \ + \ + namespace _name_##ptmatched \ + { \ + DECLARE_SOA_ARRAY_INDEX_COLUMN_FULL(_matched_jet_type_, matchedJetPt, int32_t, _matched_jet_type_##s, "_pt"); \ + } \ + \ + namespace _name_##candmatched \ + { \ + DECLARE_SOA_ARRAY_INDEX_COLUMN_FULL(_matched_jet_type_, matchedJetCand, int32_t, _matched_jet_type_##s, "_hf"); \ + } \ + namespace _name_##jetoutput \ + { \ + DECLARE_SOA_INDEX_COLUMN(_jet_type_##CollisionOutput, collision); \ + DECLARE_SOA_INDEX_COLUMN_FULL(Candidate, candidate, int, _cand_type_, "_0"); \ + } \ + DECLARE_SOA_TABLE(_jet_type_##Outputs, "AOD", _description_ "O", _name_##jetoutput::_jet_type_##CollisionOutputId, _name_##jetoutput::CandidateId, _name_##geomatched::_matched_jet_type_##Ids, _name_##ptmatched::_matched_jet_type_##Ids, _name_##candmatched::_matched_jet_type_##Ids, jetoutput::JetPt, jetoutput::JetPhi, jetoutput::JetEta, jetoutput::JetR, jetoutput::JetNConstituents); \ + using _jet_type_##Output = _jet_type_##Outputs::iterator; \ + namespace _name_##substructure \ + { \ + DECLARE_SOA_INDEX_COLUMN(_jet_type_##Output, outputTable); \ + DECLARE_SOA_DYNAMIC_COLUMN(Dummy##_jet_type_, dummy##_jet_type_, []() -> int { return 0; }); \ + } \ + \ + DECLARE_SOA_TABLE(_jet_type_##Substructures, "AOD", _description_ "SS", jetsubstructure::Zg, jetsubstructure::Rg, jetsubstructure::Nsd, _name_##substructure::Dummy##_jet_type_<>); \ + DECLARE_SOA_TABLE(_jet_type_##SubstructureOutputs, "AOD", _description_ "SSO", _name_##substructure::_jet_type_##OutputId, jetsubstructure::Zg, jetsubstructure::Rg, jetsubstructure::Nsd); \ + \ + using _jet_type_##Output = _jet_type_##Outputs::iterator; \ + using _jet_type_##SubstructureOutput = _jet_type_##SubstructureOutputs::iterator; -#define JETSUBSTRUCTURE_TABLES_DEF(_jet_type_, _cand_type_, _description_) \ - JETSUBSTRUCTURE_TABLE_DEF(Collision, _jet_type_##Jet, _jet_type_##Jet, _cand_type_, _jet_type_##jet, _description_) \ - JETSUBSTRUCTURE_TABLE_DEF(Collision, _jet_type_##MCDetectorLevelJet, _jet_type_##MCParticleLevelJet, _cand_type_, _jet_type_##mcdetectorleveljet, _description_ "MCD") \ - JETSUBSTRUCTURE_TABLE_DEF(McCollision, _jet_type_##MCParticleLevelJet, _jet_type_##MCDetectorLevelJet, McParticles, _jet_type_##mcparticleleveljet, _description_ "MCP") +#define JETSUBSTRUCTURE_TABLES_DEF(_jet_type_, _cand_type_, _hfparticle_type_, _description_) \ + JETSUBSTRUCTURE_TABLE_DEF(JCollision, _jet_type_##Jet, _jet_type_##Jet, _cand_type_, _jet_type_##jet, _description_) \ + JETSUBSTRUCTURE_TABLE_DEF(JCollision, _jet_type_##MCDetectorLevelJet, _jet_type_##MCParticleLevelJet, _cand_type_, _jet_type_##mcdetectorleveljet, _description_ "MCD") \ + JETSUBSTRUCTURE_TABLE_DEF(JMcCollision, _jet_type_##MCParticleLevelJet, _jet_type_##MCDetectorLevelJet, _hfparticle_type_, _jet_type_##mcparticleleveljet, _description_ "MCP") \ + JETSUBSTRUCTURE_TABLE_DEF(JCollision, _jet_type_##EventWiseSubtractedJet, _jet_type_##Jet, _cand_type_, _jet_type_##eventwisesubtractedjet, _description_ "EWS") -JETSUBSTRUCTURE_TABLES_DEF(Charged, HfCand2Prong, "C"); -JETSUBSTRUCTURE_TABLES_DEF(D0Charged, HfCand2Prong, "D0"); -JETSUBSTRUCTURE_TABLES_DEF(LcCharged, HfCand3Prong, "Lc"); -JETSUBSTRUCTURE_TABLES_DEF(BplusCharged, HfCandBplus, "BPL"); +JETSUBSTRUCTURE_TABLES_DEF(Charged, HfD0Bases, HfD0PBases, "C"); +JETSUBSTRUCTURE_TABLES_DEF(D0Charged, HfD0Bases, HfD0PBases, "D0"); +JETSUBSTRUCTURE_TABLES_DEF(LcCharged, HfD0Bases, HfD0PBases, "Lc"); +JETSUBSTRUCTURE_TABLES_DEF(BplusCharged, HfD0Bases, HfD0PBases, "BPL"); } // namespace o2::aod diff --git a/PWGJE/DataModel/JetSubtraction.h b/PWGJE/DataModel/JetSubtraction.h new file mode 100644 index 00000000000..3d1ee7f20de --- /dev/null +++ b/PWGJE/DataModel/JetSubtraction.h @@ -0,0 +1,161 @@ +// Copyright 2019-2020 CERN and copyright holders of ALICE O2. +// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders. +// All rights not expressly granted are reserved. +// +// This software is distributed under the terms of the GNU General Public +// License v3 (GPL Version 3), copied verbatim in the file "COPYING". +// +// In applying this license CERN does not waive the privileges and immunities +// granted to it by virtue of its status as an Intergovernmental Organization +// or submit itself to any jurisdiction. + +/// +/// \brief Table definitions for background subtraction +/// +/// +/// \author Nima Zardoshti + +#ifndef PWGJE_DATAMODEL_JETSUBTRACTION_H_ +#define PWGJE_DATAMODEL_JETSUBTRACTION_H_ + +#include +#include "Framework/AnalysisDataModel.h" +#include "PWGJE/DataModel/EMCALClusters.h" +#include "PWGJE/DataModel/JetReducedData.h" +#include "PWGHF/DataModel/DerivedTables.h" +#include "PWGHF/DataModel/CandidateReconstructionTables.h" + +namespace o2::aod +{ + +namespace bkgrho +{ +DECLARE_SOA_COLUMN(Rho, rho, float); //! +DECLARE_SOA_COLUMN(RhoM, rhoM, float); //! +} // namespace bkgrho + +namespace bkgcharged +{ +DECLARE_SOA_INDEX_COLUMN(JCollision, collision); +} // namespace bkgcharged + +namespace bkgd0 +{ +DECLARE_SOA_INDEX_COLUMN_FULL(Candidate, candidate, int, HfD0Bases, "_0"); +} // namespace bkgd0 + +namespace bkglc +{ +DECLARE_SOA_INDEX_COLUMN_FULL(Candidate, candidate, int, HfCand3Prong, "_0"); +} // namespace bkglc + +namespace bkgbplus +{ +DECLARE_SOA_INDEX_COLUMN_FULL(Candidate, candidate, int, HfCandBplus, "_0"); +} // namespace bkgbplus + +DECLARE_SOA_TABLE(BkgChargedRhos, "AOD", "BkgCRho", + o2::soa::Index<>, + bkgcharged::JCollisionId, + bkgrho::Rho, + bkgrho::RhoM); + +DECLARE_SOA_TABLE(BkgD0Rhos, "AOD", "BkgD0Rho", + o2::soa::Index<>, + bkgd0::CandidateId, + bkgrho::Rho, + bkgrho::RhoM); + +DECLARE_SOA_TABLE(BkgLcRhos, "AOD", "BkgLcRho", + o2::soa::Index<>, + bkglc::CandidateId, + bkgrho::Rho, + bkgrho::RhoM); + +DECLARE_SOA_TABLE(BkgBplusRhos, "AOD", "BkgBPlRho", + o2::soa::Index<>, + bkgbplus::CandidateId, + bkgrho::Rho, + bkgrho::RhoM); + +namespace jtracksub +{ + +DECLARE_SOA_COLUMN(Pt, pt, float); +DECLARE_SOA_COLUMN(Eta, eta, float); +DECLARE_SOA_COLUMN(Phi, phi, float); +DECLARE_SOA_COLUMN(Energy, energy, float); +DECLARE_SOA_COLUMN(TrackSel, trackSel, uint8_t); +DECLARE_SOA_DYNAMIC_COLUMN(Px, px, + [](float pt, float phi) -> float { return pt * std::cos(phi); }); +DECLARE_SOA_DYNAMIC_COLUMN(Py, py, + [](float pt, float phi) -> float { return pt * std::sin(phi); }); +DECLARE_SOA_DYNAMIC_COLUMN(Pz, pz, + [](float pt, float eta) -> float { return pt * std::sinh(eta); }); +DECLARE_SOA_DYNAMIC_COLUMN(P, p, + [](float pt, float eta) -> float { return pt * std::cosh(eta); }); +} // namespace jtracksub + +DECLARE_SOA_TABLE(JTrackSubs, "AOD", "JTrackSubs", + o2::soa::Index<>, + bkgcharged::JCollisionId, + jtracksub::Pt, + jtracksub::Eta, + jtracksub::Phi, + jtracksub::Energy, + jtracksub::TrackSel, + jtracksub::Px, + jtracksub::Py, + jtracksub::Pz, + jtracksub::P); + +using JTrackSub = JTrackSubs::iterator; + +DECLARE_SOA_TABLE(JTrackD0Subs, "AOD", "JTrackD0Subs", + o2::soa::Index<>, + bkgd0::CandidateId, + jtracksub::Pt, + jtracksub::Eta, + jtracksub::Phi, + jtracksub::Energy, + jtracksub::TrackSel, + jtracksub::Px, + jtracksub::Py, + jtracksub::Pz, + jtracksub::P); + +using JTrackD0Sub = JTrackD0Subs::iterator; + +DECLARE_SOA_TABLE(JTrackLcSubs, "AOD", "JTrackLcSubs", + o2::soa::Index<>, + bkglc::CandidateId, + jtracksub::Pt, + jtracksub::Eta, + jtracksub::Phi, + jtracksub::Energy, + jtracksub::TrackSel, + jtracksub::Px, + jtracksub::Py, + jtracksub::Pz, + jtracksub::P); + +using JTrackLcSub = JTrackLcSubs::iterator; + +DECLARE_SOA_TABLE(JTrackBplusSubs, "AOD", "JTrackBPlSubs", + o2::soa::Index<>, + bkgbplus::CandidateId, + jtracksub::Pt, + jtracksub::Eta, + jtracksub::Phi, + jtracksub::Energy, + jtracksub::TrackSel, + jtracksub::Px, + jtracksub::Py, + jtracksub::Pz, + jtracksub::P); + +using JTrackBplusSub = JTrackBplusSubs::iterator; + +} // namespace o2::aod + +#endif // PWGJE_DATAMODEL_JETSUBTRACTION_H_ diff --git a/PWGJE/TableProducer/CMakeLists.txt b/PWGJE/TableProducer/CMakeLists.txt index a8ece358094..e368f584fe3 100644 --- a/PWGJE/TableProducer/CMakeLists.txt +++ b/PWGJE/TableProducer/CMakeLists.txt @@ -22,6 +22,11 @@ o2physics_add_dpl_workflow(jet-deriveddata-trigger-producer PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::PWGJECore O2Physics::AnalysisCore COMPONENT_NAME Analysis) + o2physics_add_dpl_workflow(jet-deriveddata-producer-dummy + SOURCES jetderiveddataproducerdummy.cxx + PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::PWGJECore O2Physics::AnalysisCore + COMPONENT_NAME Analysis) + o2physics_add_dpl_workflow(jet-deriveddata-writer SOURCES jetderiveddatawriter.cxx PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::PWGJECore O2Physics::AnalysisCore @@ -47,13 +52,18 @@ o2physics_add_dpl_workflow(jet-finder-d0-mcp-charged PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::PWGJECore O2Physics::AnalysisCore O2::FrameworkPhysicsSupport COMPONENT_NAME Analysis) -o2physics_add_dpl_workflow(jet-finder-lc-data-charged - SOURCES jetfinderLcDataCharged.cxx - PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::PWGJECore O2Physics::AnalysisCore O2::FrameworkPhysicsSupport +o2physics_add_dpl_workflow(jet-matching-mc + SOURCES jetmatchingmc.cxx + PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::PWGJECore O2Physics::AnalysisCore COMPONENT_NAME Analysis) -o2physics_add_dpl_workflow(jet-matching - SOURCES jetmatching.cxx +o2physics_add_dpl_workflow(jet-matching-sub + SOURCES jetmatchingsub.cxx + PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::PWGJECore O2Physics::AnalysisCore + COMPONENT_NAME Analysis) + +o2physics_add_dpl_workflow(jet-matching-mc-sub + SOURCES jetmatchingmcsub.cxx PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::PWGJECore O2Physics::AnalysisCore COMPONENT_NAME Analysis) @@ -77,10 +87,15 @@ o2physics_add_dpl_workflow(jet-taggerhf PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::PWGJECore O2Physics::AnalysisCore COMPONENT_NAME Analysis) -o2physics_add_dpl_workflow(rho-estimator +o2physics_add_dpl_workflow(estimator-rho SOURCES rhoEstimator.cxx PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::PWGJECore O2Physics::AnalysisCore COMPONENT_NAME Analysis) + +o2physics_add_dpl_workflow(subtractor-eventwiseconstituent + SOURCES eventwiseConstituentSubtractor.cxx + PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::PWGJECore O2Physics::AnalysisCore + COMPONENT_NAME Analysis) endif() diff --git a/PWGJE/TableProducer/emcalCorrectionTask.cxx b/PWGJE/TableProducer/emcalCorrectionTask.cxx index 6dfa6020870..17ac01c4ce4 100644 --- a/PWGJE/TableProducer/emcalCorrectionTask.cxx +++ b/PWGJE/TableProducer/emcalCorrectionTask.cxx @@ -663,7 +663,7 @@ struct EmcalCorrectionTask { clusterEta.emplace_back(pos.Eta()); } IndexMapPair = - JetUtilities::MatchClustersAndTracks(clusterPhi, clusterEta, + jetutilities::MatchClustersAndTracks(clusterPhi, clusterEta, trackPhi, trackEta, maxMatchingDistance, 20); } diff --git a/PWGJE/TableProducer/eventwiseConstituentSubtractor.cxx b/PWGJE/TableProducer/eventwiseConstituentSubtractor.cxx new file mode 100644 index 00000000000..4c50a10d998 --- /dev/null +++ b/PWGJE/TableProducer/eventwiseConstituentSubtractor.cxx @@ -0,0 +1,133 @@ +// Copyright 2019-2020 CERN and copyright holders of ALICE O2. +// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders. +// All rights not expressly granted are reserved. +// +// This software is distributed under the terms of the GNU General Public +// License v3 (GPL Version 3), copied verbatim in the file "COPYING". +// +// In applying this license CERN does not waive the privileges and immunities +// granted to it by virtue of its status as an Intergovernmental Organization +// or submit itself to any jurisdiction. + +// Task to produce a table groupable with the jcollisions table which contains the event-wise constituent subtracted track list +// +/// \author Nima Zardoshti + +#include "Framework/AnalysisTask.h" +#include "Framework/AnalysisDataModel.h" +#include "Framework/ASoA.h" +#include "Framework/O2DatabasePDGPlugin.h" + +#include "PWGJE/Core/FastJetUtilities.h" +#include "PWGJE/Core/JetFindingUtilities.h" +#include "PWGJE/Core/JetDerivedDataUtilities.h" +#include "PWGJE/DataModel/Jet.h" +#include "PWGJE/Core/JetBkgSubUtils.h" +#include "Framework/runDataProcessing.h" + +using namespace o2; +using namespace o2::framework; +using namespace o2::framework::expressions; + +struct eventWiseConstituentSubtractorTask { + Produces trackSubtractedTable; + Produces trackSubtractedD0Table; + Produces trackSubtractedLcTable; + Produces trackSubtractedBplusTable; + + Configurable trackPtMin{"trackPtMin", 0.15, "minimum track pT"}; + Configurable trackPtMax{"trackPtMax", 1000.0, "maximum track pT"}; + Configurable trackEtaMin{"trackEtaMin", -0.9, "minimum track eta"}; + Configurable trackEtaMax{"trackEtaMax", 0.9, "maximum track eta"}; + Configurable trackPhiMin{"trackPhiMin", -999, "minimum track phi"}; + Configurable trackPhiMax{"trackPhiMax", 999, "maximum track phi"}; + Configurable trackSelections{"trackSelections", "globalTracks", "set track selections"}; + + Configurable selectionFlagD0{"selectionFlagD0", 1, "Selection Flag for D0"}; + Configurable selectionFlagD0bar{"selectionFlagD0bar", 1, "Selection Flag for D0bar"}; + Configurable selectionFlagLcToPKPi{"selectionFlagLcToPKPi", 1, "Selection Flag for Lc->PKPi"}; + Configurable selectionFlagLcToPiPK{"selectionFlagLcToPiPK", 1, "Selection Flag for Lc->PiPK"}; + Configurable selectionFlagBplus{"selectionFlagBplus", 1, "Selection Flag for B+"}; + + Configurable alpha{"alpha", 1.0, "exponent of transverse momentum in calculating the distance measure between pairs"}; + Configurable rMax{"rMax", 0.24, "maximum distance of subtraction"}; + Configurable eventEtaMax{"eventEtaMax", 0.9, "maximum pseudorapidity of event"}; + Configurable doRhoMassSub{"doRhoMassSub", true, "perfom mass subtraction as well"}; + + JetBkgSubUtils eventWiseConstituentSubtractor; + float bkgPhiMax_; + std::vector inputParticles; + std::vector tracksSubtracted; + int trackSelection = -1; + + void init(o2::framework::InitContext&) + { + trackSelection = jetderiveddatautilities::initialiseTrackSelection(static_cast(trackSelections)); + + eventWiseConstituentSubtractor.setDoRhoMassSub(doRhoMassSub); + eventWiseConstituentSubtractor.setConstSubAlphaRMax(alpha, rMax); + eventWiseConstituentSubtractor.setMaxEtaEvent(eventEtaMax); + } + + Filter trackCuts = (aod::jtrack::pt >= trackPtMin && aod::jtrack::pt < trackPtMax && aod::jtrack::eta > trackEtaMin && aod::jtrack::eta < trackEtaMax && aod::jtrack::phi >= trackPhiMin && aod::jtrack::phi <= trackPhiMax); + + Preslice perD0Candidate = aod::bkgd0::candidateId; + Preslice perLcCandidate = aod::bkglc::candidateId; + Preslice perBplusCandidate = aod::bkgbplus::candidateId; + + template + void analyseHF(T const& tracks, U const& candidates, V const& bkgRhos, M& trackSubtractedTable) + { + + for (auto& candidate : candidates) { + + auto const bkgRhosSliced = jethfutilities::slicedPerCandidate(bkgRhos, candidate, perD0Candidate, perLcCandidate, perBplusCandidate); + auto const bkgRho = bkgRhosSliced.iteratorAt(0); + + inputParticles.clear(); + tracksSubtracted.clear(); + jetfindingutilities::analyseTracks(inputParticles, tracks, trackSelection, std::optional{candidate}); + + tracksSubtracted = eventWiseConstituentSubtractor.JetBkgSubUtils::doEventConstSub(inputParticles, bkgRho.rho(), bkgRho.rhoM()); + for (auto const& trackSubtracted : tracksSubtracted) { + + trackSubtractedTable(candidate.globalIndex(), trackSubtracted.pt(), trackSubtracted.eta(), trackSubtracted.phi(), trackSubtracted.E(), jetderiveddatautilities::setSingleTrackSelectionBit(trackSelection)); + } + } + } + + void processCollisions(soa::Join::iterator const& collision, soa::Filtered const& tracks) + { + + inputParticles.clear(); + tracksSubtracted.clear(); + jetfindingutilities::analyseTracks, soa::Filtered::iterator>(inputParticles, tracks, trackSelection); + + tracksSubtracted = eventWiseConstituentSubtractor.JetBkgSubUtils::doEventConstSub(inputParticles, collision.rho(), collision.rhoM()); + + for (auto const& trackSubtracted : tracksSubtracted) { + trackSubtractedTable(collision.globalIndex(), trackSubtracted.pt(), trackSubtracted.eta(), trackSubtracted.phi(), trackSubtracted.E(), jetderiveddatautilities::setSingleTrackSelectionBit(trackSelection)); + } + } + PROCESS_SWITCH(eventWiseConstituentSubtractorTask, processCollisions, "Fill table of subtracted tracks for collisions", true); + + void processD0Collisions(JetCollision const& collision, aod::BkgD0Rhos const& bkgRhos, soa::Filtered const& tracks, CandidatesD0Data const& candidates) + { + analyseHF(tracks, candidates, bkgRhos, trackSubtractedD0Table); + } + PROCESS_SWITCH(eventWiseConstituentSubtractorTask, processD0Collisions, "Fill table of subtracted tracks for collisions with D0 candidates", false); + + void processLcCollisions(JetCollision const& collision, aod::BkgLcRhos const& bkgRhos, soa::Filtered const& tracks, CandidatesLcData const& candidates) + { + analyseHF(tracks, candidates, bkgRhos, trackSubtractedLcTable); + } + PROCESS_SWITCH(eventWiseConstituentSubtractorTask, processLcCollisions, "Fill table of subtracted tracks for collisions with Lc candidates", false); + + void processBplusCollisions(JetCollision const& collision, aod::BkgBplusRhos const& bkgRhos, soa::Filtered const& tracks, CandidatesBplusData const& candidates) + { + analyseHF(tracks, candidates, bkgRhos, trackSubtractedBplusTable); + } + PROCESS_SWITCH(eventWiseConstituentSubtractorTask, processBplusCollisions, "Fill table of subtracted tracks for collisions with Bplus candidates", false); +}; + +WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) { return WorkflowSpec{adaptAnalysisTask(cfgc, TaskName{"subtractor-eventwiseconstituent"})}; } diff --git a/PWGJE/TableProducer/jetderiveddataproducer.cxx b/PWGJE/TableProducer/jetderiveddataproducer.cxx index 3adac7913ce..b99c6b371bc 100644 --- a/PWGJE/TableProducer/jetderiveddataproducer.cxx +++ b/PWGJE/TableProducer/jetderiveddataproducer.cxx @@ -27,6 +27,7 @@ #include "Common/Core/TrackSelectionDefaults.h" #include "Common/DataModel/EventSelection.h" #include "Common/DataModel/TrackSelectionTables.h" +#include "Common/DataModel/Centrality.h" #include "Common/Core/RecoDecay.h" #include "PWGJE/DataModel/EMCALClusters.h" @@ -58,6 +59,8 @@ struct JetDerivedDataProducerTask { Produces jClustersTable; Produces jClustersParentIndexTable; Produces jClustersMatchedTracksTable; + Produces jD0IdsTable; + Produces jD0ParticleIdsTable; Preslice perClusterCells = aod::emcalclustercell::emcalclusterId; Preslice perClusterTracks = aod::emcalclustercell::emcalclusterId; @@ -66,21 +69,29 @@ struct JetDerivedDataProducerTask { { } - void processBunchCossings(soa::Join::iterator const& bc) + void processBunchCrossings(soa::Join::iterator const& bc) { jBCsTable(bc.runNumber(), bc.globalBC(), bc.timestamp()); jBCParentIndexTable(bc.globalIndex()); } - PROCESS_SWITCH(JetDerivedDataProducerTask, processBunchCossings, "produces derived bunch crossing table", false); + PROCESS_SWITCH(JetDerivedDataProducerTask, processBunchCrossings, "produces derived bunch crossing table", false); void processCollisions(soa::Join::iterator const& collision) { - jCollisionsTable(collision.posZ(), JetDerivedDataUtilities::setEventSelectionBit(collision), collision.alias_raw()); + jCollisionsTable(collision.posZ(), -1.0, jetderiveddatautilities::setEventSelectionBit(collision), collision.alias_raw()); jCollisionsParentIndexTable(collision.globalIndex()); jCollisionsBunchCrossingIndexTable(collision.bcId()); } PROCESS_SWITCH(JetDerivedDataProducerTask, processCollisions, "produces derived collision tables", true); + void processCollisionsWithCentrality(soa::Join::iterator const& collision) + { + jCollisionsTable(collision.posZ(), collision.centFT0C(), jetderiveddatautilities::setEventSelectionBit(collision), collision.alias_raw()); + jCollisionsParentIndexTable(collision.globalIndex()); + jCollisionsBunchCrossingIndexTable(collision.bcId()); + } + PROCESS_SWITCH(JetDerivedDataProducerTask, processCollisionsWithCentrality, "produces derived collision tables with centrality", false); + void processMcCollisionLabels(soa::Join::iterator const& collision) { @@ -101,7 +112,7 @@ struct JetDerivedDataProducerTask { void processTracks(soa::Join::iterator const& track) { - jTracksTable(track.collisionId(), track.pt(), track.eta(), track.phi(), JetDerivedDataUtilities::trackEnergy(track), track.sign(), JetDerivedDataUtilities::setTrackSelectionBit(track)); + jTracksTable(track.collisionId(), track.pt(), track.eta(), track.phi(), jetderiveddatautilities::trackEnergy(track), track.sign(), jetderiveddatautilities::setTrackSelectionBit(track)); jTracksParentIndexTable(track.globalIndex()); } PROCESS_SWITCH(JetDerivedDataProducerTask, processTracks, "produces derived track table", true); @@ -179,6 +190,18 @@ struct JetDerivedDataProducerTask { } } PROCESS_SWITCH(JetDerivedDataProducerTask, processClusters, "produces derived cluster tables", false); + + void processD0(aod::HfD0Ids::iterator const& D0, soa::Join const& collisions, aod::Tracks const& tracks) + { + jD0IdsTable(D0.collisionId(), D0.prong0Id(), D0.prong1Id()); + } + PROCESS_SWITCH(JetDerivedDataProducerTask, processD0, "produces derived bunch crossing table for D0 candidates", false); + + void processD0MC(aod::HfD0PIds::iterator const& D0, aod::McCollisions const& mcCollisions, aod::McParticles const& particles) + { + jD0ParticleIdsTable(D0.mcCollisionId(), D0.mcParticleId()); + } + PROCESS_SWITCH(JetDerivedDataProducerTask, processD0MC, "produces derived bunch crossing table for D0 particles", false); }; WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) diff --git a/PWGJE/TableProducer/jetderiveddataproducerdummy.cxx b/PWGJE/TableProducer/jetderiveddataproducerdummy.cxx new file mode 100644 index 00000000000..18986302953 --- /dev/null +++ b/PWGJE/TableProducer/jetderiveddataproducerdummy.cxx @@ -0,0 +1,46 @@ +// Copyright 2019-2020 CERN and copyright holders of ALICE O2. +// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders. +// All rights not expressly granted are reserved. +// +// This software is distributed under the terms of the GNU General Public +// License v3 (GPL Version 3), copied verbatim in the file "COPYING". +// +// In applying this license CERN does not waive the privileges and immunities +// granted to it by virtue of its status as an Intergovernmental Organization +// or submit itself to any jurisdiction. + +// temporary task to produce HF tables needed when making inclusive derived data - should become obsolete when tables are able to be prouduced based on a configurable +// +/// \author Nima Zardoshti + +#include "Framework/AnalysisTask.h" +#include "Framework/AnalysisDataModel.h" +#include "Framework/ASoA.h" +#include "Framework/runDataProcessing.h" +#include "PWGJE/DataModel/JetReducedData.h" +#include "PWGHF/DataModel/DerivedTables.h" + +using namespace o2; +using namespace o2::framework; +using namespace o2::framework::expressions; + +struct JetDerivedDataProducerDummyTask { + Produces D0Table; + Produces D0McTable; + Produces D0ParticleTable; + + void init(InitContext const&) + { + } + + void processDummy(aod::JDummys const& dummys) + { + } + PROCESS_SWITCH(JetDerivedDataProducerDummyTask, processDummy, "leaves all tables empty", true); +}; + +WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) +{ + return WorkflowSpec{ + adaptAnalysisTask(cfgc, TaskName{"jet-deriveddata-producer-dummy"})}; +} diff --git a/PWGJE/TableProducer/jetderiveddatatriggerproducer.cxx b/PWGJE/TableProducer/jetderiveddatatriggerproducer.cxx index 66a1c9e6ba3..3471a8950b2 100644 --- a/PWGJE/TableProducer/jetderiveddatatriggerproducer.cxx +++ b/PWGJE/TableProducer/jetderiveddatatriggerproducer.cxx @@ -42,25 +42,25 @@ struct JetDerivedDataTriggerProducerTask { void processChargedJetTriggers(soa::Join::iterator const& collision) { - jChargedTriggerSelsTable(JetDerivedDataUtilities::setChargedTriggerSelectionBit(collision)); + jChargedTriggerSelsTable(jetderiveddatautilities::setChargedTriggerSelectionBit(collision)); } PROCESS_SWITCH(JetDerivedDataTriggerProducerTask, processChargedJetTriggers, "produces derived charged trigger table", false); void processNoChargedJetTriggers(aod::Collision const& collision) { - jChargedTriggerSelsTable(JetDerivedDataUtilities::JTrigSelCh::noChargedTigger); + jChargedTriggerSelsTable(jetderiveddatautilities::JTrigSelCh::noChargedTigger); } PROCESS_SWITCH(JetDerivedDataTriggerProducerTask, processNoChargedJetTriggers, "produces derived charged trigger table when sample is not triggered", true); void processFullJetTriggers(soa::Join::iterator const& collision) { - jFullTriggerSelsTable(JetDerivedDataUtilities::setFullTriggerSelectionBit(collision)); + jFullTriggerSelsTable(jetderiveddatautilities::setFullTriggerSelectionBit(collision)); } PROCESS_SWITCH(JetDerivedDataTriggerProducerTask, processFullJetTriggers, "produces derived full trigger table", false); void processNoFullJetTriggers(aod::Collision const& collision) { - jFullTriggerSelsTable(JetDerivedDataUtilities::JTrigSelFull::noFullTrigger); + jFullTriggerSelsTable(jetderiveddatautilities::JTrigSelFull::noFullTrigger); } PROCESS_SWITCH(JetDerivedDataTriggerProducerTask, processNoFullJetTriggers, "produces derived full trigger table table when sample is not triggered", true); }; diff --git a/PWGJE/TableProducer/jetderiveddatawriter.cxx b/PWGJE/TableProducer/jetderiveddatawriter.cxx index bcb80aba159..a7c8da815a5 100644 --- a/PWGJE/TableProducer/jetderiveddatawriter.cxx +++ b/PWGJE/TableProducer/jetderiveddatawriter.cxx @@ -23,6 +23,7 @@ #include "Framework/ASoA.h" #include "Framework/runDataProcessing.h" +#include "PWGJE/Core/JetHFUtilities.h" #include "PWGJE/DataModel/Jet.h" #include "PWGJE/DataModel/JetReducedData.h" @@ -39,6 +40,10 @@ struct JetDerivedDataWriter { Configurable chargedD0JetPtMin{"chargedD0JetPtMin", 0.0, "Minimum charged D0 jet pt to accept event"}; Configurable chargedLcJetPtMin{"chargedLcJetPtMin", 0.0, "Minimum charged Lc jet pt to accept event"}; + Configurable saveBCsTable{"saveBCsTable", true, "save the bunch crossing table to the output"}; + Configurable saveClustersTable{"saveClustersTable", true, "save the clusters table to the output"}; + Configurable saveD0Table{"saveD0Table", false, "save the D0 table to the output"}; + Produces storedJDummysTable; Produces storedJBCsTable; Produces storedJBCParentIndexTable; @@ -59,10 +64,22 @@ struct JetDerivedDataWriter { Produces storedJClustersParentIndexTable; Produces storedJClustersMatchedTracksTable; - PresliceUnsorted> CollisionsPerMcCollision = aod::jmccollisionlb::mcCollisionId; + Produces storedD0CollisionsTable; + Produces storedD0sTable; + Produces storedD0ParsTable; + Produces storedD0ParExtrasTable; + Produces storedD0SelsTable; + Produces storedD0McsTable; + Produces storedD0IdsTable; + Produces storedD0ParticlesTable; + Produces storedD0ParticleIdsTable; + + PresliceUnsorted> + CollisionsPerMcCollision = aod::jmccollisionlb::mcCollisionId; PresliceUnsorted> ParticlesPerMcCollision = aod::jmcparticle::mcCollisionId; Preslice> TracksPerCollision = aod::jtrack::collisionId; Preslice> ClustersPerCollision = aod::jcluster::collisionId; + Preslice> D0sPerCollision = aod::jd0indices::collisionId; std::vector collisionFlag; std::vector McCollisionFlag; @@ -121,13 +138,13 @@ struct JetDerivedDataWriter { decltype(ProcessConfigurable{&_Class_ ::_Method_, #_Name_, _Default_, _Help_}) do##_Name_ = ProcessConfigurable{&_Class_ ::_Method_, #_Name_, _Default_, _Help_}; PROCESS_SWITCH(JetDerivedDataWriter, processCollisions, "setup the writing for data and MCD", true); PROCESS_SWITCH(JetDerivedDataWriter, processMcCollisions, "setup the writing for MCP", false); - PROCESS_SWITCH_JKL(JetDerivedDataWriter, processJets, processChargedJets, "process charged jets", true); - PROCESS_SWITCH_JKL(JetDerivedDataWriter, processJets, processChargedMCDJets, "process charged mcd jets", false); - PROCESS_SWITCH_JKL(JetDerivedDataWriter, processJets, processChargedMCPJets, "process charged mcp jets", false); - PROCESS_SWITCH_JKL(JetDerivedDataWriter, processJets, processNeutralJets, "process neutral jets", false); - PROCESS_SWITCH_JKL(JetDerivedDataWriter, processJets, processFullJets, "process full jets", false); - PROCESS_SWITCH_JKL(JetDerivedDataWriter, processJets, processD0ChargedJets, "process D0 charged jets", false); - PROCESS_SWITCH_JKL(JetDerivedDataWriter, processJets, processLcChargedJets, "process Lc charged jets", false); + PROCESS_SWITCH_FULL(JetDerivedDataWriter, processJets, processChargedJets, "process charged jets", true); + PROCESS_SWITCH_FULL(JetDerivedDataWriter, processJets, processChargedMCDJets, "process charged mcd jets", false); + PROCESS_SWITCH_FULL(JetDerivedDataWriter, processJets, processChargedMCPJets, "process charged mcp jets", false); + PROCESS_SWITCH_FULL(JetDerivedDataWriter, processJets, processNeutralJets, "process neutral jets", false); + PROCESS_SWITCH_FULL(JetDerivedDataWriter, processJets, processFullJets, "process full jets", false); + PROCESS_SWITCH_FULL(JetDerivedDataWriter, processJets, processD0ChargedJets, "process D0 charged jets", false); + PROCESS_SWITCH_FULL(JetDerivedDataWriter, processJets, processLcChargedJets, "process Lc charged jets", false); void processDummy(aod::JDummys const& Dummys) { @@ -135,28 +152,31 @@ struct JetDerivedDataWriter { } PROCESS_SWITCH(JetDerivedDataWriter, processDummy, "write out dummy output table", true); - void processData(soa::Join::iterator const& collision, soa::Join const& bcs, soa::Join const& tracks, soa::Join const& clusters) + void processData(soa::Join::iterator const& collision, soa::Join const& bcs, soa::Join const& tracks, soa::Join const& clusters, aod::HfD0CollBases const& D0Collisions, CandidatesD0Data const& D0s) { std::map trackMapping; if (collisionFlag[collision.globalIndex()]) { - - auto bc = collision.bc_as>(); - if (std::find(bcIndicies.begin(), bcIndicies.end(), bc.globalIndex()) == bcIndicies.end()) { - storedJBCsTable(bc.runNumber(), bc.globalBC(), bc.timestamp()); - storedJBCParentIndexTable(bc.bcId()); - bcIndicies.push_back(bc.globalIndex()); - bcMapping.insert(std::make_pair(bc.globalIndex(), storedJBCsTable.lastIndex())); + if (saveBCsTable) { + auto bc = collision.bc_as>(); + if (std::find(bcIndicies.begin(), bcIndicies.end(), bc.globalIndex()) == bcIndicies.end()) { + storedJBCsTable(bc.runNumber(), bc.globalBC(), bc.timestamp()); + storedJBCParentIndexTable(bc.bcId()); + bcIndicies.push_back(bc.globalIndex()); + bcMapping.insert(std::make_pair(bc.globalIndex(), storedJBCsTable.lastIndex())); + } } - storedJCollisionsTable(collision.posZ(), collision.eventSel(), collision.alias_raw()); + storedJCollisionsTable(collision.posZ(), collision.centrality(), collision.eventSel(), collision.alias_raw()); storedJCollisionsParentIndexTable(collision.collisionId()); - int32_t storedBCID = -1; - auto JBCIndex = bcMapping.find(collision.bcId()); - if (JBCIndex != bcMapping.end()) { - storedBCID = JBCIndex->second; + if (saveBCsTable) { + int32_t storedBCID = -1; + auto JBCIndex = bcMapping.find(collision.bcId()); + if (JBCIndex != bcMapping.end()) { + storedBCID = JBCIndex->second; + } + storedJCollisionsBunchCrossingIndexTable(storedBCID); } - storedJCollisionsBunchCrossingIndexTable(storedBCID); storedJChargedTriggerSelsTable(collision.chargedTriggerSel()); storedJFullTriggerSelsTable(collision.fullTriggerSel()); @@ -165,21 +185,48 @@ struct JetDerivedDataWriter { storedJTracksParentIndexTable(track.trackId()); trackMapping.insert(std::make_pair(track.globalIndex(), storedJTracksTable.lastIndex())); } + if (saveClustersTable) { + for (const auto& cluster : clusters) { + storedJClustersTable(storedJCollisionsTable.lastIndex(), cluster.id(), cluster.energy(), cluster.coreEnergy(), cluster.rawEnergy(), + cluster.eta(), cluster.phi(), cluster.m02(), cluster.m20(), cluster.nCells(), cluster.time(), cluster.isExotic(), cluster.distanceToBadChannel(), + cluster.nlm(), cluster.definition(), cluster.leadingCellEnergy(), cluster.subleadingCellEnergy(), cluster.leadingCellNumber(), cluster.subleadingCellNumber()); + storedJClustersParentIndexTable(cluster.clusterId()); + + std::vector clusterStoredJTrackIDs; + for (const auto& clusterTrack : cluster.matchedTracks_as>()) { + auto JtrackIndex = trackMapping.find(clusterTrack.globalIndex()); + if (JtrackIndex != trackMapping.end()) { + clusterStoredJTrackIDs.push_back(JtrackIndex->second); + } + } + storedJClustersMatchedTracksTable(clusterStoredJTrackIDs); + } + } - for (const auto& cluster : clusters) { - storedJClustersTable(storedJCollisionsTable.lastIndex(), cluster.id(), cluster.energy(), cluster.coreEnergy(), cluster.rawEnergy(), - cluster.eta(), cluster.phi(), cluster.m02(), cluster.m20(), cluster.nCells(), cluster.time(), cluster.isExotic(), cluster.distanceToBadChannel(), - cluster.nlm(), cluster.definition(), cluster.leadingCellEnergy(), cluster.subleadingCellEnergy(), cluster.leadingCellNumber(), cluster.subleadingCellNumber()); - storedJClustersParentIndexTable(cluster.clusterId()); + if (saveD0Table) { + int nD0InCollision = 0; + int32_t collisionD0Index = -1; + for (const auto& D0 : D0s) { + if (nD0InCollision == 0) { + jethfutilities::fillD0CollisionTable(D0.hfD0CollBase_as(), storedD0CollisionsTable, collisionD0Index); + } + nD0InCollision++; + + int32_t D0Index = -1; + jethfutilities::fillD0CandidateTable(D0, collisionD0Index, storedD0sTable, storedD0ParsTable, storedD0ParExtrasTable, storedD0SelsTable, storedD0McsTable, D0Index); - std::vector clusterStoredJTrackIDs; - for (const auto& clusterTrack : cluster.matchedTracks_as>()) { - auto JtrackIndex = trackMapping.find(clusterTrack.globalIndex()); + int32_t prong0Id = -1; + int32_t prong1Id = -1; + auto JtrackIndex = trackMapping.find(D0.prong0Id()); + if (JtrackIndex != trackMapping.end()) { + prong0Id = JtrackIndex->second; + } + JtrackIndex = trackMapping.find(D0.prong1Id()); if (JtrackIndex != trackMapping.end()) { - clusterStoredJTrackIDs.push_back(JtrackIndex->second); + prong1Id = JtrackIndex->second; } + storedD0IdsTable(storedJCollisionsTable.lastIndex(), prong0Id, prong1Id); } - storedJClustersMatchedTracksTable(clusterStoredJTrackIDs); } } } @@ -187,7 +234,7 @@ struct JetDerivedDataWriter { // to run after all jet selections PROCESS_SWITCH(JetDerivedDataWriter, processData, "write out data output tables", true); - void processMC(soa::Join const& mcCollisions, soa::Join const& collisions, soa::Join const& bcs, soa::Join const& tracks, soa::Join const& clusters, soa::Join const& particles) + void processMC(soa::Join const& mcCollisions, soa::Join const& collisions, soa::Join const& bcs, soa::Join const& tracks, soa::Join const& clusters, soa::Join const& particles, aod::HfD0CollBases const& D0Collisions, CandidatesD0MCD const& D0s, soa::Join const& D0Particles) { std::map paticleMapping; @@ -244,6 +291,19 @@ struct JetDerivedDataWriter { storedJMcParticlesTable(storedJMcCollisionsTable.lastIndex(), particle.pt(), particle.eta(), particle.phi(), particle.y(), particle.e(), particle.pdgCode(), particle.getGenStatusCode(), particle.getHepMCStatusCode(), particle.isPhysicalPrimary(), mothersId, daughtersId); storedJParticlesParentIndexTable(particle.mcParticleId()); } + + if (saveD0Table) { + for (const auto& D0Particle : D0Particles) { + int32_t D0ParticleIndex = -1; + jethfutilities::fillD0CandidateMcTable(D0Particle, storedD0ParticlesTable, D0ParticleIndex); + int32_t d0ParticleId = -1; + auto JParticleIndex = paticleMapping.find(D0Particle.mcParticleId()); + if (JParticleIndex != paticleMapping.end()) { + d0ParticleId = JParticleIndex->second; + } + storedD0ParticleIdsTable(storedJMcCollisionsTable.lastIndex(), d0ParticleId); + } + } } } @@ -260,28 +320,31 @@ struct JetDerivedDataWriter { for (auto collision : collisionsPerMcCollision) { std::map trackMapping; - - auto bc = collision.bc_as>(); - if (std::find(bcIndicies.begin(), bcIndicies.end(), bc.globalIndex()) == bcIndicies.end()) { - storedJBCsTable(bc.runNumber(), bc.globalBC(), bc.timestamp()); - storedJBCParentIndexTable(bc.bcId()); - bcIndicies.push_back(bc.globalIndex()); - bcMapping.insert(std::make_pair(bc.globalIndex(), storedJBCsTable.lastIndex())); + if (saveBCsTable) { + auto bc = collision.bc_as>(); + if (std::find(bcIndicies.begin(), bcIndicies.end(), bc.globalIndex()) == bcIndicies.end()) { + storedJBCsTable(bc.runNumber(), bc.globalBC(), bc.timestamp()); + storedJBCParentIndexTable(bc.bcId()); + bcIndicies.push_back(bc.globalIndex()); + bcMapping.insert(std::make_pair(bc.globalIndex(), storedJBCsTable.lastIndex())); + } } - storedJCollisionsTable(collision.posZ(), collision.eventSel(), collision.alias_raw()); + storedJCollisionsTable(collision.posZ(), collision.centrality(), collision.eventSel(), collision.alias_raw()); storedJCollisionsParentIndexTable(collision.collisionId()); auto JMcCollisionIndex = mcCollisionMapping.find(mcCollision.globalIndex()); if (JMcCollisionIndex != mcCollisionMapping.end()) { storedJMcCollisionsLabelTable(JMcCollisionIndex->second); } - int32_t storedBCID = -1; - auto JBCIndex = bcMapping.find(collision.bcId()); - if (JBCIndex != bcMapping.end()) { - storedBCID = JBCIndex->second; + if (saveBCsTable) { + int32_t storedBCID = -1; + auto JBCIndex = bcMapping.find(collision.bcId()); + if (JBCIndex != bcMapping.end()) { + storedBCID = JBCIndex->second; + } + storedJCollisionsBunchCrossingIndexTable(storedBCID); } - storedJCollisionsBunchCrossingIndexTable(storedBCID); storedJChargedTriggerSelsTable(collision.chargedTriggerSel()); storedJFullTriggerSelsTable(collision.fullTriggerSel()); @@ -302,22 +365,50 @@ struct JetDerivedDataWriter { } trackMapping.insert(std::make_pair(track.globalIndex(), storedJTracksTable.lastIndex())); } + if (saveClustersTable) { + const auto clustersPerCollision = clusters.sliceBy(ClustersPerCollision, collision.globalIndex()); + for (const auto& cluster : clustersPerCollision) { + storedJClustersTable(storedJCollisionsTable.lastIndex(), cluster.id(), cluster.energy(), cluster.coreEnergy(), cluster.rawEnergy(), + cluster.eta(), cluster.phi(), cluster.m02(), cluster.m20(), cluster.nCells(), cluster.time(), cluster.isExotic(), cluster.distanceToBadChannel(), + cluster.nlm(), cluster.definition(), cluster.leadingCellEnergy(), cluster.subleadingCellEnergy(), cluster.leadingCellNumber(), cluster.subleadingCellNumber()); + storedJClustersParentIndexTable(cluster.clusterId()); + + std::vector clusterStoredJTrackIDs; + for (const auto& clusterTrack : cluster.matchedTracks_as>()) { + auto JtrackIndex = trackMapping.find(clusterTrack.globalIndex()); + if (JtrackIndex != trackMapping.end()) { + clusterStoredJTrackIDs.push_back(JtrackIndex->second); + } + } + storedJClustersMatchedTracksTable(clusterStoredJTrackIDs); + } + } - const auto clustersPerCollision = clusters.sliceBy(ClustersPerCollision, collision.globalIndex()); - for (const auto& cluster : clustersPerCollision) { - storedJClustersTable(storedJCollisionsTable.lastIndex(), cluster.id(), cluster.energy(), cluster.coreEnergy(), cluster.rawEnergy(), - cluster.eta(), cluster.phi(), cluster.m02(), cluster.m20(), cluster.nCells(), cluster.time(), cluster.isExotic(), cluster.distanceToBadChannel(), - cluster.nlm(), cluster.definition(), cluster.leadingCellEnergy(), cluster.subleadingCellEnergy(), cluster.leadingCellNumber(), cluster.subleadingCellNumber()); - storedJClustersParentIndexTable(cluster.clusterId()); + if (saveD0Table) { + const auto d0sPerCollision = D0s.sliceBy(D0sPerCollision, collision.globalIndex()); + int nD0InCollision = 0; + int32_t collisionD0Index = -1; + for (const auto& D0 : d0sPerCollision) { + if (nD0InCollision == 0) { + jethfutilities::fillD0CollisionTable(D0.hfD0CollBase_as(), storedD0CollisionsTable, collisionD0Index); + } + nD0InCollision++; - std::vector clusterStoredJTrackIDs; - for (const auto& clusterTrack : cluster.matchedTracks_as>()) { - auto JtrackIndex = trackMapping.find(clusterTrack.globalIndex()); + int32_t D0Index = -1; + jethfutilities::fillD0CandidateTable(D0, collisionD0Index, storedD0sTable, storedD0ParsTable, storedD0ParExtrasTable, storedD0SelsTable, storedD0McsTable, D0Index); + + int32_t prong0Id = -1; + int32_t prong1Id = -1; + auto JtrackIndex = trackMapping.find(D0.prong0Id()); + if (JtrackIndex != trackMapping.end()) { + prong0Id = JtrackIndex->second; + } + JtrackIndex = trackMapping.find(D0.prong1Id()); if (JtrackIndex != trackMapping.end()) { - clusterStoredJTrackIDs.push_back(JtrackIndex->second); + prong1Id = JtrackIndex->second; } + storedD0IdsTable(storedJCollisionsTable.lastIndex(), prong0Id, prong1Id); } - storedJClustersMatchedTracksTable(clusterStoredJTrackIDs); } } } @@ -327,7 +418,7 @@ struct JetDerivedDataWriter { // to run after all jet selections PROCESS_SWITCH(JetDerivedDataWriter, processMC, "write out data output tables for mc", false); - void processMCP(soa::Join const& mcCollisions, soa::Join const& particles) + void processMCP(soa::Join const& mcCollisions, soa::Join const& particles, soa::Join const& D0Particles) { int particleTableIndex = 0; @@ -373,6 +464,19 @@ struct JetDerivedDataWriter { storedJMcParticlesTable(storedJMcCollisionsTable.lastIndex(), particle.pt(), particle.eta(), particle.phi(), particle.y(), particle.e(), particle.pdgCode(), particle.getGenStatusCode(), particle.getHepMCStatusCode(), particle.isPhysicalPrimary(), mothersId, daughtersId); storedJParticlesParentIndexTable(particle.mcParticleId()); } + + if (saveD0Table) { + for (const auto& D0Particle : D0Particles) { + int32_t D0ParticleIndex = -1; + jethfutilities::fillD0CandidateMcTable(D0Particle, storedD0ParticlesTable, D0ParticleIndex); + int32_t d0ParticleId = -1; + auto JParticleIndex = paticleMapping.find(D0Particle.mcParticleId()); + if (JParticleIndex != paticleMapping.end()) { + d0ParticleId = JParticleIndex->second; + } + storedD0ParticleIdsTable(storedJMcCollisionsTable.lastIndex(), d0ParticleId); + } + } } } } diff --git a/PWGJE/TableProducer/jeteventweightmcd.cxx b/PWGJE/TableProducer/jeteventweightmcd.cxx index 6be40adf686..b86a339ca85 100644 --- a/PWGJE/TableProducer/jeteventweightmcd.cxx +++ b/PWGJE/TableProducer/jeteventweightmcd.cxx @@ -26,30 +26,38 @@ using namespace o2::framework::expressions; #include "Framework/runDataProcessing.h" -template +template struct JetEventWeightMCDTask { Produces mcDetectorLevelWeightsTable; + Produces mcDetectorLevelEventWiseSubtractedWeightsTable; - void processDummy(aod::JCollisions const& collisions) + void processDummy(JetCollisions const& collisions) { } PROCESS_SWITCH(JetEventWeightMCDTask, processDummy, "Dummy process", true); - void processMCDetectorLevelEventWeight(MCDetectorLevelJetTable const& jet, soa::Join const& collisions, aod::JMcCollisions const& mcCollisions) + void processMCDetectorLevelEventWeight(MCDetectorLevelJetTable const& jet, soa::Join const& collisions, JetMcCollisions const& mcCollisions) { - auto collision = jet.template collision_as>(); + auto collision = jet.template collision_as>(); mcDetectorLevelWeightsTable(jet.globalIndex(), collision.mcCollision().weight()); } PROCESS_SWITCH(JetEventWeightMCDTask, processMCDetectorLevelEventWeight, "Fill event weight tables for detector level MC jets", false); + + void processMCDetectorLevelEventWiseSubtractedEventWeight(MCDetectorLevelEventWiseSubtractedJetTable const& jet, soa::Join const& collisions, JetMcCollisions const& mcCollisions) + { + auto collision = jet.template collision_as>(); + mcDetectorLevelEventWiseSubtractedWeightsTable(jet.globalIndex(), collision.mcCollision().weight()); + } + PROCESS_SWITCH(JetEventWeightMCDTask, processMCDetectorLevelEventWiseSubtractedEventWeight, "Fill event weight tables for detector level MC jets", false); }; -using ChargedMCJetsEventWeight = JetEventWeightMCDTask; -using NeutralMCJetsEventWeight = JetEventWeightMCDTask; -using FullMCJetsEventWeight = JetEventWeightMCDTask; -using D0ChargedMCJetsEventWeight = JetEventWeightMCDTask; -using LcChargedMCJetsEventWeight = JetEventWeightMCDTask; -using BplusChargedMCJetsEventWeight = JetEventWeightMCDTask; +using ChargedMCJetsEventWeight = JetEventWeightMCDTask; +using NeutralMCJetsEventWeight = JetEventWeightMCDTask; +using FullMCJetsEventWeight = JetEventWeightMCDTask; +using D0ChargedMCJetsEventWeight = JetEventWeightMCDTask; +using LcChargedMCJetsEventWeight = JetEventWeightMCDTask; +using BplusChargedMCJetsEventWeight = JetEventWeightMCDTask; WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) { diff --git a/PWGJE/TableProducer/jeteventweightmcp.cxx b/PWGJE/TableProducer/jeteventweightmcp.cxx index 44be5b8b708..63344091000 100644 --- a/PWGJE/TableProducer/jeteventweightmcp.cxx +++ b/PWGJE/TableProducer/jeteventweightmcp.cxx @@ -31,12 +31,12 @@ template mcParticleLevelWeightsTable; - void processDummy(aod::JMcCollisions const& collisions) + void processDummy(JetMcCollisions const& collisions) { } PROCESS_SWITCH(JetEventWeightMCPTask, processDummy, "Dummy process", true); - void processMCParticleLevelEventWeight(MCParticleLevelJetTable const& jet, aod::JMcCollisions const& collisions) + void processMCParticleLevelEventWeight(MCParticleLevelJetTable const& jet, JetMcCollisions const& collisions) { mcParticleLevelWeightsTable(jet.globalIndex(), jet.mcCollision().weight()); } diff --git a/PWGJE/TableProducer/jetfinder.cxx b/PWGJE/TableProducer/jetfinder.cxx index 766929ec8ba..15ab2af9e1e 100644 --- a/PWGJE/TableProducer/jetfinder.cxx +++ b/PWGJE/TableProducer/jetfinder.cxx @@ -15,7 +15,7 @@ /// \author Jochen Klein /// \author Raymond Ehlers , ORNL -#include "PWGJE/TableProducer/jetfinder.h" +#include "PWGJE/Core/JetFindingUtilities.h" #include "Framework/runDataProcessing.h" using namespace o2; @@ -23,14 +23,17 @@ using namespace o2::analysis; using namespace o2::framework; using namespace o2::framework::expressions; -template +template struct JetFinderTask { Produces jetsTable; Produces constituentsTable; - Produces constituentsSubTable; + Produces jetsEvtWiseSubTable; + Produces constituentsEvtWiseSubTable; // event level configurables Configurable vertexZCut{"vertexZCut", 10.0f, "Accepted z-vertex range"}; + Configurable centralityMin{"centralityMin", -999.0, "minimum centrality"}; + Configurable centralityMax{"centralityMax", 999.0, "maximum centrality"}; // track level configurables Configurable trackPtMin{"trackPtMin", 0.15, "minimum track pT"}; @@ -74,12 +77,10 @@ struct JetFinderTask { JetFinder jetFinder; std::vector inputParticles; - bool doConstSub = false; - void init(InitContext const&) { - trackSelection = JetDerivedDataUtilities::initialiseTrackSelection(static_cast(trackSelections)); - eventSelection = JetDerivedDataUtilities::initialiseEventSelection(static_cast(eventSelections)); + trackSelection = jetderiveddatautilities::initialiseTrackSelection(static_cast(trackSelections)); + eventSelection = jetderiveddatautilities::initialiseEventSelection(static_cast(eventSelections)); particleSelection = static_cast(particleSelections); jetFinder.etaMin = trackEtaMin; @@ -101,92 +102,109 @@ struct JetFinderTask { } aod::EMCALClusterDefinition clusterDefinition = aod::emcalcluster::getClusterDefinitionFromString(clusterDefinitionS.value); - Filter collisionFilter = nabs(aod::jcollision::posZ) < vertexZCut; + Filter collisionFilter = (nabs(aod::jcollision::posZ) < vertexZCut && aod::jcollision::centrality >= centralityMin && aod::jcollision::centrality < centralityMax); Filter trackCuts = (aod::jtrack::pt >= trackPtMin && aod::jtrack::pt < trackPtMax && aod::jtrack::eta > trackEtaMin && aod::jtrack::eta < trackEtaMax && aod::jtrack::phi >= trackPhiMin && aod::jtrack::phi <= trackPhiMax); // do we need eta cut both here and in globalselection? + Filter trackSubCuts = (aod::jtracksub::pt >= trackPtMin && aod::jtracksub::pt < trackPtMax && aod::jtracksub::eta > trackEtaMin && aod::jtracksub::eta < trackEtaMax && aod::jtracksub::phi >= trackPhiMin && aod::jtracksub::phi <= trackPhiMax); + Filter partCuts = (aod::jmcparticle::pt >= trackPtMin && aod::jmcparticle::pt < trackPtMax && aod::jmcparticle::eta > trackEtaMin && aod::jmcparticle::eta < trackEtaMax); Filter clusterFilter = (aod::jcluster::definition == static_cast(clusterDefinition) && aod::jcluster::eta > clusterEtaMin && aod::jcluster::eta < clusterEtaMax && aod::jcluster::phi >= clusterPhiMin && aod::jcluster::phi <= clusterPhiMax && aod::jcluster::energy >= clusterEnergyMin && aod::jcluster::time > clusterTimeMin && aod::jcluster::time < clusterTimeMax && (clusterRejectExotics && aod::jcluster::isExotic != true)); - void processDummy(aod::JCollision const& collision) + void processDummy(JetCollisions const& collisions) { } PROCESS_SWITCH(JetFinderTask, processDummy, "Dummy process function turned on by default", true); - void processChargedJets(soa::Filtered::iterator const& collision, - JetTracks const& tracks) + void processChargedJets(soa::Filtered::iterator const& collision, + soa::Filtered const& tracks) { - if (!JetDerivedDataUtilities::selectCollision(collision, eventSelection)) { + if (!jetderiveddatautilities::selectCollision(collision, eventSelection)) { return; } inputParticles.clear(); - analyseTracks(inputParticles, tracks, trackSelection); - findJets(jetFinder, inputParticles, jetRadius, collision, jetsTable, constituentsTable, constituentsSubTable, doConstSub); + jetfindingutilities::analyseTracks, soa::Filtered::iterator>(inputParticles, tracks, trackSelection); + jetfindingutilities::findJets(jetFinder, inputParticles, jetRadius, collision, jetsTable, constituentsTable); } - PROCESS_SWITCH(JetFinderTask, processChargedJets, "Data jet finding for charged jets", false); + PROCESS_SWITCH(JetFinderTask, processChargedJets, "Data and reco level jet finding for charged jets", false); - void processNeutralJets(soa::Filtered::iterator const& collision, - JetClusters const& clusters) + void processChargedEvtWiseSubJets(soa::Filtered::iterator const& collision, + soa::Filtered const& tracks) { - if (!JetDerivedDataUtilities::eventEMCAL(collision)) { + if (!jetderiveddatautilities::selectCollision(collision, eventSelection)) { return; } inputParticles.clear(); - analyseClusters(inputParticles, &clusters); - findJets(jetFinder, inputParticles, jetRadius, collision, jetsTable, constituentsTable, constituentsSubTable, doConstSub); + jetfindingutilities::analyseTracks, soa::Filtered::iterator>(inputParticles, tracks, trackSelection); + jetfindingutilities::findJets(jetFinder, inputParticles, jetRadius, collision, jetsEvtWiseSubTable, constituentsEvtWiseSubTable); } - PROCESS_SWITCH(JetFinderTask, processNeutralJets, "Data jet finding for neutral jets", false); - void processFullJets(soa::Filtered::iterator const& collision, - JetTracks const& tracks, - JetClusters const& clusters) + PROCESS_SWITCH(JetFinderTask, processChargedEvtWiseSubJets, "Data and reco level jet finding for charged jets with event-wise constituent subtraction", false); + + void processNeutralJets(soa::Filtered::iterator const& collision, + soa::Filtered const& clusters) { - if (!JetDerivedDataUtilities::eventEMCAL(collision)) { + if (!jetderiveddatautilities::eventEMCAL(collision)) { return; } inputParticles.clear(); - analyseTracks(inputParticles, tracks, trackSelection); - analyseClusters(inputParticles, &clusters); - findJets(jetFinder, inputParticles, jetRadius, collision, jetsTable, constituentsTable, constituentsSubTable, doConstSub); + jetfindingutilities::analyseClusters(inputParticles, &clusters); + jetfindingutilities::findJets(jetFinder, inputParticles, jetRadius, collision, jetsTable, constituentsTable); } - PROCESS_SWITCH(JetFinderTask, processFullJets, "Data jet finding for full and neutral jets", false); + PROCESS_SWITCH(JetFinderTask, processNeutralJets, "Data and reco level jet finding for neutral jets", false); - void processParticleLevelChargedJets(aod::JMcCollision const& collision, soa::Filtered const& particles) + void processFullJets(soa::Filtered::iterator const& collision, + soa::Filtered const& tracks, + soa::Filtered const& clusters) + { + if (!jetderiveddatautilities::eventEMCAL(collision)) { + return; + } + inputParticles.clear(); + jetfindingutilities::analyseTracks, soa::Filtered::iterator>(inputParticles, tracks, trackSelection); + jetfindingutilities::analyseClusters(inputParticles, &clusters); + jetfindingutilities::findJets(jetFinder, inputParticles, jetRadius, collision, jetsTable, constituentsTable); + } + PROCESS_SWITCH(JetFinderTask, processFullJets, "Data and reco level jet finding for full and neutral jets", false); + + void processParticleLevelChargedJets(JetMcCollision const& collision, soa::Filtered const& particles) { // TODO: MC event selection? - analyseParticles, soa::Filtered::iterator>(inputParticles, particleSelection, 1, particles, pdgDatabase); - findJets(jetFinder, inputParticles, jetRadius, collision, jetsTable, constituentsTable, constituentsSubTable, doConstSub); + inputParticles.clear(); + jetfindingutilities::analyseParticles, soa::Filtered::iterator>(inputParticles, particleSelection, 1, particles, pdgDatabase); + jetfindingutilities::findJets(jetFinder, inputParticles, jetRadius, collision, jetsTable, constituentsTable); } PROCESS_SWITCH(JetFinderTask, processParticleLevelChargedJets, "Particle level charged jet finding", false); - void processParticleLevelNeutralJets(aod::JMcCollision const& collision, soa::Filtered const& particles) + void processParticleLevelNeutralJets(JetMcCollision const& collision, soa::Filtered const& particles) { // TODO: MC event selection? - analyseParticles, soa::Filtered::iterator>(inputParticles, particleSelection, 2, particles, pdgDatabase); - findJets(jetFinder, inputParticles, jetRadius, collision, jetsTable, constituentsTable, constituentsSubTable, doConstSub); + inputParticles.clear(); + jetfindingutilities::analyseParticles, soa::Filtered::iterator>(inputParticles, particleSelection, 2, particles, pdgDatabase); + jetfindingutilities::findJets(jetFinder, inputParticles, jetRadius, collision, jetsTable, constituentsTable); } PROCESS_SWITCH(JetFinderTask, processParticleLevelNeutralJets, "Particle level neutral jet finding", false); - void processParticleLevelFullJets(aod::JMcCollision const& collision, soa::Filtered const& particles) + void processParticleLevelFullJets(JetMcCollision const& collision, soa::Filtered const& particles) { // TODO: MC event selection? - analyseParticles, soa::Filtered::iterator>(inputParticles, particleSelection, 0, particles, pdgDatabase); - findJets(jetFinder, inputParticles, jetRadius, collision, jetsTable, constituentsTable, constituentsSubTable, doConstSub); + inputParticles.clear(); + jetfindingutilities::analyseParticles, soa::Filtered::iterator>(inputParticles, particleSelection, 0, particles, pdgDatabase); + jetfindingutilities::findJets(jetFinder, inputParticles, jetRadius, collision, jetsTable, constituentsTable); } PROCESS_SWITCH(JetFinderTask, processParticleLevelFullJets, "Particle level full jet finding", false); }; -using JetFinderDataCharged = JetFinderTask; -using JetFinderDataFull = JetFinderTask; -using JetFinderDataNeutral = JetFinderTask; -using JetFinderMCDetectorLevelCharged = JetFinderTask; -using JetFinderMCDetectorLevelFull = JetFinderTask; -using JetFinderMCDetectorLevelNeutral = JetFinderTask; -using JetFinderMCParticleLevelCharged = JetFinderTask; -using JetFinderMCParticleLevelFull = JetFinderTask; -using JetFinderMCParticleLevelNeutral = JetFinderTask; -// using JetFinderHybridIntermediate = JetFinderTask; +using JetFinderDataCharged = JetFinderTask; +using JetFinderDataFull = JetFinderTask; +using JetFinderDataNeutral = JetFinderTask; +using JetFinderMCDetectorLevelCharged = JetFinderTask; +using JetFinderMCDetectorLevelFull = JetFinderTask; +using JetFinderMCDetectorLevelNeutral = JetFinderTask; +using JetFinderMCParticleLevelCharged = JetFinderTask; +using JetFinderMCParticleLevelFull = JetFinderTask; +using JetFinderMCParticleLevelNeutral = JetFinderTask; WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) { @@ -217,10 +235,6 @@ WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) adaptAnalysisTask(cfgc, SetDefaultProcesses{}, TaskName{"jet-finder-mcd-neutral"})); - // tasks.emplace_back( - // adaptAnalysisTask(cfgc, - // SetDefaultProcesses{}, TaskName{"jet-finder-hybrid-intermedaite-full"})); - tasks.emplace_back( adaptAnalysisTask(cfgc, SetDefaultProcesses{}, TaskName{"jet-finder-mcp-charged"})); diff --git a/PWGJE/TableProducer/jetfinder.h b/PWGJE/TableProducer/jetfinder.h deleted file mode 100644 index a7da5143e17..00000000000 --- a/PWGJE/TableProducer/jetfinder.h +++ /dev/null @@ -1,234 +0,0 @@ -// Copyright 2019-2020 CERN and copyright holders of ALICE O2. -// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders. -// All rights not expressly granted are reserved. -// -// This software is distributed under the terms of the GNU General Public -// License v3 (GPL Version 3), copied verbatim in the file "COPYING". -// -// In applying this license CERN does not waive the privileges and immunities -// granted to it by virtue of its status as an Intergovernmental Organization -// or submit itself to any jurisdiction. - -// jet finder task header file -// -/// \author Nima Zardoshti -/// \author Jochen Klein - -#ifndef PWGJE_TABLEPRODUCER_JETFINDER_H_ -#define PWGJE_TABLEPRODUCER_JETFINDER_H_ - -#include -#include -#include -#include - -#include "Framework/AnalysisTask.h" -#include "Framework/AnalysisDataModel.h" -#include "Framework/ASoA.h" -#include "Framework/O2DatabasePDGPlugin.h" - -#include "Common/Core/TrackSelection.h" -#include "Common/Core/TrackSelectionDefaults.h" -#include "Common/DataModel/EventSelection.h" -#include "Common/DataModel/TrackSelectionTables.h" -#include "PWGJE/DataModel/EMCALClusters.h" - -#include "PWGHF/Core/SelectorCuts.h" -#include "PWGHF/DataModel/CandidateReconstructionTables.h" -#include "PWGHF/DataModel/CandidateSelectionTables.h" - -// #include "PWGJE/Core/JetBkgSubUtils.h" -#include "PWGJE/Core/FastJetUtilities.h" -#include "PWGJE/Core/JetDerivedDataUtilities.h" -#include "PWGJE/Core/JetFinder.h" -#include "PWGJE/DataModel/Jet.h" - -using JetTracks = o2::soa::Filtered; -using JetClusters = o2::soa::Filtered; - -using ParticlesD0 = o2::soa::Filtered>; -using ParticlesLc = o2::soa::Filtered>; -using ParticlesBplus = o2::soa::Filtered>; - -using CandidatesD0Data = o2::soa::Filtered>; -using CandidatesD0MCD = o2::soa::Filtered>; - -using CandidatesBplusData = o2::soa::Filtered>; -using CandidatesBplusMCD = o2::soa::Filtered>; - -using CandidatesLcData = o2::soa::Filtered>; -using CandidatesLcMCD = o2::soa::Filtered>; - -// functions for track, cluster and candidate selection - -// function that adds tracks to the fastjet list, removing daughters of 2Prong candidates -template -void analyseTracks(std::vector& inputParticles, T const& tracks, int trackSelection, std::optional const& candidate = std::nullopt) -{ - for (auto& track : tracks) { - if (!JetDerivedDataUtilities::selectTrack(track, trackSelection)) { - continue; - } - if (candidate != std::nullopt) { - auto cand = candidate.value(); - if constexpr (std::is_same_v, CandidatesD0Data::iterator> || std::is_same_v, CandidatesD0Data::filtered_iterator> || std::is_same_v, CandidatesD0MCD::iterator> || std::is_same_v, CandidatesD0MCD::filtered_iterator>) { - if (cand.template prong0_as().globalIndex() == track.globalIndex() || cand.template prong1_as().globalIndex() == track.globalIndex()) { - continue; - } - } - - if constexpr (std::is_same_v, CandidatesLcData::iterator> || std::is_same_v, CandidatesLcData::filtered_iterator> || std::is_same_v, CandidatesLcMCD::iterator> || std::is_same_v, CandidatesLcMCD::filtered_iterator>) { - if (cand.template prong0_as().globalIndex() == track.globalIndex() || cand.template prong1_as().globalIndex() == track.globalIndex() || cand.template prong2_as().globalIndex() == track.globalIndex()) { - continue; - } - } - - if constexpr (std::is_same_v, CandidatesBplusData::iterator> || std::is_same_v, CandidatesBplusData::filtered_iterator> || std::is_same_v, CandidatesBplusMCD::iterator> || std::is_same_v, CandidatesBplusMCD::filtered_iterator>) { - if (cand.template prong0_as().template prong0_as().globalIndex() == track.globalIndex() || cand.template prong0_as().template prong1_as().globalIndex() == track.globalIndex() || cand.template prong1_as().globalIndex() == track.globalIndex()) { - continue; - } - } - } - FastJetUtilities::fillTracks(track, inputParticles, track.globalIndex()); - } -} - -// function that adds clusters to the fastjet list -template -void analyseClusters(std::vector& inputParticles, T const& clusters) -{ - for (auto& cluster : *clusters) { - // add cluster selections - FastJetUtilities::fillClusters(cluster, inputParticles, cluster.globalIndex()); - } -} - -// function that takes any generic candidate, performs selections and adds the candidate to the fastjet list -template -bool analyseCandidate(std::vector& inputParticles, int candMass, float candPtMin, float candPtMax, float candYMin, float candYMax, T const& candidate) -{ - if (candidate.y(candMass) < candYMin || candidate.y(candMass) > candYMax) { - return false; - } - if (candidate.pt() < candPtMin || candidate.pt() >= candPtMax) { - return false; - } - FastJetUtilities::fillTracks(candidate, inputParticles, candidate.globalIndex(), static_cast(JetConstituentStatus::candidateHF), candMass); - return true; -} - -// function that checks the MC status of a candidate and then calls the function to analyseCandidates -template -bool analyseCandidateMC(std::vector& inputParticles, int candMass, int candDecay, float candPtMin, float candPtMax, float candYMin, float candYMax, T const& candidate, bool rejectBackgroundMCCandidates) -{ - if (rejectBackgroundMCCandidates && !(std::abs(candidate.flagMcMatchRec()) == 1 << candDecay)) { - return false; - } - return analyseCandidate(inputParticles, candMass, candPtMin, candPtMax, candYMin, candYMax, candidate); -} - -// function that calls the jet finding and fills the relevant tables -template -void findJets(JetFinder& jetFinder, std::vector& inputParticles, std::vector jetRadius, T const& collision, U& jetsTable, V& constituentsTable, W& constituentsSubTable, bool DoConstSub, bool doHFJetFinding = false) -{ - // auto candidatepT = 0.0; - auto jetRValues = static_cast>(jetRadius); - for (auto R : jetRValues) { - jetFinder.jetR = R; - std::vector jets; - fastjet::ClusterSequenceArea clusterSeq(jetFinder.findJets(inputParticles, jets)); - - // JetBkgSubUtils bkgSub(jetFinder.jetR, 1., 0.6, jetFinder.jetEtaMin, jetFinder.jetEtaMax, jetFinder.jetPhiMin, jetFinder.jetPhiMax, jetFinder.ghostAreaSpec); - // bkgSub.setMaxEtaEvent(jetFinder.etaMax); - // auto[rho, rhoM] = bkgSub.estimateRhoAreaMedian(inputParticles, false); - // jets = jetFinder.selJets(bkgSub.doRhoAreaSub(jets, rho, rhoM)); - - for (const auto& jet : jets) { - bool isHFJet = false; - if (doHFJetFinding) { - for (const auto& constituent : jet.constituents()) { - if (constituent.template user_info().getStatus() == static_cast(JetConstituentStatus::candidateHF)) { - isHFJet = true; - // candidatepT = constituent.pt(); - break; - } - } - if (!isHFJet) { - continue; - } - } - std::vector trackconst; - std::vector candconst; - std::vector clusterconst; - jetsTable(collision.globalIndex(), jet.pt(), jet.eta(), jet.phi(), - jet.E(), jet.m(), jet.has_area() ? jet.area() : -1., std::round(R * 100)); - for (const auto& constituent : sorted_by_pt(jet.constituents())) { - // need to add seperate thing for constituent subtraction - if (DoConstSub) { - constituentsSubTable(jetsTable.lastIndex(), constituent.pt(), constituent.eta(), constituent.phi(), - constituent.E(), constituent.m(), constituent.user_index()); - } - - if (constituent.template user_info().getStatus() == static_cast(JetConstituentStatus::track)) { - trackconst.push_back(constituent.template user_info().getIndex()); - } - if (constituent.template user_info().getStatus() == static_cast(JetConstituentStatus::cluster)) { - clusterconst.push_back(constituent.template user_info().getIndex()); - } - if (constituent.template user_info().getStatus() == static_cast(JetConstituentStatus::candidateHF)) { - candconst.push_back(constituent.template user_info().getIndex()); - } - } - constituentsTable(jetsTable.lastIndex(), trackconst, clusterconst, candconst); - } - } -} - -// function that checks if a candidate has any daughters that need to be removed from the event at gen level -template -bool checkDaughters(T const& particle, int globalIndex) -{ - for (auto daughter : particle.template daughters_as()) { - if (daughter.globalIndex() == globalIndex) { - return true; - } - if (checkDaughters(daughter, globalIndex)) { - return true; - } - } - return false; -} - -template -void analyseParticles(std::vector& inputParticles, std::string particleSelection, int jetTypeParticleLevel, T const& particles, o2::framework::Service pdgDatabase, std::optional const& candidate = std::nullopt) -{ - inputParticles.clear(); - for (auto& particle : particles) { - if (particleSelection == "PhysicalPrimary" && !particle.isPhysicalPrimary()) { // CHECK : Does this exclude the HF hadron? - continue; - } else if (particleSelection == "HepMCStatus" && particle.getHepMCStatusCode() != 1) { // do we need isPhysicalPrimary as well? Note: Might give unforseen results if the generator isnt PYTHIA - continue; - } else if (particleSelection == "GenStatus" && particle.getGenStatusCode() != 1) { - continue; - } else if (particleSelection == "PhysicalPrimaryAndHepMCStatus" && (!particle.isPhysicalPrimary() || particle.getHepMCStatusCode() != 1)) { - continue; - } - auto pdgParticle = pdgDatabase->GetParticle(particle.pdgCode()); - auto pdgCharge = pdgParticle ? std::abs(pdgParticle->Charge()) : -1.0; - if (jetTypeParticleLevel == static_cast(JetType::charged) && pdgCharge < 3.0) { - continue; - } - if (jetTypeParticleLevel == static_cast(JetType::neutral) && pdgCharge != 0.0) { - continue; - } - if (candidate != std::nullopt) { - auto cand = candidate.value(); - if (checkDaughters(cand, particle.globalIndex())) { - continue; - } - } - FastJetUtilities::fillTracks(particle, inputParticles, particle.globalIndex(), static_cast(JetConstituentStatus::track), pdgParticle->Mass()); - } -} - -#endif // PWGJE_TABLEPRODUCER_JETFINDER_H_ diff --git a/PWGJE/TableProducer/jetfinderD0DataCharged.cxx b/PWGJE/TableProducer/jetfinderD0DataCharged.cxx index 9250c8ad582..126cecd682b 100644 --- a/PWGJE/TableProducer/jetfinderD0DataCharged.cxx +++ b/PWGJE/TableProducer/jetfinderD0DataCharged.cxx @@ -15,7 +15,7 @@ #include "PWGJE/TableProducer/jetfinderhf.cxx" -using JetFinderD0DataCharged = JetFinderHFTask; +using JetFinderD0DataCharged = JetFinderHFTask; WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) { diff --git a/PWGJE/TableProducer/jetfinderD0MCDCharged.cxx b/PWGJE/TableProducer/jetfinderD0MCDCharged.cxx index 74813626c7c..52e2365084b 100644 --- a/PWGJE/TableProducer/jetfinderD0MCDCharged.cxx +++ b/PWGJE/TableProducer/jetfinderD0MCDCharged.cxx @@ -15,7 +15,7 @@ #include "PWGJE/TableProducer/jetfinderhf.cxx" -using JetFinderD0MCDetectorLevelCharged = JetFinderHFTask; +using JetFinderD0MCDetectorLevelCharged = JetFinderHFTask; WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) { diff --git a/PWGJE/TableProducer/jetfinderD0MCPCharged.cxx b/PWGJE/TableProducer/jetfinderD0MCPCharged.cxx index 38b839c03cc..31532715035 100644 --- a/PWGJE/TableProducer/jetfinderD0MCPCharged.cxx +++ b/PWGJE/TableProducer/jetfinderD0MCPCharged.cxx @@ -15,7 +15,7 @@ #include "PWGJE/TableProducer/jetfinderhf.cxx" -using JetFinderD0MCParticleLevelCharged = JetFinderHFTask; +using JetFinderD0MCParticleLevelCharged = JetFinderHFTask; WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) { diff --git a/PWGJE/TableProducer/jetfinderLcDataCharged.cxx b/PWGJE/TableProducer/jetfinderLcDataCharged.cxx deleted file mode 100644 index 0e2de5a83cb..00000000000 --- a/PWGJE/TableProducer/jetfinderLcDataCharged.cxx +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright 2019-2020 CERN and copyright holders of ALICE O2. -// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders. -// All rights not expressly granted are reserved. -// -// This software is distributed under the terms of the GNU General Public -// License v3 (GPL Version 3), copied verbatim in the file "COPYING". -// -// In applying this license CERN does not waive the privileges and immunities -// granted to it by virtue of its status as an Intergovernmental Organization -// or submit itself to any jurisdiction. - -// jet finder lc data charged task -// -/// \author Nima Zardoshti - -#include "PWGJE/TableProducer/jetfinderhf.cxx" - -using JetFinderLcDataCharged = JetFinderHFTask; - -WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) -{ - std::vector tasks; - - tasks.emplace_back(adaptAnalysisTask(cfgc, - SetDefaultProcesses{}, - TaskName{"jet-finder-lc-data-charged"})); - - return WorkflowSpec{tasks}; -} diff --git a/PWGJE/TableProducer/jetfinderhf.cxx b/PWGJE/TableProducer/jetfinderhf.cxx index dc3d96a307a..1f17369f40d 100644 --- a/PWGJE/TableProducer/jetfinderhf.cxx +++ b/PWGJE/TableProducer/jetfinderhf.cxx @@ -16,10 +16,9 @@ #include "CommonConstants/PhysicsConstants.h" +#include "PWGJE/Core/JetFindingUtilities.h" #include "Common/Core/RecoDecay.h" -#include "PWGJE/TableProducer/jetfinder.h" - using namespace o2; using namespace o2::analysis; using namespace o2::framework; @@ -44,14 +43,17 @@ void customize(std::vector& workflowOptions) // NB: runDataProcessing.h must be included after customize! #include "Framework/runDataProcessing.h" -template +template struct JetFinderHFTask { Produces jetsTable; Produces constituentsTable; - Produces constituentsSubTable; + Produces jetsEvtWiseSubTable; + Produces constituentsEvtWiseSubTable; // event level configurables Configurable vertexZCut{"vertexZCut", 10.0f, "Accepted z-vertex range"}; + Configurable centralityMin{"centralityMin", -999.0, "minimum centrality"}; + Configurable centralityMax{"centralityMax", 999.0, "maximum centrality"}; // track level configurables Configurable trackPtMin{"trackPtMin", 0.15, "minimum track pT"}; @@ -81,12 +83,8 @@ struct JetFinderHFTask { Configurable candYMin{"candYMin", -0.8, "minimum candidate eta"}; Configurable candYMax{"candYMax", 0.8, "maximum candidate eta"}; // HF candidiate selection configurables - Configurable rejectBackgroundMCCandidates{"rejectBackgroundMCCandidates", true, "reject background HF candidates at MC detector level"}; - Configurable selectionFlagD0{"selectionFlagD0", 1, "Selection Flag for D0"}; - Configurable selectionFlagD0bar{"selectionFlagD0bar", 1, "Selection Flag for D0bar"}; - Configurable selectionFlagLcToPKPi{"selectionFlagLcToPKPi", 1, "Selection Flag for Lc->PKPi"}; - Configurable selectionFlagLcToPiPK{"selectionFlagLcToPiPK", 1, "Selection Flag for Lc->PiPK"}; - Configurable selectionFlagBplus{"selectionFlagBplus", 1, "Selection Flag for B+"}; + Configurable rejectBackgroundMCDCandidates{"rejectBackgroundMCDCandidates", false, "reject background HF candidates at MC detector level"}; + Configurable rejectIncorrectDecaysMCP{"rejectIncorrectDecaysMCP", true, "reject HF paticles decaying to the non-analysed decay channels at MC generator level"}; // jet level configurables Configurable> jetRadius{"jetRadius", {0.4}, "jet resolution parameters"}; @@ -108,14 +106,12 @@ struct JetFinderHFTask { JetFinder jetFinder; std::vector inputParticles; - bool doConstSub = false; - int candDecay; double candMass; void init(InitContext const&) { - trackSelection = JetDerivedDataUtilities::initialiseTrackSelection(static_cast(trackSelections)); - eventSelection = JetDerivedDataUtilities::initialiseEventSelection(static_cast(eventSelections)); + trackSelection = jetderiveddatautilities::initialiseTrackSelection(static_cast(trackSelections)); + eventSelection = jetderiveddatautilities::initialiseEventSelection(static_cast(eventSelections)); particleSelection = static_cast(particleSelections); jetFinder.etaMin = trackEtaMin; @@ -132,124 +128,121 @@ struct JetFinderHFTask { jetFinder.ghostArea = jetGhostArea; jetFinder.ghostRepeatN = ghostRepeat; - if constexpr (std::is_same_v, CandidatesD0Data>) { // Note : need to be careful if configurable workflow options are added later - candMass = o2::constants::physics::MassD0; - candDecay = static_cast(aod::hf_cand_2prong::DecayType::D0ToPiK); - } - if constexpr (std::is_same_v, CandidatesBplusData>) { - candMass = o2::constants::physics::MassBPlus; - candDecay = static_cast(aod::hf_cand_bplus::DecayType::BplusToD0Pi); - } - if constexpr (std::is_same_v, CandidatesLcData>) { - candMass = o2::constants::physics::MassLambdaCPlus; - candDecay = static_cast(aod::hf_cand_3prong::DecayType::LcToPKPi); - } + candMass = jethfutilities::getTablePDGMass(); } aod::EMCALClusterDefinition clusterDefinition = aod::emcalcluster::getClusterDefinitionFromString(clusterDefinitionS.value); - Filter collisionFilter = (nabs(aod::jcollision::posZ) < vertexZCut); + Filter collisionFilter = (nabs(aod::jcollision::posZ) < vertexZCut && aod::jcollision::centrality >= centralityMin && aod::jcollision::centrality < centralityMax); Filter trackCuts = (aod::jtrack::pt >= trackPtMin && aod::jtrack::pt < trackPtMax && aod::jtrack::eta > trackEtaMin && aod::jtrack::eta < trackEtaMax && aod::jtrack::phi >= trackPhiMin && aod::jtrack::phi <= trackPhiMax); + Filter trackSubCuts = (aod::jtracksub::pt >= trackPtMin && aod::jtracksub::pt < trackPtMax && aod::jtracksub::eta > trackEtaMin && aod::jtracksub::eta < trackEtaMax && aod::jtracksub::phi >= trackPhiMin && aod::jtracksub::phi <= trackPhiMax); Filter partCuts = (aod::jmcparticle::pt >= trackPtMin && aod::jmcparticle::pt < trackPtMax); Filter clusterFilter = (aod::jcluster::definition == static_cast(clusterDefinition) && aod::jcluster::eta > clusterEtaMin && aod::jcluster::eta < clusterEtaMax && aod::jcluster::phi >= clusterPhiMin && aod::jcluster::phi <= clusterPhiMax && aod::jcluster::energy >= clusterEnergyMin && aod::jcluster::time > clusterTimeMin && aod::jcluster::time < clusterTimeMax && (clusterRejectExotics && aod::jcluster::isExotic != true)); // Filter candidateCuts = (aod::hfcand::pt >= candPtMin && aod::hfcand::pt < candPtMax && aod::hfcand::y >= candYMin && aod::hfcand::y < candYMax); - Filter candidateCutsD0 = (aod::hf_sel_candidate_d0::isSelD0 >= selectionFlagD0 || aod::hf_sel_candidate_d0::isSelD0bar >= selectionFlagD0bar); - Filter candidateCutsLc = (aod::hf_sel_candidate_lc::isSelLcToPKPi >= selectionFlagLcToPKPi || aod::hf_sel_candidate_lc::isSelLcToPiKP >= selectionFlagLcToPiPK); - Filter candidateCutsBplus = (aod::hf_sel_candidate_bplus::isSelBplusToD0Pi >= selectionFlagBplus); - // function that processes data for all 2Prong candidates - template - void analyseData(T const& collision, U const& tracks, M const& candidates) + PresliceOptional> perD0Candidate = aod::bkgd0::candidateId; + PresliceOptional> perLcCandidate = aod::bkglc::candidateId; + PresliceOptional> perBplusCandidate = aod::bkgbplus::candidateId; + + // function that generalically processes Data and reco level events + template + void analyseCharged(T const& collision, U const& tracks, V const& candidate, M& jetsTableInput, N& constituentsTableInput, O& originalTracks) { - if (!JetDerivedDataUtilities::selectCollision(collision, eventSelection)) { + if (!jetderiveddatautilities::selectCollision(collision, eventSelection)) { return; } + inputParticles.clear(); - for (auto& candidate : candidates) { - inputParticles.clear(); - if (!analyseCandidate(inputParticles, candMass, candPtMin, candPtMax, candYMin, candYMax, candidate)) { - continue; + if constexpr (jethfutilities::isHFCandidate()) { + if (!jetfindingutilities::analyseCandidate(inputParticles, candidate, candPtMin, candPtMax, candYMin, candYMax, candMass)) { + return; } - analyseTracks(inputParticles, tracks, trackSelection, std::optional{candidate}); - findJets(jetFinder, inputParticles, jetRadius, collision, jetsTable, constituentsTable, constituentsSubTable, doConstSub, true); - } - } - - // function that processes MC det for all 2Prong candidates - template - void analyseMCD(T const& collision, U const& tracks, M const& candidates) - { - if (!JetDerivedDataUtilities::selectCollision(collision, eventSelection)) { - return; } - for (auto& candidate : candidates) { - inputParticles.clear(); - if (!analyseCandidateMC(inputParticles, candMass, candDecay, candPtMin, candPtMax, candYMin, candYMax, candidate, rejectBackgroundMCCandidates)) { - continue; + if constexpr (jethfutilities::isHFMcCandidate()) { + if (!jetfindingutilities::analyseCandidateMC(inputParticles, candidate, candPtMin, candPtMax, candYMin, candYMax, candMass, rejectBackgroundMCDCandidates)) { + return; } - analyseTracks(inputParticles, tracks, trackSelection, std::optional{candidate}); - findJets(jetFinder, inputParticles, jetRadius, collision, jetsTable, constituentsTable, constituentsSubTable, doConstSub, true); } + jetfindingutilities::analyseTracks(inputParticles, tracks, trackSelection, std::optional{candidate}); + jetfindingutilities::findJets(jetFinder, inputParticles, jetRadius, collision, jetsTableInput, constituentsTableInput, true); } // function that generalically processes gen level events - template - void analyseMCP(T const& collision, U const& particles, int jetTypeParticleLevel) + template + void analyseMCP(T const& collision, U const& particles, V const& candidate, int jetTypeParticleLevel) { - inputParticles.clear(); - std::vector candidates; - candidates.clear(); - - for (auto const& particle : particles) { - if (std::abs(particle.flagMcMatchGen()) & (1 << candDecay)) { - auto particleY = RecoDecay::y(std::array{particle.px(), particle.py(), particle.pz()}, pdgDatabase->Mass(particle.pdgCode())); - if (particleY < candYMin || particleY > candYMax) { - continue; - } - if (particle.pt() < candPtMin || particle.pt() >= candPtMax) { - continue; - } - candidates.push_back(particle); - } + if (rejectIncorrectDecaysMCP && !jethfutilities::isMatchedHFCandidate(candidate)) { // is this even needed in the new derived format? it means any simulations run have to force the decay channel + return; } - for (auto& candidate : candidates) { - analyseParticles(inputParticles, particleSelection, jetTypeParticleLevel, particles, pdgDatabase, std::optional{candidate}); - FastJetUtilities::fillTracks(candidate, inputParticles, candidate.globalIndex(), static_cast(JetConstituentStatus::candidateHF), pdgDatabase->Mass(candidate.pdgCode())); - findJets(jetFinder, inputParticles, jetRadius, collision, jetsTable, constituentsTable, constituentsSubTable, doConstSub, true); + + inputParticles.clear(); + if (!jetfindingutilities::analyseCandidate(inputParticles, candidate, candPtMin, candPtMax, candYMin, candYMax, candMass)) { + return; } + jetfindingutilities::analyseParticles(inputParticles, particleSelection, jetTypeParticleLevel, particles, pdgDatabase, std::optional{candidate}); + jetfindingutilities::findJets(jetFinder, inputParticles, jetRadius, collision, jetsTable, constituentsTable, true); } - void processDummy(aod::JCollision const& collision) + void processDummy(JetCollisions const& collisions) { } PROCESS_SWITCH(JetFinderHFTask, processDummy, "Dummy process function turned on by default", true); - void processChargedJetsData(soa::Filtered::iterator const& collision, JetTracks const& tracks, CandidateTableData const& candidates) { analyseData(collision, tracks, candidates); } + void processChargedJetsData(soa::Filtered::iterator const& collision, soa::Filtered const& tracks, CandidateTableData const& candidates) + { + for (typename CandidateTableData::iterator const& candidate : candidates) { // why can the type not be auto? try const auto + analyseCharged(collision, tracks, candidate, jetsTable, constituentsTable, tracks); + } + } PROCESS_SWITCH(JetFinderHFTask, processChargedJetsData, "charged hf jet finding on data", false); - void processChargedJetsMCD(soa::Filtered::iterator const& collision, JetTracks const& tracks, CandidateTableMCD const& candidates) { analyseMCD(collision, tracks, candidates); } + void processChargedEvtWiseSubJetsData(soa::Filtered::iterator const& collision, soa::Filtered const& tracks, CandidateTableData const& candidates) + { + for (typename CandidateTableData::iterator const& candidate : candidates) { + analyseCharged(collision, jethfutilities::slicedPerCandidate(tracks, candidate, perD0Candidate, perLcCandidate, perBplusCandidate), candidate, jetsEvtWiseSubTable, constituentsEvtWiseSubTable, tracks); + } + } + PROCESS_SWITCH(JetFinderHFTask, processChargedEvtWiseSubJetsData, "charged hf jet finding on data with event-wise constituent subtraction", false); + + void processChargedJetsMCD(soa::Filtered::iterator const& collision, soa::Filtered const& tracks, CandidateTableMCD const& candidates) + { + for (typename CandidateTableMCD::iterator const& candidate : candidates) { + analyseCharged(collision, tracks, candidate, jetsTable, constituentsTable, tracks); + } + } PROCESS_SWITCH(JetFinderHFTask, processChargedJetsMCD, "charged hf jet finding on MC detector level", false); - void processChargedJetsMCP(aod::JMcCollision const& collision, - ParticleTable const& particles) + void processChargedEvtWiseSubJetsMCD(soa::Filtered::iterator const& collision, soa::Filtered const& tracks, CandidateTableMCD const& candidates) + { + for (typename CandidateTableMCD::iterator const& candidate : candidates) { + analyseCharged(collision, jethfutilities::slicedPerCandidate(tracks, candidate, perD0Candidate, perLcCandidate, perBplusCandidate), candidate, jetsEvtWiseSubTable, constituentsEvtWiseSubTable, tracks); + } + } + PROCESS_SWITCH(JetFinderHFTask, processChargedEvtWiseSubJetsMCD, "charged hf jet finding on MC detector level with event-wise constituent subtraction", false); + + void processChargedJetsMCP(JetMcCollision const& collision, + soa::Filtered const& particles, + CandidateTableMCP const& candidates) { - analyseMCP(collision, particles, 1); + for (typename CandidateTableMCP::iterator const& candidate : candidates) { + analyseMCP(collision, particles, candidate, 1); + } } PROCESS_SWITCH(JetFinderHFTask, processChargedJetsMCP, "hf jet finding on MC particle level", false); }; /* -using JetFinderD0DataCharged = JetFinderHFTask; -using JetFinderD0MCDetectorLevelCharged = JetFinderHFTask; -using JetFinderD0MCParticleLevelCharged = JetFinderHFTask; +using JetFinderD0DataCharged = JetFinderHFTask; +using JetFinderD0MCDetectorLevelCharged = JetFinderHFTask; +using JetFinderD0MCParticleLevelCharged = JetFinderHFTask; -using JetFinderBplusDataCharged = JetFinderHFTask; -using JetFinderBplusMCDetectorLevelCharged = JetFinderHFTask; -using JetFinderBplusMCParticleLevelCharged = JetFinderHFTask; +using JetFinderBplusDataCharged = JetFinderHFTask; +using JetFinderBplusMCDetectorLevelCharged = JetFinderHFTask; +using JetFinderBplusMCParticleLevelCharged = JetFinderHFTask; -using JetFinderLcDataCharged = JetFinderHFTask; -using JetFinderLcMCDetectorLevelCharged = JetFinderHFTask; -using JetFinderLcMCParticleLevelCharged = JetFinderHFTask; +using JetFinderLcDataCharged = JetFinderHFTask; +using JetFinderLcMCDetectorLevelCharged = JetFinderHFTask; +using JetFinderLcMCParticleLevelCharged = JetFinderHFTask; WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) { diff --git a/PWGJE/TableProducer/jetmatching.cxx b/PWGJE/TableProducer/jetmatching.cxx deleted file mode 100644 index ab3cb816ebb..00000000000 --- a/PWGJE/TableProducer/jetmatching.cxx +++ /dev/null @@ -1,416 +0,0 @@ -// Copyright 2019-2020 CERN and copyright holders of ALICE O2. -// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders. -// All rights not expressly granted are reserved. -// -// This software is distributed under the terms of the GNU General Public -// License v3 (GPL Version 3), copied verbatim in the file "COPYING". -// -// In applying this license CERN does not waive the privileges and immunities -// granted to it by virtue of its status as an Intergovernmental Organization -// or submit itself to any jurisdiction. - -/// \file jetmatching.cxx -/// \brief Unified implementation of jet matching based on different criteria -/// expanding on previously separate implementations of geometric matching -/// (by Raymond Ehlers) and heavy-flavour matching -/// -/// \author Raymond Ehlers , ORNL -/// \author Jochen Klein -/// \author Aimeric Lanodu - -#include "Framework/AnalysisTask.h" -#include "Framework/AnalysisDataModel.h" -#include "Framework/ASoA.h" -#include "Framework/runDataProcessing.h" -#include "Common/DataModel/EventSelection.h" -#include "Common/DataModel/TrackSelectionTables.h" - -#include "PWGJE/DataModel/Jet.h" -#include "PWGJE/Core/JetUtilities.h" -#include "PWGHF/DataModel/CandidateReconstructionTables.h" -#include "PWGHF/DataModel/CandidateSelectionTables.h" - -using namespace o2; -using namespace o2::framework; -using namespace o2::framework::expressions; - -template -struct JetMatching { - - Configurable doMatchingGeo{"doMatchingGeo", true, "Enable geometric matching"}; - Configurable doMatchingPt{"doMatchingPt", true, "Enable pt matching"}; - Configurable doMatchingHf{"doMatchingHf", true, "Enable HF matching"}; - Configurable maxMatchingDistance{"maxMatchingDistance", 0.4f, "Max matching distance"}; - Configurable minPtFraction{"minPtFraction", 0.f, "Minimum pt fraction for pt matching"}; - - Produces jetsBaseToTag; - Produces jetsTagToBase; - - // preslicing jet collections, only for MC-based collection - static constexpr bool jetsBaseIsMC = o2::soa::relatedByIndex(); - static constexpr bool jetsTagIsMC = o2::soa::relatedByIndex(); - Preslice baseJetsPerCollision = jetsBaseIsMC ? aod::jet::mcCollisionId : aod::jet::collisionId; - Preslice tagJetsPerCollision = jetsTagIsMC ? aod::jet::mcCollisionId : aod::jet::collisionId; - - using JetCollisions = soa::Join; - PresliceUnsorted CollisionsCollectionPerMcCollision = aod::jmccollisionlb::mcCollisionId; - using JetTracks = soa::Join; - - // initialise objects used to store the matching index arrays (array in case a mcCollision is split) before filling the matching tables - std::vector> geojetidBaseToTag, ptjetidBaseToTag, hfjetidBaseToTag; - std::vector> geojetidTagToBase, ptjetidTagToBase, hfjetidTagToBase; - - static constexpr int8_t getHfFlag() - { - if (std::is_same::value && - std::is_same::value) - return 1 << aod::hf_cand_2prong::DecayType::D0ToPiK; - - if (std::is_same::value && - std::is_same::value) - return 1 << aod::hf_cand_3prong::DecayType::LcToPKPi; - - if (std::is_same::value && - std::is_same::value) - return 1 << aod::hf_cand_bplus::DecayType::BplusToD0Pi; - - return -1; - } - - void init(InitContext const&) - { - } - - // function that does the geometric matching of jets from jetsBasePerColl and jets from jetsTagPerColl - template - void MatchGeo(T const& jetsBasePerColl, U const& jetsTagPerColl, std::vector& baseToTagGeo, std::vector& tagToBaseGeo) - { - std::vector jetsBasePhi; - std::vector jetsBaseEta; - for (const auto& jet : jetsBasePerColl) { - jetsBasePhi.emplace_back(jet.phi()); - jetsBaseEta.emplace_back(jet.eta()); - } - std::vector jetsTagPhi; - std::vector jetsTagEta; - for (const auto& jet : jetsTagPerColl) { - jetsTagPhi.emplace_back(jet.phi()); - jetsTagEta.emplace_back(jet.eta()); - } - std::tie(baseToTagGeo, tagToBaseGeo) = JetUtilities::MatchJetsGeometrically(jetsBasePhi, jetsBaseEta, jetsTagPhi, jetsTagEta, maxMatchingDistance); - LOGF(debug, "geometric matching: %d - %d jets", baseToTagGeo.size(), tagToBaseGeo.size()); - for (std::size_t i = 0; i < baseToTagGeo.size(); ++i) { - LOGF(debug, "bjet %i -> %i", i, baseToTagGeo[i]); - } - for (std::size_t i = 0; i < tagToBaseGeo.size(); ++i) { - LOGF(debug, "tjet %i -> %i", i, tagToBaseGeo[i]); - } - } - - // function that does the HF matching of jets from jetsBasePerColl and jets from jetsTagPerColl; assumes both jetsBasePerColl and jetsTagPerColl have access to MC information - template - void MatchHF(T const& jetsBasePerColl, U const& jetsTagPerColl, std::vector& baseToTagHF, std::vector& tagToBaseHF) - { - int index_bjet = 0; - int index_tjet = 0; - for (const auto& bjet : jetsBasePerColl) { - LOGF(debug, "jet index: %d (coll %d, pt %g, phi %g) with %d tracks, %d HF candidates", - bjet.index(), bjet.collisionId(), bjet.pt(), bjet.phi(), bjet.tracks().size(), bjet.hfcandidates().size()); - const auto hfcand = bjet.template hfcandidates_first_as(); - if (hfcand.flagMcMatchRec() & getHfFlag()) { - const auto hfCandMC = hfcand.template prong1_as().template mcParticle_as(); - const auto hfCandMcId = hfCandMC.template mothers_first_as().globalIndex(); - for (const auto& tjet : jetsTagPerColl) { - const auto cand = tjet.template hfcandidates_first_as(); - if (cand.globalIndex() == hfCandMcId) { - LOGF(debug, "Found HF match: %d (pt %g) <-> %d (pt %g)", - bjet.globalIndex(), bjet.pt(), tjet.globalIndex(), tjet.pt()); - baseToTagHF[index_bjet] = index_tjet; - tagToBaseHF[index_tjet] = index_bjet; - } - index_tjet++; - } - } - index_bjet++; - } - } - - template - float getPtSum_FirstArgIsMC(T const& mcParts_IdCheck, U const& recoTracks_Summed) - { - float ptSum = 0; - for (const auto& mcPart_IdCheck : mcParts_IdCheck) { - for (const auto& recoTrack_Summed : recoTracks_Summed) { - if (recoTrack_Summed.has_mcParticle() && mcPart_IdCheck.globalIndex() == recoTrack_Summed.template mcParticle_as().globalIndex()) { - ptSum += recoTrack_Summed.pt(); - break; - } - } - } - return ptSum; - } - template - float getPtSum_SecondArgIsMC(T const& recoTracks_IdCheck, U const& mcParts_Summed) - { - float ptSum = 0; - for (const auto& recoTrack_IdCheck : recoTracks_IdCheck) { - for (const auto& mcPart_Summed : mcParts_Summed) { - if (recoTrack_IdCheck.has_mcParticle() && mcPart_Summed.globalIndex() == recoTrack_IdCheck.template mcParticle_as().globalIndex()) { - ptSum += mcPart_Summed.pt(); - break; - } - } - } - return ptSum; - } - - // function that does the pT matching of jets from jetsBasePerColl and jets from jetsTagPerColl ; assumes either one of jetsBasePerColl or jetsTagPerColl have access to MC information - template - void MatchPt(T const& jetsBasePerColl, U const& jetsTagPerColl, std::vector& baseToTagPt, std::vector& tagToBasePt) - { - float ptSum; - int index_bjet = 0; - int index_tjet = 0; - - for (const auto& bjet : jetsBasePerColl) { - for (const auto& tjet : jetsTagPerColl) { - auto btracksTracks = bjet.template tracks_as(); - auto btracksMcParts = bjet.template tracks_as(); - auto ttracksMcParts = tjet.template tracks_as(); - auto ttracksTracks = tjet.template tracks_as(); - - jetsBaseIsMC ? ptSum = getPtSum_FirstArgIsMC(btracksMcParts, ttracksTracks) : ptSum = getPtSum_SecondArgIsMC(btracksTracks, ttracksMcParts); - - if (ptSum > tjet.pt() * minPtFraction) { - LOGF(debug, "Found pt match: %d (pt %g) <-> %d (pt %g)", - bjet.globalIndex(), bjet.pt(), tjet.globalIndex(), tjet.pt()); - baseToTagPt[index_bjet] = index_tjet; - } else { - LOGF(debug, "DID NOT find pt match: %d (pt %g) <-> %d (pt %g)", - bjet.globalIndex(), bjet.pt(), tjet.globalIndex(), tjet.pt()); - } - index_tjet++; - } - index_bjet++; - } - - index_bjet = 0; - index_tjet = 0; - for (const auto& tjet : jetsTagPerColl) { - for (const auto& bjet : jetsBasePerColl) { - auto btracksMcParts = bjet.template tracks_as(); - auto btracksTracks = bjet.template tracks_as(); - auto ttracksMcParts = tjet.template tracks_as(); - auto ttracksTracks = tjet.template tracks_as(); - - jetsBaseIsMC ? ptSum = getPtSum_SecondArgIsMC(ttracksTracks, btracksMcParts) : ptSum = getPtSum_FirstArgIsMC(ttracksMcParts, btracksTracks); - - if (ptSum > bjet.pt() * minPtFraction) { - LOGF(debug, "Found pt match: %d (pt %g) <-> %d (pt %g)", - tjet.globalIndex(), tjet.pt(), bjet.globalIndex(), bjet.pt()); - tagToBasePt[index_tjet] = index_bjet; - } else { - LOGF(debug, "DID NOT find pt match: %d (pt %g) <-> %d (pt %g)", - bjet.globalIndex(), bjet.pt(), tjet.globalIndex(), tjet.pt()); - } - index_bjet++; - } - index_tjet++; - } - } - - // function that calls all the Match functions - template - void doAllMatching(T const& jetsBasePerColl, U const& jetsTagPerColl, std::vector& baseToTagGeo, std::vector& baseToTagHF, std::vector& baseToTagPt, std::vector& tagToBaseGeo, std::vector& tagToBaseHF, std::vector& tagToBasePt) - { - // geometric matching - if (doMatchingGeo) { - MatchGeo(jetsBasePerColl, jetsTagPerColl, baseToTagGeo, tagToBaseGeo); - } - // HF matching - if constexpr (getHfFlag() > 0) { - if (doMatchingHf) { - MatchHF(jetsBasePerColl, jetsTagPerColl, baseToTagHF, tagToBaseHF); - } - } - // pt matching - if (doMatchingPt) { - MatchPt(jetsBasePerColl, jetsTagPerColl, baseToTagPt, tagToBasePt); - } - } - - // function that fills the jetidTagToBase vectors, where the vector that is the i-th entry (corresponding to the tag jet with global index i) sees added to itself the global index of the matched base jet - template - void fillJetIdArraysTagToBase(T const& jetsBasePerColl, U const& jetsTagPerColl, std::vector const& tagToBaseGeo, std::vector const& tagToBasePt, std::vector const& tagToBaseHF) - { - int geojetidTemp; - int ptjetidTemp; - int hfjetidTemp; - std::vector geojetidTempVector; - std::vector ptjetidTempVector; - std::vector hfjetidTempVector; - for (const auto& jet : jetsTagPerColl) { - geojetidTemp = tagToBaseGeo[jet.index()]; - if (geojetidTemp > -1 && geojetidTemp < jetsBasePerColl.size()) { - geojetidTemp = jetsBasePerColl.iteratorAt(geojetidTemp).globalIndex(); - geojetidTagToBase[jet.globalIndex()].push_back(geojetidTemp); - } else { - geojetidTemp = -1; - } - // Pt matching - ptjetidTemp = tagToBasePt[jet.index()]; - if (ptjetidTemp > -1 && ptjetidTemp < jetsBasePerColl.size()) { - ptjetidTemp = jetsBasePerColl.iteratorAt(ptjetidTemp).globalIndex(); - ptjetidTagToBase[jet.globalIndex()].push_back(ptjetidTemp); - } else { - ptjetidTemp = -1; - } - // HF matching - hfjetidTemp = tagToBaseHF[jet.index()]; - if (hfjetidTemp > -1 && hfjetidTemp < jetsBasePerColl.size()) { - hfjetidTemp = jetsBasePerColl.iteratorAt(hfjetidTemp).globalIndex(); - hfjetidTagToBase[jet.globalIndex()].push_back(hfjetidTemp); - } - LOGF(debug, "registering matches for tag jet %d (%d): geo -> %d (%d), pT -> %d (%d), HF -> %d", - jet.index(), jet.globalIndex(), geojetidTemp, tagToBaseGeo[jet.index()], ptjetidTemp, tagToBasePt[jet.index()], tagToBaseHF[jet.index()]); - } - } - - // function that fills the jetidBaseToTag vectors, where the vector that is the i-th entry (corresponding to the base jet with global index i) sees added to itself the global index of the matched tag jet - template - void fillJetIdArraysBaseToTag(T const& jetsBasePerColl, U const& jetsTagPerColl, std::vector const& baseToTagGeo, std::vector const& baseToTagPt, std::vector const& baseToTagHF) - { - int geojetidTemp; - int ptjetidTemp; - int hfjetidTemp; - std::vector geojetidTempVector; - std::vector ptjetidTempVector; - std::vector hfjetidTempVector; - for (const auto& jet : jetsBasePerColl) { - geojetidTemp = baseToTagGeo[jet.index()]; - if (geojetidTemp > -1 && geojetidTemp < jetsTagPerColl.size()) { - geojetidTemp = jetsTagPerColl.iteratorAt(geojetidTemp).globalIndex(); - geojetidBaseToTag[jet.globalIndex()].push_back(geojetidTemp); - } else { - geojetidTemp = -1; - } - // Pt matching - ptjetidTemp = baseToTagPt[jet.index()]; - if (ptjetidTemp > -1 && ptjetidTemp < jetsTagPerColl.size()) { - ptjetidTemp = jetsTagPerColl.iteratorAt(ptjetidTemp).globalIndex(); - ptjetidBaseToTag[jet.globalIndex()].push_back(ptjetidTemp); - } - // HF matching - hfjetidTemp = baseToTagHF[jet.index()]; - if (hfjetidTemp > -1 && hfjetidTemp < jetsTagPerColl.size()) { - hfjetidTemp = jetsTagPerColl.iteratorAt(hfjetidTemp).globalIndex(); - hfjetidBaseToTag[jet.globalIndex()].push_back(hfjetidTemp); - } - LOGF(debug, "registering matches for base jet %d (%d): geo -> %d (%d), pT -> %d (%d), HF -> %d", - jet.index(), jet.globalIndex(), geojetidTemp, baseToTagGeo[jet.index()], ptjetidTemp, baseToTagPt[jet.index()], baseToTagHF[jet.index()]); - } - } - - void processDummy(aod::JMcCollisions const& mcCollisions) - { - } - PROCESS_SWITCH(JetMatching, processDummy, "Dummy process", true); - - // for now: - // the input file must have MC information to check collision<->mcCollision - // for HF tagging: both BaseJetCollection and TagJetCollection must have MC info - // for pT tagging: at least either one of BaseJetCollection or TagJetCollection must have MC info - // for geo tagging: no need to access MC info of either BaseJetCollection or TagJetCollection - void processJets(aod::JMcCollisions const& mcCollisions, JetCollisions const& collisions, - BaseJetCollection const& jetsBase, TagJetCollection const& jetsTag, McParticles const& particlesMC, - JetTracks const& tracks, HfCandidates const& hfcandidates) - { - - // waiting for framework fix to make sliced collection of same type as original collection: - geojetidBaseToTag.assign(jetsBase.size(), {}); - ptjetidBaseToTag.assign(jetsBase.size(), {}); - hfjetidBaseToTag.assign(jetsBase.size(), {}); - geojetidTagToBase.assign(jetsTag.size(), {}); - ptjetidTagToBase.assign(jetsTag.size(), {}); - hfjetidTagToBase.assign(jetsTag.size(), {}); - - for (const auto& mcCollision : mcCollisions) { - - const auto collisionsPerMcColl = collisions.sliceBy(CollisionsCollectionPerMcCollision, mcCollision.globalIndex()); - - int i_collision = 0; - for (const auto& collision : collisionsPerMcColl) { - ++i_collision; - - const auto jetsBasePerColl = jetsBase.sliceBy(baseJetsPerCollision, jetsBaseIsMC ? mcCollision.globalIndex() : collision.globalIndex()); - const auto jetsTagPerColl = jetsTag.sliceBy(tagJetsPerCollision, jetsTagIsMC ? mcCollision.globalIndex() : collision.globalIndex()); - - // mini jet matching tables for the collection of jets from the current mcCollision (if mcp jet) or collision (if mcd or data jet) - std::vector baseToTagGeo(jetsBasePerColl.size(), -1), baseToTagHF(jetsBasePerColl.size(), -1), baseToTagPt(jetsBasePerColl.size(), -1); - std::vector tagToBaseGeo(jetsTagPerColl.size(), -1), tagToBaseHF(jetsTagPerColl.size(), -1), tagToBasePt(jetsTagPerColl.size(), -1); - - LOGF(debug, "performing geometric matching for mcCollision %d and collision %d (%d / %d jets)", - mcCollision.globalIndex(), collision.globalIndex(), jetsBasePerColl.size(), jetsTagPerColl.size()); - - doAllMatching(jetsBasePerColl, jetsTagPerColl, baseToTagGeo, baseToTagHF, baseToTagPt, tagToBaseGeo, tagToBaseHF, tagToBasePt); - - // time to fill the tables - if (i_collision == 1) { // do this once regardless; if both tag and base are MC, or if one is MC and the other is not and there is no split vertex: it's the only iteration - fillJetIdArraysBaseToTag(jetsBasePerColl, jetsTagPerColl, baseToTagGeo, baseToTagPt, baseToTagHF); - fillJetIdArraysTagToBase(jetsBasePerColl, jetsTagPerColl, tagToBaseGeo, tagToBasePt, tagToBaseHF); - } - if (i_collision > 1) { // collision is split - if (!jetsBaseIsMC || !jetsTagIsMC) { // if both are MC, allowing those two lines below to happen would make duplicates in the matching table; this is why thie i_collision>1 case is not treated the same way as the i_collision==1 case - fillJetIdArraysBaseToTag(jetsBasePerColl, jetsTagPerColl, baseToTagGeo, baseToTagPt, baseToTagHF); - fillJetIdArraysTagToBase(jetsBasePerColl, jetsTagPerColl, tagToBaseGeo, tagToBasePt, tagToBaseHF); - } - } - } - } - for (std::size_t i = 0; i < jetsTag.size(); i++) { - jetsTagToBase(geojetidTagToBase[i], ptjetidTagToBase[i], hfjetidTagToBase[i]); // is (and needs to) be filled in order - } - for (std::size_t i = 0; i < jetsBase.size(); ++i) { - jetsBaseToTag(geojetidBaseToTag[i], ptjetidBaseToTag[i], hfjetidBaseToTag[i]); // is (and needs to) be filled in order - } - } - PROCESS_SWITCH(JetMatching, processJets, "Perform jet matching", false); -}; - -using ChargedJetMatching = JetMatching, - soa::Join, - aod::ChargedMCDetectorLevelJetsMatchedToChargedMCParticleLevelJets, - aod::ChargedMCParticleLevelJetsMatchedToChargedMCDetectorLevelJets, - aod::JMcParticles, - aod::JDummys>; -using D0ChargedJetMatching = JetMatching, - soa::Join, - aod::D0ChargedMCDetectorLevelJetsMatchedToD0ChargedMCParticleLevelJets, - aod::D0ChargedMCParticleLevelJetsMatchedToD0ChargedMCDetectorLevelJets, - soa::Join, - soa::Join>; -using LcChargedJetMatching = JetMatching, - soa::Join, - aod::LcChargedMCDetectorLevelJetsMatchedToLcChargedMCParticleLevelJets, - aod::LcChargedMCParticleLevelJetsMatchedToLcChargedMCDetectorLevelJets, - soa::Join, - soa::Join>; -using BplusChargedJetMatching = JetMatching, - soa::Join, - aod::BplusChargedMCDetectorLevelJetsMatchedToBplusChargedMCParticleLevelJets, - aod::BplusChargedMCParticleLevelJetsMatchedToBplusChargedMCDetectorLevelJets, - soa::Join, - soa::Join>; - -WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) -{ - std::vector tasks; - - tasks.emplace_back(adaptAnalysisTask(cfgc, SetDefaultProcesses{}, TaskName{"jet-matching-ch"})); - tasks.emplace_back(adaptAnalysisTask(cfgc, TaskName{"jet-matching-d0-ch"})); - tasks.emplace_back(adaptAnalysisTask(cfgc, TaskName{"jet-matching-lc-ch"})); - tasks.emplace_back(adaptAnalysisTask(cfgc, TaskName{"jet-matching-bplus-ch"})); - - return WorkflowSpec{tasks}; -} diff --git a/PWGJE/TableProducer/jetmatchingmc.cxx b/PWGJE/TableProducer/jetmatchingmc.cxx new file mode 100644 index 00000000000..cb7cdc014d8 --- /dev/null +++ b/PWGJE/TableProducer/jetmatchingmc.cxx @@ -0,0 +1,143 @@ +// Copyright 2019-2020 CERN and copyright holders of ALICE O2. +// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders. +// All rights not expressly granted are reserved. +// +// This software is distributed under the terms of the GNU General Public +// License v3 (GPL Version 3), copied verbatim in the file "COPYING". +// +// In applying this license CERN does not waive the privileges and immunities +// granted to it by virtue of its status as an Intergovernmental Organization +// or submit itself to any jurisdiction. + +/// \file jetmatchingmc.cxx +/// \brief matching detector level and generator level jets +/// +/// \author Raymond Ehlers , ORNL +/// \author Jochen Klein +/// \author Aimeric Lanodu +/// \author Nima Zardoshti + +#include "Framework/AnalysisTask.h" +#include "Framework/AnalysisDataModel.h" +#include "Framework/ASoA.h" +#include "Framework/runDataProcessing.h" +#include "Common/DataModel/EventSelection.h" +#include "Common/DataModel/TrackSelectionTables.h" + +#include "PWGJE/DataModel/Jet.h" +#include "PWGJE/Core/JetUtilities.h" +#include "PWGJE/Core/JetFindingUtilities.h" +#include "PWGJE/Core/JetMatchingUtilities.h" +#include "PWGHF/DataModel/CandidateSelectionTables.h" + +using namespace o2; +using namespace o2::framework; +using namespace o2::framework::expressions; + +template +struct JetMatchingMc { + + Configurable doMatchingGeo{"doMatchingGeo", true, "Enable geometric matching"}; + Configurable doMatchingPt{"doMatchingPt", true, "Enable pt matching"}; + Configurable doMatchingHf{"doMatchingHf", false, "Enable HF matching"}; + Configurable maxMatchingDistance{"maxMatchingDistance", 0.24f, "Max matching distance"}; + Configurable minPtFraction{"minPtFraction", 0.5f, "Minimum pt fraction for pt matching"}; + + Produces jetsBasetoTagMatchingTable; + Produces jetsTagtoBaseMatchingTable; + + // preslicing jet collections, only for Mc-based collection + static constexpr bool jetsBaseIsMc = o2::soa::relatedByIndex(); + static constexpr bool jetsTagIsMc = o2::soa::relatedByIndex(); + + Preslice baseJetsPerCollision = jetsBaseIsMc ? aod::jet::mcCollisionId : aod::jet::collisionId; + Preslice tagJetsPerCollision = jetsTagIsMc ? aod::jet::mcCollisionId : aod::jet::collisionId; + + PresliceUnsorted CollisionsPerMcCollision = aod::jmccollisionlb::mcCollisionId; + + void init(InitContext const&) + { + } + + void processDummy(JetMcCollisions const& mcCollisions) + { + } + PROCESS_SWITCH(JetMatchingMc, processDummy, "Dummy process", true); + + void processJets(JetMcCollisions const& mcCollisions, JetCollisionsMCD const& collisions, + JetsBase const& jetsBase, JetsTag const& jetsTag, + JetTracksMCD const& tracks, + JetParticles const& particles, + CandidatesBase const& candidatesBase, + CandidatesTag const& candidatesTag) + { + + // initialise objects used to store the matching index arrays (array in case a mcCollision is split) before filling the matching tables + std::vector> jetsBasetoTagMatchingGeo, jetsBasetoTagMatchingPt, jetsBasetoTagMatchingHF; + std::vector> jetsTagtoBaseMatchingGeo, jetsTagtoBaseMatchingPt, jetsTagtoBaseMatchingHF; + // waiting for framework fix to make sliced collection of same type as original collection: + jetsBasetoTagMatchingGeo.assign(jetsBase.size(), {}); + jetsBasetoTagMatchingPt.assign(jetsBase.size(), {}); + jetsBasetoTagMatchingHF.assign(jetsBase.size(), {}); + jetsTagtoBaseMatchingGeo.assign(jetsTag.size(), {}); + jetsTagtoBaseMatchingPt.assign(jetsTag.size(), {}); + jetsTagtoBaseMatchingHF.assign(jetsTag.size(), {}); + + for (const auto& mcCollision : mcCollisions) { + + const auto collisionsPerMcColl = collisions.sliceBy(CollisionsPerMcCollision, mcCollision.globalIndex()); + + for (const auto& collision : collisionsPerMcColl) { + + const auto jetsBasePerColl = jetsBase.sliceBy(baseJetsPerCollision, jetsBaseIsMc ? mcCollision.globalIndex() : collision.globalIndex()); + const auto jetsTagPerColl = jetsTag.sliceBy(tagJetsPerCollision, jetsTagIsMc ? mcCollision.globalIndex() : collision.globalIndex()); + + jetmatchingutilities::doAllMatching(jetsBasePerColl, jetsTagPerColl, jetsBasetoTagMatchingGeo, jetsBasetoTagMatchingPt, jetsBasetoTagMatchingHF, jetsTagtoBaseMatchingGeo, jetsTagtoBaseMatchingPt, jetsTagtoBaseMatchingHF, candidatesBase, candidatesTag, tracks, particles, doMatchingGeo, doMatchingHf, doMatchingPt, maxMatchingDistance, minPtFraction); + } + } + for (auto i = 0; i < jetsBase.size(); ++i) { + jetsBasetoTagMatchingTable(jetsBasetoTagMatchingGeo[i], jetsBasetoTagMatchingPt[i], jetsBasetoTagMatchingHF[i]); // is (and needs to) be filled in order + } + for (auto i = 0; i < jetsTag.size(); i++) { + jetsTagtoBaseMatchingTable(jetsTagtoBaseMatchingGeo[i], jetsTagtoBaseMatchingPt[i], jetsTagtoBaseMatchingHF[i]); // is (and needs to) be filled in order + } + } + PROCESS_SWITCH(JetMatchingMc, processJets, "Perform jet matching", false); +}; + +using ChargedJetMatching = JetMatchingMc, + soa::Join, + aod::ChargedMCDetectorLevelJetsMatchedToChargedMCParticleLevelJets, + aod::ChargedMCParticleLevelJetsMatchedToChargedMCDetectorLevelJets, + aod::JCollisions, + aod::JMcCollisions>; +using D0ChargedJetMatching = JetMatchingMc, + soa::Join, + aod::D0ChargedMCDetectorLevelJetsMatchedToD0ChargedMCParticleLevelJets, + aod::D0ChargedMCParticleLevelJetsMatchedToD0ChargedMCDetectorLevelJets, + CandidatesD0MCD, + CandidatesD0MCP>; +/*using LcChargedJetMatching = JetMatchingMc, + soa::Join, + aod::LcChargedMCDetectorLevelJetsMatchedToLcChargedMCParticleLevelJets, + aod::LcChargedMCParticleLevelJetsMatchedToLcChargedMCDetectorLevelJets, + CandidatesLcMCD, + CandidatesLcMCP>; +using BplusChargedJetMatching = JetMatchingMc, + soa::Join, + aod::BplusChargedMCDetectorLevelJetsMatchedToBplusChargedMCParticleLevelJets, + aod::BplusChargedMCParticleLevelJetsMatchedToBplusChargedMCDetectorLevelJets, + CandidatesBplusMCD, + CandidatesBplusMCP>;*/ + +WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) +{ + std::vector tasks; + + tasks.emplace_back(adaptAnalysisTask(cfgc, SetDefaultProcesses{}, TaskName{"jet-matching-mc-ch"})); + tasks.emplace_back(adaptAnalysisTask(cfgc, TaskName{"jet-matching-mc-d0-ch"})); + // tasks.emplace_back(adaptAnalysisTask(cfgc, TaskName{"jet-matching-mc-lc-ch"})); + // tasks.emplace_back(adaptAnalysisTask(cfgc, TaskName{"jet-matching-mc-bplus-ch"})); + + return WorkflowSpec{tasks}; +} diff --git a/PWGJE/TableProducer/jetmatchingmcsub.cxx b/PWGJE/TableProducer/jetmatchingmcsub.cxx new file mode 100644 index 00000000000..734e971db94 --- /dev/null +++ b/PWGJE/TableProducer/jetmatchingmcsub.cxx @@ -0,0 +1,128 @@ +// Copyright 2019-2020 CERN and copyright holders of ALICE O2. +// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders. +// All rights not expressly granted are reserved. +// +// This software is distributed under the terms of the GNU General Public +// License v3 (GPL Version 3), copied verbatim in the file "COPYING". +// +// In applying this license CERN does not waive the privileges and immunities +// granted to it by virtue of its status as an Intergovernmental Organization +// or submit itself to any jurisdiction. + +/// \file jetmatchingmcsub.cxx +/// \brief matching event-wise constituent subtracted detector level and unsubtracted generated level jets (this is usseful as a template for embedding matching) +/// \author Nima Zardoshti + +#include "Framework/AnalysisTask.h" +#include "Framework/AnalysisDataModel.h" +#include "Framework/ASoA.h" +#include "Framework/runDataProcessing.h" +#include "Common/DataModel/EventSelection.h" +#include "Common/DataModel/TrackSelectionTables.h" + +#include "PWGJE/DataModel/Jet.h" +#include "PWGJE/Core/JetUtilities.h" +#include "PWGJE/Core/JetFindingUtilities.h" +#include "PWGJE/Core/JetMatchingUtilities.h" +#include "PWGHF/DataModel/CandidateSelectionTables.h" + +using namespace o2; +using namespace o2::framework; +using namespace o2::framework::expressions; + +template +struct JetMatchingMcSub { + + Configurable doMatchingGeo{"doMatchingGeo", true, "Enable geometric matching"}; + Configurable doMatchingPt{"doMatchingPt", true, "Enable pt matching"}; + Configurable doMatchingHf{"doMatchingHf", false, "Enable HF matching"}; + Configurable maxMatchingDistance{"maxMatchingDistance", 0.24f, "Max matching distance"}; + Configurable minPtFraction{"minPtFraction", 0.5f, "Minimum pt fraction for pt matching"}; + + Produces jetsBasetoTagMatchingTable; + Produces jetsTagtoBaseMatchingTable; + + // preslicing jet collections, only for Mc-based collection + static constexpr bool jetsBaseIsMc = false; + static constexpr bool jetsTagIsMc = false; + + Preslice baseJetsPerCollision = aod::jet::collisionId; + Preslice tagJetsPerCollision = aod::jet::collisionId; + + void init(InitContext const&) + { + } + + void processDummy(JetCollisions const& mcCollisions) + { + } + PROCESS_SWITCH(JetMatchingMcSub, processDummy, "Dummy process", true); + + void processJets(JetCollisions const& collisions, + JetsBase const& jetsBase, JetsTag const& jetsTag, + JetTracks const& tracks, + JetTracksSub const& tracksSub, + Candidates const& candidates) + { + + // initialise objects used to store the matching index arrays (array in case a mcCollision is split) before filling the matching tables + std::vector> jetsBasetoTagMatchingGeo, jetsBasetoTagMatchingPt, jetsBasetoTagMatchingHF; + std::vector> jetsTagtoBaseMatchingGeo, jetsTagtoBaseMatchingPt, jetsTagtoBaseMatchingHF; + // waiting for framework fix to make sliced collection of same type as original collection: + jetsBasetoTagMatchingGeo.assign(jetsBase.size(), {}); + jetsBasetoTagMatchingPt.assign(jetsBase.size(), {}); + jetsBasetoTagMatchingHF.assign(jetsBase.size(), {}); + jetsTagtoBaseMatchingGeo.assign(jetsTag.size(), {}); + jetsTagtoBaseMatchingPt.assign(jetsTag.size(), {}); + jetsTagtoBaseMatchingHF.assign(jetsTag.size(), {}); + + for (const auto& collision : collisions) { + + const auto jetsBasePerColl = jetsBase.sliceBy(baseJetsPerCollision, collision.globalIndex()); + const auto jetsTagPerColl = jetsTag.sliceBy(tagJetsPerCollision, collision.globalIndex()); + + jetmatchingutilities::doAllMatching(jetsBasePerColl, jetsTagPerColl, jetsBasetoTagMatchingGeo, jetsBasetoTagMatchingPt, jetsBasetoTagMatchingHF, jetsTagtoBaseMatchingGeo, jetsTagtoBaseMatchingPt, jetsTagtoBaseMatchingHF, candidates, candidates, tracks, tracksSub, doMatchingGeo, doMatchingHf, doMatchingPt, maxMatchingDistance, minPtFraction); + } + + for (auto i = 0; i < jetsBase.size(); ++i) { + jetsBasetoTagMatchingTable(jetsBasetoTagMatchingGeo[i], jetsBasetoTagMatchingPt[i], jetsBasetoTagMatchingHF[i]); // is (and needs to) be filled in order + } + for (auto i = 0; i < jetsTag.size(); i++) { + jetsTagtoBaseMatchingTable(jetsTagtoBaseMatchingGeo[i], jetsTagtoBaseMatchingPt[i], jetsTagtoBaseMatchingHF[i]); // is (and needs to) be filled in order + } + } + PROCESS_SWITCH(JetMatchingMcSub, processJets, "Perform jet matching", false); +}; + +using ChargedJetMatching = JetMatchingMcSub, + soa::Join, + aod::ChargedMCDetectorLevelJetsMatchedToChargedMCDetectorLevelEventWiseSubtractedJets, + aod::ChargedMCDetectorLevelEventWiseSubtractedJetsMatchedToChargedMCDetectorLevelJets, + aod::JDummys>; +using D0ChargedJetMatching = JetMatchingMcSub, + soa::Join, + aod::D0ChargedMCDetectorLevelJetsMatchedToD0ChargedMCDetectorLevelEventWiseSubtractedJets, + aod::D0ChargedMCDetectorLevelEventWiseSubtractedJetsMatchedToD0ChargedMCDetectorLevelJets, + CandidatesD0MCD>; +/*using LcChargedJetMatching = JetMatchingMcSub, + soa::Join, + aod::LcChargedMCDetectorLevelJetsMatchedToLcChargedMCDetectorLevelEventWiseSubtractedJets, + aod::LcChargedMCDetectorLevelEventWiseSubtractedJetsMatchedToLcChargedMCDetectorLevelJets, + CandidatesLcMCD>; +using BplusChargedJetMatching = JetMatchingMcSub, + soa::Join, + aod::BplusChargedMCDetectorLevelJetsMatchedToBplusChargedMCDetectorLevelEventWiseSubtractedJets, + aod::BplusChargedMCDetectorLevelEventWiseSubtractedJetsMatchedToBplusChargedMCDetectorLevelJets, + CandidatesBplusMCD>;*/ + +WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) +{ + std::vector tasks; + + tasks.emplace_back(adaptAnalysisTask(cfgc, SetDefaultProcesses{}, TaskName{"jet-matching-mc-sub-ch"})); + tasks.emplace_back(adaptAnalysisTask(cfgc, TaskName{"jet-matching-mc-sub-d0-ch"})); + // tasks.emplace_back(adaptAnalysisTask(cfgc, TaskName{"jet-matching-mc-sub-lc-ch"})); + // tasks.emplace_back(adaptAnalysisTask(cfgc, TaskName{"jet-matching-mc-sub-bplus-ch"})); + + return WorkflowSpec{tasks}; +} diff --git a/PWGJE/TableProducer/jetmatchingsub.cxx b/PWGJE/TableProducer/jetmatchingsub.cxx new file mode 100644 index 00000000000..85cc453a540 --- /dev/null +++ b/PWGJE/TableProducer/jetmatchingsub.cxx @@ -0,0 +1,130 @@ +// Copyright 2019-2020 CERN and copyright holders of ALICE O2. +// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders. +// All rights not expressly granted are reserved. +// +// This software is distributed under the terms of the GNU General Public +// License v3 (GPL Version 3), copied verbatim in the file "COPYING". +// +// In applying this license CERN does not waive the privileges and immunities +// granted to it by virtue of its status as an Intergovernmental Organization +// or submit itself to any jurisdiction. + +/// \file jetmatching.cxx +/// \brief matching event-wise constituent subtracted data jets and unsubtracted data jets +/// \author Nima Zardoshti + +#include "Framework/AnalysisTask.h" +#include "Framework/AnalysisDataModel.h" +#include "Framework/ASoA.h" +#include "Framework/runDataProcessing.h" +#include "Common/DataModel/EventSelection.h" +#include "Common/DataModel/TrackSelectionTables.h" + +#include "PWGJE/DataModel/Jet.h" +#include "PWGJE/Core/JetUtilities.h" +#include "PWGJE/Core/JetFindingUtilities.h" +#include "PWGJE/Core/JetMatchingUtilities.h" +#include "PWGHF/DataModel/CandidateSelectionTables.h" + +using namespace o2; +using namespace o2::framework; +using namespace o2::framework::expressions; + +template +struct JetMatchingSub { + + Configurable doMatchingGeo{"doMatchingGeo", true, "Enable geometric matching"}; + Configurable doMatchingPt{"doMatchingPt", true, "Enable pt matching"}; + Configurable doMatchingHf{"doMatchingHf", false, "Enable HF matching"}; + Configurable maxMatchingDistance{"maxMatchingDistance", 0.24f, "Max matching distance"}; + Configurable minPtFraction{"minPtFraction", 0.5f, "Minimum pt fraction for pt matching"}; + + Produces jetsBasetoTagMatchingTable; + Produces jetsTagtoBaseMatchingTable; + + // preslicing jet collections, only for Mc-based collection + static constexpr bool jetsBaseIsMc = o2::soa::relatedByIndex(); + static constexpr bool jetsTagIsMc = o2::soa::relatedByIndex(); + + Preslice baseJetsPerCollision = jetsBaseIsMc ? aod::jet::mcCollisionId : aod::jet::collisionId; + Preslice tagJetsPerCollision = jetsTagIsMc ? aod::jet::mcCollisionId : aod::jet::collisionId; + + void init(InitContext const&) + { + } + + void processDummy(JetCollisions const& collisions) + { + } + PROCESS_SWITCH(JetMatchingSub, processDummy, "Dummy process", true); + + void processJets(JetCollisions const& collisions, + JetsBase const& jetsBase, JetsTag const& jetsTag, + JetTracks const& tracks, TracksTag const& tracksSub, Candidates const& candidates) + { + + // initialise objects used to store the matching index arrays (array in case a mcCollision is split) before filling the matching tables + std::vector> jetsBasetoTagMatchingGeo, jetsBasetoTagMatchingPt, jetsBasetoTagMatchingHF; + std::vector> jetsTagtoBaseMatchingGeo, jetsTagtoBaseMatchingPt, jetsTagtoBaseMatchingHF; + // waiting for framework fix to make sliced collection of same type as original collection: + jetsBasetoTagMatchingGeo.assign(jetsBase.size(), {}); + jetsBasetoTagMatchingPt.assign(jetsBase.size(), {}); + jetsBasetoTagMatchingHF.assign(jetsBase.size(), {}); + jetsTagtoBaseMatchingGeo.assign(jetsTag.size(), {}); + jetsTagtoBaseMatchingPt.assign(jetsTag.size(), {}); + jetsTagtoBaseMatchingHF.assign(jetsTag.size(), {}); + + for (const auto& collision : collisions) { + + const auto jetsBasePerColl = jetsBase.sliceBy(baseJetsPerCollision, collision.globalIndex()); + const auto jetsTagPerColl = jetsTag.sliceBy(tagJetsPerCollision, collision.globalIndex()); + + jetmatchingutilities::doAllMatching(jetsBasePerColl, jetsTagPerColl, jetsBasetoTagMatchingGeo, jetsBasetoTagMatchingPt, jetsBasetoTagMatchingHF, jetsTagtoBaseMatchingGeo, jetsTagtoBaseMatchingPt, jetsTagtoBaseMatchingHF, candidates, candidates, tracks, tracksSub, doMatchingGeo, doMatchingHf, doMatchingPt, maxMatchingDistance, minPtFraction); + } + + for (auto i = 0; i < jetsBase.size(); ++i) { + jetsBasetoTagMatchingTable(jetsBasetoTagMatchingGeo[i], jetsBasetoTagMatchingPt[i], jetsBasetoTagMatchingHF[i]); // is (and needs to) be filled in order + } + for (auto i = 0; i < jetsTag.size(); i++) { + jetsTagtoBaseMatchingTable(jetsTagtoBaseMatchingGeo[i], jetsTagtoBaseMatchingPt[i], jetsTagtoBaseMatchingHF[i]); // is (and needs to) be filled in order + } + } + PROCESS_SWITCH(JetMatchingSub, processJets, "Perform jet matching", false); +}; + +using ChargedJetMatching = JetMatchingSub, + soa::Join, + aod::ChargedJetsMatchedToChargedEventWiseSubtractedJets, + aod::ChargedEventWiseSubtractedJetsMatchedToChargedJets, + aod::JTrackSubs, + aod::JDummys>; +using D0ChargedJetMatching = JetMatchingSub, + soa::Join, + aod::D0ChargedJetsMatchedToD0ChargedEventWiseSubtractedJets, + aod::D0ChargedEventWiseSubtractedJetsMatchedToD0ChargedJets, + aod::JTrackD0Subs, + CandidatesD0Data>; +/*using LcChargedJetMatching = JetMatchingSub, + soa::Join, + aod::LcChargedJetsMatchedToLcChargedEventWiseSubtractedJets, + aod::LcChargedEventWiseSubtractedJetsMatchedToLcChargedJets, + aod::JTrackLcSubs, + CandidatesLcData>; +using BplusChargedJetMatching = JetMatchingSub, + soa::Join, + aod::BplusChargedJetsMatchedToBplusChargedEventWiseSubtractedJets, + aod::BplusChargedEventWiseSubtractedJetsMatchedToBplusChargedJets, + aod::JTrackBplusSubs, + CandidatesBplusData>;*/ + +WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) +{ + std::vector tasks; + + tasks.emplace_back(adaptAnalysisTask(cfgc, SetDefaultProcesses{}, TaskName{"jet-matching-sub-ch"})); + tasks.emplace_back(adaptAnalysisTask(cfgc, TaskName{"jet-matching-sub-d0-ch"})); + // tasks.emplace_back(adaptAnalysisTask(cfgc, TaskName{"jet-matching-sub-lc-ch"})); + // tasks.emplace_back(adaptAnalysisTask(cfgc, TaskName{"jet-matching-sub-bplus-ch"})); + + return WorkflowSpec{tasks}; +} diff --git a/PWGJE/TableProducer/jettaggerhf.cxx b/PWGJE/TableProducer/jettaggerhf.cxx index d929187ef3c..da941c4825b 100644 --- a/PWGJE/TableProducer/jettaggerhf.cxx +++ b/PWGJE/TableProducer/jettaggerhf.cxx @@ -39,37 +39,37 @@ struct JetTaggerHFTask { Configurable doAlgorithm3{"doAlgorithm3", false, "fill table for algoithm 3"}; Configurable maxDeltaR{"maxDeltaR", 0.25, "maximum distance of jet axis from flavour initiating parton"}; - void processDummy(aod::Collision const& collision) + void processDummy(JetCollisions const& collision) { } PROCESS_SWITCH(JetTaggerHFTask, processDummy, "Dummy process", true); - void processData(aod::JCollision const& collision, JetTableData const& jets, aod::JTracks const& tracks) + void processData(JetCollision const& collision, JetTableData const& jets, aod::JTracks const& tracks) { for (auto& jet : jets) { int algorithm1 = jet.globalIndex(); // This needs to be changed. It is only done because O2Physics compilation breaks if jet is unused int algorithm2 = 0; int algorithm3 = 0; - // if (doAlgorithm1) algorithm1 = JetTaggingUtilities::Algorithm1((mcdjet, tracks); - // if (doAlgorithm2) algorithm2 = JetTaggingUtilities::Algorithm2((mcdjet, tracks); - // if (doAlgorithm3) algorithm3 = JetTaggingUtilities::Algorithm3((mcdjet, tracks); + // if (doAlgorithm1) algorithm1 = jettaggingutilities::Algorithm1((mcdjet, tracks); + // if (doAlgorithm2) algorithm2 = jettaggingutilities::Algorithm2((mcdjet, tracks); + // if (doAlgorithm3) algorithm3 = jettaggingutilities::Algorithm3((mcdjet, tracks); taggingTableData(0, algorithm1, algorithm2, algorithm3); } } PROCESS_SWITCH(JetTaggerHFTask, processData, "Fill tagging decision for data jets", false); - void processMCD(aod::JCollision const& collision, JetTableMCD const& mcdjets, soa::Join const& tracks, aod::JMcParticles const& particles) + void processMCD(JetCollision const& collision, JetTableMCD const& mcdjets, JetTracksMCD const& tracks, JetParticles const& particles) { for (auto& mcdjet : mcdjets) { - int origin = JetTaggingUtilities::mcdJetFromHFShower(mcdjet, tracks, particles, maxDeltaR); + int origin = jettaggingutilities::mcdJetFromHFShower(mcdjet, tracks, particles, maxDeltaR); int algorithm1 = 0; int algorithm2 = 0; int algorithm3 = 0; - // if (doAlgorithm1) algorithm1 = JetTaggingUtilities::Algorithm1((mcdjet, tracks); - // if (doAlgorithm2) algorithm2 = JetTaggingUtilities::Algorithm2((mcdjet, tracks); - // if (doAlgorithm3) algorithm3 = JetTaggingUtilities::Algorithm3((mcdjet, tracks); + // if (doAlgorithm1) algorithm1 = jettaggingutilities::Algorithm1((mcdjet, tracks); + // if (doAlgorithm2) algorithm2 = jettaggingutilities::Algorithm2((mcdjet, tracks); + // if (doAlgorithm3) algorithm3 = jettaggingutilities::Algorithm3((mcdjet, tracks); taggingTableMCD(origin, algorithm1, algorithm2, algorithm3); } } diff --git a/PWGJE/TableProducer/rhoEstimator.cxx b/PWGJE/TableProducer/rhoEstimator.cxx index aa9174e898b..dabbbcf08d4 100644 --- a/PWGJE/TableProducer/rhoEstimator.cxx +++ b/PWGJE/TableProducer/rhoEstimator.cxx @@ -9,7 +9,7 @@ // granted to it by virtue of its status as an Intergovernmental Organization // or submit itself to any jurisdiction. -// Task to produce a table joinable to the collision table with the mean background pT density +// Task to produce a table joinable to the jcollision table with the mean background pT density // /// \author Nima Zardoshti @@ -19,6 +19,7 @@ #include "Framework/O2DatabasePDGPlugin.h" #include "PWGJE/Core/FastJetUtilities.h" +#include "PWGJE/Core/JetFindingUtilities.h" #include "PWGJE/Core/JetDerivedDataUtilities.h" #include "PWGJE/DataModel/Jet.h" #include "PWGJE/Core/JetBkgSubUtils.h" @@ -29,43 +30,98 @@ using namespace o2::framework; using namespace o2::framework::expressions; struct RhoEstimatorTask { - Produces rhoTable; + Produces rhoChargedTable; + Produces rhoD0Table; + Produces rhoLcTable; + Produces rhoBplusTable; + Configurable trackPtMin{"trackPtMin", 0.15, "minimum track pT"}; + Configurable trackPtMax{"trackPtMax", 1000.0, "maximum track pT"}; + Configurable trackEtaMin{"trackEtaMin", -0.9, "minimum track eta"}; + Configurable trackEtaMax{"trackEtaMax", 0.9, "maximum track eta"}; + Configurable trackPhiMin{"trackPhiMin", -999, "minimum track phi"}; + Configurable trackPhiMax{"trackPhiMax", 999, "maximum track phi"}; Configurable trackSelections{"trackSelections", "globalTracks", "set track selections"}; + + Configurable selectionFlagD0{"selectionFlagD0", 1, "Selection Flag for D0"}; + Configurable selectionFlagD0bar{"selectionFlagD0bar", 1, "Selection Flag for D0bar"}; + Configurable selectionFlagLcToPKPi{"selectionFlagLcToPKPi", 1, "Selection Flag for Lc->PKPi"}; + Configurable selectionFlagLcToPiPK{"selectionFlagLcToPiPK", 1, "Selection Flag for Lc->PiPK"}; + Configurable selectionFlagBplus{"selectionFlagBplus", 1, "Selection Flag for B+"}; + Configurable bkgjetR{"bkgjetR", 0.2, "jet resolution parameter for determining background density"}; Configurable bkgEtaMin{"bkgEtaMin", -0.9, "minimim pseudorapidity for determining background density"}; Configurable bkgEtaMax{"bkgEtaMax", 0.9, "maximum pseudorapidity for determining background density"}; - Configurable bkgPhiMin{"bkgPhiMin", -99., "minimim phi for determining background density"}; - Configurable bkgPhiMax{"bkgPhiMax", 99., "maximum phi for determining background density"}; + Configurable bkgPhiMin{"bkgPhiMin", 0., "minimim phi for determining background density"}; + Configurable bkgPhiMax{"bkgPhiMax", 99.0, "maximum phi for determining background density"}; Configurable doSparse{"doSparse", false, "perfom sparse estimation"}; JetBkgSubUtils bkgSub; + float bkgPhiMax_; std::vector inputParticles; int trackSelection = -1; void init(o2::framework::InitContext&) { - trackSelection = JetDerivedDataUtilities::initialiseTrackSelection(static_cast(trackSelections)); + trackSelection = jetderiveddatautilities::initialiseTrackSelection(static_cast(trackSelections)); bkgSub.setJetBkgR(bkgjetR); bkgSub.setEtaMinMax(bkgEtaMin, bkgEtaMax); - bkgSub.setPhiMinMax(bkgPhiMin, bkgPhiMax); + if (bkgPhiMax > 98.0) { + bkgPhiMax_ = 2.0 * M_PI; + } + bkgSub.setPhiMinMax(bkgPhiMin, bkgPhiMax_); + } + + Filter trackCuts = (aod::jtrack::pt >= trackPtMin && aod::jtrack::pt < trackPtMax && aod::jtrack::eta > trackEtaMin && aod::jtrack::eta < trackEtaMax && aod::jtrack::phi >= trackPhiMin && aod::jtrack::phi <= trackPhiMax); + + void processChargedCollisions(JetCollision const& collision, soa::Filtered const& tracks) + { + inputParticles.clear(); + jetfindingutilities::analyseTracks, soa::Filtered::iterator>(inputParticles, tracks, trackSelection); + auto [rho, rhoM] = bkgSub.estimateRhoAreaMedian(inputParticles, doSparse); + rhoChargedTable(collision.globalIndex(), rho, rhoM); + } + PROCESS_SWITCH(RhoEstimatorTask, processChargedCollisions, "Fill rho tables for collisions using charged tracks", true); + + void processD0Collisions(JetCollision const& collision, soa::Filtered const& tracks, CandidatesD0Data const& candidates) + { + inputParticles.clear(); + for (auto& candidate : candidates) { + inputParticles.clear(); + jetfindingutilities::analyseTracks(inputParticles, tracks, trackSelection, std::optional{candidate}); + + auto [rho, rhoM] = bkgSub.estimateRhoAreaMedian(inputParticles, doSparse); + rhoD0Table(candidate.globalIndex(), rho, rhoM); + } } + PROCESS_SWITCH(RhoEstimatorTask, processD0Collisions, "Fill rho tables for collisions with D0 candidates", false); - void processCollisions(aod::JCollisions const& collision, aod::JTracks const& tracks) + void processLcCollisions(JetCollision const& collision, soa::Filtered const& tracks, CandidatesLcData const& candidates) { inputParticles.clear(); - for (auto& track : tracks) { - if (!JetDerivedDataUtilities::selectTrack(track, trackSelection)) { - continue; - } - FastJetUtilities::fillTracks(track, inputParticles, track.globalIndex()); + for (auto& candidate : candidates) { + inputParticles.clear(); + jetfindingutilities::analyseTracks(inputParticles, tracks, trackSelection, std::optional{candidate}); + + auto [rho, rhoM] = bkgSub.estimateRhoAreaMedian(inputParticles, doSparse); + rhoLcTable(candidate.globalIndex(), rho, rhoM); } + } + PROCESS_SWITCH(RhoEstimatorTask, processLcCollisions, "Fill rho tables for collisions with Lc candidates", false); - auto [rho, rhoM] = bkgSub.estimateRhoAreaMedian(inputParticles, doSparse); - rhoTable(rho, rhoM); + void processBplusCollisions(JetCollision const& collision, soa::Filtered const& tracks, CandidatesBplusData const& candidates) + { + inputParticles.clear(); + for (auto& candidate : candidates) { + inputParticles.clear(); + jetfindingutilities::analyseTracks(inputParticles, tracks, trackSelection, std::optional{candidate}); + + auto [rho, rhoM] = bkgSub.estimateRhoAreaMedian(inputParticles, doSparse); + rhoBplusTable(candidate.globalIndex(), rho, rhoM); + } } - PROCESS_SWITCH(RhoEstimatorTask, processCollisions, "Fill rho tables for collisions", true); + PROCESS_SWITCH(RhoEstimatorTask, processBplusCollisions, "Fill rho tables for collisions with Bplus candidates", false); }; -WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) { return WorkflowSpec{adaptAnalysisTask(cfgc, TaskName{"rho-estimator"})}; } +WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) { return WorkflowSpec{adaptAnalysisTask(cfgc, TaskName{"estimator-rho"})}; } diff --git a/PWGJE/Tasks/ChJetTriggerQATask.cxx b/PWGJE/Tasks/ChJetTriggerQATask.cxx index 0c918c128b5..9cead597449 100644 --- a/PWGJE/Tasks/ChJetTriggerQATask.cxx +++ b/PWGJE/Tasks/ChJetTriggerQATask.cxx @@ -33,10 +33,10 @@ #include "PWGJE/Core/JetFinder.h" #include "PWGJE/Core/FastJetUtilities.h" +#include "PWGJE/Core/JetFindingUtilities.h" #include "PWGJE/Core/JetDerivedDataUtilities.h" #include "PWGJE/DataModel/EMCALClusters.h" #include "PWGJE/DataModel/Jet.h" -#include "PWGJE/TableProducer/jetfinder.h" #include "Framework/HistogramRegistry.h" @@ -103,8 +103,8 @@ struct ChJetTriggerQATask { void init(o2::framework::InitContext&) { fiducialVolume = static_cast(cfgTPCVolume) - static_cast(cfgJetR); - eventSelection = JetDerivedDataUtilities::initialiseEventSelection(static_cast(evSel)); - trackSelection = JetDerivedDataUtilities::initialiseTrackSelection(static_cast(trackSelections)); + eventSelection = jetderiveddatautilities::initialiseEventSelection(static_cast(evSel)); + trackSelection = jetderiveddatautilities::initialiseTrackSelection(static_cast(trackSelections)); // Basic histos spectra.add("vertexZ", "z vertex", {HistType::kTH1F, {{400, -20., +20.}}}); @@ -151,19 +151,18 @@ struct ChJetTriggerQATask { Filter jetRadiusSelection = (o2::aod::jet::r == nround(cfgJetR.node() * 100.0f)); using filteredJets = o2::soa::Filtered; - using TrackCandidates = aod::JTracks; void - process(soa::Filtered>::iterator const& collision, - soa::Filtered const& tracks, o2::soa::Filtered> const& jets) + soa::Filtered const& tracks, o2::soa::Filtered> const& jets) { - if (!JetDerivedDataUtilities::selectCollision(collision, eventSelection)) { + if (!jetderiveddatautilities::selectCollision(collision, eventSelection)) { return; } - if ((bLowPtTrigger && JetDerivedDataUtilities::selectChargedTrigger(collision, JetDerivedDataUtilities::JTrigSelCh::chargedLow)) || (bHighPtTrigger && JetDerivedDataUtilities::selectChargedTrigger(collision, JetDerivedDataUtilities::JTrigSelCh::chargedHigh)) || ((!bLowPtTrigger) && (!bHighPtTrigger))) { + if ((bLowPtTrigger && jetderiveddatautilities::selectChargedTrigger(collision, jetderiveddatautilities::JTrigSelCh::chargedLow)) || (bHighPtTrigger && jetderiveddatautilities::selectChargedTrigger(collision, jetderiveddatautilities::JTrigSelCh::chargedHigh)) || ((!bLowPtTrigger) && (!bHighPtTrigger))) { // bLowPtTrigger=1 and bHighPtTrigger=0 --> fill histos with low trigger only // bLowPtTrigger=0 and bHighPtTrigger=1 --> fill histos with high trigger only // bLowPtTrigger=1 and bHighPtTrigger=1 --> fill histos with mixture of low and high trigger @@ -186,7 +185,7 @@ struct ChJetTriggerQATask { for (auto& trk : tracks) { // loop over filtered tracks in full TPC volume having pT > 100 MeV - if (!JetDerivedDataUtilities::selectTrack(trk, trackSelection)) { + if (!jetderiveddatautilities::selectTrack(trk, trackSelection)) { continue; } @@ -243,7 +242,7 @@ struct ChJetTriggerQATask { // access jet constituents as tracks if (bAddBigHistosToOutput) { - for (auto& jct : jet.tracks_as()) { + for (auto& jct : jet.tracks_as()) { for (UInt_t itr = 0; itr < acceptedTracks.size(); itr++) { if (acceptedTracks[itr].globalIndex == jct.globalIndex()) { diff --git a/PWGJE/Tasks/FullJetTriggerQATask.cxx b/PWGJE/Tasks/FullJetTriggerQATask.cxx index 44247cc960b..630a0722065 100644 --- a/PWGJE/Tasks/FullJetTriggerQATask.cxx +++ b/PWGJE/Tasks/FullJetTriggerQATask.cxx @@ -38,7 +38,7 @@ using namespace o2::framework; using namespace o2::framework::expressions; struct JetTriggerQA { - using selectedClusters = o2::soa::Filtered; + using selectedClusters = o2::soa::Filtered; using fullJetInfos = soa::Join; using neutralJetInfos = soa::Join; using collisionWithTrigger = soa::Join::iterator; @@ -160,7 +160,7 @@ struct JetTriggerQA { histProcessed->GetXaxis()->SetBinLabel(15, "Selected Gamma very low DCAL"); std::array triggerlabels = {{"MB", "EMC Any", "EMC MB", "EMC jet full high", "EMC jet full low", "EMC jet neutral high", "EMC jet neutral low", "EMC gamma very high", "DCL gamma very high", "EMC gamma high", "DCL gamma high", "EMC gamma low", "DCL gamma low", "EMC gamma very low", "DCL gamma very low"}}; - registry.add("hTriggerCorrelation", "Correlation between EMCAL triggers", HistType::kTH2D, {{TriggerType_t::kNTriggers, -0.5, (double)TriggerType_t::kNTriggers - 0.5, "Main trigger"}, {TriggerType_t::kNTriggers, -0.5, (double)TriggerType_t::kNTriggers - 0.5, "Associated trigger"}}); + registry.add("hTriggerCorrelation", "Correlation between EMCAL triggers", HistType::kTH2D, {{TriggerType_t::kNTriggers, -0.5, static_cast(TriggerType_t::kNTriggers) - 0.5, "Main trigger"}, {TriggerType_t::kNTriggers, -0.5, static_cast(TriggerType_t::kNTriggers) - 0.5, "Associated trigger"}}); auto triggerCorrelation = registry.get(HIST("hTriggerCorrelation")); for (std::size_t triggertype = 0; triggertype < TriggerType_t::kNTriggers; triggertype++) { triggerCorrelation->GetXaxis()->SetBinLabel(triggertype + 1, triggerlabels[triggertype].data()); @@ -544,7 +544,7 @@ struct JetTriggerQA { } template - std::pair, std::vector> fillJetQA(const JetCollection& jets, aod::JTracks const& tracks, selectedClusters const& clusters, std::bitset hwtrg, const std::bitset& triggerstatus) + std::pair, std::vector> fillJetQA(const JetCollection& jets, JetTracks const& tracks, selectedClusters const& clusters, std::bitset hwtrg, const std::bitset& triggerstatus) { auto isTrigger = [&triggerstatus](TriggerType_t triggertype) -> bool { return triggerstatus.test(triggertype); @@ -568,7 +568,7 @@ struct JetTriggerQA { // This gives us access to all jet substructure information // auto tracksInJet = jetTrackConstituents.sliceBy(perJetTrackConstituents, jet.globalIndex()); // for (const auto& trackList : tracksInJet) { - for (auto& track : jet.template tracks_as()) { + for (auto& track : jet.template tracks_as()) { auto trackPt = track.pt(); auto chargeFrag = track.px() * jet.px() + track.py() * jet.py() + track.pz() * jet.pz(); chargeFrag /= (jet.p() * jet.p()); @@ -647,12 +647,12 @@ struct JetTriggerQA { return std::make_pair(vecMaxJet, vecMaxJetNoFiducial); } - using JetCollisionsTable = soa::Join; + using JetCollisionsTable = soa::Join; template void runQA(collisionWithTrigger const& collision, JetCollection const& jets, - aod::JTracks const& tracks, + JetTracks const& tracks, selectedClusters const& clusters) { std::bitset triggerstatus; @@ -688,55 +688,55 @@ struct JetTriggerQA { setTrigger(TriggerType_t::kEmcalMB); } - if (JetDerivedDataUtilities::selectFullTrigger(collision, JetDerivedDataUtilities::JTrigSelFull::fullHigh)) { + if (jetderiveddatautilities::selectFullTrigger(collision, jetderiveddatautilities::JTrigSelFull::fullHigh)) { fillEventSelectionCounter(3); setTrigger(TriggerType_t::kEmcalJetFull); } - if (JetDerivedDataUtilities::selectFullTrigger(collision, JetDerivedDataUtilities::JTrigSelFull::fullLow)) { + if (jetderiveddatautilities::selectFullTrigger(collision, jetderiveddatautilities::JTrigSelFull::fullLow)) { fillEventSelectionCounter(4); setTrigger(TriggerType_t::kEmcalJetFullLow); } - if (JetDerivedDataUtilities::selectFullTrigger(collision, JetDerivedDataUtilities::JTrigSelFull::neutralHigh)) { + if (jetderiveddatautilities::selectFullTrigger(collision, jetderiveddatautilities::JTrigSelFull::neutralHigh)) { fillEventSelectionCounter(5); setTrigger(TriggerType_t::kEmcalJetNeutral); } - if (JetDerivedDataUtilities::selectFullTrigger(collision, JetDerivedDataUtilities::JTrigSelFull::neutralLow)) { + if (jetderiveddatautilities::selectFullTrigger(collision, jetderiveddatautilities::JTrigSelFull::neutralLow)) { fillEventSelectionCounter(6); setTrigger(TriggerType_t::kEmcalJetNeutralLow); } - if (JetDerivedDataUtilities::selectFullTrigger(collision, JetDerivedDataUtilities::JTrigSelFull::neutralLow)) { + if (jetderiveddatautilities::selectFullTrigger(collision, jetderiveddatautilities::JTrigSelFull::neutralLow)) { fillEventSelectionCounter(6); setTrigger(TriggerType_t::kEmcalJetNeutralLow); } - if (JetDerivedDataUtilities::selectFullTrigger(collision, JetDerivedDataUtilities::JTrigSelFull::gammaVeryHighEMCAL)) { + if (jetderiveddatautilities::selectFullTrigger(collision, jetderiveddatautilities::JTrigSelFull::gammaVeryHighEMCAL)) { fillEventSelectionCounter(7); setTrigger(TriggerType_t::kEmcalGammaVeryHigh); } - if (JetDerivedDataUtilities::selectFullTrigger(collision, JetDerivedDataUtilities::JTrigSelFull::gammaVeryHighDCAL)) { + if (jetderiveddatautilities::selectFullTrigger(collision, jetderiveddatautilities::JTrigSelFull::gammaVeryHighDCAL)) { fillEventSelectionCounter(8); setTrigger(TriggerType_t::kDcalGammaVeryHigh); } - if (JetDerivedDataUtilities::selectFullTrigger(collision, JetDerivedDataUtilities::JTrigSelFull::gammaHighEMCAL)) { + if (jetderiveddatautilities::selectFullTrigger(collision, jetderiveddatautilities::JTrigSelFull::gammaHighEMCAL)) { fillEventSelectionCounter(9); setTrigger(TriggerType_t::kEmcalGammaHigh); } - if (JetDerivedDataUtilities::selectFullTrigger(collision, JetDerivedDataUtilities::JTrigSelFull::gammaHighDCAL)) { + if (jetderiveddatautilities::selectFullTrigger(collision, jetderiveddatautilities::JTrigSelFull::gammaHighDCAL)) { fillEventSelectionCounter(10); setTrigger(TriggerType_t::kDcalGammaHigh); } - if (JetDerivedDataUtilities::selectFullTrigger(collision, JetDerivedDataUtilities::JTrigSelFull::gammaLowEMCAL)) { + if (jetderiveddatautilities::selectFullTrigger(collision, jetderiveddatautilities::JTrigSelFull::gammaLowEMCAL)) { fillEventSelectionCounter(11); setTrigger(TriggerType_t::kEmcalGammaLow); } - if (JetDerivedDataUtilities::selectFullTrigger(collision, JetDerivedDataUtilities::JTrigSelFull::gammaLowDCAL)) { + if (jetderiveddatautilities::selectFullTrigger(collision, jetderiveddatautilities::JTrigSelFull::gammaLowDCAL)) { fillEventSelectionCounter(12); setTrigger(TriggerType_t::kDcalGammaLow); } - if (JetDerivedDataUtilities::selectFullTrigger(collision, JetDerivedDataUtilities::JTrigSelFull::gammaVeryLowEMCAL)) { + if (jetderiveddatautilities::selectFullTrigger(collision, jetderiveddatautilities::JTrigSelFull::gammaVeryLowEMCAL)) { fillEventSelectionCounter(13); setTrigger(TriggerType_t::kEmcalGammaVeryLow); } - if (JetDerivedDataUtilities::selectFullTrigger(collision, JetDerivedDataUtilities::JTrigSelFull::gammaVeryLowDCAL)) { + if (jetderiveddatautilities::selectFullTrigger(collision, jetderiveddatautilities::JTrigSelFull::gammaVeryLowDCAL)) { fillEventSelectionCounter(14); setTrigger(TriggerType_t::kDcalGammaVeryLow); } @@ -830,7 +830,7 @@ struct JetTriggerQA { void processFullJets(collisionWithTrigger const& collision, fullJetInfos const& jets, - aod::JTracks const& tracks, + JetTracks const& tracks, selectedClusters const& clusters) { runQA(collision, jets, tracks, clusters); @@ -839,7 +839,7 @@ struct JetTriggerQA { void processNeutralJets(collisionWithTrigger const& collision, neutralJetInfos const& jets, - aod::JTracks const& tracks, + JetTracks const& tracks, selectedClusters const& clusters) { runQA(collision, jets, tracks, clusters); diff --git a/PWGJE/Tasks/jetTutorial.cxx b/PWGJE/Tasks/jetTutorial.cxx index ba9b6b9b1ca..e42195d6691 100644 --- a/PWGJE/Tasks/jetTutorial.cxx +++ b/PWGJE/Tasks/jetTutorial.cxx @@ -77,22 +77,22 @@ struct JetTutorialTask { void init(o2::framework::InitContext&) { - eventSelection = JetDerivedDataUtilities::initialiseEventSelection(static_cast(eventSelections)); - trackSelection = JetDerivedDataUtilities::initialiseTrackSelection(static_cast(trackSelections)); + eventSelection = jetderiveddatautilities::initialiseEventSelection(static_cast(eventSelections)); + trackSelection = jetderiveddatautilities::initialiseTrackSelection(static_cast(trackSelections)); } Filter jetCuts = aod::jet::pt > jetPtMin&& aod::jet::r == nround(jetR.node() * 100.0f); - void processCollisions(aod::JCollision const& collision, aod::JTracks const& tracks) + void processCollisions(JetCollision const& collision, JetTracks const& tracks) { registry.fill(HIST("h_collisions"), 0.5); - if (!JetDerivedDataUtilities::selectCollision(collision, eventSelection)) { + if (!jetderiveddatautilities::selectCollision(collision, eventSelection)) { return; } registry.fill(HIST("h_collisions"), 1.5); for (auto const& track : tracks) { - if (!JetDerivedDataUtilities::selectTrack(track, trackSelection)) { + if (!jetderiveddatautilities::selectTrack(track, trackSelection)) { continue; } registry.fill(HIST("h_track_pt"), track.pt()); @@ -102,16 +102,16 @@ struct JetTutorialTask { } PROCESS_SWITCH(JetTutorialTask, processCollisions, "process self contained collisions", true); - void processCollisionsWithExternalTracks(aod::JCollision const& collision, soa::Join const& tracks, soa::Join const& originalTracks) + void processCollisionsWithExternalTracks(JetCollision const& collision, soa::Join const& tracks, soa::Join const& originalTracks) { registry.fill(HIST("h_collisions"), 0.5); - if (!JetDerivedDataUtilities::selectCollision(collision, eventSelection)) { + if (!jetderiveddatautilities::selectCollision(collision, eventSelection)) { return; } registry.fill(HIST("h_collisions"), 1.5); for (auto const& track : tracks) { - if (!JetDerivedDataUtilities::selectTrack(track, trackSelection)) { + if (!jetderiveddatautilities::selectTrack(track, trackSelection)) { continue; } registry.fill(HIST("h_track_pt"), track.pt()); @@ -147,7 +147,7 @@ struct JetTutorialTask { } PROCESS_SWITCH(JetTutorialTask, processMCParticleLevel, "jets on particle level MC", false); - void processMCCharged(aod::JCollisions const& collision, soa::Filtered const& mcdjets, soa::Filtered const& mcpjets) + void processMCCharged(JetCollision const& collision, soa::Filtered const& mcdjets, soa::Filtered const& mcpjets) { for (auto& mcdjet : mcdjets) { registry.fill(HIST("h_jet_pt"), mcdjet.pt()); @@ -163,11 +163,11 @@ struct JetTutorialTask { PROCESS_SWITCH(JetTutorialTask, processMCCharged, "jets on detector and particle level MC", false); using JetMCPTable = soa::Filtered>; - void processMCChargedMatched(aod::JCollision const& collision, + void processMCChargedMatched(JetCollision const& collision, soa::Filtered> const& mcdjets, JetMCPTable const& mcpjets, - aod::JTracks const& tracks, - aod::JMcParticles const& particles) + JetTracks const& tracks, + JetParticles const& particles) { for (const auto& mcdjet : mcdjets) { @@ -182,7 +182,7 @@ struct JetTutorialTask { } PROCESS_SWITCH(JetTutorialTask, processMCChargedMatched, "jet finder QA matched mcp and mcd", false); - void processDataChargedSubstructure(soa::Filtered>::iterator const& jet, aod::JTracks const& tracks) + void processDataChargedSubstructure(soa::Filtered>::iterator const& jet, JetTracks const& tracks) { // add aditional selection on jet eta registry.fill(HIST("h_jet_pt"), jet.pt()); @@ -190,14 +190,14 @@ struct JetTutorialTask { registry.fill(HIST("h_jet_phi"), jet.phi()); registry.fill(HIST("h_jet_ntracks"), jet.tracks().size()); double angularity = 0.0; - for (auto& jetConstituent : jet.tracks_as()) { + for (auto& jetConstituent : jet.tracks_as()) { angularity += jetConstituent.pt() * TMath::Sqrt(TMath::Power(jet.phi() - jetConstituent.phi(), 2.0) + TMath::Power(jet.eta() - jetConstituent.eta(), 2.0)); } registry.fill(HIST("h_jet_angularity"), angularity / (jet.pt() * round(jet.r() / 100.0f))); } PROCESS_SWITCH(JetTutorialTask, processDataChargedSubstructure, "jet substructure charged jets", false); - void processMCParticleSubstructure(soa::Filtered>::iterator const& jet, aod::JMcParticles const& particles) + void processMCParticleSubstructure(soa::Filtered>::iterator const& jet, JetParticles const& particles) { double angularity = 0.0; for (auto& jetConstituents : jet.tracks_as()) { @@ -215,7 +215,7 @@ struct JetTutorialTask { } PROCESS_SWITCH(JetTutorialTask, processDataFull, "jets data", true); - void processDataFullSubstructure(soa::Filtered>::iterator const& jet, aod::JTracks const& tracks, aod::JClusters const& clusters) + void processDataFullSubstructure(soa::Filtered>::iterator const& jet, JetTracks const& tracks, JetClusters const& clusters) { // add aditional selection on jet eta registry.fill(HIST("h_full_jet_pt"), jet.pt()); @@ -224,11 +224,11 @@ struct JetTutorialTask { registry.fill(HIST("h_full_jet_ntracks"), jet.tracks().size()); registry.fill(HIST("h_full_jet_nclusters"), jet.clusters().size()); double angularity = 0.0; - for (auto& jetTrack : jet.tracks_as()) { + for (auto& jetTrack : jet.tracks_as()) { angularity += jetTrack.pt() * TMath::Sqrt(TMath::Power(jet.phi() - jetTrack.phi(), 2.0) + TMath::Power(jet.eta() - jetTrack.eta(), 2.0)); } - for (auto& jetCluster : jet.clusters_as()) { + for (auto& jetCluster : jet.clusters_as()) { angularity += jetCluster.energy() * TMath::Sqrt(TMath::Power(jet.phi() - jetCluster.phi(), 2.0) + TMath::Power(jet.eta() - jetCluster.eta(), 2.0)); } @@ -236,9 +236,9 @@ struct JetTutorialTask { } PROCESS_SWITCH(JetTutorialTask, processDataFullSubstructure, "jet substructure full jets", false); - void processDataRecoil(aod::JCollision const& collision, soa::Filtered const& jets, aod::JTracks const& tracks) + void processDataRecoil(JetCollision const& collision, soa::Filtered const& jets, JetTracks const& tracks) { - if (!JetDerivedDataUtilities::selectCollision(collision, eventSelection)) { + if (!jetderiveddatautilities::selectCollision(collision, eventSelection)) { return; } double leadingTrackpT = 0.0; @@ -264,7 +264,7 @@ struct JetTutorialTask { } PROCESS_SWITCH(JetTutorialTask, processDataRecoil, "hadron-recoil jets", false); - void processDataBackgroundSubtracted(soa::Join::iterator const& collision, soa::Filtered const& jets) + /*void processDataBackgroundSubtracted(soa::Join::iterator const& collision, soa::Filtered const& jets) { for (auto jet : jets) { registry.fill(HIST("h_jet_pt"), jet.pt()); @@ -273,7 +273,7 @@ struct JetTutorialTask { registry.fill(HIST("h_jet_phi"), jet.phi()); } } - PROCESS_SWITCH(JetTutorialTask, processDataBackgroundSubtracted, "baackground subtracted jets", false); + PROCESS_SWITCH(JetTutorialTask, processDataBackgroundSubtracted, "baackground subtracted jets", false);*/ }; WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) { return WorkflowSpec{adaptAnalysisTask(cfgc, TaskName{"jet-tutorial"})}; } diff --git a/PWGJE/Tasks/jetTutorialSkeleton.cxx b/PWGJE/Tasks/jetTutorialSkeleton.cxx index b27e86d6426..1c6139fb58d 100644 --- a/PWGJE/Tasks/jetTutorialSkeleton.cxx +++ b/PWGJE/Tasks/jetTutorialSkeleton.cxx @@ -77,8 +77,8 @@ struct JetTutorialSkeletonTask { void init(o2::framework::InitContext&) { - eventSelection = JetDerivedDataUtilities::initialiseEventSelection(static_cast(eventSelections)); - trackSelection = JetDerivedDataUtilities::initialiseTrackSelection(static_cast(trackSelections)); + eventSelection = jetderiveddatautilities::initialiseEventSelection(static_cast(eventSelections)); + trackSelection = jetderiveddatautilities::initialiseTrackSelection(static_cast(trackSelections)); } Filter jetCuts = aod::jet::pt > jetPtMin&& aod::jet::r == nround(jetR.node() * 100.0f); @@ -148,10 +148,10 @@ struct JetTutorialSkeletonTask { } PROCESS_SWITCH(JetTutorialSkeletonTask, processDataRecoil, "hadron-recoil jets", false); - void processDataBackgroundSubtracted(soa::Join::iterator const& collision, soa::Filtered const& jets) + /*void processDataBackgroundSubtracted(soa::Join::iterator const& collision, soa::Filtered const& jets) { } - PROCESS_SWITCH(JetTutorialSkeletonTask, processDataBackgroundSubtracted, "baackground subtracted jets", false); + PROCESS_SWITCH(JetTutorialSkeletonTask, processDataBackgroundSubtracted, "baackground subtracted jets", false);*/ }; WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) { return WorkflowSpec{adaptAnalysisTask(cfgc, TaskName{"jet-tutorial-skeleton"})}; } diff --git a/PWGJE/Tasks/jetfinderQA.cxx b/PWGJE/Tasks/jetfinderQA.cxx index b9792d1287a..429fd0b04e7 100644 --- a/PWGJE/Tasks/jetfinderQA.cxx +++ b/PWGJE/Tasks/jetfinderQA.cxx @@ -29,6 +29,7 @@ #include "PWGJE/Core/FastJetUtilities.h" #include "PWGJE/Core/JetFinder.h" +#include "PWGJE/Core/JetFindingUtilities.h" #include "PWGJE/DataModel/Jet.h" #include "PWGJE/Core/JetDerivedDataUtilities.h" @@ -46,6 +47,8 @@ struct JetFinderQATask { Configurable selectedJetsRadius{"selectedJetsRadius", 0.4, "resolution parameter for histograms without radius"}; Configurable eventSelections{"eventSelections", "sel8", "choose event selection"}; Configurable vertexZCut{"vertexZCut", 10.0f, "Accepted z-vertex range"}; + Configurable centralityMin{"centralityMin", -999.0, "minimum centrality"}; + Configurable centralityMax{"centralityMax", 999.0, "maximum centrality"}; Configurable> jetRadii{"jetRadii", std::vector{0.4}, "jet resolution parameters"}; Configurable trackEtaMin{"trackEtaMin", -0.9, "minimum eta acceptance for tracks"}; Configurable trackEtaMax{"trackEtaMax", 0.9, "maximum eta acceptance for tracks"}; @@ -55,8 +58,11 @@ struct JetFinderQATask { Configurable pTHatMaxMCD{"pTHatMaxMCD", 999.0, "maximum fraction of hard scattering for jet acceptance in detector MC"}; Configurable pTHatMaxMCP{"pTHatMaxMCP", 999.0, "maximum fraction of hard scattering for jet acceptance in particle MC"}; Configurable pTHatExponent{"pTHatExponent", 6.0, "exponent of the event weight for the calculation of pTHat"}; - - std::vector filledJetR; + Configurable jetEtaMin{"jetEtaMin", -99.0, "minimum jet pseudorapidity"}; + Configurable jetEtaMax{"jetEtaMax", 99.0, "maximum jet pseudorapidity"}; + std::vector filledJetR_Both; + std::vector filledJetR_Low; + std::vector filledJetR_High; std::vector jetRadiiValues; int eventSelection = -1; @@ -64,12 +70,14 @@ struct JetFinderQATask { void init(o2::framework::InitContext&) { - eventSelection = JetDerivedDataUtilities::initialiseEventSelection(static_cast(eventSelections)); - trackSelection = JetDerivedDataUtilities::initialiseTrackSelection(static_cast(trackSelections)); + eventSelection = jetderiveddatautilities::initialiseEventSelection(static_cast(eventSelections)); + trackSelection = jetderiveddatautilities::initialiseTrackSelection(static_cast(trackSelections)); jetRadiiValues = (std::vector)jetRadii; for (std::size_t iJetRadius = 0; iJetRadius < jetRadiiValues.size(); iJetRadius++) { - filledJetR.push_back(0.0); + filledJetR_Both.push_back(0.0); + filledJetR_Low.push_back(0.0); + filledJetR_High.push_back(0.0); } auto jetRadiiBins = (std::vector)jetRadii; if (jetRadiiBins.size() > 1) { @@ -96,6 +104,43 @@ struct JetFinderQATask { registry.add("h_jet_ptcut", "p_{T} cut;p_{T,jet} (GeV/#it{c});N;entries", {HistType::kTH2F, {{200, 0, 200}, {20, 0, 5}}}); } + if (doprocessJetsRhoAreaSubData) { + + registry.add("h_jet_pt_rhoareasubtracted", "jet pT;#it{p}_{T,jet} (GeV/#it{c});entries", {HistType::kTH1F, {{200, 0., 200.}}}); + registry.add("h_jet_eta_rhoareasubtracted", "jet #eta;#eta_{jet};entries", {HistType::kTH1F, {{100, -1.0, 1.0}}}); + registry.add("h_jet_phi_rhoareasubtracted", "jet #varphi;#varphi_{jet};entries", {HistType::kTH1F, {{160, -1.0, 7.}}}); + registry.add("h_jet_ntracks_rhoareasubtracted", "jet N tracks;N_{jet tracks};entries", {HistType::kTH1F, {{200, -0.5, 199.5}}}); + registry.add("h3_jet_r_jet_pt_jet_eta_rhoareasubtracted", "#it{R}_{jet};#it{p}_{T,jet} (GeV/#it{c});#eta_{jet}", {HistType::kTH3F, {{jetRadiiBins, ""}, {200, 0., 200.}, {100, -1.0, 1.0}}}); + registry.add("h3_jet_r_jet_pt_jet_phi_rhoareasubtracted", "#it{R}_{jet};#it{p}_{T,jet} (GeV/#it{c});#varphi_{jet}", {HistType::kTH3F, {{jetRadiiBins, ""}, {200, 0., 200.}, {160, -1.0, 7.}}}); + registry.add("h3_jet_r_jet_eta_jet_phi_rhoareasubtracted", "#it{R}_{jet};#eta_{jet};#varphi_{jet}", {HistType::kTH3F, {{jetRadiiBins, ""}, {100, -1.0, 1.0}, {160, -1.0, 7.}}}); + registry.add("h3_jet_r_jet_pt_jet_ntracks_rhoareasubtracted", "#it{R}_{jet};#it{p}_{T,jet} (GeV/#it{c});N_{jet tracks}", {HistType::kTH3F, {{jetRadiiBins, ""}, {200, 0., 200.}, {100, -0.5, 99.5}}}); + registry.add("h3_jet_r_jet_pt_jet_area_rhoareasubtracted", "#it{R}_{jet}; #it{p}_{T,jet} (GeV/#it{c}); #it{Area}_{jet}", {HistType::kTH3F, {{jetRadiiBins, ""}, {200, 0., 200.}, {300, 0., 3.}}}); + registry.add("h3_jet_r_jet_pt_track_pt_rhoareasubtracted", "#it{R}_{jet};#it{p}_{T,jet} (GeV/#it{c});#it{p}_{T,jet tracks} (GeV/#it{c})", {HistType::kTH3F, {{jetRadiiBins, ""}, {200, 0., 200.}, {200, 0., 200.}}}); + registry.add("h3_jet_r_jet_pt_track_eta_rhoareasubtracted", "#it{R}_{jet};#it{p}_{T,jet} (GeV/#it{c});#eta_{jet tracks}", {HistType::kTH3F, {{jetRadiiBins, ""}, {200, 0., 200.}, {100, -1.0, 1.0}}}); + registry.add("h3_jet_r_jet_pt_track_phi_rhoareasubtracted", "#it{R}_{jet};#it{p}_{T,jet} (GeV/#it{c});#varphi_{jet tracks}", {HistType::kTH3F, {{jetRadiiBins, ""}, {200, 0., 200.}, {160, -1.0, 7.}}}); + registry.add("h3_jet_r_jet_pt_jet_pt_rhoareasubtracted", "#it{R}_{jet};#it{p}_{T,jet} (GeV/#it{c});#it{p}_{T,jet} (GeV/#it{c})", {HistType::kTH3F, {{jetRadiiBins, ""}, {200, 0., 200.}, {200, 0., 200.}}}); + } + + if (doprocessEvtWiseConstSubJetsData) { + registry.add("h_jet_pt_eventwiseconstituentsubtracted", "jet pT;#it{p}_{T,jet} (GeV/#it{c});entries", {HistType::kTH1F, {{200, 0., 200.}}}); + registry.add("h_jet_eta_eventwiseconstituentsubtracted", "jet #eta;#eta_{jet};entries", {HistType::kTH1F, {{100, -1.0, 1.0}}}); + registry.add("h_jet_phi_eventwiseconstituentsubtracted", "jet #varphi;#varphi_{jet};entries", {HistType::kTH1F, {{160, -1.0, 7.}}}); + registry.add("h_jet_ntracks_eventwiseconstituentsubtracted", "jet N tracks;N_{jet tracks};entries", {HistType::kTH1F, {{200, -0.5, 199.5}}}); + registry.add("h3_jet_r_jet_pt_jet_eta_eventwiseconstituentsubtracted", "#it{R}_{jet};#it{p}_{T,jet} (GeV/#it{c});#eta_{jet}", {HistType::kTH3F, {{jetRadiiBins, ""}, {200, 0., 200.}, {100, -1.0, 1.0}}}); + registry.add("h3_jet_r_jet_pt_jet_phi_eventwiseconstituentsubtracted", "#it{R}_{jet};#it{p}_{T,jet} (GeV/#it{c});#varphi_{jet}", {HistType::kTH3F, {{jetRadiiBins, ""}, {200, 0., 200.}, {160, -1.0, 7.}}}); + registry.add("h3_jet_r_jet_eta_jet_phi_eventwiseconstituentsubtracted", "#it{R}_{jet};#eta_{jet};#varphi_{jet}", {HistType::kTH3F, {{jetRadiiBins, ""}, {100, -1.0, 1.0}, {160, -1.0, 7.}}}); + registry.add("h3_jet_r_jet_pt_jet_ntracks_eventwiseconstituentsubtracted", "#it{R}_{jet};#it{p}_{T,jet} (GeV/#it{c});N_{jet tracks}", {HistType::kTH3F, {{jetRadiiBins, ""}, {200, 0., 200.}, {100, -0.5, 99.5}}}); + registry.add("h3_jet_r_jet_pt_jet_area_eventwiseconstituentsubtracted", "#it{R}_{jet}; #it{p}_{T,jet} (GeV/#it{c}); #it{Area}_{jet}", {HistType::kTH3F, {{jetRadiiBins, ""}, {200, 0., 200.}, {300, 0., 3.}}}); + registry.add("h3_jet_r_jet_pt_track_pt_eventwiseconstituentsubtracted", "#it{R}_{jet};#it{p}_{T,jet} (GeV/#it{c});#it{p}_{T,jet tracks} (GeV/#it{c})", {HistType::kTH3F, {{jetRadiiBins, ""}, {200, 0., 200.}, {200, 0., 200.}}}); + registry.add("h3_jet_r_jet_pt_track_eta_eventwiseconstituentsubtracted", "#it{R}_{jet};#it{p}_{T,jet} (GeV/#it{c});#eta_{jet tracks}", {HistType::kTH3F, {{jetRadiiBins, ""}, {200, 0., 200.}, {100, -1.0, 1.0}}}); + registry.add("h3_jet_r_jet_pt_track_phi_eventwiseconstituentsubtracted", "#it{R}_{jet};#it{p}_{T,jet} (GeV/#it{c});#varphi_{jet tracks}", {HistType::kTH3F, {{jetRadiiBins, ""}, {200, 0., 200.}, {160, -1.0, 7.}}}); + } + + if (doprocessRho) { + registry.add("h2_rho_centrality", "#it{rho} (GeV/area); centrality", {HistType::kTH2F, {{400, 0., 400.0}, {1100, 0., 110.}}}); + registry.add("h2_rhom_centrality", "#it{rho}_{m} (GeV/area); centrality", {HistType::kTH2F, {{400, 0., 400.0}, {1100, 0., 110.}}}); + } + if (doprocessJetsMCP || doprocessJetsMCPWeighted) { registry.add("h_jet_pt_part", "jet pT;#it{p}_{T,jet}^{part}(GeV/#it{c});entries", {HistType::kTH1F, {{200, 0., 200.}}}); registry.add("h_jet_eta_part", "jet #eta;#eta_{jet}^{part};entries", {HistType::kTH1F, {{100, -1.0, 1.0}}}); @@ -112,17 +157,39 @@ struct JetFinderQATask { registry.add("h_jet_ptcut_part", "p_{T} cut;p_{T,jet}^{part} (GeV/#it{c});N;entries", {HistType::kTH2F, {{200, 0, 200}, {20, 0, 5}}}); } - if (doprocessJetsMCPMCDMatched || doprocessJetsMCPMCDMatchedWeighted) { - registry.add("h3_jet_r_jet_pt_part_jet_pt", "#it{R}_{jet};#it{p}_{T,jet}^{part} (GeV/#it{c});#it{p}_{T,jet} (GeV/#it{c})", {HistType::kTH3F, {{jetRadiiBins, ""}, {200, 0., 200.}, {200, 0., 200.}}}); - registry.add("h3_jet_r_jet_eta_part_jet_eta", "#it{R}_{jet};#eta_{jet}^{part};#eta_{jet}", {HistType::kTH3F, {{jetRadiiBins, ""}, {200, 0., 200.}, {100, -1.0, 1.0}}}); - registry.add("h3_jet_r_jet_phi_part_jet_phi", "#it{R}_{jet};#varphi_{jet}^{part};#varphi_{jet}", {HistType::kTH3F, {{jetRadiiBins, ""}, {200, 0., 200.}, {160, -1.0, 7.}}}); - registry.add("h3_jet_r_jet_ntracks_part_jet_ntracks", "#it{R}_{jet};N_{jet tracks}^{part};N_{jet tracks}", {HistType::kTH3F, {{jetRadiiBins, ""}, {100, -0.5, 99.5}, {100, -0.5, 99.5}}}); - registry.add("h3_jet_r_jet_pt_part_jet_pt_diff", "#it{R}_{jet};#it{p}_{T,jet}^{part} (GeV/#it{c}); (#it{p}_{T,jet}^{part} (GeV/#it{c}) - #it{p}_{T,jet} (GeV/#it{c})) / #it{p}_{T,jet}^{part} (GeV/#it{c})", {HistType::kTH3F, {{jetRadiiBins, ""}, {200, 0.0, 200}, {1000, -5.0, 5.0}}}); - registry.add("h3_jet_r_jet_pt_part_jet_eta_diff", "#it{R}_{jet};#it{p}_{T,jet}^{part} (GeV/#it{c}); (#eta_{jet}^{part} - #eta_{jet}) / #eta_{jet}^{part}", {HistType::kTH3F, {{jetRadiiBins, ""}, {200, 0.0, 200}, {1000, -5.0, 5.0}}}); - registry.add("h3_jet_r_jet_pt_part_jet_phi_diff", "#it{R}_{jet};#it{p}_{T,jet}^{part} (GeV/#it{c}); (#varphi_{jet}^{part} - #varphi_{jet}) / #varphi_{jet}^{part}", {HistType::kTH3F, {{jetRadiiBins, ""}, {200, 0.0, 200}, {1000, -5.0, 5.0}}}); - registry.add("h3_jet_pt_part_jet_eta_part_jet_eta", ";#it{p}_{T,jet}^{part} (GeV/#it{c}); #eta_{jet}^{part}; #eta_{jet}", {HistType::kTH3F, {{200, 0.0, 200}, {100, -1.0, 1.0}, {100, -1.0, 1.0}}}); - registry.add("h3_jet_pt_part_jet_phi_part_jet_phi", ";#it{p}_{T,jet}^{part} (GeV/#it{c}); #varphi_{jet}^{part}; #varphi_{jet}", {HistType::kTH3F, {{200, 0.0, 200}, {160, -1.0, 7.}, {160, -1.0, 7.}}}); - registry.add("h3_jet_pt_part_jet_ntracks_part_jet_ntracks", ";#it{p}_{T,jet}^{part} (GeV/#it{c}); N_{jet tracks}^{part}; N_{jet tracks}", {HistType::kTH3F, {{200, 0.0, 200}, {100, -0.5, 99.5}, {100, -0.5, 99.5}}}); + if (doprocessJetsMCPMCDMatched || doprocessJetsMCPMCDMatchedWeighted || doprocessJetsSubMatched) { + registry.add("h3_jet_r_jet_pt_tag_jet_pt_base_matchedgeo", "#it{R}_{jet};#it{p}_{T,jet}^{tag} (GeV/#it{c});#it{p}_{T,jet}^{base} (GeV/#it{c})", {HistType::kTH3F, {{jetRadiiBins, ""}, {200, 0., 200.}, {200, 0., 200.}}}); + registry.add("h3_jet_r_jet_eta_tag_jet_eta_base_matchedgeo", "#it{R}_{jet};#eta_{jet}^{tag};#eta_{jet}^{base}", {HistType::kTH3F, {{jetRadiiBins, ""}, {200, 0., 200.}, {100, -1.0, 1.0}}}); + registry.add("h3_jet_r_jet_phi_tag_jet_phi_base_matchedgeo", "#it{R}_{jet};#varphi_{jet}^{tag};#varphi_{jet}^{base}", {HistType::kTH3F, {{jetRadiiBins, ""}, {200, 0., 200.}, {160, -1.0, 7.}}}); + registry.add("h3_jet_r_jet_ntracks_tag_jet_ntracks_base_matchedgeo", "#it{R}_{jet};N_{jet tracks}^{tag};N_{jet tracks}^{base}", {HistType::kTH3F, {{jetRadiiBins, ""}, {100, -0.5, 99.5}, {100, -0.5, 99.5}}}); + registry.add("h3_jet_r_jet_pt_tag_jet_pt_base_diff_matchedgeo", "#it{R}_{jet};#it{p}_{T,jet}^{tag} (GeV/#it{c}); (#it{p}_{T,jet}^{tag} (GeV/#it{c}) - #it{p}_{T,jet}^{base} (GeV/#it{c})) / #it{p}_{T,jet}^{tag} (GeV/#it{c})", {HistType::kTH3F, {{jetRadiiBins, ""}, {200, 0.0, 200}, {1000, -5.0, 5.0}}}); + registry.add("h3_jet_r_jet_pt_tag_jet_eta_base_diff_matchedgeo", "#it{R}_{jet};#it{p}_{T,jet}^{tag} (GeV/#it{c}); (#eta_{jet}^{tag} - #eta_{jet}^{base}) / #eta_{jet}^{tag}", {HistType::kTH3F, {{jetRadiiBins, ""}, {200, 0.0, 200}, {1000, -5.0, 5.0}}}); + registry.add("h3_jet_r_jet_pt_tag_jet_phi_base_diff_matchedgeo", "#it{R}_{jet};#it{p}_{T,jet}^{tag} (GeV/#it{c}); (#varphi_{jet}^{tag} - #varphi_{jet}^{base}) / #varphi_{jet}^{tag}", {HistType::kTH3F, {{jetRadiiBins, ""}, {200, 0.0, 200}, {1000, -5.0, 5.0}}}); + registry.add("h3_jet_pt_tag_jet_eta_tag_jet_eta_base_matchedgeo", ";#it{p}_{T,jet}^{tag} (GeV/#it{c}); #eta_{jet}^{tag}; #eta_{jet}^{base}", {HistType::kTH3F, {{200, 0.0, 200}, {100, -1.0, 1.0}, {100, -1.0, 1.0}}}); + registry.add("h3_jet_pt_tag_jet_phi_tag_jet_phi_base_matchedgeo", ";#it{p}_{T,jet}^{tag} (GeV/#it{c}); #varphi_{jet}^{tag}; #varphi_{jet}^{base}", {HistType::kTH3F, {{200, 0.0, 200}, {160, -1.0, 7.}, {160, -1.0, 7.}}}); + registry.add("h3_jet_pt_tag_jet_ntracks_tag_jet_ntracks_base_matchedgeo", ";#it{p}_{T,jet}^{tag} (GeV/#it{c}); N_{jet tracks}^{tag}; N_{jet tracks}^{base}", {HistType::kTH3F, {{200, 0.0, 200}, {100, -0.5, 99.5}, {100, -0.5, 99.5}}}); + + registry.add("h3_jet_r_jet_pt_tag_jet_pt_base_matchedpt", "#it{R}_{jet};#it{p}_{T,jet}^{tag} (GeV/#it{c});#it{p}_{T,jet}^{base} (GeV/#it{c})", {HistType::kTH3F, {{jetRadiiBins, ""}, {200, 0., 200.}, {200, 0., 200.}}}); + registry.add("h3_jet_r_jet_eta_tag_jet_eta_base_matchedpt", "#it{R}_{jet};#eta_{jet}^{tag};#eta_{jet}^{base}", {HistType::kTH3F, {{jetRadiiBins, ""}, {200, 0., 200.}, {100, -1.0, 1.0}}}); + registry.add("h3_jet_r_jet_phi_tag_jet_phi_base_matchedpt", "#it{R}_{jet};#varphi_{jet}^{tag};#varphi_{jet}^{base}", {HistType::kTH3F, {{jetRadiiBins, ""}, {200, 0., 200.}, {160, -1.0, 7.}}}); + registry.add("h3_jet_r_jet_ntracks_tag_jet_ntracks_base_matchedpt", "#it{R}_{jet};N_{jet tracks}^{tag};N_{jet tracks}^{base}", {HistType::kTH3F, {{jetRadiiBins, ""}, {100, -0.5, 99.5}, {100, -0.5, 99.5}}}); + registry.add("h3_jet_r_jet_pt_tag_jet_pt_base_diff_matchedpt", "#it{R}_{jet};#it{p}_{T,jet}^{tag} (GeV/#it{c}); (#it{p}_{T,jet}^{tag} (GeV/#it{c}) - #it{p}_{T,jet}^{base} (GeV/#it{c})) / #it{p}_{T,jet}^{tag} (GeV/#it{c})", {HistType::kTH3F, {{jetRadiiBins, ""}, {200, 0.0, 200}, {1000, -5.0, 5.0}}}); + registry.add("h3_jet_r_jet_pt_tag_jet_eta_base_diff_matchedpt", "#it{R}_{jet};#it{p}_{T,jet}^{tag} (GeV/#it{c}); (#eta_{jet}^{tag} - #eta_{jet}^{base}) / #eta_{jet}^{tag}", {HistType::kTH3F, {{jetRadiiBins, ""}, {200, 0.0, 200}, {1000, -5.0, 5.0}}}); + registry.add("h3_jet_r_jet_pt_tag_jet_phi_base_diff_matchedpt", "#it{R}_{jet};#it{p}_{T,jet}^{tag} (GeV/#it{c}); (#varphi_{jet}^{tag} - #varphi_{jet}^{base}) / #varphi_{jet}^{tag}", {HistType::kTH3F, {{jetRadiiBins, ""}, {200, 0.0, 200}, {1000, -5.0, 5.0}}}); + registry.add("h3_jet_pt_tag_jet_eta_tag_jet_eta_base_matchedpt", ";#it{p}_{T,jet}^{tag} (GeV/#it{c}); #eta_{jet}^{tag}; #eta_{jet}^{base}", {HistType::kTH3F, {{200, 0.0, 200}, {100, -1.0, 1.0}, {100, -1.0, 1.0}}}); + registry.add("h3_jet_pt_tag_jet_phi_tag_jet_phi_base_matchedpt", ";#it{p}_{T,jet}^{tag} (GeV/#it{c}); #varphi_{jet}^{tag}; #varphi_{jet}^{base}", {HistType::kTH3F, {{200, 0.0, 200}, {160, -1.0, 7.}, {160, -1.0, 7.}}}); + registry.add("h3_jet_pt_tag_jet_ntracks_tag_jet_ntracks_base_matchedpt", ";#it{p}_{T,jet}^{tag} (GeV/#it{c}); N_{jet tracks}^{tag}; N_{jet tracks}^{base}", {HistType::kTH3F, {{200, 0.0, 200}, {100, -0.5, 99.5}, {100, -0.5, 99.5}}}); + + registry.add("h3_jet_r_jet_pt_tag_jet_pt_base_matchedgeopt", "#it{R}_{jet};#it{p}_{T,jet}^{tag} (GeV/#it{c});#it{p}_{T,jet}^{base} (GeV/#it{c})", {HistType::kTH3F, {{jetRadiiBins, ""}, {200, 0., 200.}, {200, 0., 200.}}}); + registry.add("h3_jet_r_jet_eta_tag_jet_eta_base_matchedgeopt", "#it{R}_{jet};#eta_{jet}^{tag};#eta_{jet}^{base}", {HistType::kTH3F, {{jetRadiiBins, ""}, {200, 0., 200.}, {100, -1.0, 1.0}}}); + registry.add("h3_jet_r_jet_phi_tag_jet_phi_base_matchedgeopt", "#it{R}_{jet};#varphi_{jet}^{tag};#varphi_{jet}^{base}", {HistType::kTH3F, {{jetRadiiBins, ""}, {200, 0., 200.}, {160, -1.0, 7.}}}); + registry.add("h3_jet_r_jet_ntracks_tag_jet_ntracks_base_matchedgeopt", "#it{R}_{jet};N_{jet tracks}^{tag};N_{jet tracks}^{base}", {HistType::kTH3F, {{jetRadiiBins, ""}, {100, -0.5, 99.5}, {100, -0.5, 99.5}}}); + registry.add("h3_jet_r_jet_pt_tag_jet_pt_base_diff_matchedgeopt", "#it{R}_{jet};#it{p}_{T,jet}^{tag} (GeV/#it{c}); (#it{p}_{T,jet}^{tag} (GeV/#it{c}) - #it{p}_{T,jet}^{base} (GeV/#it{c})) / #it{p}_{T,jet}^{tag} (GeV/#it{c})", {HistType::kTH3F, {{jetRadiiBins, ""}, {200, 0.0, 200}, {1000, -5.0, 5.0}}}); + registry.add("h3_jet_r_jet_pt_tag_jet_eta_base_diff_matchedgeopt", "#it{R}_{jet};#it{p}_{T,jet}^{tag} (GeV/#it{c}); (#eta_{jet}^{tag} - #eta_{jet}^{base}) / #eta_{jet}^{tag}", {HistType::kTH3F, {{jetRadiiBins, ""}, {200, 0.0, 200}, {1000, -5.0, 5.0}}}); + registry.add("h3_jet_r_jet_pt_tag_jet_phi_base_diff_matchedgeopt", "#it{R}_{jet};#it{p}_{T,jet}^{tag} (GeV/#it{c}); (#varphi_{jet}^{tag} - #varphi_{jet}^{base}) / #varphi_{jet}^{tag}", {HistType::kTH3F, {{jetRadiiBins, ""}, {200, 0.0, 200}, {1000, -5.0, 5.0}}}); + registry.add("h3_jet_pt_tag_jet_eta_tag_jet_eta_base_matchedgeopt", ";#it{p}_{T,jet}^{tag} (GeV/#it{c}); #eta_{jet}^{tag}; #eta_{jet}^{base}", {HistType::kTH3F, {{200, 0.0, 200}, {100, -1.0, 1.0}, {100, -1.0, 1.0}}}); + registry.add("h3_jet_pt_tag_jet_phi_tag_jet_phi_base_matchedgeopt", ";#it{p}_{T,jet}^{tag} (GeV/#it{c}); #varphi_{jet}^{tag}; #varphi_{jet}^{base}", {HistType::kTH3F, {{200, 0.0, 200}, {160, -1.0, 7.}, {160, -1.0, 7.}}}); + registry.add("h3_jet_pt_tag_jet_ntracks_tag_jet_ntracks_base_matchedgeopt", ";#it{p}_{T,jet}^{tag} (GeV/#it{c}); N_{jet tracks}^{tag}; N_{jet tracks}^{base}", {HistType::kTH3F, {{200, 0.0, 200}, {100, -0.5, 99.5}, {100, -0.5, 99.5}}}); } if (doprocessTriggeredData) { @@ -168,6 +235,12 @@ struct JetFinderQATask { registry.add("h_collisions_weighted", "event status;event status;entries", {HistType::kTH1F, {{4, 0.0, 4.0}}}); } } + if (doprocessTracksSub) { + + registry.add("h_track_pt_eventwiseconstituentsubtracted", "track pT;#it{p}_{T,track} (GeV/#it{c});entries", {HistType::kTH1F, {{200, 0., 200.}}}); + registry.add("h_track_eta_eventwiseconstituentsubtracted", "track #eta;#eta_{track};entries", {HistType::kTH1F, {{100, -1.0, 1.0}}}); + registry.add("h_track_phi_eventwiseconstituentsubtracted", "track #varphi;#varphi_{track};entries", {HistType::kTH1F, {{160, -1.0, 7.}}}); + } if (doprocessMCCollisionsWeighted) { AxisSpec weightAxis = {{VARIABLE_WIDTH, 1e-13, 1e-12, 1e-11, 1e-10, 1e-9, 1e-8, 1e-7, 1e-6, 1e-5, 1e-4, 1e-3, 1e-2, 1e-1, 1.0, 10.0}, "weights"}; @@ -175,10 +248,9 @@ struct JetFinderQATask { } } - using JetTracks = aod::JTracks; - using JetParticles = aod::JMcParticles; - Filter trackCuts = (aod::jtrack::pt >= trackPtMin && aod::jtrack::pt < trackPtMax && aod::jtrack::eta > trackEtaMin && aod::jtrack::eta < trackEtaMax); + Filter trackSubCuts = (aod::jtracksub::pt >= trackPtMin && aod::jtracksub::pt < trackPtMax && aod::jtracksub::eta > trackEtaMin && aod::jtracksub::eta < trackEtaMax); + Filter eventCuts = (nabs(aod::jcollision::posZ) < vertexZCut && aod::jcollision::centrality >= centralityMin && aod::jcollision::centrality < centralityMax); template void fillHistograms(T const& jet, float weight = 1.0) @@ -210,6 +282,55 @@ struct JetFinderQATask { } } + template + void fillRhoAreaSubtractedHistograms(T const& jet, float rho, float weight = 1.0) + { + if (jet.r() == round(selectedJetsRadius * 100.0f)) { + registry.fill(HIST("h_jet_pt_rhoareasubtracted"), jet.pt() - (rho * jet.area()), weight); + registry.fill(HIST("h_jet_eta_rhoareasubtracted"), jet.eta(), weight); + registry.fill(HIST("h_jet_phi_rhoareasubtracted"), jet.phi(), weight); + registry.fill(HIST("h_jet_ntracks_rhoareasubtracted"), jet.tracks().size(), weight); + } + + registry.fill(HIST("h3_jet_r_jet_pt_jet_eta_rhoareasubtracted"), jet.r() / 100.0, jet.pt() - (rho * jet.area()), jet.eta(), weight); + registry.fill(HIST("h3_jet_r_jet_pt_jet_phi_rhoareasubtracted"), jet.r() / 100.0, jet.pt() - (rho * jet.area()), jet.phi(), weight); + registry.fill(HIST("h3_jet_r_jet_eta_jet_phi_rhoareasubtracted"), jet.r() / 100.0, jet.eta(), jet.phi(), weight); + registry.fill(HIST("h3_jet_r_jet_pt_jet_ntracks_rhoareasubtracted"), jet.r() / 100.0, jet.pt() - (rho * jet.area()), jet.tracks().size(), weight); + registry.fill(HIST("h3_jet_r_jet_pt_jet_area_rhoareasubtracted"), jet.r() / 100.0, jet.pt() - (rho * jet.area()), jet.area(), weight); + registry.fill(HIST("h3_jet_r_jet_pt_jet_pt_rhoareasubtracted"), jet.r() / 100.0, jet.pt(), jet.pt() - (rho * jet.area()), weight); + + for (auto& constituent : jet.template tracks_as()) { + + registry.fill(HIST("h3_jet_r_jet_pt_track_pt_rhoareasubtracted"), jet.r() / 100.0, jet.pt() - (rho * jet.area()), constituent.pt(), weight); + registry.fill(HIST("h3_jet_r_jet_pt_track_eta_rhoareasubtracted"), jet.r() / 100.0, jet.pt() - (rho * jet.area()), constituent.eta(), weight); + registry.fill(HIST("h3_jet_r_jet_pt_track_phi_rhoareasubtracted"), jet.r() / 100.0, jet.pt() - (rho * jet.area()), constituent.phi(), weight); + } + } + + template + void fillEventWiseConstituentSubtractedHistograms(T const& jet, float weight = 1.0) + { + if (jet.r() == round(selectedJetsRadius * 100.0f)) { + registry.fill(HIST("h_jet_pt_eventwiseconstituentsubtracted"), jet.pt(), weight); + registry.fill(HIST("h_jet_eta_eventwiseconstituentsubtracted"), jet.eta(), weight); + registry.fill(HIST("h_jet_phi_eventwiseconstituentsubtracted"), jet.phi(), weight); + registry.fill(HIST("h_jet_ntracks_eventwiseconstituentsubtracted"), jet.tracks().size(), weight); + } + + registry.fill(HIST("h3_jet_r_jet_pt_jet_eta_eventwiseconstituentsubtracted"), jet.r() / 100.0, jet.pt(), jet.eta(), weight); + registry.fill(HIST("h3_jet_r_jet_pt_jet_phi_eventwiseconstituentsubtracted"), jet.r() / 100.0, jet.pt(), jet.phi(), weight); + registry.fill(HIST("h3_jet_r_jet_eta_jet_phi_eventwiseconstituentsubtracted"), jet.r() / 100.0, jet.eta(), jet.phi(), weight); + registry.fill(HIST("h3_jet_r_jet_pt_jet_ntracks_eventwiseconstituentsubtracted"), jet.r() / 100.0, jet.pt(), jet.tracks().size(), weight); + registry.fill(HIST("h3_jet_r_jet_pt_jet_area_eventwiseconstituentsubtracted"), jet.r() / 100.0, jet.pt(), jet.area(), weight); + + for (auto& constituent : jet.template tracks_as()) { + + registry.fill(HIST("h3_jet_r_jet_pt_track_pt_eventwiseconstituentsubtracted"), jet.r() / 100.0, jet.pt(), constituent.pt(), weight); + registry.fill(HIST("h3_jet_r_jet_pt_track_eta_eventwiseconstituentsubtracted"), jet.r() / 100.0, jet.pt(), constituent.eta(), weight); + registry.fill(HIST("h3_jet_r_jet_pt_track_phi_eventwiseconstituentsubtracted"), jet.r() / 100.0, jet.pt(), constituent.phi(), weight); + } + } + template void fillMCPHistograms(T const& jet, float weight = 1.0) { @@ -240,39 +361,85 @@ struct JetFinderQATask { } template - void fillMCMatchedHistograms(T const& mcdjet, float weight = 1.0) + void fillMatchedHistograms(T const& jetBase, float weight = 1.0) { float pTHat = 10. / (std::pow(weight, 1.0 / pTHatExponent)); - if (mcdjet.pt() > pTHatMaxMCD * pTHat) { + if (jetBase.pt() > pTHatMaxMCD * pTHat) { return; } - for (auto& mcpjet : mcdjet.template matchedJetGeo_as>()) { - - if (mcpjet.pt() > pTHatMaxMCP * pTHat) { - continue; + if (jetBase.has_matchedJetGeo()) { + for (auto& jetTag : jetBase.template matchedJetGeo_as>()) { + if (jetTag.pt() > pTHatMaxMCP * pTHat) { + continue; + } + registry.fill(HIST("h3_jet_r_jet_pt_tag_jet_pt_base_matchedgeo"), jetBase.r() / 100.0, jetTag.pt(), jetBase.pt(), weight); + registry.fill(HIST("h3_jet_r_jet_eta_tag_jet_eta_base_matchedgeo"), jetBase.r() / 100.0, jetTag.eta(), jetBase.eta(), weight); + registry.fill(HIST("h3_jet_r_jet_phi_tag_jet_phi_base_matchedgeo"), jetBase.r() / 100.0, jetTag.phi(), jetBase.phi(), weight); + registry.fill(HIST("h3_jet_r_jet_ntracks_tag_jet_ntracks_base_matchedgeo"), jetBase.r() / 100.0, jetTag.tracks().size(), jetBase.tracks().size(), weight); + registry.fill(HIST("h3_jet_r_jet_pt_tag_jet_pt_base_diff_matchedgeo"), jetBase.r() / 100.0, jetTag.pt(), (jetTag.pt() - jetBase.pt()) / jetTag.pt(), weight); + registry.fill(HIST("h3_jet_r_jet_pt_tag_jet_eta_base_diff_matchedgeo"), jetBase.r() / 100.0, jetTag.pt(), (jetTag.eta() - jetBase.eta()) / jetTag.eta(), weight); + registry.fill(HIST("h3_jet_r_jet_pt_tag_jet_phi_base_diff_matchedgeo"), jetBase.r() / 100.0, jetTag.pt(), (jetTag.phi() - jetBase.phi()) / jetTag.phi(), weight); + + if (jetBase.r() == round(selectedJetsRadius * 100.0f)) { + registry.fill(HIST("h3_jet_pt_tag_jet_eta_tag_jet_eta_base_matchedgeo"), jetTag.pt(), jetTag.eta(), jetBase.eta(), weight); + registry.fill(HIST("h3_jet_pt_tag_jet_phi_tag_jet_phi_base_matchedgeo"), jetTag.pt(), jetTag.phi(), jetBase.phi(), weight); + registry.fill(HIST("h3_jet_pt_tag_jet_ntracks_tag_jet_ntracks_base_matchedgeo"), jetTag.pt(), jetTag.tracks().size(), jetBase.tracks().size(), weight); + } + } + } + if (jetBase.has_matchedJetPt()) { + for (auto& jetTag : jetBase.template matchedJetPt_as>()) { + if (jetTag.pt() > pTHatMaxMCP * pTHat) { + continue; + } + registry.fill(HIST("h3_jet_r_jet_pt_tag_jet_pt_base_matchedpt"), jetBase.r() / 100.0, jetTag.pt(), jetBase.pt(), weight); + registry.fill(HIST("h3_jet_r_jet_eta_tag_jet_eta_base_matchedpt"), jetBase.r() / 100.0, jetTag.eta(), jetBase.eta(), weight); + registry.fill(HIST("h3_jet_r_jet_phi_tag_jet_phi_base_matchedpt"), jetBase.r() / 100.0, jetTag.phi(), jetBase.phi(), weight); + registry.fill(HIST("h3_jet_r_jet_ntracks_tag_jet_ntracks_base_matchedpt"), jetBase.r() / 100.0, jetTag.tracks().size(), jetBase.tracks().size(), weight); + registry.fill(HIST("h3_jet_r_jet_pt_tag_jet_pt_base_diff_matchedpt"), jetBase.r() / 100.0, jetTag.pt(), (jetTag.pt() - jetBase.pt()) / jetTag.pt(), weight); + registry.fill(HIST("h3_jet_r_jet_pt_tag_jet_eta_base_diff_matchedpt"), jetBase.r() / 100.0, jetTag.pt(), (jetTag.eta() - jetBase.eta()) / jetTag.eta(), weight); + registry.fill(HIST("h3_jet_r_jet_pt_tag_jet_phi_base_diff_matchedpt"), jetBase.r() / 100.0, jetTag.pt(), (jetTag.phi() - jetBase.phi()) / jetTag.phi(), weight); + + if (jetBase.r() == round(selectedJetsRadius * 100.0f)) { + registry.fill(HIST("h3_jet_pt_tag_jet_eta_tag_jet_eta_base_matchedpt"), jetTag.pt(), jetTag.eta(), jetBase.eta(), weight); + registry.fill(HIST("h3_jet_pt_tag_jet_phi_tag_jet_phi_base_matchedpt"), jetTag.pt(), jetTag.phi(), jetBase.phi(), weight); + registry.fill(HIST("h3_jet_pt_tag_jet_ntracks_tag_jet_ntracks_base_matchedpt"), jetTag.pt(), jetTag.tracks().size(), jetBase.tracks().size(), weight); + } } + } + + if (jetBase.has_matchedJetGeo() && jetBase.has_matchedJetPt()) { + + for (auto& jetTag : jetBase.template matchedJetGeo_as>()) { + if (jetTag.pt() > pTHatMaxMCP * pTHat) { + continue; + } - registry.fill(HIST("h3_jet_r_jet_pt_part_jet_pt"), mcdjet.r() / 100.0, mcpjet.pt(), mcdjet.pt(), weight); - registry.fill(HIST("h3_jet_r_jet_eta_part_jet_eta"), mcdjet.r() / 100.0, mcpjet.eta(), mcdjet.eta(), weight); - registry.fill(HIST("h3_jet_r_jet_phi_part_jet_phi"), mcdjet.r() / 100.0, mcpjet.phi(), mcdjet.phi(), weight); - registry.fill(HIST("h3_jet_r_jet_ntracks_part_jet_ntracks"), mcdjet.r() / 100.0, mcpjet.tracks().size(), mcdjet.tracks().size(), weight); - registry.fill(HIST("h3_jet_r_jet_pt_part_jet_pt_diff"), mcdjet.r() / 100.0, mcpjet.pt(), (mcpjet.pt() - mcdjet.pt()) / mcpjet.pt(), weight); - registry.fill(HIST("h3_jet_r_jet_pt_part_jet_eta_diff"), mcdjet.r() / 100.0, mcpjet.pt(), (mcpjet.eta() - mcdjet.eta()) / mcpjet.eta(), weight); - registry.fill(HIST("h3_jet_r_jet_pt_part_jet_phi_diff"), mcdjet.r() / 100.0, mcpjet.pt(), (mcpjet.phi() - mcdjet.phi()) / mcpjet.phi(), weight); - - if (mcdjet.r() == round(selectedJetsRadius * 100.0f)) { - registry.fill(HIST("h3_jet_pt_part_jet_eta_part_jet_eta"), mcpjet.pt(), mcpjet.eta(), mcdjet.eta(), weight); - registry.fill(HIST("h3_jet_pt_part_jet_phi_part_jet_phi"), mcpjet.pt(), mcpjet.phi(), mcdjet.phi(), weight); - registry.fill(HIST("h3_jet_pt_part_jet_ntracks_part_jet_ntracks"), mcpjet.pt(), mcpjet.tracks().size(), mcdjet.tracks().size(), weight); + if (jetBase.template matchedJetGeo_first_as>().globalIndex() == jetBase.template matchedJetPt_first_as>().globalIndex()) { // not a good way to do this + registry.fill(HIST("h3_jet_r_jet_pt_tag_jet_pt_base_matchedgeopt"), jetBase.r() / 100.0, jetTag.pt(), jetBase.pt(), weight); + registry.fill(HIST("h3_jet_r_jet_eta_tag_jet_eta_base_matchedgeopt"), jetBase.r() / 100.0, jetTag.eta(), jetBase.eta(), weight); + registry.fill(HIST("h3_jet_r_jet_phi_tag_jet_phi_base_matchedgeopt"), jetBase.r() / 100.0, jetTag.phi(), jetBase.phi(), weight); + registry.fill(HIST("h3_jet_r_jet_ntracks_tag_jet_ntracks_base_matchedgeopt"), jetBase.r() / 100.0, jetTag.tracks().size(), jetBase.tracks().size(), weight); + registry.fill(HIST("h3_jet_r_jet_pt_tag_jet_pt_base_diff_matchedgeopt"), jetBase.r() / 100.0, jetTag.pt(), (jetTag.pt() - jetBase.pt()) / jetTag.pt(), weight); + registry.fill(HIST("h3_jet_r_jet_pt_tag_jet_eta_base_diff_matchedgeopt"), jetBase.r() / 100.0, jetTag.pt(), (jetTag.eta() - jetBase.eta()) / jetTag.eta(), weight); + registry.fill(HIST("h3_jet_r_jet_pt_tag_jet_phi_base_diff_matchedgeopt"), jetBase.r() / 100.0, jetTag.pt(), (jetTag.phi() - jetBase.phi()) / jetTag.phi(), weight); + + if (jetBase.r() == round(selectedJetsRadius * 100.0f)) { + registry.fill(HIST("h3_jet_pt_tag_jet_eta_tag_jet_eta_base_matchedgeopt"), jetTag.pt(), jetTag.eta(), jetBase.eta(), weight); + registry.fill(HIST("h3_jet_pt_tag_jet_phi_tag_jet_phi_base_matchedgeopt"), jetTag.pt(), jetTag.phi(), jetBase.phi(), weight); + registry.fill(HIST("h3_jet_pt_tag_jet_ntracks_tag_jet_ntracks_base_matchedgeopt"), jetTag.pt(), jetTag.tracks().size(), jetBase.tracks().size(), weight); + } + } } } } - void fillTrackHistograms(soa::Filtered const& tracks, float weight = 1.0) + template + void fillTrackHistograms(T const& tracks, float weight = 1.0) { for (auto const& track : tracks) { - if (!JetDerivedDataUtilities::selectTrack(track, trackSelection)) { + if (!jetderiveddatautilities::selectTrack(track, trackSelection)) { continue; } registry.fill(HIST("h_track_pt"), track.pt(), weight); @@ -281,39 +448,60 @@ struct JetFinderQATask { } } - void processJetsData(soa::Join::iterator const& jet, JetTracks const& tracks) + void processJetsData(soa::Filtered::iterator const& collision, soa::Join const& jets, JetTracks const& tracks) { - fillHistograms(jet); + for (auto const& jet : jets) { + if (!jetfindingutilities::isInEtaAcceptance(jet, jetEtaMin, jetEtaMax, trackEtaMin, trackEtaMax)) { + continue; + } + fillHistograms(jet); + } } PROCESS_SWITCH(JetFinderQATask, processJetsData, "jet finder QA data", false); - void processJetsMCD(soa::Join::iterator const& jet, JetTracks const& tracks) + void processJetsMCD(soa::Filtered::iterator const& collision, soa::Join const& jets, JetTracks const& tracks) { - fillHistograms(jet); + for (auto const& jet : jets) { + if (!jetfindingutilities::isInEtaAcceptance(jet, jetEtaMin, jetEtaMax, trackEtaMin, trackEtaMax)) { + continue; + } + fillHistograms(jet); + } } PROCESS_SWITCH(JetFinderQATask, processJetsMCD, "jet finder QA mcd", false); - void processJetsMCDWeighted(soa::Join::iterator const& jet, JetTracks const& tracks) + void processJetsMCDWeighted(soa::Filtered::iterator const& collision, soa::Join const& jets, JetTracks const& tracks) { - double pTHat = 10. / (std::pow(jet.eventWeight(), 1.0 / 6.0)); - for (int N = 1; N < 21; N++) { - if (jet.pt() < N * 0.25 * pTHat && jet.r() == round(selectedJetsRadius * 100.0f)) { - registry.fill(HIST("h_jet_ptcut"), jet.pt(), N * 0.25, jet.eventWeight()); + for (auto const& jet : jets) { + if (!jetfindingutilities::isInEtaAcceptance(jet, jetEtaMin, jetEtaMax, trackEtaMin, trackEtaMax)) { + continue; + } + double pTHat = 10. / (std::pow(jet.eventWeight(), 1.0 / 6.0)); + for (int N = 1; N < 21; N++) { + if (jet.pt() < N * 0.25 * pTHat && jet.r() == round(selectedJetsRadius * 100.0f)) { + registry.fill(HIST("h_jet_ptcut"), jet.pt(), N * 0.25, jet.eventWeight()); + } } + registry.fill(HIST("h_jet_phat"), pTHat); + fillHistograms(jet, jet.eventWeight()); } - registry.fill(HIST("h_jet_phat"), pTHat); - fillHistograms(jet, jet.eventWeight()); } PROCESS_SWITCH(JetFinderQATask, processJetsMCDWeighted, "jet finder QA mcd with weighted events", false); void processJetsMCP(soa::Join::iterator const& jet, JetParticles const& particles) { + if (!jetfindingutilities::isInEtaAcceptance(jet, jetEtaMin, jetEtaMax, trackEtaMin, trackEtaMax)) { + return; + } fillMCPHistograms(jet); } PROCESS_SWITCH(JetFinderQATask, processJetsMCP, "jet finder QA mcp", false); void processJetsMCPWeighted(soa::Join::iterator const& jet, JetParticles const& particles) { + if (!jetfindingutilities::isInEtaAcceptance(jet, jetEtaMin, jetEtaMax, trackEtaMin, trackEtaMax)) { + return; + } double pTHat = 10. / (std::pow(jet.eventWeight(), 1.0 / 6.0)); for (int N = 1; N < 21; N++) { if (jet.pt() < N * 0.25 * pTHat && jet.r() == round(selectedJetsRadius * 100.0f)) { @@ -325,69 +513,104 @@ struct JetFinderQATask { } PROCESS_SWITCH(JetFinderQATask, processJetsMCPWeighted, "jet finder QA mcp with weighted events", false); - void processJetsMCPMCDMatched(aod::JCollision const& collision, + void processJetsMCPMCDMatched(soa::Filtered::iterator const& collision, soa::Join const& mcdjets, soa::Join const& mcpjets, JetTracks const& tracks, JetParticles const& particles) { for (const auto& mcdjet : mcdjets) { - fillMCMatchedHistograms::iterator, soa::Join>(mcdjet); + if (!jetfindingutilities::isInEtaAcceptance(mcdjet, jetEtaMin, jetEtaMax, trackEtaMin, trackEtaMax)) { + continue; + } + fillMatchedHistograms::iterator, soa::Join>(mcdjet); } } PROCESS_SWITCH(JetFinderQATask, processJetsMCPMCDMatched, "jet finder QA matched mcp and mcd", false); - void processJetsMCPMCDMatchedWeighted(aod::JCollision const& collision, + void processJetsMCPMCDMatchedWeighted(soa::Filtered::iterator const& collision, soa::Join const& mcdjets, soa::Join const& mcpjets, JetTracks const& tracks, JetParticles const& particles) { for (const auto& mcdjet : mcdjets) { - fillMCMatchedHistograms::iterator, soa::Join>(mcdjet, mcdjet.eventWeight()); + if (!jetfindingutilities::isInEtaAcceptance(mcdjet, jetEtaMin, jetEtaMax, trackEtaMin, trackEtaMax)) { + continue; + } + fillMatchedHistograms::iterator, soa::Join>(mcdjet, mcdjet.eventWeight()); } } PROCESS_SWITCH(JetFinderQATask, processJetsMCPMCDMatchedWeighted, "jet finder QA matched mcp and mcd with weighted events", false); - void processMCCollisionsWeighted(aod::McCollision const& collision) + void processJetsSubMatched(soa::Filtered::iterator const& collision, + soa::Join const& jets, + soa::Join const& jetSubs, + JetTracks const& tracks, JetTracksSub const& tracksSub) + { + for (const auto& jet : jets) { + if (!jetfindingutilities::isInEtaAcceptance(jet, jetEtaMin, jetEtaMax, trackEtaMin, trackEtaMax)) { + continue; + } + fillMatchedHistograms::iterator, soa::Join>(jet); + } + } + PROCESS_SWITCH(JetFinderQATask, processJetsSubMatched, "jet finder QA matched unsubtracted and constituent subtracted jets", false); + + void processMCCollisionsWeighted(JetMcCollision const& collision) { registry.fill(HIST("h_collision_eventweight_part"), collision.weight()); } PROCESS_SWITCH(JetFinderQATask, processMCCollisionsWeighted, "collision QA for weighted events", false); - void processTriggeredData(soa::Join::iterator const& collision, + void processTriggeredData(soa::Join::iterator const& collision, soa::Join const& jets, - JetTracks const& tracks) + soa::Filtered const& tracks) { registry.fill(HIST("h_collision_trigger_events"), 0.5); // all events if (collision.posZ() > vertexZCut) { return; } registry.fill(HIST("h_collision_trigger_events"), 1.5); // all events with z vertex cut - if (!JetDerivedDataUtilities::selectCollision(collision, eventSelection)) { + if (!jetderiveddatautilities::selectCollision(collision, eventSelection)) { return; } registry.fill(HIST("h_collision_trigger_events"), 2.5); // events with sel8() - if (JetDerivedDataUtilities::selectChargedTrigger(collision, JetDerivedDataUtilities::JTrigSelCh::chargedLow)) { + if (jetderiveddatautilities::selectChargedTrigger(collision, jetderiveddatautilities::JTrigSelCh::chargedLow)) { registry.fill(HIST("h_collision_trigger_events"), 3.5); // events with high pT triggered jets } - if (JetDerivedDataUtilities::selectChargedTrigger(collision, JetDerivedDataUtilities::JTrigSelCh::chargedHigh)) { + if (jetderiveddatautilities::selectChargedTrigger(collision, jetderiveddatautilities::JTrigSelCh::chargedHigh)) { registry.fill(HIST("h_collision_trigger_events"), 4.5); // events with high pT triggered jets } - if (JetDerivedDataUtilities::selectChargedTrigger(collision, JetDerivedDataUtilities::JTrigSelCh::chargedLow) && JetDerivedDataUtilities::selectChargedTrigger(collision, JetDerivedDataUtilities::JTrigSelCh::chargedHigh)) { + if (jetderiveddatautilities::selectChargedTrigger(collision, jetderiveddatautilities::JTrigSelCh::chargedLow) && jetderiveddatautilities::selectChargedTrigger(collision, jetderiveddatautilities::JTrigSelCh::chargedHigh)) { registry.fill(HIST("h_collision_trigger_events"), 5.5); // events with high pT triggered jets } for (std::size_t iJetRadius = 0; iJetRadius < jetRadiiValues.size(); iJetRadius++) { - filledJetR[iJetRadius] = false; + filledJetR_Both[iJetRadius] = false; + filledJetR_Low[iJetRadius] = false; + filledJetR_High[iJetRadius] = false; } for (auto& jet : jets) { for (std::size_t iJetRadius = 0; iJetRadius < jetRadiiValues.size(); iJetRadius++) { - if (jet.r() == round(jetRadiiValues[iJetRadius] * 100.0f) && !filledJetR[iJetRadius]) { - filledJetR[iJetRadius] = true; - for (double pt = 0.0; pt <= jet.pt(); pt += 1.0) { - registry.fill(HIST("h2_jet_r_jet_pT_triggered"), jet.r() / 100.0, pt); + if (jet.r() == round(jetRadiiValues[iJetRadius] * 100.0f)) { + if (jetderiveddatautilities::selectChargedTrigger(collision, jetderiveddatautilities::JTrigSelCh::chargedLow) && !filledJetR_Low[iJetRadius]) { + filledJetR_Low[iJetRadius] = true; + for (double pt = 0.0; pt <= jet.pt(); pt += 1.0) { + registry.fill(HIST("h2_jet_r_jet_pT_triggered_Low"), jet.r() / 100.0, pt); + } + } + if (jetderiveddatautilities::selectChargedTrigger(collision, jetderiveddatautilities::JTrigSelCh::chargedHigh) && !filledJetR_High[iJetRadius]) { + filledJetR_High[iJetRadius] = true; + for (double pt = 0.0; pt <= jet.pt(); pt += 1.0) { + registry.fill(HIST("h2_jet_r_jet_pT_triggered_High"), jet.r() / 100.0, pt); + } + } + if (jetderiveddatautilities::selectChargedTrigger(collision, jetderiveddatautilities::JTrigSelCh::chargedLow) && jetderiveddatautilities::selectChargedTrigger(collision, jetderiveddatautilities::JTrigSelCh::chargedHigh) && !filledJetR_Both[iJetRadius]) { + filledJetR_Both[iJetRadius] = true; + for (double pt = 0.0; pt <= jet.pt(); pt += 1.0) { + registry.fill(HIST("h2_jet_r_jet_pT_triggered_Both"), jet.r() / 100.0, pt); + } } - break; } } @@ -399,17 +622,17 @@ struct JetFinderQATask { registry.fill(HIST("h3_jet_r_jet_eta_collision"), jet.r() / 100.0, jet.eta(), 0.0); registry.fill(HIST("h3_jet_r_jet_phi_collision"), jet.r() / 100.0, jet.phi(), 0.0); - if (JetDerivedDataUtilities::selectChargedTrigger(collision, JetDerivedDataUtilities::JTrigSelCh::chargedLow)) { + if (jetderiveddatautilities::selectChargedTrigger(collision, jetderiveddatautilities::JTrigSelCh::chargedLow)) { registry.fill(HIST("h3_jet_r_jet_pt_collision"), jet.r() / 100.0, jet.pt(), 1.0); registry.fill(HIST("h3_jet_r_jet_eta_collision"), jet.r() / 100.0, jet.eta(), 1.0); registry.fill(HIST("h3_jet_r_jet_phi_collision"), jet.r() / 100.0, jet.phi(), 1.0); } - if (JetDerivedDataUtilities::selectChargedTrigger(collision, JetDerivedDataUtilities::JTrigSelCh::chargedHigh)) { + if (jetderiveddatautilities::selectChargedTrigger(collision, jetderiveddatautilities::JTrigSelCh::chargedHigh)) { registry.fill(HIST("h3_jet_r_jet_pt_collision"), jet.r() / 100.0, jet.pt(), 2.0); registry.fill(HIST("h3_jet_r_jet_eta_collision"), jet.r() / 100.0, jet.eta(), 2.0); registry.fill(HIST("h3_jet_r_jet_phi_collision"), jet.r() / 100.0, jet.phi(), 2.0); } - if (JetDerivedDataUtilities::selectChargedTrigger(collision, JetDerivedDataUtilities::JTrigSelCh::chargedLow) && JetDerivedDataUtilities::selectChargedTrigger(collision, JetDerivedDataUtilities::JTrigSelCh::chargedHigh)) { + if (jetderiveddatautilities::selectChargedTrigger(collision, jetderiveddatautilities::JTrigSelCh::chargedLow) && jetderiveddatautilities::selectChargedTrigger(collision, jetderiveddatautilities::JTrigSelCh::chargedHigh)) { registry.fill(HIST("h3_jet_r_jet_pt_collision"), jet.r() / 100.0, jet.pt(), 3.0); registry.fill(HIST("h3_jet_r_jet_eta_collision"), jet.r() / 100.0, jet.eta(), 3.0); registry.fill(HIST("h3_jet_r_jet_phi_collision"), jet.r() / 100.0, jet.phi(), 3.0); @@ -420,17 +643,17 @@ struct JetFinderQATask { registry.fill(HIST("h3_jet_r_jet_pt_track_eta_MB"), jet.r() / 100.0, jet.pt(), constituent.eta()); registry.fill(HIST("h3_jet_r_jet_pt_track_phi_MB"), jet.r() / 100.0, jet.pt(), constituent.phi()); - if (JetDerivedDataUtilities::selectChargedTrigger(collision, JetDerivedDataUtilities::JTrigSelCh::chargedLow)) { + if (jetderiveddatautilities::selectChargedTrigger(collision, jetderiveddatautilities::JTrigSelCh::chargedLow)) { registry.fill(HIST("h3_jet_r_jet_pt_track_pt_Triggered_Low"), jet.r() / 100.0, jet.pt(), constituent.pt()); registry.fill(HIST("h3_jet_r_jet_pt_track_eta_Triggered_Low"), jet.r() / 100.0, jet.pt(), constituent.eta()); registry.fill(HIST("h3_jet_r_jet_pt_track_phi_Triggered_Low"), jet.r() / 100.0, jet.pt(), constituent.phi()); } - if (JetDerivedDataUtilities::selectChargedTrigger(collision, JetDerivedDataUtilities::JTrigSelCh::chargedHigh)) { + if (jetderiveddatautilities::selectChargedTrigger(collision, jetderiveddatautilities::JTrigSelCh::chargedHigh)) { registry.fill(HIST("h3_jet_r_jet_pt_track_pt_Triggered_High"), jet.r() / 100.0, jet.pt(), constituent.pt()); registry.fill(HIST("h3_jet_r_jet_pt_track_eta_Triggered_High"), jet.r() / 100.0, jet.pt(), constituent.eta()); registry.fill(HIST("h3_jet_r_jet_pt_track_phi_Triggered_High"), jet.r() / 100.0, jet.pt(), constituent.phi()); } - if (JetDerivedDataUtilities::selectChargedTrigger(collision, JetDerivedDataUtilities::JTrigSelCh::chargedLow) && JetDerivedDataUtilities::selectChargedTrigger(collision, JetDerivedDataUtilities::JTrigSelCh::chargedHigh)) { + if (jetderiveddatautilities::selectChargedTrigger(collision, jetderiveddatautilities::JTrigSelCh::chargedLow) && jetderiveddatautilities::selectChargedTrigger(collision, jetderiveddatautilities::JTrigSelCh::chargedHigh)) { registry.fill(HIST("h3_jet_r_jet_pt_track_pt_Triggered_Both"), jet.r() / 100.0, jet.pt(), constituent.pt()); registry.fill(HIST("h3_jet_r_jet_pt_track_eta_Triggered_Both"), jet.r() / 100.0, jet.pt(), constituent.eta()); registry.fill(HIST("h3_jet_r_jet_pt_track_phi_Triggered_Both"), jet.r() / 100.0, jet.pt(), constituent.phi()); @@ -439,24 +662,24 @@ struct JetFinderQATask { } for (auto& track : tracks) { - if (!JetDerivedDataUtilities::selectTrack(track, trackSelection) || !JetDerivedDataUtilities::applyTrackKinematics(track, trackPtMin, trackPtMax, trackEtaMin, trackEtaMax)) { + if (!jetderiveddatautilities::selectTrack(track, trackSelection)) { continue; } registry.fill(HIST("h_track_pt_MB"), track.pt()); registry.fill(HIST("h_track_eta_MB"), track.eta()); registry.fill(HIST("h_track_phi_MB"), track.phi()); - if (JetDerivedDataUtilities::selectChargedTrigger(collision, JetDerivedDataUtilities::JTrigSelCh::chargedLow)) { + if (jetderiveddatautilities::selectChargedTrigger(collision, jetderiveddatautilities::JTrigSelCh::chargedLow)) { registry.fill(HIST("h_track_pt_Triggered_Low"), track.pt()); registry.fill(HIST("h_track_eta_Triggered_Low"), track.eta()); registry.fill(HIST("h_track_phi_Triggered_Low"), track.phi()); } - if (JetDerivedDataUtilities::selectChargedTrigger(collision, JetDerivedDataUtilities::JTrigSelCh::chargedHigh)) { + if (jetderiveddatautilities::selectChargedTrigger(collision, jetderiveddatautilities::JTrigSelCh::chargedHigh)) { registry.fill(HIST("h_track_pt_Triggered_High"), track.pt()); registry.fill(HIST("h_track_eta_Triggered_High"), track.eta()); registry.fill(HIST("h_track_phi_Triggered_High"), track.phi()); } - if (JetDerivedDataUtilities::selectChargedTrigger(collision, JetDerivedDataUtilities::JTrigSelCh::chargedLow) && JetDerivedDataUtilities::selectChargedTrigger(collision, JetDerivedDataUtilities::JTrigSelCh::chargedHigh)) { + if (jetderiveddatautilities::selectChargedTrigger(collision, jetderiveddatautilities::JTrigSelCh::chargedLow) && jetderiveddatautilities::selectChargedTrigger(collision, jetderiveddatautilities::JTrigSelCh::chargedHigh)) { registry.fill(HIST("h_track_pt_Triggered_Both"), track.pt()); registry.fill(HIST("h_track_eta_Triggered_Both"), track.eta()); registry.fill(HIST("h_track_phi_Triggered_Both"), track.phi()); @@ -465,11 +688,11 @@ struct JetFinderQATask { } PROCESS_SWITCH(JetFinderQATask, processTriggeredData, "QA for charged jet trigger", false); - void processTracks(aod::JCollision const& collision, + void processTracks(soa::Filtered::iterator const& collision, soa::Filtered const& tracks) { registry.fill(HIST("h_collisions"), 0.5); - if (!JetDerivedDataUtilities::selectCollision(collision, eventSelection)) { + if (!jetderiveddatautilities::selectCollision(collision, eventSelection)) { return; } registry.fill(HIST("h_collisions"), 1.5); @@ -477,14 +700,14 @@ struct JetFinderQATask { } PROCESS_SWITCH(JetFinderQATask, processTracks, "QA for charged tracks", false); - void processTracksWeighted(soa::Join::iterator const& collision, - aod::JMcCollisions const& mcCollisions, + void processTracksWeighted(soa::Join::iterator const& collision, + JetMcCollisions const& mcCollisions, soa::Filtered const& tracks) { float eventWeight = collision.mcCollision().weight(); registry.fill(HIST("h_collisions"), 0.5); registry.fill(HIST("h_collisions_weighted"), 0.5, eventWeight); - if (!JetDerivedDataUtilities::selectCollision(collision, eventSelection)) { + if (!jetderiveddatautilities::selectCollision(collision, eventSelection)) { return; } registry.fill(HIST("h_collisions"), 1.5); @@ -492,6 +715,51 @@ struct JetFinderQATask { fillTrackHistograms(tracks, eventWeight); } PROCESS_SWITCH(JetFinderQATask, processTracksWeighted, "QA for charged tracks weighted", false); + + void processTracksSub(soa::Filtered::iterator const& collision, + soa::Filtered const& tracks) + { + if (!jetderiveddatautilities::selectCollision(collision, eventSelection)) { + return; + } + for (auto const& track : tracks) { + registry.fill(HIST("h_track_pt_eventwiseconstituentsubtracted"), track.pt()); + registry.fill(HIST("h_track_eta_eventwiseconstituentsubtracted"), track.eta()); + registry.fill(HIST("h_track_phi_eventwiseconstituentsubtracted"), track.phi()); + } + } + PROCESS_SWITCH(JetFinderQATask, processTracksSub, "QA for charged event-wise embedded subtracted tracks", false); + + void processRho(soa::Join::iterator const& collision) + { + registry.fill(HIST("h2_rho_centrality"), collision.rho(), collision.centrality()); + registry.fill(HIST("h2_rhom_centrality"), collision.rhoM(), collision.centrality()); + } + PROCESS_SWITCH(JetFinderQATask, processRho, "QA for rho-area subtracted jets", false); + + void processJetsRhoAreaSubData(soa::Filtered>::iterator const& collision, + soa::Join const& jets, + JetTracks const& tracks) + { + for (auto jet : jets) { + if (!jetfindingutilities::isInEtaAcceptance(jet, jetEtaMin, jetEtaMax, trackEtaMin, trackEtaMax)) { + continue; + } + fillRhoAreaSubtractedHistograms(jet, collision.rho()); + } + } + PROCESS_SWITCH(JetFinderQATask, processJetsRhoAreaSubData, "jet finder QA for rho-area subtracted jets", false); + + void processEvtWiseConstSubJetsData(soa::Filtered::iterator const& collision, soa::Join const& jets, JetTracksSub const& tracks) + { + for (auto const& jet : jets) { + if (!jetfindingutilities::isInEtaAcceptance(jet, jetEtaMin, jetEtaMax, trackEtaMin, trackEtaMax)) { + continue; + } + fillEventWiseConstituentSubtractedHistograms(jet); + } + } + PROCESS_SWITCH(JetFinderQATask, processEvtWiseConstSubJetsData, "jet finder QA for eventwise constituent-subtracted jets data", false); }; WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) { return WorkflowSpec{adaptAnalysisTask(cfgc, TaskName{"jet-finder-charged-qa"})}; } diff --git a/PWGJE/Tasks/jetfinderfullQA.cxx b/PWGJE/Tasks/jetfinderfullQA.cxx index 78f854107ca..b8677fdea3f 100644 --- a/PWGJE/Tasks/jetfinderfullQA.cxx +++ b/PWGJE/Tasks/jetfinderfullQA.cxx @@ -29,6 +29,7 @@ #include "PWGJE/DataModel/Jet.h" #include "PWGJE/Core/JetDerivedDataUtilities.h" +#include "PWGJE/Core/JetFindingUtilities.h" #include "EventFiltering/filterTables.h" @@ -39,10 +40,13 @@ using namespace o2::framework::expressions; template struct JetFinderFullQATask { + HistogramRegistry registry; Configurable selectedJetsRadius{"selectedJetsRadius", 0.4, "resolution parameter for histograms without radius"}; Configurable vertexZCut{"vertexZCut", 10.0f, "Accepted z-vertex range"}; + Configurable centralityMin{"centralityMin", -999.0, "minimum centrality"}; + Configurable centralityMax{"centralityMax", 999.0, "maximum centrality"}; Configurable> jetRadii{"jetRadii", std::vector{0.4}, "jet resolution parameters"}; Configurable trackEtaMin{"trackEtaMin", -0.9, "minimum eta acceptance for tracks"}; Configurable trackEtaMax{"trackEtaMax", 0.9, "maximum eta acceptance for tracks"}; @@ -50,6 +54,9 @@ struct JetFinderFullQATask { Configurable trackPtMax{"trackPtMax", 100.0, "maximum pT acceptance for tracks"}; Configurable trackSelections{"trackSelections", "globalTracks", "set track selections"}; + Configurable jetEtaMin{"jetEtaMin", -99.0, "minimum jet pseudorapidity"}; + Configurable jetEtaMax{"jetEtaMax", 99.0, "maximum jet pseudorapidity"}; + // cluster level configurables Configurable clusterDefinitionS{"clusterDefinition", "kV3Default", "cluster definition to be selected, e.g. V3Default"}; Configurable clusterEtaMin{"clusterEtaMin", -0.7, "minimum cluster eta"}; // For ECMAL: |eta| < 0.7, phi = 1.40 - 3.26 @@ -70,10 +77,12 @@ struct JetFinderFullQATask { int trackSelection = -1; + Service pdgDatabase; + void init(o2::framework::InitContext&) { - trackSelection = JetDerivedDataUtilities::initialiseTrackSelection(static_cast(trackSelections)); + trackSelection = jetderiveddatautilities::initialiseTrackSelection(static_cast(trackSelections)); jetRadiiValues = (std::vector)jetRadii; for (std::size_t iJetRadius = 0; iJetRadius < jetRadiiValues.size(); iJetRadius++) { @@ -97,6 +106,7 @@ struct JetFinderFullQATask { registry.add("h3_jet_r_jet_eta_jet_phi", "#it{R}_{jet};#eta_{jet};#varphi_{jet}", {HistType::kTH3F, {{jetRadiiBins, ""}, {100, -1.0, 1.0}, {160, -1.0, 7.}}}); registry.add("h3_jet_r_jet_pt_jet_ntracks", "#it{R}_{jet};#it{p}_{T,jet} (GeV/#it{c});N_{jet tracks}", {HistType::kTH3F, {{jetRadiiBins, ""}, {200, 0., 200.}, {100, -0.5, 99.5}}}); registry.add("h3_jet_r_jet_pt_jet_nclusters", "#it{R}_{jet};#it{p}_{T,jet} (GeV/#it{c});N_{jet clusters}", {HistType::kTH3F, {{jetRadiiBins, ""}, {200, 0., 200.}, {100, -0.5, 99.5}}}); + registry.add("h3_jet_r_jet_pt_jet_neutralenergyfraction", "#it{R}_{jet};#it{p}_{T,jet} (GeV/#it{c});E_{neutral}/E_{total}", {HistType::kTH3F, {{jetRadiiBins, ""}, {200, 0., 200.}, {120, 0.0, 1.2}}}); registry.add("h3_jet_r_jet_pt_jet_area", "#it{R}_{jet}; #it{p}_{T,jet} (GeV/#it{c}); #it{Area}_{jet}", {HistType::kTH3F, {{jetRadiiBins, ""}, {200, 0., 200.}, {300, 0., 3.}}}); registry.add("h3_jet_r_jet_pt_track_pt", "#it{R}_{jet};#it{p}_{T,jet} (GeV/#it{c});#it{p}_{T,jet tracks} (GeV/#it{c})", {HistType::kTH3F, {{jetRadiiBins, ""}, {200, 0., 200.}, {200, 0., 200.}}}); registry.add("h3_jet_r_jet_pt_track_eta", "#it{R}_{jet};#it{p}_{T,jet} (GeV/#it{c});#eta_{jet tracks}", {HistType::kTH3F, {{jetRadiiBins, ""}, {200, 0., 200.}, {100, -1.0, 1.0}}}); @@ -116,26 +126,57 @@ struct JetFinderFullQATask { registry.add("h3_jet_r_part_jet_pt_part_jet_phi_part", ";#it{R}_{jet}^{part};#it{p}_{T,jet}^{part} (GeV/#it{c});#varphi_{jet}^{part}", {HistType::kTH3F, {{jetRadiiBins, ""}, {200, 0., 200.}, {160, -1.0, 7.}}}); registry.add("h3_jet_r_part_jet_eta_part_jet_phi_part", ";#it{R}_{jet}^{part};#eta_{jet}^{part};#varphi_{jet}^{part}", {HistType::kTH3F, {{jetRadiiBins, ""}, {100, -1.0, 1.0}, {160, -1.0, 7.}}}); registry.add("h3_jet_r_part_jet_pt_part_jet_ntracks_part", "#it{R}_{jet}^{part};#it{p}_{T,jet}^{part} (GeV/#it{c});N_{jet tracks}^{part}", {HistType::kTH3F, {{jetRadiiBins, ""}, {200, 0., 200.}, {100, -0.5, 99.5}}}); + registry.add("h3_jet_r_part_jet_pt_part_jet_neutralenergyfraction_part", "#it{R}_{jet}^{part};#it{p}_{T,jet}^{part} (GeV/#it{c});E_{neutral}^{part}/E_{total}^{part}", {HistType::kTH3F, {{jetRadiiBins, ""}, {200, 0., 200.}, {120, 0.0, 1.2}}}); registry.add("h3_jet_r_part_jet_pt_part_track_pt_part", "#it{R}_{jet}^{part};#it{p}_{T,jet}^{part} (GeV/#it{c});#it{p}_{T,jet tracks}^{part} (GeV/#it{c})", {HistType::kTH3F, {{jetRadiiBins, ""}, {200, 0., 200.}, {200, 0., 200.}}}); registry.add("h3_jet_r_part_jet_pt_part_track_eta_part", "#it{R}_{jet}^{part};#it{p}_{T,jet}^{part} (GeV/#it{c});#eta_{jet tracks}^{part}", {HistType::kTH3F, {{jetRadiiBins, ""}, {200, 0., 200.}, {100, -1.0, 1.0}}}); registry.add("h3_jet_r_part_jet_pt_part_track_phi_part", "#it{R}_{jet}^{part};#it{p}_{T,jet}^{part} (GeV/#it{c});#varphi_{jet tracks}^{part}", {HistType::kTH3F, {{jetRadiiBins, ""}, {200, 0., 200.}, {160, -1.0, 7.}}}); } if (doprocessJetsMCPMCDMatched || doprocessJetsMCPMCDMatchedWeighted) { - registry.add("h3_jet_r_jet_pt_part_jet_pt", "#it{R}_{jet};#it{p}_{T,jet}^{part} (GeV/#it{c});#it{p}_{T,jet} (GeV/#it{c})", {HistType::kTH3F, {{jetRadiiBins, ""}, {200, 0., 200.}, {200, 0., 200.}}}); - registry.add("h3_jet_r_jet_eta_part_jet_eta", "#it{R}_{jet};#eta_{jet}^{part};#eta_{jet}", {HistType::kTH3F, {{jetRadiiBins, ""}, {200, 0., 200.}, {100, -1.0, 1.0}}}); - registry.add("h3_jet_r_jet_phi_part_jet_phi", "#it{R}_{jet};#varphi_{jet}^{part};#varphi_{jet}", {HistType::kTH3F, {{jetRadiiBins, ""}, {200, 0., 200.}, {160, -1.0, 7.}}}); - registry.add("h3_jet_r_jet_ntracks_part_jet_ntracks", "#it{R}_{jet};N_{jet tracks}^{part};N_{jet tracks}", {HistType::kTH3F, {{jetRadiiBins, ""}, {100, -0.5, 99.5}, {100, -0.5, 99.5}}}); - registry.add("h3_jet_r_cluster_pt_part_cluster_pt", "#it{R}_{jet};#it{p}_{T,cluster}^{part} (GeV/#it{c});#it{p}_{T,cluster} (GeV/#it{c})", {HistType::kTH3F, {{jetRadiiBins, ""}, {200, 0., 200.}, {200, 0., 200.}}}); - registry.add("h3_jet_r_cluster_eta_part_cluster_eta", "#it{R}_{jet};#eta_{cluster}^{part};#eta_{cluster}", {HistType::kTH3F, {{jetRadiiBins, ""}, {100, -1.0, 1.0}, {100, -1.0, 1.0}}}); - registry.add("h3_jet_r_cluster_phi_part_cluster_phi", "#it{R}_{jet};#varphi_{cluster}^{part};#varphi_{cluster}", {HistType::kTH3F, {{jetRadiiBins, ""}, {160, -1.0, 7.}, {160, -1.0, 7.}}}); - registry.add("h3_jet_r_cluster_energy_part_cluster_energy", "#it{R}_{jet};#E_{cluster}^{part};#E_{cluster}", {HistType::kTH3F, {{jetRadiiBins, ""}, {200, 0., 200.}, {200, 0., 200.0}}}); - registry.add("h3_jet_r_jet_pt_part_jet_pt_diff", "#it{R}_{jet};#it{p}_{T,jet}^{part} (GeV/#it{c}); (#it{p}_{T,jet}^{part} (GeV/#it{c}) - #it{p}_{T,jet} (GeV/#it{c})) / #it{p}_{T,jet}^{part} (GeV/#it{c})", {HistType::kTH3F, {{jetRadiiBins, ""}, {200, 0.0, 200}, {1000, -5.0, 5.0}}}); - registry.add("h3_jet_r_jet_pt_part_jet_eta_diff", "#it{R}_{jet};#it{p}_{T,jet}^{part} (GeV/#it{c}); (#eta_{jet}^{part} - #eta_{jet}) / #eta_{jet}^{part}", {HistType::kTH3F, {{jetRadiiBins, ""}, {200, 0.0, 200}, {1000, -5.0, 5.0}}}); - registry.add("h3_jet_r_jet_pt_part_jet_phi_diff", "#it{R}_{jet};#it{p}_{T,jet}^{part} (GeV/#it{c}); (#varphi_{jet}^{part} - #varphi_{jet}) / #varphi_{jet}^{part}", {HistType::kTH3F, {{jetRadiiBins, ""}, {200, 0.0, 200}, {1000, -5.0, 5.0}}}); - registry.add("h3_jet_pt_part_jet_eta_part_jet_eta", ";#it{p}_{T,jet}^{part} (GeV/#it{c}); #eta_{jet}^{part}; #eta_{jet}", {HistType::kTH3F, {{200, 0.0, 200}, {100, -1.0, 1.0}, {100, -1.0, 1.0}}}); - registry.add("h3_jet_pt_part_jet_phi_part_jet_phi", ";#it{p}_{T,jet}^{part} (GeV/#it{c}); #varphi_{jet}^{part}; #varphi_{jet}", {HistType::kTH3F, {{200, 0.0, 200}, {160, -1.0, 7.}, {160, -1.0, 7.}}}); - registry.add("h3_jet_pt_part_jet_ntracks_part_jet_ntracks", ";#it{p}_{T,jet}^{part} (GeV/#it{c}); N_{jet tracks}^{part}; N_{jet tracks}", {HistType::kTH3F, {{200, 0.0, 200}, {100, -0.5, 99.5}, {100, -0.5, 99.5}}}); + registry.add("h3_jet_r_jet_pt_tag_jet_pt_base_matchedgeo", "#it{R}_{jet};#it{p}_{T,jet}^{tag} (GeV/#it{c});#it{p}_{T,jet}^{base} (GeV/#it{c})", {HistType::kTH3F, {{jetRadiiBins, ""}, {200, 0., 200.}, {200, 0., 200.}}}); + registry.add("h3_jet_r_jet_eta_tag_jet_eta_base_matchedgeo", "#it{R}_{jet};#eta_{jet}^{tag};#eta_{jet}^{base}", {HistType::kTH3F, {{jetRadiiBins, ""}, {200, 0., 200.}, {100, -1.0, 1.0}}}); + registry.add("h3_jet_r_jet_phi_tag_jet_phi_base_matchedgeo", "#it{R}_{jet};#varphi_{jet}^{tag};#varphi_{jet}^{base}", {HistType::kTH3F, {{jetRadiiBins, ""}, {200, 0., 200.}, {160, -1.0, 7.}}}); + registry.add("h3_jet_r_jet_ntracks_tag_jet_ntracks_base_matchedgeo", "#it{R}_{jet};N_{jet tracks}^{tag};N_{jet tracks}^{base}", {HistType::kTH3F, {{jetRadiiBins, ""}, {100, -0.5, 99.5}, {100, -0.5, 99.5}}}); + registry.add("h3_jet_r_cluster_pt_tag_cluster_pt_base_matchedgeo", "#it{R}_{jet};#it{p}_{T,cluster}^{tag} (GeV/#it{c});#it{p}_{T,cluster}^{base} (GeV/#it{c})", {HistType::kTH3F, {{jetRadiiBins, ""}, {200, 0., 200.}, {200, 0., 200.}}}); + registry.add("h3_jet_r_cluster_eta_tag_cluster_eta_base_matchedgeo", "#it{R}_{jet};#eta_{cluster}^{tag};#eta_{cluster}^{base}", {HistType::kTH3F, {{jetRadiiBins, ""}, {100, -1.0, 1.0}, {100, -1.0, 1.0}}}); + registry.add("h3_jet_r_cluster_phi_tag_cluster_phi_base_matchedgeo", "#it{R}_{jet};#varphi_{cluster}^{tag};#varphi_{cluster}^{base}", {HistType::kTH3F, {{jetRadiiBins, ""}, {160, -1.0, 7.}, {160, -1.0, 7.}}}); + registry.add("h3_jet_r_cluster_energy_tag_cluster_energy_base_matchedgeo", "#it{R}_{jet};#E_{cluster}^{tag};#E_{cluster}^{base}", {HistType::kTH3F, {{jetRadiiBins, ""}, {200, 0., 200.}, {200, 0., 200.0}}}); + registry.add("h3_jet_r_jet_pt_tag_jet_pt_base_diff_matchedgeo", "#it{R}_{jet};#it{p}_{T,jet}^{tag} (GeV/#it{c}); (#it{p}_{T,jet}^{tag} (GeV/#it{c}) - #it{p}_{T,jet}^{base} (GeV/#it{c})) / #it{p}_{T,jet}^{tag} (GeV/#it{c})", {HistType::kTH3F, {{jetRadiiBins, ""}, {200, 0.0, 200}, {1000, -5.0, 5.0}}}); + registry.add("h3_jet_r_jet_pt_tag_jet_eta_base_diff_matchedgeo", "#it{R}_{jet};#it{p}_{T,jet}^{tag} (GeV/#it{c}); (#eta_{jet}^{tag} - #eta_{jet}^{base}) / #eta_{jet}^{tag}", {HistType::kTH3F, {{jetRadiiBins, ""}, {200, 0.0, 200}, {1000, -5.0, 5.0}}}); + registry.add("h3_jet_r_jet_pt_tag_jet_phi_base_diff_matchedgeo", "#it{R}_{jet};#it{p}_{T,jet}^{tag} (GeV/#it{c}); (#varphi_{jet}^{tag} - #varphi_{jet}^{base}) / #varphi_{jet}^{tag}", {HistType::kTH3F, {{jetRadiiBins, ""}, {200, 0.0, 200}, {1000, -5.0, 5.0}}}); + registry.add("h3_jet_pt_tag_jet_eta_tag_jet_eta_base_matchedgeo", ";#it{p}_{T,jet}^{tag} (GeV/#it{c}); #eta_{jet}^{tag}; #eta_{jet}^{base}", {HistType::kTH3F, {{200, 0.0, 200}, {100, -1.0, 1.0}, {100, -1.0, 1.0}}}); + registry.add("h3_jet_pt_tag_jet_phi_tag_jet_phi_base_matchedgeo", ";#it{p}_{T,jet}^{tag} (GeV/#it{c}); #varphi_{jet}^{tag}; #varphi_{jet}^{base}", {HistType::kTH3F, {{200, 0.0, 200}, {160, -1.0, 7.}, {160, -1.0, 7.}}}); + registry.add("h3_jet_pt_tag_jet_ntracks_tag_jet_ntracks_base_matchedgeo", ";#it{p}_{T,jet}^{tag} (GeV/#it{c}); N_{jet tracks}^{tag}; N_{jet tracks}^{base}", {HistType::kTH3F, {{200, 0.0, 200}, {100, -0.5, 99.5}, {100, -0.5, 99.5}}}); + + registry.add("h3_jet_r_jet_pt_tag_jet_pt_base_matchedpt", "#it{R}_{jet};#it{p}_{T,jet}^{tag} (GeV/#it{c});#it{p}_{T,jet}^{base} (GeV/#it{c})", {HistType::kTH3F, {{jetRadiiBins, ""}, {200, 0., 200.}, {200, 0., 200.}}}); + registry.add("h3_jet_r_jet_eta_tag_jet_eta_base_matchedpt", "#it{R}_{jet};#eta_{jet}^{tag};#eta_{jet}^{base}", {HistType::kTH3F, {{jetRadiiBins, ""}, {200, 0., 200.}, {100, -1.0, 1.0}}}); + registry.add("h3_jet_r_jet_phi_tag_jet_phi_base_matchedpt", "#it{R}_{jet};#varphi_{jet}^{tag};#varphi_{jet}^{base}", {HistType::kTH3F, {{jetRadiiBins, ""}, {200, 0., 200.}, {160, -1.0, 7.}}}); + registry.add("h3_jet_r_jet_ntracks_tag_jet_ntracks_base_matchedpt", "#it{R}_{jet};N_{jet tracks}^{tag};N_{jet tracks}^{base}", {HistType::kTH3F, {{jetRadiiBins, ""}, {100, -0.5, 99.5}, {100, -0.5, 99.5}}}); + registry.add("h3_jet_r_cluster_pt_tag_cluster_pt_base_matchedpt", "#it{R}_{jet};#it{p}_{T,cluster}^{tag} (GeV/#it{c});#it{p}_{T,cluster}^{base} (GeV/#it{c})", {HistType::kTH3F, {{jetRadiiBins, ""}, {200, 0., 200.}, {200, 0., 200.}}}); + registry.add("h3_jet_r_cluster_eta_tag_cluster_eta_base_matchedpt", "#it{R}_{jet};#eta_{cluster}^{tag};#eta_{cluster}^{base}", {HistType::kTH3F, {{jetRadiiBins, ""}, {100, -1.0, 1.0}, {100, -1.0, 1.0}}}); + registry.add("h3_jet_r_cluster_phi_tag_cluster_phi_base_matchedpt", "#it{R}_{jet};#varphi_{cluster}^{tag};#varphi_{cluster}^{base}", {HistType::kTH3F, {{jetRadiiBins, ""}, {160, -1.0, 7.}, {160, -1.0, 7.}}}); + registry.add("h3_jet_r_cluster_energy_tag_cluster_energy_base_matchedpt", "#it{R}_{jet};#E_{cluster}^{tag};#E_{cluster}^{base}", {HistType::kTH3F, {{jetRadiiBins, ""}, {200, 0., 200.}, {200, 0., 200.0}}}); + registry.add("h3_jet_r_jet_pt_tag_jet_pt_base_diff_matchedpt", "#it{R}_{jet};#it{p}_{T,jet}^{tag} (GeV/#it{c}); (#it{p}_{T,jet}^{tag} (GeV/#it{c}) - #it{p}_{T,jet}^{base} (GeV/#it{c})) / #it{p}_{T,jet}^{tag} (GeV/#it{c})", {HistType::kTH3F, {{jetRadiiBins, ""}, {200, 0.0, 200}, {1000, -5.0, 5.0}}}); + registry.add("h3_jet_r_jet_pt_tag_jet_eta_base_diff_matchedpt", "#it{R}_{jet};#it{p}_{T,jet}^{tag} (GeV/#it{c}); (#eta_{jet}^{tag} - #eta_{jet}^{base}) / #eta_{jet}^{tag}", {HistType::kTH3F, {{jetRadiiBins, ""}, {200, 0.0, 200}, {1000, -5.0, 5.0}}}); + registry.add("h3_jet_r_jet_pt_tag_jet_phi_base_diff_matchedpt", "#it{R}_{jet};#it{p}_{T,jet}^{tag} (GeV/#it{c}); (#varphi_{jet}^{tag} - #varphi_{jet}^{base}) / #varphi_{jet}^{tag}", {HistType::kTH3F, {{jetRadiiBins, ""}, {200, 0.0, 200}, {1000, -5.0, 5.0}}}); + registry.add("h3_jet_pt_tag_jet_eta_tag_jet_eta_base_matchedpt", ";#it{p}_{T,jet}^{tag} (GeV/#it{c}); #eta_{jet}^{tag}; #eta_{jet}^{base}", {HistType::kTH3F, {{200, 0.0, 200}, {100, -1.0, 1.0}, {100, -1.0, 1.0}}}); + registry.add("h3_jet_pt_tag_jet_phi_tag_jet_phi_base_matchedpt", ";#it{p}_{T,jet}^{tag} (GeV/#it{c}); #varphi_{jet}^{tag}; #varphi_{jet}^{base}", {HistType::kTH3F, {{200, 0.0, 200}, {160, -1.0, 7.}, {160, -1.0, 7.}}}); + registry.add("h3_jet_pt_tag_jet_ntracks_tag_jet_ntracks_base_matchedpt", ";#it{p}_{T,jet}^{tag} (GeV/#it{c}); N_{jet tracks}^{tag}; N_{jet tracks}^{base}", {HistType::kTH3F, {{200, 0.0, 200}, {100, -0.5, 99.5}, {100, -0.5, 99.5}}}); + + registry.add("h3_jet_r_jet_pt_tag_jet_pt_base_matchedgeopt", "#it{R}_{jet};#it{p}_{T,jet}^{tag} (GeV/#it{c});#it{p}_{T,jet}^{base} (GeV/#it{c})", {HistType::kTH3F, {{jetRadiiBins, ""}, {200, 0., 200.}, {200, 0., 200.}}}); + registry.add("h3_jet_r_jet_eta_tag_jet_eta_base_matchedgeopt", "#it{R}_{jet};#eta_{jet}^{tag};#eta_{jet}^{base}", {HistType::kTH3F, {{jetRadiiBins, ""}, {200, 0., 200.}, {100, -1.0, 1.0}}}); + registry.add("h3_jet_r_jet_phi_tag_jet_phi_base_matchedgeopt", "#it{R}_{jet};#varphi_{jet}^{tag};#varphi_{jet}^{base}", {HistType::kTH3F, {{jetRadiiBins, ""}, {200, 0., 200.}, {160, -1.0, 7.}}}); + registry.add("h3_jet_r_jet_ntracks_tag_jet_ntracks_base_matchedgeopt", "#it{R}_{jet};N_{jet tracks}^{tag};N_{jet tracks}^{base}", {HistType::kTH3F, {{jetRadiiBins, ""}, {100, -0.5, 99.5}, {100, -0.5, 99.5}}}); + registry.add("h3_jet_r_cluster_pt_tag_cluster_pt_base_matchedgeopt", "#it{R}_{jet};#it{p}_{T,cluster}^{tag} (GeV/#it{c});#it{p}_{T,cluster}^{base} (GeV/#it{c})", {HistType::kTH3F, {{jetRadiiBins, ""}, {200, 0., 200.}, {200, 0., 200.}}}); + registry.add("h3_jet_r_cluster_eta_tag_cluster_eta_base_matchedgeopt", "#it{R}_{jet};#eta_{cluster}^{tag};#eta_{cluster}^{base}", {HistType::kTH3F, {{jetRadiiBins, ""}, {100, -1.0, 1.0}, {100, -1.0, 1.0}}}); + registry.add("h3_jet_r_cluster_phi_tag_cluster_phi_base_matchedgeopt", "#it{R}_{jet};#varphi_{cluster}^{tag};#varphi_{cluster}^{base}", {HistType::kTH3F, {{jetRadiiBins, ""}, {160, -1.0, 7.}, {160, -1.0, 7.}}}); + registry.add("h3_jet_r_cluster_energy_tag_cluster_energy_base_matchedgeopt", "#it{R}_{jet};#E_{cluster}^{tag};#E_{cluster}^{base}", {HistType::kTH3F, {{jetRadiiBins, ""}, {200, 0., 200.}, {200, 0., 200.0}}}); + registry.add("h3_jet_r_jet_pt_tag_jet_pt_base_diff_matchedgeopt", "#it{R}_{jet};#it{p}_{T,jet}^{tag} (GeV/#it{c}); (#it{p}_{T,jet}^{tag} (GeV/#it{c}) - #it{p}_{T,jet}^{base} (GeV/#it{c})) / #it{p}_{T,jet}^{tag} (GeV/#it{c})", {HistType::kTH3F, {{jetRadiiBins, ""}, {200, 0.0, 200}, {1000, -5.0, 5.0}}}); + registry.add("h3_jet_r_jet_pt_tag_jet_eta_base_diff_matchedgeopt", "#it{R}_{jet};#it{p}_{T,jet}^{tag} (GeV/#it{c}); (#eta_{jet}^{tag} - #eta_{jet}^{base}) / #eta_{jet}^{tag}", {HistType::kTH3F, {{jetRadiiBins, ""}, {200, 0.0, 200}, {1000, -5.0, 5.0}}}); + registry.add("h3_jet_r_jet_pt_tag_jet_phi_base_diff_matchedgeopt", "#it{R}_{jet};#it{p}_{T,jet}^{tag} (GeV/#it{c}); (#varphi_{jet}^{tag} - #varphi_{jet}^{base}) / #varphi_{jet}^{tag}", {HistType::kTH3F, {{jetRadiiBins, ""}, {200, 0.0, 200}, {1000, -5.0, 5.0}}}); + registry.add("h3_jet_pt_tag_jet_eta_tag_jet_eta_base_matchedgeopt", ";#it{p}_{T,jet}^{tag} (GeV/#it{c}); #eta_{jet}^{tag}; #eta_{jet}^{base}", {HistType::kTH3F, {{200, 0.0, 200}, {100, -1.0, 1.0}, {100, -1.0, 1.0}}}); + registry.add("h3_jet_pt_tag_jet_phi_tag_jet_phi_base_matchedgeopt", ";#it{p}_{T,jet}^{tag} (GeV/#it{c}); #varphi_{jet}^{tag}; #varphi_{jet}^{base}", {HistType::kTH3F, {{200, 0.0, 200}, {160, -1.0, 7.}, {160, -1.0, 7.}}}); + registry.add("h3_jet_pt_tag_jet_ntracks_tag_jet_ntracks_base_matchedgeopt", ";#it{p}_{T,jet}^{tag} (GeV/#it{c}); N_{jet tracks}^{tag}; N_{jet tracks}^{base}", {HistType::kTH3F, {{200, 0.0, 200}, {100, -0.5, 99.5}, {100, -0.5, 99.5}}}); } if (doprocessTracks || doprocessTracksWeighted) { @@ -158,9 +199,6 @@ struct JetFinderFullQATask { } } - using JetTracks = aod::JTracks; - using JetClusters = aod::JClusters; - using JetParticles = aod::JMcParticles; using JetTableDataJoined = soa::Join; using JetTableMCDJoined = soa::Join; using JetTableMCDWeightedJoined = soa::Join; @@ -172,6 +210,7 @@ struct JetFinderFullQATask { using JetTableMCPMatchedWeightedJoined = soa::Join; Filter trackCuts = (aod::jtrack::pt >= trackPtMin && aod::jtrack::pt < trackPtMax && aod::jtrack::eta > trackEtaMin && aod::jtrack::eta < trackEtaMax); + Filter eventCuts = (nabs(aod::jcollision::posZ) < vertexZCut && aod::jcollision::centrality >= centralityMin && aod::jcollision::centrality < centralityMax); aod::EMCALClusterDefinition clusterDefinition = aod::emcalcluster::getClusterDefinitionFromString(clusterDefinitionS.value); Filter clusterFilter = (aod::jcluster::definition == static_cast(clusterDefinition) && aod::jcluster::eta > clusterEtaMin && aod::jcluster::eta < clusterEtaMax && aod::jcluster::phi >= clusterPhiMin && aod::jcluster::phi <= clusterPhiMax && aod::jcluster::energy >= clusterEnergyMin && aod::jcluster::time > clusterTimeMin && aod::jcluster::time < clusterTimeMax && (clusterRejectExotics && aod::jcluster::isExotic != true)); @@ -184,6 +223,7 @@ struct JetFinderFullQATask { return; } + float neutralEnergy = 0.0; if (jet.r() == round(selectedJetsRadius * 100.0f)) { registry.fill(HIST("h_jet_pt"), jet.pt(), weight); registry.fill(HIST("h_jet_eta"), jet.eta(), weight); @@ -208,11 +248,48 @@ struct JetFinderFullQATask { for (auto& cluster : jet.template clusters_as()) { double clusterpt = cluster.energy() / std::cosh(cluster.eta()); + neutralEnergy += cluster.energy(); registry.fill(HIST("h3_jet_r_jet_pt_cluster_pt"), jet.r() / 100.0, jet.pt(), clusterpt, weight); registry.fill(HIST("h3_jet_r_jet_pt_cluster_eta"), jet.r() / 100.0, jet.pt(), cluster.eta(), weight); registry.fill(HIST("h3_jet_r_jet_pt_cluster_phi"), jet.r() / 100.0, jet.pt(), cluster.phi(), weight); registry.fill(HIST("h3_jet_r_jet_pt_cluster_energy"), jet.r() / 100.0, jet.pt(), cluster.energy(), weight); } + registry.fill(HIST("h3_jet_r_jet_pt_jet_neutralenergyfraction"), jet.r() / 100.0, jet.pt(), neutralEnergy / jet.energy(), weight); + } + + template + void fillRhoAreaSubtractedHistograms(T const& jet, float rho, float weight = 1.0) + { + if (jet.r() == round(selectedJetsRadius * 100.0f)) { + registry.fill(HIST("h_jet_pt_rhoareasubtracted"), jet.pt() - (rho * jet.area()), weight); + registry.fill(HIST("h_jet_eta_rhoareasubtracted"), jet.eta(), weight); + registry.fill(HIST("h_jet_phi_rhoareasubtracted"), jet.phi(), weight); + registry.fill(HIST("h_jet_ntracks_rhoareasubtracted"), jet.tracks().size(), weight); + registry.fill(HIST("h_jet_nclusters_rhoareasubtracted"), jet.clusters().size(), weight); + } + + registry.fill(HIST("h3_jet_r_jet_pt_jet_eta_rhoareasubtracted"), jet.r() / 100.0, jet.pt() - (rho * jet.area()), jet.eta(), weight); + registry.fill(HIST("h3_jet_r_jet_pt_jet_phi_rhoareasubtracted"), jet.r() / 100.0, jet.pt() - (rho * jet.area()), jet.phi(), weight); + registry.fill(HIST("h3_jet_r_jet_eta_jet_phi_rhoareasubtracted"), jet.r() / 100.0, jet.eta(), jet.phi(), weight); + registry.fill(HIST("h3_jet_r_jet_pt_jet_ntracks_rhoareasubtracted"), jet.r() / 100.0, jet.pt() - (rho * jet.area()), jet.tracks().size(), weight); + registry.fill(HIST("h3_jet_r_jet_pt_jet_nclusters_rhoareasubtracted"), jet.r() / 100.0, jet.pt() - (rho * jet.area()), jet.clusters().size(), weight); + registry.fill(HIST("h3_jet_r_jet_pt_jet_area_rhoareasubtracted"), jet.r() / 100.0, jet.pt() - (rho * jet.area()), jet.area(), weight); + registry.fill(HIST("h3_jet_r_jet_pt_jet_pt_rhoareasubtracted"), jet.r() / 100.0, jet.pt(), jet.pt() - (rho * jet.area()), weight); + + for (auto& constituent : jet.template tracks_as()) { + + registry.fill(HIST("h3_jet_r_jet_pt_track_pt_rhoareasubtracted"), jet.r() / 100.0, jet.pt() - (rho * jet.area()), constituent.pt(), weight); + registry.fill(HIST("h3_jet_r_jet_pt_track_eta_rhoareasubtracted"), jet.r() / 100.0, jet.pt() - (rho * jet.area()), constituent.eta(), weight); + registry.fill(HIST("h3_jet_r_jet_pt_track_phi_rhoareasubtracted"), jet.r() / 100.0, jet.pt() - (rho * jet.area()), constituent.phi(), weight); + } + + for (auto& cluster : jet.template clusters_as()) { + double clusterpt = cluster.energy() / std::cosh(cluster.eta()); + registry.fill(HIST("h3_jet_r_jet_pt_cluster_pt_rhoareasubtracted"), jet.r() / 100.0, jet.pt() - (rho * jet.area()), clusterpt, weight); + registry.fill(HIST("h3_jet_r_jet_pt_cluster_eta_rhoareasubtracted"), jet.r() / 100.0, jet.pt() - (rho * jet.area()), cluster.eta(), weight); + registry.fill(HIST("h3_jet_r_jet_pt_cluster_phi_rhoareasubtracted"), jet.r() / 100.0, jet.pt() - (rho * jet.area()), cluster.phi(), weight); + registry.fill(HIST("h3_jet_r_jet_pt_cluster_energy_rhoareasubtracted"), jet.r() / 100.0, jet.pt() - (rho * jet.area()), cluster.energy(), weight); + } } template @@ -224,6 +301,7 @@ struct JetFinderFullQATask { return; } + float neutralEnergy = 0.0; if (jet.r() == round(selectedJetsRadius * 100.0f)) { registry.fill(HIST("h_jet_pt_part"), jet.pt(), weight); registry.fill(HIST("h_jet_eta_part"), jet.eta(), weight); @@ -237,48 +315,97 @@ struct JetFinderFullQATask { registry.fill(HIST("h3_jet_r_part_jet_pt_part_jet_ntracks_part"), jet.r() / 100.0, jet.pt(), jet.tracks().size(), weight); for (auto& constituent : jet.template tracks_as()) { - + auto pdgParticle = pdgDatabase->GetParticle(constituent.pdgCode()); + if (pdgParticle->Charge() == 0) { + neutralEnergy += constituent.e(); + } registry.fill(HIST("h3_jet_r_part_jet_pt_part_track_pt_part"), jet.r() / 100.0, jet.pt(), constituent.pt(), weight); registry.fill(HIST("h3_jet_r_part_jet_pt_part_track_eta_part"), jet.r() / 100.0, jet.pt(), constituent.eta(), weight); registry.fill(HIST("h3_jet_r_part_jet_pt_part_track_phi_part"), jet.r() / 100.0, jet.pt(), constituent.phi(), weight); } + registry.fill(HIST("h3_jet_r_part_jet_pt_part_jet_neutralenergyfraction_part"), jet.r() / 100.0, jet.pt(), neutralEnergy / jet.energy(), weight); } template - void fillMCMatchedHistograms(T const& mcdjet, float weight = 1.0) + void fillMatchedHistograms(T const& jetBase, float weight = 1.0) { float pTHat = 10. / (std::pow(weight, 1.0 / pTHatExponent)); - if (mcdjet.pt() > pTHatMaxMCD * pTHat) { + if (jetBase.pt() > pTHatMaxMCD * pTHat) { return; } - for (auto& mcpjet : mcdjet.template matchedJetGeo_as>()) { + if (jetBase.has_matchedJetGeo()) { + for (auto& jetTag : jetBase.template matchedJetGeo_as>()) { + if (jetTag.pt() > pTHatMaxMCP * pTHat) { + continue; + } + registry.fill(HIST("h3_jet_r_jet_pt_tag_jet_pt_base_matchedgeo"), jetBase.r() / 100.0, jetTag.pt(), jetBase.pt(), weight); + registry.fill(HIST("h3_jet_r_jet_eta_tag_jet_eta_base_matchedgeo"), jetBase.r() / 100.0, jetTag.eta(), jetBase.eta(), weight); + registry.fill(HIST("h3_jet_r_jet_phi_tag_jet_phi_base_matchedgeo"), jetBase.r() / 100.0, jetTag.phi(), jetBase.phi(), weight); + registry.fill(HIST("h3_jet_r_jet_ntracks_tag_jet_ntracks_base_matchedgeo"), jetBase.r() / 100.0, jetTag.tracks().size(), jetBase.tracks().size(), weight); + registry.fill(HIST("h3_jet_r_jet_pt_tag_jet_pt_base_diff_matchedgeo"), jetBase.r() / 100.0, jetTag.pt(), (jetTag.pt() - jetBase.pt()) / jetTag.pt(), weight); + registry.fill(HIST("h3_jet_r_jet_pt_tag_jet_eta_base_diff_matchedgeo"), jetBase.r() / 100.0, jetTag.pt(), (jetTag.eta() - jetBase.eta()) / jetTag.eta(), weight); + registry.fill(HIST("h3_jet_r_jet_pt_tag_jet_phi_base_diff_matchedgeo"), jetBase.r() / 100.0, jetTag.pt(), (jetTag.phi() - jetBase.phi()) / jetTag.phi(), weight); + + if (jetBase.r() == round(selectedJetsRadius * 100.0f)) { + registry.fill(HIST("h3_jet_pt_tag_jet_eta_tag_jet_eta_matchedgeo"), jetTag.pt(), jetTag.eta(), jetBase.eta(), weight); + registry.fill(HIST("h3_jet_pt_tag_jet_phi_tag_jet_phi_matchedgeo"), jetTag.pt(), jetTag.phi(), jetBase.phi(), weight); + registry.fill(HIST("h3_jet_pt_tag_jet_ntracks_tag_jet_ntracks_matchedgeo"), jetTag.pt(), jetTag.tracks().size(), jetBase.tracks().size(), weight); + } + } + } - if (mcpjet.pt() > pTHatMaxMCP * pTHat) { - continue; + if (jetBase.has_matchedJetPt()) { + for (auto& jetTag : jetBase.template matchedJetPt_as>()) { + if (jetTag.pt() > pTHatMaxMCP * pTHat) { + continue; + } + registry.fill(HIST("h3_jet_r_jet_pt_tag_jet_pt_base_matchedpt"), jetBase.r() / 100.0, jetTag.pt(), jetBase.pt(), weight); + registry.fill(HIST("h3_jet_r_jet_eta_tag_jet_eta_base_matchedpt"), jetBase.r() / 100.0, jetTag.eta(), jetBase.eta(), weight); + registry.fill(HIST("h3_jet_r_jet_phi_tag_jet_phi_base_matchedpt"), jetBase.r() / 100.0, jetTag.phi(), jetBase.phi(), weight); + registry.fill(HIST("h3_jet_r_jet_ntracks_tag_jet_ntracks_base_matchedpt"), jetBase.r() / 100.0, jetTag.tracks().size(), jetBase.tracks().size(), weight); + registry.fill(HIST("h3_jet_r_jet_pt_tag_jet_pt_base_diff_matchedpt"), jetBase.r() / 100.0, jetTag.pt(), (jetTag.pt() - jetBase.pt()) / jetTag.pt(), weight); + registry.fill(HIST("h3_jet_r_jet_pt_tag_jet_eta_base_diff_matchedpt"), jetBase.r() / 100.0, jetTag.pt(), (jetTag.eta() - jetBase.eta()) / jetTag.eta(), weight); + registry.fill(HIST("h3_jet_r_jet_pt_tag_jet_phi_base_diff_matchedpt"), jetBase.r() / 100.0, jetTag.pt(), (jetTag.phi() - jetBase.phi()) / jetTag.phi(), weight); + + if (jetBase.r() == round(selectedJetsRadius * 100.0f)) { + registry.fill(HIST("h3_jet_pt_tag_jet_eta_tag_jet_eta_base_matchedpt"), jetTag.pt(), jetTag.eta(), jetBase.eta(), weight); + registry.fill(HIST("h3_jet_pt_tag_jet_phi_tag_jet_phi_base_matchedpt"), jetTag.pt(), jetTag.phi(), jetBase.phi(), weight); + registry.fill(HIST("h3_jet_pt_tag_jet_ntracks_tag_jet_ntracks_base_matchedpt"), jetTag.pt(), jetTag.tracks().size(), jetBase.tracks().size(), weight); + } } + } - registry.fill(HIST("h3_jet_r_jet_pt_part_jet_pt"), mcdjet.r() / 100.0, mcpjet.pt(), mcdjet.pt(), weight); - registry.fill(HIST("h3_jet_r_jet_eta_part_jet_eta"), mcdjet.r() / 100.0, mcpjet.eta(), mcdjet.eta(), weight); - registry.fill(HIST("h3_jet_r_jet_phi_part_jet_phi"), mcdjet.r() / 100.0, mcpjet.phi(), mcdjet.phi(), weight); - registry.fill(HIST("h3_jet_r_jet_ntracks_part_jet_ntracks"), mcdjet.r() / 100.0, mcpjet.tracks().size(), mcdjet.tracks().size(), weight); // Note: At truth level tracks include both neutral and charged particles. Is it worth differentiating these in the jetFinder? - registry.fill(HIST("h3_jet_r_jet_pt_part_jet_pt_diff"), mcdjet.r() / 100.0, mcpjet.pt(), (mcpjet.pt() - mcdjet.pt()) / mcpjet.pt(), weight); - registry.fill(HIST("h3_jet_r_jet_pt_part_jet_eta_diff"), mcdjet.r() / 100.0, mcpjet.pt(), (mcpjet.eta() - mcdjet.eta()) / mcpjet.eta(), weight); - registry.fill(HIST("h3_jet_r_jet_pt_part_jet_phi_diff"), mcdjet.r() / 100.0, mcpjet.pt(), (mcpjet.phi() - mcdjet.phi()) / mcpjet.phi(), weight); - - if (mcdjet.r() == round(selectedJetsRadius * 100.0f)) { - registry.fill(HIST("h3_jet_pt_part_jet_eta_part_jet_eta"), mcpjet.pt(), mcpjet.eta(), mcdjet.eta(), weight); - registry.fill(HIST("h3_jet_pt_part_jet_phi_part_jet_phi"), mcpjet.pt(), mcpjet.phi(), mcdjet.phi(), weight); - registry.fill(HIST("h3_jet_pt_part_jet_ntracks_part_jet_ntracks"), mcpjet.pt(), mcpjet.tracks().size(), mcdjet.tracks().size(), weight); + if (jetBase.has_matchedJetGeo() && jetBase.has_matchedJetPt()) { + for (auto& jetTag : jetBase.template matchedJetGeo_as>()) { + if (jetTag.pt() > pTHatMaxMCP * pTHat) { + continue; + } + if (jetBase.template matchedJetGeo_first_as>().globalIndex() == jetBase.template matchedJetPt_first_as>().globalIndex()) { // not a good way to do this + registry.fill(HIST("h3_jet_r_jet_pt_tag_jet_pt_base_matchedgeopt"), jetBase.r() / 100.0, jetTag.pt(), jetBase.pt(), weight); + registry.fill(HIST("h3_jet_r_jet_eta_tag_jet_eta_base_matchedgeopt"), jetBase.r() / 100.0, jetTag.eta(), jetBase.eta(), weight); + registry.fill(HIST("h3_jet_r_jet_phi_tag_jet_phi_base_matchedgeopt"), jetBase.r() / 100.0, jetTag.phi(), jetBase.phi(), weight); + registry.fill(HIST("h3_jet_r_jet_ntracks_tag_jet_ntracks_base_matchedgeopt"), jetBase.r() / 100.0, jetTag.tracks().size(), jetBase.tracks().size(), weight); + registry.fill(HIST("h3_jet_r_jet_pt_tag_jet_pt_base_diff_matchedgeopt"), jetBase.r() / 100.0, jetTag.pt(), (jetTag.pt() - jetBase.pt()) / jetTag.pt(), weight); + registry.fill(HIST("h3_jet_r_jet_pt_tag_jet_eta_base_diff_matchedgeopt"), jetBase.r() / 100.0, jetTag.pt(), (jetTag.eta() - jetBase.eta()) / jetTag.eta(), weight); + registry.fill(HIST("h3_jet_r_jet_pt_tag_jet_phi_base_diff_matchedgeopt"), jetBase.r() / 100.0, jetTag.pt(), (jetTag.phi() - jetBase.phi()) / jetTag.phi(), weight); + + if (jetBase.r() == round(selectedJetsRadius * 100.0f)) { + registry.fill(HIST("h3_jet_pt_tag_jet_eta_tag_jet_eta_base_matchedpt"), jetTag.pt(), jetTag.eta(), jetBase.eta(), weight); + registry.fill(HIST("h3_jet_pt_tag_jet_phi_tag_jet_phi_base_matchedpt"), jetTag.pt(), jetTag.phi(), jetBase.phi(), weight); + registry.fill(HIST("h3_jet_pt_tag_jet_ntracks_tag_jet_ntracks_base_matchedpt"), jetTag.pt(), jetTag.tracks().size(), jetBase.tracks().size(), weight); + } + } } } } - void fillTrackHistograms(soa::Filtered const& tracks, soa::Filtered const& clusters, float weight = 1.0) + template + void fillTrackHistograms(T const& tracks, U const& clusters, float weight = 1.0) { for (auto const& track : tracks) { - if (!JetDerivedDataUtilities::selectTrack(track, trackSelection) || !JetDerivedDataUtilities::applyTrackKinematics(track, trackPtMin, trackPtMax, trackEtaMin, trackEtaMax)) { + if (!jetderiveddatautilities::selectTrack(track, trackSelection)) { continue; } registry.fill(HIST("h_track_pt"), track.pt(), weight); @@ -294,42 +421,59 @@ struct JetFinderFullQATask { } } - void processDummy(aod::JCollisions const& collision) + void processDummy(JetCollisions const& collisions) { } PROCESS_SWITCH(JetFinderFullQATask, processDummy, "dummy task", true); - void processJetsData(typename JetTableDataJoined::iterator const& jet, JetTracks const& tracks, JetClusters const& clusters) + void processJetsData(soa::Filtered::iterator const& collision, JetTableDataJoined const& jets, JetTracks const& tracks, JetClusters const& clusters) { - fillHistograms(jet); + for (auto const& jet : jets) { + if (!jetfindingutilities::isInEtaAcceptance(jet, jetEtaMin, jetEtaMax, trackEtaMin, trackEtaMax)) { + continue; + } + fillHistograms(jet); + } } PROCESS_SWITCH(JetFinderFullQATask, processJetsData, "jet finder HF QA data", false); void processJetsMCD(typename JetTableMCDJoined::iterator const& jet, JetTracks const& tracks, JetClusters const& clusters) { + if (!jetfindingutilities::isInEtaAcceptance(jet, jetEtaMin, jetEtaMax, trackEtaMin, trackEtaMax)) { + return; + } fillHistograms(jet); } PROCESS_SWITCH(JetFinderFullQATask, processJetsMCD, "jet finder HF QA mcd", false); void processJetsMCDWeighted(typename JetTableMCDWeightedJoined::iterator const& jet, JetTracks const& tracks, JetClusters const& clusters) { + if (!jetfindingutilities::isInEtaAcceptance(jet, jetEtaMin, jetEtaMax, trackEtaMin, trackEtaMax)) { + return; + } fillHistograms(jet, jet.eventWeight()); } PROCESS_SWITCH(JetFinderFullQATask, processJetsMCDWeighted, "jet finder HF QA mcd on weighted events", false); void processJetsMCP(typename JetTableMCPJoined::iterator const& jet, JetParticles const& particles) { + if (!jetfindingutilities::isInEtaAcceptance(jet, jetEtaMin, jetEtaMax, trackEtaMin, trackEtaMax)) { + return; + } fillMCPHistograms(jet); } PROCESS_SWITCH(JetFinderFullQATask, processJetsMCP, "jet finder HF QA mcp", false); - void processJetsMCPWeighted(typename JetTableMCDWeightedJoined::iterator const& jet, JetParticles const& particles) + void processJetsMCPWeighted(typename JetTableMCPWeightedJoined::iterator const& jet, JetParticles const& particles) { + if (!jetfindingutilities::isInEtaAcceptance(jet, jetEtaMin, jetEtaMax, trackEtaMin, trackEtaMax)) { + return; + } fillMCPHistograms(jet, jet.eventWeight()); } PROCESS_SWITCH(JetFinderFullQATask, processJetsMCPWeighted, "jet finder HF QA mcp on weighted events", false); - void processJetsMCPMCDMatched(aod::JCollisions::iterator const& collision, + void processJetsMCPMCDMatched(JetCollision const& collision, JetTableMCDMatchedJoined const& mcdjets, JetTableMCPMatchedJoined const& mcpjets, JetTracks const& tracks, @@ -338,13 +482,15 @@ struct JetFinderFullQATask { { for (const auto& mcdjet : mcdjets) { - - fillMCMatchedHistograms(mcdjet); + if (!jetfindingutilities::isInEtaAcceptance(mcdjet, jetEtaMin, jetEtaMax, trackEtaMin, trackEtaMax)) { + continue; + } + fillMatchedHistograms(mcdjet); } } PROCESS_SWITCH(JetFinderFullQATask, processJetsMCPMCDMatched, "jet finder HF QA matched mcp and mcd", false); - void processJetsMCPMCDMatchedWeighted(aod::JCollisions::iterator const& collision, + void processJetsMCPMCDMatchedWeighted(JetCollision const& collision, JetTableMCDMatchedWeightedJoined const& mcdjets, JetTableMCPMatchedWeightedJoined const& mcpjets, JetTracks const& tracks, @@ -353,25 +499,27 @@ struct JetFinderFullQATask { { for (const auto& mcdjet : mcdjets) { - - fillMCMatchedHistograms(mcdjet, mcdjet.eventWeight()); + if (!jetfindingutilities::isInEtaAcceptance(mcdjet, jetEtaMin, jetEtaMax, trackEtaMin, trackEtaMax)) { + continue; + } + fillMatchedHistograms(mcdjet, mcdjet.eventWeight()); } } PROCESS_SWITCH(JetFinderFullQATask, processJetsMCPMCDMatchedWeighted, "jet finder HF QA matched mcp and mcd on weighted events", false); - void processMCCollisionsWeighted(aod::JMcCollision const& collision) + void processMCCollisionsWeighted(JetMcCollision const& collision) { registry.fill(HIST("h_collision_eventweight_part"), collision.weight()); } PROCESS_SWITCH(JetFinderFullQATask, processMCCollisionsWeighted, "collision QA for weighted events", false); - void processTracks(aod::JCollision const& collision, + void processTracks(JetCollision const& collision, soa::Filtered const& tracks, soa::Filtered const& clusters) { registry.fill(HIST("h_collisions"), 0.5); - if (!JetDerivedDataUtilities::eventEMCAL(collision)) { + if (!jetderiveddatautilities::eventEMCAL(collision)) { return; } registry.fill(HIST("h_collisions"), 1.5); @@ -387,7 +535,7 @@ struct JetFinderFullQATask { float eventWeight = collision.mcCollision().weight(); registry.fill(HIST("h_collisions"), 0.5); registry.fill(HIST("h_collisions_weighted"), 0.5, eventWeight); - if (!JetDerivedDataUtilities::eventEMCAL(collision)) { + if (!jetderiveddatautilities::eventEMCAL(collision)) { return; } registry.fill(HIST("h_collisions"), 1.5); diff --git a/PWGJE/Tasks/jetfinderhfQA.cxx b/PWGJE/Tasks/jetfinderhfQA.cxx index 1072e967b6d..f577b67cf52 100644 --- a/PWGJE/Tasks/jetfinderhfQA.cxx +++ b/PWGJE/Tasks/jetfinderhfQA.cxx @@ -32,6 +32,8 @@ #include "PWGJE/DataModel/Jet.h" #include "PWGJE/Core/JetDerivedDataUtilities.h" +#include "PWGJE/Core/JetHFUtilities.h" +#include "PWGJE/Core/JetFindingUtilities.h" #include "EventFiltering/filterTables.h" @@ -40,56 +42,48 @@ using namespace o2::analysis; using namespace o2::framework; using namespace o2::framework::expressions; -template +template struct JetFinderHFQATask { + HistogramRegistry registry; Configurable selectedJetsRadius{"selectedJetsRadius", 0.4, "resolution parameter for histograms without radius"}; Configurable eventSelections{"eventSelections", "sel8", "choose event selection"}; Configurable vertexZCut{"vertexZCut", 10.0f, "Accepted z-vertex range"}; + Configurable centralityMin{"centralityMin", -999.0, "minimum centrality"}; + Configurable centralityMax{"centralityMax", 999.0, "maximum centrality"}; Configurable> jetRadii{"jetRadii", std::vector{0.4}, "jet resolution parameters"}; Configurable trackEtaMin{"trackEtaMin", -0.9, "minimum eta acceptance for tracks"}; Configurable trackEtaMax{"trackEtaMax", 0.9, "maximum eta acceptance for tracks"}; Configurable trackPtMin{"trackPtMin", 0.15, "minimum pT acceptance for tracks"}; Configurable trackPtMax{"trackPtMax", 100.0, "maximum pT acceptance for tracks"}; Configurable trackSelections{"trackSelections", "globalTracks", "set track selections"}; - Configurable selectionFlagD0{"selectionFlagD0", 1, "Selection Flag for D0"}; - Configurable selectionFlagD0bar{"selectionFlagD0bar", 1, "Selection Flag for D0bar"}; - Configurable selectionFlagLcToPKPi{"selectionFlagLcToPKPi", 1, "Selection Flag for Lc->PKPi"}; - Configurable selectionFlagLcToPiPK{"selectionFlagLcToPiPK", 1, "Selection Flag for Lc->PiPK"}; - Configurable selectionFlagBplus{"selectionFlagBplus", 1, "Selection Flag for B+"}; + Configurable jetEtaMin{"jetEtaMin", -99.0, "minimum jet pseudorapidity"}; + Configurable jetEtaMax{"jetEtaMax", 99.0, "maximum jet pseudorapidity"}; Configurable pTHatMaxMCD{"pTHatMaxMCD", 999.0, "maximum fraction of hard scattering for jet acceptance in detector MC"}; Configurable pTHatMaxMCP{"pTHatMaxMCP", 999.0, "maximum fraction of hard scattering for jet acceptance in particle MC"}; Configurable pTHatExponent{"pTHatExponent", 6.0, "exponent of the event weight for the calculation of pTHat"}; HfHelper hfHelper; - std::vector filledJetR; + std::vector filledJetR_Both; + std::vector filledJetR_Low; + std::vector filledJetR_High; std::vector jetRadiiValues; int eventSelection = -1; int trackSelection = -1; - double candMass; - void init(o2::framework::InitContext&) { - eventSelection = JetDerivedDataUtilities::initialiseEventSelection(static_cast(eventSelections)); - trackSelection = JetDerivedDataUtilities::initialiseTrackSelection(static_cast(trackSelections)); - - if constexpr (std::is_same_v, soa::Join>) { // Note : need to be careful if configurable workflow options are added later - candMass = o2::constants::physics::MassD0; - } - if constexpr (std::is_same_v, soa::Join>) { - candMass = o2::constants::physics::MassLambdaCPlus; - } - if constexpr (std::is_same_v, soa::Join>) { - candMass = o2::constants::physics::MassBPlus; - } + eventSelection = jetderiveddatautilities::initialiseEventSelection(static_cast(eventSelections)); + trackSelection = jetderiveddatautilities::initialiseTrackSelection(static_cast(trackSelections)); jetRadiiValues = (std::vector)jetRadii; for (std::size_t iJetRadius = 0; iJetRadius < jetRadiiValues.size(); iJetRadius++) { - filledJetR.push_back(0.0); + filledJetR_Both.push_back(0.0); + filledJetR_Low.push_back(0.0); + filledJetR_High.push_back(0.0); } auto jetRadiiBins = (std::vector)jetRadii; if (jetRadiiBins.size() > 1) { @@ -119,6 +113,51 @@ struct JetFinderHFQATask { registry.add("h3_candidatebar_invmass_jet_pt_candidate_pt", ";#it{m}_{inv, candidate bar} (GeV/#it{c}^{2}); #it{p}_{T,jet} (GeV/#it{c}) ;#it{p}_{T,candidate} (GeV/#it{c})", {HistType::kTH3F, {{500, 0.0, 5.0}, {200, 0.0, 200.0}, {200, 0.0, 200.0}}}); } + if (doprocessJetsRhoAreaSubData) { + + registry.add("h_jet_pt_rhoareasubtracted", "jet pT;#it{p}_{T,jet} (GeV/#it{c});entries", {HistType::kTH1F, {{200, 0., 200.}}}); + registry.add("h_jet_eta_rhoareasubtracted", "jet #eta;#eta_{jet};entries", {HistType::kTH1F, {{100, -1.0, 1.0}}}); + registry.add("h_jet_phi_rhoareasubtracted", "jet #varphi;#varphi_{jet};entries", {HistType::kTH1F, {{160, -1.0, 7.}}}); + registry.add("h_jet_ntracks_rhoareasubtracted", "jet N tracks;N_{jet tracks};entries", {HistType::kTH1F, {{200, -0.5, 199.5}}}); + registry.add("h3_jet_r_jet_pt_jet_eta_rhoareasubtracted", "#it{R}_{jet};#it{p}_{T,jet} (GeV/#it{c});#eta_{jet}", {HistType::kTH3F, {{jetRadiiBins, ""}, {200, 0., 200.}, {100, -1.0, 1.0}}}); + registry.add("h3_jet_r_jet_pt_jet_phi_rhoareasubtracted", "#it{R}_{jet};#it{p}_{T,jet} (GeV/#it{c});#varphi_{jet}", {HistType::kTH3F, {{jetRadiiBins, ""}, {200, 0., 200.}, {160, -1.0, 7.}}}); + registry.add("h3_jet_r_jet_eta_jet_phi_rhoareasubtracted", "#it{R}_{jet};#eta_{jet};#varphi_{jet}", {HistType::kTH3F, {{jetRadiiBins, ""}, {100, -1.0, 1.0}, {160, -1.0, 7.}}}); + registry.add("h3_jet_r_jet_pt_jet_ntracks_rhoareasubtracted", "#it{R}_{jet};#it{p}_{T,jet} (GeV/#it{c});N_{jet tracks}", {HistType::kTH3F, {{jetRadiiBins, ""}, {200, 0., 200.}, {100, -0.5, 99.5}}}); + registry.add("h3_jet_r_jet_pt_jet_area_rhoareasubtracted", "#it{R}_{jet}; #it{p}_{T,jet} (GeV/#it{c}); #it{Area}_{jet}", {HistType::kTH3F, {{jetRadiiBins, ""}, {200, 0., 200.}, {300, 0., 3.}}}); + registry.add("h3_jet_r_jet_pt_track_pt_rhoareasubtracted", "#it{R}_{jet};#it{p}_{T,jet} (GeV/#it{c});#it{p}_{T,jet tracks} (GeV/#it{c})", {HistType::kTH3F, {{jetRadiiBins, ""}, {200, 0., 200.}, {200, 0., 200.}}}); + registry.add("h3_jet_r_jet_pt_track_eta_rhoareasubtracted", "#it{R}_{jet};#it{p}_{T,jet} (GeV/#it{c});#eta_{jet tracks}", {HistType::kTH3F, {{jetRadiiBins, ""}, {200, 0., 200.}, {100, -1.0, 1.0}}}); + registry.add("h3_jet_r_jet_pt_track_phi_rhoareasubtracted", "#it{R}_{jet};#it{p}_{T,jet} (GeV/#it{c});#varphi_{jet tracks}", {HistType::kTH3F, {{jetRadiiBins, ""}, {200, 0., 200.}, {160, -1.0, 7.}}}); + registry.add("h3_jet_r_jet_pt_jet_pt_rhoareasubtracted", "#it{R}_{jet};#it{p}_{T,jet} (GeV/#it{c});#it{p}_{T,jet} (GeV/#it{c})", {HistType::kTH3F, {{jetRadiiBins, ""}, {200, 0., 200.}, {200, 0., 200.}}}); + registry.add("h3_jet_r_jet_pt_candidate_pt_rhoareasubtracted", "#it{R}_{jet};#it{p}_{T,jet} (GeV/#it{c});#it{p}_{T,candidate} (GeV/#it{c})", {HistType::kTH3F, {{jetRadiiBins, ""}, {200, 0., 200.}, {200, 0., 200.}}}); + registry.add("h3_jet_r_jet_pt_candidate_eta_rhoareasubtracted", "#it{R}_{jet};#it{p}_{T,jet} (GeV/#it{c});#eta_{candidate}", {HistType::kTH3F, {{jetRadiiBins, ""}, {200, 0., 200.}, {100, -1.0, 1.0}}}); + registry.add("h3_jet_r_jet_pt_candidate_phi_rhoareasubtracted", "#it{R}_{jet};#it{p}_{T,jet} (GeV/#it{c});#varphi_{candidate}", {HistType::kTH3F, {{jetRadiiBins, ""}, {200, 0., 200.}, {160, -1.0, 7.}}}); + registry.add("h3_jet_r_jet_pt_candidate_y_rhoareasubtracted", "#it{R}_{jet};#it{p}_{T,jet} (GeV/#it{c});y_{candidate}", {HistType::kTH3F, {{jetRadiiBins, ""}, {200, 0., 200.}, {100, -1.0, 1.0}}}); + } + + if (doprocessEvtWiseConstSubJetsData) { + registry.add("h_jet_pt_eventwiseconstituentsubtracted", "jet pT;#it{p}_{T,jet} (GeV/#it{c});entries", {HistType::kTH1F, {{200, 0., 200.}}}); + registry.add("h_jet_eta_eventwiseconstituentsubtracted", "jet #eta;#eta_{jet};entries", {HistType::kTH1F, {{100, -1.0, 1.0}}}); + registry.add("h_jet_phi_eventwiseconstituentsubtracted", "jet #varphi;#varphi_{jet};entries", {HistType::kTH1F, {{160, -1.0, 7.}}}); + registry.add("h_jet_ntracks_eventwiseconstituentsubtracted", "jet N tracks;N_{jet tracks};entries", {HistType::kTH1F, {{200, -0.5, 199.5}}}); + registry.add("h3_jet_r_jet_pt_jet_eta_eventwiseconstituentsubtracted", "#it{R}_{jet};#it{p}_{T,jet} (GeV/#it{c});#eta_{jet}", {HistType::kTH3F, {{jetRadiiBins, ""}, {200, 0., 200.}, {100, -1.0, 1.0}}}); + registry.add("h3_jet_r_jet_pt_jet_phi_eventwiseconstituentsubtracted", "#it{R}_{jet};#it{p}_{T,jet} (GeV/#it{c});#varphi_{jet}", {HistType::kTH3F, {{jetRadiiBins, ""}, {200, 0., 200.}, {160, -1.0, 7.}}}); + registry.add("h3_jet_r_jet_eta_jet_phi_eventwiseconstituentsubtracted", "#it{R}_{jet};#eta_{jet};#varphi_{jet}", {HistType::kTH3F, {{jetRadiiBins, ""}, {100, -1.0, 1.0}, {160, -1.0, 7.}}}); + registry.add("h3_jet_r_jet_pt_jet_ntracks_eventwiseconstituentsubtracted", "#it{R}_{jet};#it{p}_{T,jet} (GeV/#it{c});N_{jet tracks}", {HistType::kTH3F, {{jetRadiiBins, ""}, {200, 0., 200.}, {100, -0.5, 99.5}}}); + registry.add("h3_jet_r_jet_pt_jet_area_eventwiseconstituentsubtracted", "#it{R}_{jet}; #it{p}_{T,jet} (GeV/#it{c}); #it{Area}_{jet}", {HistType::kTH3F, {{jetRadiiBins, ""}, {200, 0., 200.}, {300, 0., 3.}}}); + registry.add("h3_jet_r_jet_pt_track_pt_eventwiseconstituentsubtracted", "#it{R}_{jet};#it{p}_{T,jet} (GeV/#it{c});#it{p}_{T,jet tracks} (GeV/#it{c})", {HistType::kTH3F, {{jetRadiiBins, ""}, {200, 0., 200.}, {200, 0., 200.}}}); + registry.add("h3_jet_r_jet_pt_track_eta_eventwiseconstituentsubtracted", "#it{R}_{jet};#it{p}_{T,jet} (GeV/#it{c});#eta_{jet tracks}", {HistType::kTH3F, {{jetRadiiBins, ""}, {200, 0., 200.}, {100, -1.0, 1.0}}}); + registry.add("h3_jet_r_jet_pt_track_phi_eventwiseconstituentsubtracted", "#it{R}_{jet};#it{p}_{T,jet} (GeV/#it{c});#varphi_{jet tracks}", {HistType::kTH3F, {{jetRadiiBins, ""}, {200, 0., 200.}, {160, -1.0, 7.}}}); + registry.add("h3_jet_r_jet_pt_candidate_pt_eventwiseconstituentsubtracted", "#it{R}_{jet};#it{p}_{T,jet} (GeV/#it{c});#it{p}_{T,candidate} (GeV/#it{c})", {HistType::kTH3F, {{jetRadiiBins, ""}, {200, 0., 200.}, {200, 0., 200.}}}); + registry.add("h3_jet_r_jet_pt_candidate_eta_eventwiseconstituentsubtracted", "#it{R}_{jet};#it{p}_{T,jet} (GeV/#it{c});#eta_{candidate}", {HistType::kTH3F, {{jetRadiiBins, ""}, {200, 0., 200.}, {100, -1.0, 1.0}}}); + registry.add("h3_jet_r_jet_pt_candidate_phi_eventwiseconstituentsubtracted", "#it{R}_{jet};#it{p}_{T,jet} (GeV/#it{c});#varphi_{candidate}", {HistType::kTH3F, {{jetRadiiBins, ""}, {200, 0., 200.}, {160, -1.0, 7.}}}); + registry.add("h3_jet_r_jet_pt_candidate_y_eventwiseconstituentsubtracted", "#it{R}_{jet};#it{p}_{T,jet} (GeV/#it{c});y_{candidate}", {HistType::kTH3F, {{jetRadiiBins, ""}, {200, 0., 200.}, {100, -1.0, 1.0}}}); + } + + if (doprocessRho) { + registry.add("h2_rho_centrality", "#it{rho} (GeV/area); centrality", {HistType::kTH2F, {{400, 0., 400.0}, {1100, 0., 110.}}}); + registry.add("h2_rhom_centrality", "#it{rho}_{m} (GeV/area); centrality", {HistType::kTH2F, {{400, 0., 400.0}, {1100, 0., 110.}}}); + } + if (doprocessJetsMCP || doprocessJetsMCPWeighted) { registry.add("h_jet_pt_part", "jet pT;#it{p}_{T,jet}^{part}(GeV/#it{c});entries", {HistType::kTH1F, {{200, 0., 200.}}}); registry.add("h_jet_eta_part", "jet #eta;#eta_{jet}^{part};entries", {HistType::kTH1F, {{100, -1.0, 1.0}}}); @@ -137,21 +176,104 @@ struct JetFinderHFQATask { registry.add("h3_jet_r_part_jet_pt_part_candidate_y_part", "#it{R}_{jet}^{part};#it{p}_{T,jet}^{part} (GeV/#it{c});y_{candidate}^{part}", {HistType::kTH3F, {{jetRadiiBins, ""}, {200, 0., 200.}, {100, -1.0, 1.0}}}); } - if (doprocessJetsMCPMCDMatched || doprocessJetsMCPMCDMatchedWeighted) { - registry.add("h3_jet_r_jet_pt_part_jet_pt", "#it{R}_{jet};#it{p}_{T,jet}^{part} (GeV/#it{c});#it{p}_{T,jet} (GeV/#it{c})", {HistType::kTH3F, {{jetRadiiBins, ""}, {200, 0., 200.}, {200, 0., 200.}}}); - registry.add("h3_jet_r_jet_eta_part_jet_eta", "#it{R}_{jet};#eta_{jet}^{part};#eta_{jet}", {HistType::kTH3F, {{jetRadiiBins, ""}, {200, 0., 200.}, {100, -1.0, 1.0}}}); - registry.add("h3_jet_r_jet_phi_part_jet_phi", "#it{R}_{jet};#varphi_{jet}^{part};#varphi_{jet}", {HistType::kTH3F, {{jetRadiiBins, ""}, {200, 0., 200.}, {160, -1.0, 7.}}}); - registry.add("h3_jet_r_jet_ntracks_part_jet_ntracks", "#it{R}_{jet};N_{jet tracks}^{part};N_{jet tracks}", {HistType::kTH3F, {{jetRadiiBins, ""}, {100, -0.5, 99.5}, {100, -0.5, 99.5}}}); - registry.add("h3_jet_r_candidate_pt_part_candidate_pt", "#it{R}_{jet};#it{p}_{T,candidate}^{part} (GeV/#it{c});#it{p}_{T,candidate} (GeV/#it{c})", {HistType::kTH3F, {{jetRadiiBins, ""}, {200, 0., 200.}, {200, 0., 200.}}}); - registry.add("h3_jet_r_candidate_eta_part_candidate_eta", "#it{R}_{jet};#eta_{candidate}^{part};#eta_{candidate}", {HistType::kTH3F, {{jetRadiiBins, ""}, {100, -1.0, 1.0}, {100, -1.0, 1.0}}}); - registry.add("h3_jet_r_candidate_phi_part_candidate_phi", "#it{R}_{jet};#varphi_{candidate}^{part};#varphi_{candidate}", {HistType::kTH3F, {{jetRadiiBins, ""}, {160, -1.0, 7.}, {160, -1.0, 7.}}}); - registry.add("h3_jet_r_candidate_y_part_candidate_y", "#it{R}_{jet};#y_{candidate}^{part};#y_{candidate}", {HistType::kTH3F, {{jetRadiiBins, ""}, {100, -1.0, 1.0}, {100, -1.0, 1.0}}}); - registry.add("h3_jet_r_jet_pt_part_jet_pt_diff", "#it{R}_{jet};#it{p}_{T,jet}^{part} (GeV/#it{c}); (#it{p}_{T,jet}^{part} (GeV/#it{c}) - #it{p}_{T,jet} (GeV/#it{c})) / #it{p}_{T,jet}^{part} (GeV/#it{c})", {HistType::kTH3F, {{jetRadiiBins, ""}, {200, 0.0, 200}, {1000, -5.0, 5.0}}}); - registry.add("h3_jet_r_jet_pt_part_jet_eta_diff", "#it{R}_{jet};#it{p}_{T,jet}^{part} (GeV/#it{c}); (#eta_{jet}^{part} - #eta_{jet}) / #eta_{jet}^{part}", {HistType::kTH3F, {{jetRadiiBins, ""}, {200, 0.0, 200}, {1000, -5.0, 5.0}}}); - registry.add("h3_jet_r_jet_pt_part_jet_phi_diff", "#it{R}_{jet};#it{p}_{T,jet}^{part} (GeV/#it{c}); (#varphi_{jet}^{part} - #varphi_{jet}) / #varphi_{jet}^{part}", {HistType::kTH3F, {{jetRadiiBins, ""}, {200, 0.0, 200}, {1000, -5.0, 5.0}}}); - registry.add("h3_jet_pt_part_jet_eta_part_jet_eta", ";#it{p}_{T,jet}^{part} (GeV/#it{c}); #eta_{jet}^{part}; #eta_{jet}", {HistType::kTH3F, {{200, 0.0, 200}, {100, -1.0, 1.0}, {100, -1.0, 1.0}}}); - registry.add("h3_jet_pt_part_jet_phi_part_jet_phi", ";#it{p}_{T,jet}^{part} (GeV/#it{c}); #varphi_{jet}^{part}; #varphi_{jet}", {HistType::kTH3F, {{200, 0.0, 200}, {160, -1.0, 7.}, {160, -1.0, 7.}}}); - registry.add("h3_jet_pt_part_jet_ntracks_part_jet_ntracks", ";#it{p}_{T,jet}^{part} (GeV/#it{c}); N_{jet tracks}^{part}; N_{jet tracks}", {HistType::kTH3F, {{200, 0.0, 200}, {100, -0.5, 99.5}, {100, -0.5, 99.5}}}); + if (doprocessJetsMCPMCDMatched || doprocessJetsMCPMCDMatchedWeighted || doprocessJetsSubMatched) { + registry.add("h3_jet_r_jet_pt_tag_jet_pt_base_matchedgeo", "#it{R}_{jet};#it{p}_{T,jet}^{tag} (GeV/#it{c});#it{p}_{T,jet}^{base} (GeV/#it{c})", {HistType::kTH3F, {{jetRadiiBins, ""}, {200, 0., 200.}, {200, 0., 200.}}}); + registry.add("h3_jet_r_jet_eta_tag_jet_eta_base_matchedgeo", "#it{R}_{jet};#eta_{jet}^{tag};#eta_{jet}^{base}", {HistType::kTH3F, {{jetRadiiBins, ""}, {200, 0., 200.}, {100, -1.0, 1.0}}}); + registry.add("h3_jet_r_jet_phi_tag_jet_phi_base_matchedgeo", "#it{R}_{jet};#varphi_{jet}^{tag};#varphi_{jet}^{base}", {HistType::kTH3F, {{jetRadiiBins, ""}, {200, 0., 200.}, {160, -1.0, 7.}}}); + registry.add("h3_jet_r_jet_ntracks_tag_jet_ntracks_base_matchedgeo", "#it{R}_{jet};N_{jet tracks}^{tag};N_{jet tracks}^{base}", {HistType::kTH3F, {{jetRadiiBins, ""}, {100, -0.5, 99.5}, {100, -0.5, 99.5}}}); + registry.add("h3_jet_r_candidate_pt_tag_candidate_pt_base_matchedgeo", "#it{R}_{jet};#it{p}_{T,candidate}^{tag} (GeV/#it{c});#it{p}_{T,candidate}^{base} (GeV/#it{c})", {HistType::kTH3F, {{jetRadiiBins, ""}, {200, 0., 200.}, {200, 0., 200.}}}); + registry.add("h3_jet_r_candidate_eta_tag_candidate_eta_base_matchedgeo", "#it{R}_{jet};#eta_{candidate}^{tag};#eta_{candidate}^{base}", {HistType::kTH3F, {{jetRadiiBins, ""}, {100, -1.0, 1.0}, {100, -1.0, 1.0}}}); + registry.add("h3_jet_r_candidate_phi_tag_candidate_phi_base_matchedgeo", "#it{R}_{jet};#varphi_{candidate}^{tag};#varphi_{candidate}^{base}", {HistType::kTH3F, {{jetRadiiBins, ""}, {160, -1.0, 7.}, {160, -1.0, 7.}}}); + registry.add("h3_jet_r_jet_pt_tag_jet_pt_base_diff_matchedgeo", "#it{R}_{jet};#it{p}_{T,jet}^{tag} (GeV/#it{c}); (#it{p}_{T,jet}^{tag} (GeV/#it{c}) - #it{p}_{T,jet}^{base} (GeV/#it{c})) / #it{p}_{T,jet}^{tag} (GeV/#it{c})", {HistType::kTH3F, {{jetRadiiBins, ""}, {200, 0.0, 200}, {1000, -5.0, 5.0}}}); + registry.add("h3_jet_r_jet_pt_tag_jet_eta_base_diff_matchedgeo", "#it{R}_{jet};#it{p}_{T,jet}^{tag} (GeV/#it{c}); (#eta_{jet}^{tag} - #eta_{jet}^{base}) / #eta_{jet}^{tag}", {HistType::kTH3F, {{jetRadiiBins, ""}, {200, 0.0, 200}, {1000, -5.0, 5.0}}}); + registry.add("h3_jet_r_jet_pt_tag_jet_phi_base_diff_matchedgeo", "#it{R}_{jet};#it{p}_{T,jet}^{tag} (GeV/#it{c}); (#varphi_{jet}^{tag} - #varphi_{jet}^{base}) / #varphi_{jet}^{tag}", {HistType::kTH3F, {{jetRadiiBins, ""}, {200, 0.0, 200}, {1000, -5.0, 5.0}}}); + registry.add("h3_jet_pt_tag_jet_eta_tag_jet_eta_base_matchedgeo", ";#it{p}_{T,jet}^{tag} (GeV/#it{c}); #eta_{jet}^{tag}; #eta_{jet}^{base}", {HistType::kTH3F, {{200, 0.0, 200}, {100, -1.0, 1.0}, {100, -1.0, 1.0}}}); + registry.add("h3_jet_pt_tag_jet_phi_tag_jet_phi_base_matchedgeo", ";#it{p}_{T,jet}^{tag} (GeV/#it{c}); #varphi_{jet}^{tag}; #varphi_{jet}^{base}", {HistType::kTH3F, {{200, 0.0, 200}, {160, -1.0, 7.}, {160, -1.0, 7.}}}); + registry.add("h3_jet_pt_tag_jet_ntracks_tag_jet_ntracks_base_matchedgeo", ";#it{p}_{T,jet}^{tag} (GeV/#it{c}); N_{jet tracks}^{tag}; N_{jet tracks}^{base}", {HistType::kTH3F, {{200, 0.0, 200}, {100, -0.5, 99.5}, {100, -0.5, 99.5}}}); + + registry.add("h3_jet_r_jet_pt_tag_jet_pt_base_matchedpt", "#it{R}_{jet};#it{p}_{T,jet}^{tag} (GeV/#it{c});#it{p}_{T,jet}^{base} (GeV/#it{c})", {HistType::kTH3F, {{jetRadiiBins, ""}, {200, 0., 200.}, {200, 0., 200.}}}); + registry.add("h3_jet_r_jet_eta_tag_jet_eta_base_matchedpt", "#it{R}_{jet};#eta_{jet}^{tag};#eta_{jet}^{base}", {HistType::kTH3F, {{jetRadiiBins, ""}, {200, 0., 200.}, {100, -1.0, 1.0}}}); + registry.add("h3_jet_r_jet_phi_tag_jet_phi_base_matchedpt", "#it{R}_{jet};#varphi_{jet}^{tag};#varphi_{jet}^{base}", {HistType::kTH3F, {{jetRadiiBins, ""}, {200, 0., 200.}, {160, -1.0, 7.}}}); + registry.add("h3_jet_r_jet_ntracks_tag_jet_ntracks_base_matchedpt", "#it{R}_{jet};N_{jet tracks}^{tag};N_{jet tracks}^{base}", {HistType::kTH3F, {{jetRadiiBins, ""}, {100, -0.5, 99.5}, {100, -0.5, 99.5}}}); + registry.add("h3_jet_r_candidate_pt_tag_candidate_pt_base_matchedpt", "#it{R}_{jet};#it{p}_{T,candidate}^{tag} (GeV/#it{c});#it{p}_{T,candidate} (GeV/#it{c})", {HistType::kTH3F, {{jetRadiiBins, ""}, {200, 0., 200.}, {200, 0., 200.}}}); + registry.add("h3_jet_r_candidate_eta_tag_candidate_eta_base_matchedpt", "#it{R}_{jet};#eta_{candidate}^{tag};#eta_{candidate}^{base}", {HistType::kTH3F, {{jetRadiiBins, ""}, {100, -1.0, 1.0}, {100, -1.0, 1.0}}}); + registry.add("h3_jet_r_candidate_phi_tag_candidate_phi_base_matchedpt", "#it{R}_{jet};#varphi_{candidate}^{tag};#varphi_{candidate}^{base}", {HistType::kTH3F, {{jetRadiiBins, ""}, {160, -1.0, 7.}, {160, -1.0, 7.}}}); + registry.add("h3_jet_r_jet_pt_tag_jet_pt_base_diff_matchedpt", "#it{R}_{jet};#it{p}_{T,jet}^{tag} (GeV/#it{c}); (#it{p}_{T,jet}^{tag} (GeV/#it{c}) - #it{p}_{T,jet}^{base} (GeV/#it{c})) / #it{p}_{T,jet}^{tag} (GeV/#it{c})", {HistType::kTH3F, {{jetRadiiBins, ""}, {200, 0.0, 200}, {1000, -5.0, 5.0}}}); + registry.add("h3_jet_r_jet_pt_tag_jet_eta_base_diff_matchedpt", "#it{R}_{jet};#it{p}_{T,jet}^{tag} (GeV/#it{c}); (#eta_{jet}^{tag} - #eta_{jet}^{base}) / #eta_{jet}^{tag}", {HistType::kTH3F, {{jetRadiiBins, ""}, {200, 0.0, 200}, {1000, -5.0, 5.0}}}); + registry.add("h3_jet_r_jet_pt_tag_jet_phi_base_diff_matchedpt", "#it{R}_{jet};#it{p}_{T,jet}^{tag} (GeV/#it{c}); (#varphi_{jet}^{tag} - #varphi_{jet}^{base}) / #varphi_{jet}^{tag}", {HistType::kTH3F, {{jetRadiiBins, ""}, {200, 0.0, 200}, {1000, -5.0, 5.0}}}); + registry.add("h3_jet_pt_tag_jet_eta_tag_jet_eta_base_matchedpt", ";#it{p}_{T,jet}^{tag} (GeV/#it{c}); #eta_{jet}^{tag}; #eta_{jet}^{base}", {HistType::kTH3F, {{200, 0.0, 200}, {100, -1.0, 1.0}, {100, -1.0, 1.0}}}); + registry.add("h3_jet_pt_tag_jet_phi_tag_jet_phi_base_matchedpt", ";#it{p}_{T,jet}^{tag} (GeV/#it{c}); #varphi_{jet}^{tag}; #varphi_{jet}^{base}", {HistType::kTH3F, {{200, 0.0, 200}, {160, -1.0, 7.}, {160, -1.0, 7.}}}); + registry.add("h3_jet_pt_tag_jet_ntracks_tag_jet_ntracks_base_matchedpt", ";#it{p}_{T,jet}^{tag} (GeV/#it{c}); N_{jet tracks}^{tag}; N_{jet tracks}^{base}", {HistType::kTH3F, {{200, 0.0, 200}, {100, -0.5, 99.5}, {100, -0.5, 99.5}}}); + + registry.add("h3_jet_r_jet_pt_tag_jet_pt_base_matchedgeopt", "#it{R}_{jet};#it{p}_{T,jet}^{tag} (GeV/#it{c});#it{p}_{T,jet}^{base} (GeV/#it{c})", {HistType::kTH3F, {{jetRadiiBins, ""}, {200, 0., 200.}, {200, 0., 200.}}}); + registry.add("h3_jet_r_jet_eta_tag_jet_eta_base_matchedgeopt", "#it{R}_{jet};#eta_{jet}^{tag};#eta_{jet}^{base}", {HistType::kTH3F, {{jetRadiiBins, ""}, {200, 0., 200.}, {100, -1.0, 1.0}}}); + registry.add("h3_jet_r_jet_phi_tag_jet_phi_base_matchedgeopt", "#it{R}_{jet};#varphi_{jet}^{tag};#varphi_{jet}^{base}", {HistType::kTH3F, {{jetRadiiBins, ""}, {200, 0., 200.}, {160, -1.0, 7.}}}); + registry.add("h3_jet_r_jet_ntracks_tag_jet_ntracks_base_matchedgeopt", "#it{R}_{jet};N_{jet tracks}^{tag};N_{jet tracks}^{base}", {HistType::kTH3F, {{jetRadiiBins, ""}, {100, -0.5, 99.5}, {100, -0.5, 99.5}}}); + registry.add("h3_jet_r_candidate_pt_tag_candidate_pt_base_matchedgeopt", "#it{R}_{jet};#it{p}_{T,candidate}^{tag} (GeV/#it{c});#it{p}_{T,candidate} (GeV/#it{c})", {HistType::kTH3F, {{jetRadiiBins, ""}, {200, 0., 200.}, {200, 0., 200.}}}); + registry.add("h3_jet_r_candidate_eta_tag_candidate_eta_base_matchedgeopt", "#it{R}_{jet};#eta_{candidate}^{tag};#eta_{candidate}^{base}", {HistType::kTH3F, {{jetRadiiBins, ""}, {100, -1.0, 1.0}, {100, -1.0, 1.0}}}); + registry.add("h3_jet_r_candidate_phi_tag_candidate_phi_base_matchedgeopt", "#it{R}_{jet};#varphi_{candidate}^{tag};#varphi_{candidate}^{base}", {HistType::kTH3F, {{jetRadiiBins, ""}, {160, -1.0, 7.}, {160, -1.0, 7.}}}); + registry.add("h3_jet_r_jet_pt_tag_jet_pt_base_diff_matchedgeopt", "#it{R}_{jet};#it{p}_{T,jet}^{tag} (GeV/#it{c}); (#it{p}_{T,jet}^{tag} (GeV/#it{c}) - #it{p}_{T,jet}^{base} (GeV/#it{c})) / #it{p}_{T,jet}^{tag} (GeV/#it{c})", {HistType::kTH3F, {{jetRadiiBins, ""}, {200, 0.0, 200}, {1000, -5.0, 5.0}}}); + registry.add("h3_jet_r_jet_pt_tag_jet_eta_base_diff_matchedgeopt", "#it{R}_{jet};#it{p}_{T,jet}^{tag} (GeV/#it{c}); (#eta_{jet}^{tag} - #eta_{jet}^{base}) / #eta_{jet}^{tag}", {HistType::kTH3F, {{jetRadiiBins, ""}, {200, 0.0, 200}, {1000, -5.0, 5.0}}}); + registry.add("h3_jet_r_jet_pt_tag_jet_phi_base_diff_matchedgeopt", "#it{R}_{jet};#it{p}_{T,jet}^{tag} (GeV/#it{c}); (#varphi_{jet}^{tag} - #varphi_{jet}^{base}) / #varphi_{jet}^{tag}", {HistType::kTH3F, {{jetRadiiBins, ""}, {200, 0.0, 200}, {1000, -5.0, 5.0}}}); + registry.add("h3_jet_pt_tag_jet_eta_tag_jet_eta_base_matchedgeopt", ";#it{p}_{T,jet}^{tag} (GeV/#it{c}); #eta_{jet}^{tag}; #eta_{jet}^{base}", {HistType::kTH3F, {{200, 0.0, 200}, {100, -1.0, 1.0}, {100, -1.0, 1.0}}}); + registry.add("h3_jet_pt_tag_jet_phi_tag_jet_phi_base_matchedgeopt", ";#it{p}_{T,jet}^{tag} (GeV/#it{c}); #varphi_{jet}^{tag}; #varphi_{jet}^{base}", {HistType::kTH3F, {{200, 0.0, 200}, {160, -1.0, 7.}, {160, -1.0, 7.}}}); + registry.add("h3_jet_pt_tag_jet_ntracks_tag_jet_ntracks_base_matchedgeopt", ";#it{p}_{T,jet}^{tag} (GeV/#it{c}); N_{jet tracks}^{tag}; N_{jet tracks}^{base}", {HistType::kTH3F, {{200, 0.0, 200}, {100, -0.5, 99.5}, {100, -0.5, 99.5}}}); + + registry.add("h3_jet_r_jet_pt_tag_jet_pt_base_matchedhf", "#it{R}_{jet};#it{p}_{T,jet}^{tag} (GeV/#it{c});#it{p}_{T,jet}^{base} (GeV/#it{c})", {HistType::kTH3F, {{jetRadiiBins, ""}, {200, 0., 200.}, {200, 0., 200.}}}); + registry.add("h3_jet_r_jet_eta_tag_jet_eta_base_matchedhf", "#it{R}_{jet};#eta_{jet}^{tag};#eta_{jet}^{base}", {HistType::kTH3F, {{jetRadiiBins, ""}, {200, 0., 200.}, {100, -1.0, 1.0}}}); + registry.add("h3_jet_r_jet_phi_tag_jet_phi_base_matchedhf", "#it{R}_{jet};#varphi_{jet}^{tag};#varphi_{jet}^{base}", {HistType::kTH3F, {{jetRadiiBins, ""}, {200, 0., 200.}, {160, -1.0, 7.}}}); + registry.add("h3_jet_r_jet_ntracks_tag_jet_ntracks_base_matchedhf", "#it{R}_{jet};N_{jet tracks}^{tag};N_{jet tracks}^{base}", {HistType::kTH3F, {{jetRadiiBins, ""}, {100, -0.5, 99.5}, {100, -0.5, 99.5}}}); + registry.add("h3_jet_r_candidate_pt_tag_candidate_pt_base_matchedhf", "#it{R}_{jet};#it{p}_{T,candidate}^{tag} (GeV/#it{c});#it{p}_{T,candidate} (GeV/#it{c})", {HistType::kTH3F, {{jetRadiiBins, ""}, {200, 0., 200.}, {200, 0., 200.}}}); + registry.add("h3_jet_r_candidate_eta_tag_candidate_eta_base_matchedhf", "#it{R}_{jet};#eta_{candidate}^{tag};#eta_{candidate}^{base}", {HistType::kTH3F, {{jetRadiiBins, ""}, {100, -1.0, 1.0}, {100, -1.0, 1.0}}}); + registry.add("h3_jet_r_candidate_phi_tag_candidate_phi_base_matchedhf", "#it{R}_{jet};#varphi_{candidate}^{tag};#varphi_{candidate}^{base}", {HistType::kTH3F, {{jetRadiiBins, ""}, {160, -1.0, 7.}, {160, -1.0, 7.}}}); + registry.add("h3_jet_r_jet_pt_tag_jet_pt_base_diff_matchedhf", "#it{R}_{jet};#it{p}_{T,jet}^{tag} (GeV/#it{c}); (#it{p}_{T,jet}^{tag} (GeV/#it{c}) - #it{p}_{T,jet}^{base} (GeV/#it{c})) / #it{p}_{T,jet}^{tag} (GeV/#it{c})", {HistType::kTH3F, {{jetRadiiBins, ""}, {200, 0.0, 200}, {1000, -5.0, 5.0}}}); + registry.add("h3_jet_r_jet_pt_tag_jet_eta_base_diff_matchedhf", "#it{R}_{jet};#it{p}_{T,jet}^{tag} (GeV/#it{c}); (#eta_{jet}^{tag} - #eta_{jet}^{base}) / #eta_{jet}^{tag}", {HistType::kTH3F, {{jetRadiiBins, ""}, {200, 0.0, 200}, {1000, -5.0, 5.0}}}); + registry.add("h3_jet_r_jet_pt_tag_jet_phi_base_diff_matchedhf", "#it{R}_{jet};#it{p}_{T,jet}^{tag} (GeV/#it{c}); (#varphi_{jet}^{tag} - #varphi_{jet}^{base}) / #varphi_{jet}^{tag}", {HistType::kTH3F, {{jetRadiiBins, ""}, {200, 0.0, 200}, {1000, -5.0, 5.0}}}); + registry.add("h3_jet_pt_tag_jet_eta_tag_jet_eta_base_matchedhf", ";#it{p}_{T,jet}^{tag} (GeV/#it{c}); #eta_{jet}^{tag}; #eta_{jet}^{base}", {HistType::kTH3F, {{200, 0.0, 200}, {100, -1.0, 1.0}, {100, -1.0, 1.0}}}); + registry.add("h3_jet_pt_tag_jet_phi_tag_jet_phi_base_matchedhf", ";#it{p}_{T,jet}^{tag} (GeV/#it{c}); #varphi_{jet}^{tag}; #varphi_{jet}^{base}", {HistType::kTH3F, {{200, 0.0, 200}, {160, -1.0, 7.}, {160, -1.0, 7.}}}); + registry.add("h3_jet_pt_tag_jet_ntracks_tag_jet_ntracks_base_matchedhf", ";#it{p}_{T,jet}^{tag} (GeV/#it{c}); N_{jet tracks}^{tag}; N_{jet tracks}^{base}", {HistType::kTH3F, {{200, 0.0, 200}, {100, -0.5, 99.5}, {100, -0.5, 99.5}}}); + + registry.add("h3_jet_r_jet_pt_tag_jet_pt_base_matchedgeohf", "#it{R}_{jet};#it{p}_{T,jet}^{tag} (GeV/#it{c});#it{p}_{T,jet}^{base} (GeV/#it{c})", {HistType::kTH3F, {{jetRadiiBins, ""}, {200, 0., 200.}, {200, 0., 200.}}}); + registry.add("h3_jet_r_jet_eta_tag_jet_eta_base_matchedgeohf", "#it{R}_{jet};#eta_{jet}^{tag};#eta_{jet}^{base}", {HistType::kTH3F, {{jetRadiiBins, ""}, {200, 0., 200.}, {100, -1.0, 1.0}}}); + registry.add("h3_jet_r_jet_phi_tag_jet_phi_base_matchedgeohf", "#it{R}_{jet};#varphi_{jet}^{tag};#varphi_{jet}^{base}", {HistType::kTH3F, {{jetRadiiBins, ""}, {200, 0., 200.}, {160, -1.0, 7.}}}); + registry.add("h3_jet_r_jet_ntracks_tag_jet_ntracks_base_matchedgeohf", "#it{R}_{jet};N_{jet tracks}^{tag};N_{jet tracks}^{base}", {HistType::kTH3F, {{jetRadiiBins, ""}, {100, -0.5, 99.5}, {100, -0.5, 99.5}}}); + registry.add("h3_jet_r_candidate_pt_tag_candidate_pt_base_matchedgeohf", "#it{R}_{jet};#it{p}_{T,candidate}^{tag} (GeV/#it{c});#it{p}_{T,candidate} (GeV/#it{c})", {HistType::kTH3F, {{jetRadiiBins, ""}, {200, 0., 200.}, {200, 0., 200.}}}); + registry.add("h3_jet_r_candidate_eta_tag_candidate_eta_base_matchedgeohf", "#it{R}_{jet};#eta_{candidate}^{tag};#eta_{candidate}^{base}", {HistType::kTH3F, {{jetRadiiBins, ""}, {100, -1.0, 1.0}, {100, -1.0, 1.0}}}); + registry.add("h3_jet_r_candidate_phi_tag_candidate_phi_base_matchedgeohf", "#it{R}_{jet};#varphi_{candidate}^{tag};#varphi_{candidate}^{base}", {HistType::kTH3F, {{jetRadiiBins, ""}, {160, -1.0, 7.}, {160, -1.0, 7.}}}); + registry.add("h3_jet_r_jet_pt_tag_jet_pt_base_diff_matchedgeohf", "#it{R}_{jet};#it{p}_{T,jet}^{tag} (GeV/#it{c}); (#it{p}_{T,jet}^{tag} (GeV/#it{c}) - #it{p}_{T,jet}^{base} (GeV/#it{c})) / #it{p}_{T,jet}^{tag} (GeV/#it{c})", {HistType::kTH3F, {{jetRadiiBins, ""}, {200, 0.0, 200}, {1000, -5.0, 5.0}}}); + registry.add("h3_jet_r_jet_pt_tag_jet_eta_base_diff_matchedgeohf", "#it{R}_{jet};#it{p}_{T,jet}^{tag} (GeV/#it{c}); (#eta_{jet}^{tag} - #eta_{jet}^{base}) / #eta_{jet}^{tag}", {HistType::kTH3F, {{jetRadiiBins, ""}, {200, 0.0, 200}, {1000, -5.0, 5.0}}}); + registry.add("h3_jet_r_jet_pt_tag_jet_phi_base_diff_matchedgeohf", "#it{R}_{jet};#it{p}_{T,jet}^{tag} (GeV/#it{c}); (#varphi_{jet}^{tag} - #varphi_{jet}^{base}) / #varphi_{jet}^{tag}", {HistType::kTH3F, {{jetRadiiBins, ""}, {200, 0.0, 200}, {1000, -5.0, 5.0}}}); + registry.add("h3_jet_pt_tag_jet_eta_tag_jet_eta_base_matchedgeohf", ";#it{p}_{T,jet}^{tag} (GeV/#it{c}); #eta_{jet}^{tag}; #eta_{jet}^{base}", {HistType::kTH3F, {{200, 0.0, 200}, {100, -1.0, 1.0}, {100, -1.0, 1.0}}}); + registry.add("h3_jet_pt_tag_jet_phi_tag_jet_phi_base_matchedgeohf", ";#it{p}_{T,jet}^{tag} (GeV/#it{c}); #varphi_{jet}^{tag}; #varphi_{jet}^{base}", {HistType::kTH3F, {{200, 0.0, 200}, {160, -1.0, 7.}, {160, -1.0, 7.}}}); + registry.add("h3_jet_pt_tag_jet_ntracks_tag_jet_ntracks_base_matchedgeohf", ";#it{p}_{T,jet}^{tag} (GeV/#it{c}); N_{jet tracks}^{tag}; N_{jet tracks}^{base}", {HistType::kTH3F, {{200, 0.0, 200}, {100, -0.5, 99.5}, {100, -0.5, 99.5}}}); + + registry.add("h3_jet_r_jet_pt_tag_jet_pt_base_matchedpthf", "#it{R}_{jet};#it{p}_{T,jet}^{tag} (GeV/#it{c});#it{p}_{T,jet}^{base} (GeV/#it{c})", {HistType::kTH3F, {{jetRadiiBins, ""}, {200, 0., 200.}, {200, 0., 200.}}}); + registry.add("h3_jet_r_jet_eta_tag_jet_eta_base_matchedpthf", "#it{R}_{jet};#eta_{jet}^{tag};#eta_{jet}^{base}", {HistType::kTH3F, {{jetRadiiBins, ""}, {200, 0., 200.}, {100, -1.0, 1.0}}}); + registry.add("h3_jet_r_jet_phi_tag_jet_phi_base_matchedpthf", "#it{R}_{jet};#varphi_{jet}^{tag};#varphi_{jet}^{base}", {HistType::kTH3F, {{jetRadiiBins, ""}, {200, 0., 200.}, {160, -1.0, 7.}}}); + registry.add("h3_jet_r_jet_ntracks_tag_jet_ntracks_base_matchedpthf", "#it{R}_{jet};N_{jet tracks}^{tag};N_{jet tracks}^{base}", {HistType::kTH3F, {{jetRadiiBins, ""}, {100, -0.5, 99.5}, {100, -0.5, 99.5}}}); + registry.add("h3_jet_r_candidate_pt_tag_candidate_pt_base_matchedpthf", "#it{R}_{jet};#it{p}_{T,candidate}^{tag} (GeV/#it{c});#it{p}_{T,candidate} (GeV/#it{c})", {HistType::kTH3F, {{jetRadiiBins, ""}, {200, 0., 200.}, {200, 0., 200.}}}); + registry.add("h3_jet_r_candidate_eta_tag_candidate_eta_base_matchedpthf", "#it{R}_{jet};#eta_{candidate}^{tag};#eta_{candidate}^{base}", {HistType::kTH3F, {{jetRadiiBins, ""}, {100, -1.0, 1.0}, {100, -1.0, 1.0}}}); + registry.add("h3_jet_r_candidate_phi_tag_candidate_phi_base_matchedpthf", "#it{R}_{jet};#varphi_{candidate}^{tag};#varphi_{candidate}^{base}", {HistType::kTH3F, {{jetRadiiBins, ""}, {160, -1.0, 7.}, {160, -1.0, 7.}}}); + registry.add("h3_jet_r_jet_pt_tag_jet_pt_base_diff_matchedpthf", "#it{R}_{jet};#it{p}_{T,jet}^{tag} (GeV/#it{c}); (#it{p}_{T,jet}^{tag} (GeV/#it{c}) - #it{p}_{T,jet}^{base} (GeV/#it{c})) / #it{p}_{T,jet}^{tag} (GeV/#it{c})", {HistType::kTH3F, {{jetRadiiBins, ""}, {200, 0.0, 200}, {1000, -5.0, 5.0}}}); + registry.add("h3_jet_r_jet_pt_tag_jet_eta_base_diff_matchedpthf", "#it{R}_{jet};#it{p}_{T,jet}^{tag} (GeV/#it{c}); (#eta_{jet}^{tag} - #eta_{jet}^{base}) / #eta_{jet}^{tag}", {HistType::kTH3F, {{jetRadiiBins, ""}, {200, 0.0, 200}, {1000, -5.0, 5.0}}}); + registry.add("h3_jet_r_jet_pt_tag_jet_phi_base_diff_matchedpthf", "#it{R}_{jet};#it{p}_{T,jet}^{tag} (GeV/#it{c}); (#varphi_{jet}^{tag} - #varphi_{jet}^{base}) / #varphi_{jet}^{tag}", {HistType::kTH3F, {{jetRadiiBins, ""}, {200, 0.0, 200}, {1000, -5.0, 5.0}}}); + registry.add("h3_jet_pt_tag_jet_eta_tag_jet_eta_base_matchedpthf", ";#it{p}_{T,jet}^{tag} (GeV/#it{c}); #eta_{jet}^{tag}; #eta_{jet}^{base}", {HistType::kTH3F, {{200, 0.0, 200}, {100, -1.0, 1.0}, {100, -1.0, 1.0}}}); + registry.add("h3_jet_pt_tag_jet_phi_tag_jet_phi_base_matchedpthf", ";#it{p}_{T,jet}^{tag} (GeV/#it{c}); #varphi_{jet}^{tag}; #varphi_{jet}^{base}", {HistType::kTH3F, {{200, 0.0, 200}, {160, -1.0, 7.}, {160, -1.0, 7.}}}); + registry.add("h3_jet_pt_tag_jet_ntracks_tag_jet_ntracks_base_matchedpthf", ";#it{p}_{T,jet}^{tag} (GeV/#it{c}); N_{jet tracks}^{tag}; N_{jet tracks}^{base}", {HistType::kTH3F, {{200, 0.0, 200}, {100, -0.5, 99.5}, {100, -0.5, 99.5}}}); + + registry.add("h3_jet_r_jet_pt_tag_jet_pt_base_matchedgeopthf", "#it{R}_{jet};#it{p}_{T,jet}^{tag} (GeV/#it{c});#it{p}_{T,jet}^{base} (GeV/#it{c})", {HistType::kTH3F, {{jetRadiiBins, ""}, {200, 0., 200.}, {200, 0., 200.}}}); + registry.add("h3_jet_r_jet_eta_tag_jet_eta_base_matchedgeopthf", "#it{R}_{jet};#eta_{jet}^{tag};#eta_{jet}^{base}", {HistType::kTH3F, {{jetRadiiBins, ""}, {200, 0., 200.}, {100, -1.0, 1.0}}}); + registry.add("h3_jet_r_jet_phi_tag_jet_phi_base_matchedgeopthf", "#it{R}_{jet};#varphi_{jet}^{tag};#varphi_{jet}^{base}", {HistType::kTH3F, {{jetRadiiBins, ""}, {200, 0., 200.}, {160, -1.0, 7.}}}); + registry.add("h3_jet_r_jet_ntracks_tag_jet_ntracks_base_matchedgeopthf", "#it{R}_{jet};N_{jet tracks}^{tag};N_{jet tracks}^{base}", {HistType::kTH3F, {{jetRadiiBins, ""}, {100, -0.5, 99.5}, {100, -0.5, 99.5}}}); + registry.add("h3_jet_r_candidate_pt_tag_candidate_pt_base_matchedgeopthf", "#it{R}_{jet};#it{p}_{T,candidate}^{tag} (GeV/#it{c});#it{p}_{T,candidate} (GeV/#it{c})", {HistType::kTH3F, {{jetRadiiBins, ""}, {200, 0., 200.}, {200, 0., 200.}}}); + registry.add("h3_jet_r_candidate_eta_tag_candidate_eta_base_matchedgeopthf", "#it{R}_{jet};#eta_{candidate}^{tag};#eta_{candidate}^{base}", {HistType::kTH3F, {{jetRadiiBins, ""}, {100, -1.0, 1.0}, {100, -1.0, 1.0}}}); + registry.add("h3_jet_r_candidate_phi_tag_candidate_phi_base_matchedgeopthf", "#it{R}_{jet};#varphi_{candidate}^{tag};#varphi_{candidate}^{base}", {HistType::kTH3F, {{jetRadiiBins, ""}, {160, -1.0, 7.}, {160, -1.0, 7.}}}); + registry.add("h3_jet_r_jet_pt_tag_jet_pt_base_diff_matchedgeopthf", "#it{R}_{jet};#it{p}_{T,jet}^{tag} (GeV/#it{c}); (#it{p}_{T,jet}^{tag} (GeV/#it{c}) - #it{p}_{T,jet}^{base} (GeV/#it{c})) / #it{p}_{T,jet}^{tag} (GeV/#it{c})", {HistType::kTH3F, {{jetRadiiBins, ""}, {200, 0.0, 200}, {1000, -5.0, 5.0}}}); + registry.add("h3_jet_r_jet_pt_tag_jet_eta_base_diff_matchedgeopthf", "#it{R}_{jet};#it{p}_{T,jet}^{tag} (GeV/#it{c}); (#eta_{jet}^{tag} - #eta_{jet}^{base}) / #eta_{jet}^{tag}", {HistType::kTH3F, {{jetRadiiBins, ""}, {200, 0.0, 200}, {1000, -5.0, 5.0}}}); + registry.add("h3_jet_r_jet_pt_tag_jet_phi_base_diff_matchedgeopthf", "#it{R}_{jet};#it{p}_{T,jet}^{tag} (GeV/#it{c}); (#varphi_{jet}^{tag} - #varphi_{jet}^{base}) / #varphi_{jet}^{tag}", {HistType::kTH3F, {{jetRadiiBins, ""}, {200, 0.0, 200}, {1000, -5.0, 5.0}}}); + registry.add("h3_jet_pt_tag_jet_eta_tag_jet_eta_base_matchedgeopthf", ";#it{p}_{T,jet}^{tag} (GeV/#it{c}); #eta_{jet}^{tag}; #eta_{jet}^{base}", {HistType::kTH3F, {{200, 0.0, 200}, {100, -1.0, 1.0}, {100, -1.0, 1.0}}}); + registry.add("h3_jet_pt_tag_jet_phi_tag_jet_phi_base_matchedgeopthf", ";#it{p}_{T,jet}^{tag} (GeV/#it{c}); #varphi_{jet}^{tag}; #varphi_{jet}^{base}", {HistType::kTH3F, {{200, 0.0, 200}, {160, -1.0, 7.}, {160, -1.0, 7.}}}); + registry.add("h3_jet_pt_tag_jet_ntracks_tag_jet_ntracks_base_matchedgeopthf", ";#it{p}_{T,jet}^{tag} (GeV/#it{c}); N_{jet tracks}^{tag}; N_{jet tracks}^{base}", {HistType::kTH3F, {{200, 0.0, 200}, {100, -0.5, 99.5}, {100, -0.5, 99.5}}}); } if (doprocessTriggeredData) { @@ -214,24 +336,55 @@ struct JetFinderHFQATask { } } + if (doprocessTracksSub) { + + registry.add("h_track_pt_eventwiseconstituentsubtracted", "track pT;#it{p}_{T,track} (GeV/#it{c});entries", {HistType::kTH1F, {{200, 0., 200.}}}); + registry.add("h_track_eta_eventwiseconstituentsubtracted", "track #eta;#eta_{track};entries", {HistType::kTH1F, {{100, -1.0, 1.0}}}); + registry.add("h_track_phi_eventwiseconstituentsubtracted", "track #varphi;#varphi_{track};entries", {HistType::kTH1F, {{160, -1.0, 7.}}}); + } + if (doprocessMCCollisionsWeighted) { AxisSpec weightAxis = {{VARIABLE_WIDTH, 1e-13, 1e-12, 1e-11, 1e-10, 1e-9, 1e-8, 1e-7, 1e-6, 1e-5, 1e-4, 1e-3, 1e-2, 1e-1, 1.0, 10.0}, "weights"}; registry.add("h_collision_eventweight_part", "event weight;event weight;entries", {HistType::kTH1F, {weightAxis}}); } + + if (doprocessCandidates) { + registry.add("h_candidate_invmass", ";#it{m}_{inv, candidate} (GeV/#it{c}^{2});counts", {HistType::kTH1F, {{500, 0.0, 5.0}}}); + registry.add("h_candidate_pt", ";#it{p}_{T,candidate} (GeV/#it{c});counts", {HistType::kTH1F, {{200, 0.0, 200.0}}}); + registry.add("h_candidate_y", ";y_{candidate};counts", {HistType::kTH1F, {{100, -1.0, 1.0}}}); + } } - using JetTracks = aod::JTracks; using JetTableDataJoined = soa::Join; + using JetTableDataMatchedJoined = soa::Join; + using JetTableDataSubJoined = soa::Join; + using JetTableDataSubMatchedJoined = soa::Join; + using JetTableMCDJoined = soa::Join; using JetTableMCDWeightedJoined = soa::Join; using JetTableMCDMatchedJoined = soa::Join; using JetTableMCDMatchedWeightedJoined = soa::Join; + using JetTableMCPJoined = soa::Join; using JetTableMCPWeightedJoined = soa::Join; using JetTableMCPMatchedJoined = soa::Join; using JetTableMCPMatchedWeightedJoined = soa::Join; Filter trackCuts = (aod::jtrack::pt >= trackPtMin && aod::jtrack::pt < trackPtMax && aod::jtrack::eta > trackEtaMin && aod::jtrack::eta < trackEtaMax); + Filter trackSubCuts = (aod::jtracksub::pt >= trackPtMin && aod::jtracksub::pt < trackPtMax && aod::jtracksub::eta > trackEtaMin && aod::jtracksub::eta < trackEtaMax); + Filter eventCuts = (nabs(aod::jcollision::posZ) < vertexZCut && aod::jcollision::centrality >= centralityMin && aod::jcollision::centrality < centralityMax); + + // Filter candidateCutsD0 = (aod::hf_sel_candidate_d0::isSelD0 >= selectionFlagD0 || aod::hf_sel_candidate_d0::isSelD0bar >= selectionFlagD0bar); + // Filter candidateCutsLc = (aod::hf_sel_candidate_lc::isSelLcToPKPi >= selectionFlagLcToPKPi || aod::hf_sel_candidate_lc::isSelLcToPiKP >= selectionFlagLcToPiPK); + // Filter candidateCutsBplus = (aod::hf_sel_candidate_bplus::isSelBplusToD0Pi >= selectionFlagBplus); + + PresliceOptional> perD0CandidateTracks = aod::bkgd0::candidateId; + PresliceOptional> perLcCandidateTracks = aod::bkglc::candidateId; + PresliceOptional> perBplusCandidateTracks = aod::bkgbplus::candidateId; + + PresliceOptional perD0CandidateRhos = aod::bkgd0::candidateId; + PresliceOptional perLcCandidateRhos = aod::bkglc::candidateId; + PresliceOptional perBplusCandidateRhos = aod::bkgbplus::candidateId; template void fillHistograms(T const& jet, float weight = 1.0) @@ -271,38 +424,79 @@ struct JetFinderHFQATask { registry.fill(HIST("h3_jet_r_jet_pt_candidate_pt"), jet.r() / 100.0, jet.pt(), hfcandidate.pt(), weight); registry.fill(HIST("h3_jet_r_jet_pt_candidate_eta"), jet.r() / 100.0, jet.pt(), hfcandidate.eta(), weight); registry.fill(HIST("h3_jet_r_jet_pt_candidate_phi"), jet.r() / 100.0, jet.pt(), hfcandidate.phi(), weight); - registry.fill(HIST("h3_jet_r_jet_pt_candidate_y"), jet.r() / 100.0, jet.pt(), hfcandidate.y(candMass), weight); + registry.fill(HIST("h3_jet_r_jet_pt_candidate_y"), jet.r() / 100.0, jet.pt(), hfcandidate.y(), weight); if (jet.r() == round(selectedJetsRadius * 100.0f)) { - if constexpr (std::is_same_v, soa::Join> || std::is_same_v, soa::Join>) { - if (hfcandidate.isSelD0() >= selectionFlagD0) { - registry.fill(HIST("h3_candidate_invmass_jet_pt_candidate_pt"), hfHelper.invMassD0ToPiK(hfcandidate), jet.pt(), hfcandidate.pt(), weight); - } - if (hfcandidate.isSelD0bar() >= selectionFlagD0bar) { - registry.fill(HIST("h3_candidatebar_invmass_jet_pt_candidate_pt"), hfHelper.invMassD0barToKPi(hfcandidate), jet.pt(), hfcandidate.pt(), weight); - } - } - - if constexpr (std::is_same_v, soa::Join> || std::is_same_v, soa::Join>) { - if (hfcandidate.isSelLcToPKPi() >= selectionFlagLcToPKPi) { - registry.fill(HIST("h3_candidate_invmass_jet_pt_candidate_pt"), hfHelper.invMassLcToPKPi(hfcandidate), jet.pt(), hfcandidate.pt(), weight); - } - if (hfcandidate.isSelLcToPiKP() >= selectionFlagLcToPiPK) { - registry.fill(HIST("h3_candidatebar_invmass_jet_pt_candidate_pt"), hfHelper.invMassLcToPiKP(hfcandidate), jet.pt(), hfcandidate.pt(), weight); - } - } - - if constexpr (std::is_same_v, soa::Join> || std::is_same_v, soa::Join>) { - if (hfcandidate.isSelBplusToD0Pi() >= selectionFlagBplus) { - registry.fill(HIST("h3_candidate_invmass_jet_pt_candidate_pt"), hfHelper.invMassBplusToD0Pi(hfcandidate), jet.pt(), hfcandidate.pt(), weight); - registry.fill(HIST("h3_candidatebar_invmass_jet_pt_candidate_pt"), hfHelper.invMassBplusToD0Pi(hfcandidate), jet.pt(), hfcandidate.pt(), weight); - } - } + registry.fill(HIST("h3_candidate_invmass_jet_pt_candidate_pt"), hfcandidate.m(), jet.pt(), hfcandidate.pt(), weight); + registry.fill(HIST("h3_candidatebar_invmass_jet_pt_candidate_pt"), hfcandidate.m(), jet.pt(), hfcandidate.pt(), weight); } } } template + void fillRhoAreaSubtractedHistograms(T const& jet, float rho, float weight = 1.0) + { + if (jet.r() == round(selectedJetsRadius * 100.0f)) { + registry.fill(HIST("h_jet_pt_rhoareasubtracted"), jet.pt() - (rho * jet.area()), weight); + registry.fill(HIST("h_jet_eta_rhoareasubtracted"), jet.eta(), weight); + registry.fill(HIST("h_jet_phi_rhoareasubtracted"), jet.phi(), weight); + registry.fill(HIST("h_jet_ntracks_rhoareasubtracted"), jet.tracks().size(), weight); + } + + registry.fill(HIST("h3_jet_r_jet_pt_jet_eta_rhoareasubtracted"), jet.r() / 100.0, jet.pt() - (rho * jet.area()), jet.eta(), weight); + registry.fill(HIST("h3_jet_r_jet_pt_jet_phi_rhoareasubtracted"), jet.r() / 100.0, jet.pt() - (rho * jet.area()), jet.phi(), weight); + registry.fill(HIST("h3_jet_r_jet_eta_jet_phi_rhoareasubtracted"), jet.r() / 100.0, jet.eta(), jet.phi(), weight); + registry.fill(HIST("h3_jet_r_jet_pt_jet_ntracks_rhoareasubtracted"), jet.r() / 100.0, jet.pt() - (rho * jet.area()), jet.tracks().size(), weight); + registry.fill(HIST("h3_jet_r_jet_pt_jet_area_rhoareasubtracted"), jet.r() / 100.0, jet.pt() - (rho * jet.area()), jet.area(), weight); + registry.fill(HIST("h3_jet_r_jet_pt_jet_pt_rhoareasubtracted"), jet.r() / 100.0, jet.pt(), jet.pt() - (rho * jet.area()), weight); + + for (auto& constituent : jet.template tracks_as()) { + + registry.fill(HIST("h3_jet_r_jet_pt_track_pt_rhoareasubtracted"), jet.r() / 100.0, jet.pt() - (rho * jet.area()), constituent.pt(), weight); + registry.fill(HIST("h3_jet_r_jet_pt_track_eta_rhoareasubtracted"), jet.r() / 100.0, jet.pt() - (rho * jet.area()), constituent.eta(), weight); + registry.fill(HIST("h3_jet_r_jet_pt_track_phi_rhoareasubtracted"), jet.r() / 100.0, jet.pt() - (rho * jet.area()), constituent.phi(), weight); + } + + for (auto& hfcandidate : jet.template hfcandidates_as>()) { + registry.fill(HIST("h3_jet_r_jet_pt_candidate_pt_rhoareasubtracted"), jet.r() / 100.0, jet.pt() - (rho * jet.area()), hfcandidate.pt(), weight); + registry.fill(HIST("h3_jet_r_jet_pt_candidate_eta_rhoareasubtracted"), jet.r() / 100.0, jet.pt() - (rho * jet.area()), hfcandidate.eta(), weight); + registry.fill(HIST("h3_jet_r_jet_pt_candidate_phi_rhoareasubtracted"), jet.r() / 100.0, jet.pt() - (rho * jet.area()), hfcandidate.phi(), weight); + registry.fill(HIST("h3_jet_r_jet_pt_candidate_y_rhoareasubtracted"), jet.r() / 100.0, jet.pt() - (rho * jet.area()), hfcandidate.y(), weight); + } + } + + template + void fillEventWiseConstituentSubtractedHistograms(T const& jet, float weight = 1.0) + { + if (jet.r() == round(selectedJetsRadius * 100.0f)) { + registry.fill(HIST("h_jet_pt_eventwiseconstituentsubtracted"), jet.pt(), weight); + registry.fill(HIST("h_jet_eta_eventwiseconstituentsubtracted"), jet.eta(), weight); + registry.fill(HIST("h_jet_phi_eventwiseconstituentsubtracted"), jet.phi(), weight); + registry.fill(HIST("h_jet_ntracks_eventwiseconstituentsubtracted"), jet.tracks().size(), weight); + } + + registry.fill(HIST("h3_jet_r_jet_pt_jet_eta_eventwiseconstituentsubtracted"), jet.r() / 100.0, jet.pt(), jet.eta(), weight); + registry.fill(HIST("h3_jet_r_jet_pt_jet_phi_eventwiseconstituentsubtracted"), jet.r() / 100.0, jet.pt(), jet.phi(), weight); + registry.fill(HIST("h3_jet_r_jet_eta_jet_phi_eventwiseconstituentsubtracted"), jet.r() / 100.0, jet.eta(), jet.phi(), weight); + registry.fill(HIST("h3_jet_r_jet_pt_jet_ntracks_eventwiseconstituentsubtracted"), jet.r() / 100.0, jet.pt(), jet.tracks().size(), weight); + registry.fill(HIST("h3_jet_r_jet_pt_jet_area_eventwiseconstituentsubtracted"), jet.r() / 100.0, jet.pt(), jet.area(), weight); + + for (auto& constituent : jet.template tracks_as()) { + + registry.fill(HIST("h3_jet_r_jet_pt_track_pt_eventwiseconstituentsubtracted"), jet.r() / 100.0, jet.pt(), constituent.pt(), weight); + registry.fill(HIST("h3_jet_r_jet_pt_track_eta_eventwiseconstituentsubtracted"), jet.r() / 100.0, jet.pt(), constituent.eta(), weight); + registry.fill(HIST("h3_jet_r_jet_pt_track_phi_eventwiseconstituentsubtracted"), jet.r() / 100.0, jet.pt(), constituent.phi(), weight); + } + + for (auto& hfcandidate : jet.template hfcandidates_as>()) { + registry.fill(HIST("h3_jet_r_jet_pt_candidate_pt_eventwiseconstituentsubtracted"), jet.r() / 100.0, jet.pt(), hfcandidate.pt(), weight); + registry.fill(HIST("h3_jet_r_jet_pt_candidate_eta_eventwiseconstituentsubtracted"), jet.r() / 100.0, jet.pt(), hfcandidate.eta(), weight); + registry.fill(HIST("h3_jet_r_jet_pt_candidate_phi_eventwiseconstituentsubtracted"), jet.r() / 100.0, jet.pt(), hfcandidate.phi(), weight); + registry.fill(HIST("h3_jet_r_jet_pt_candidate_y_eventwiseconstituentsubtracted"), jet.r() / 100.0, jet.pt(), hfcandidate.y(), weight); + } + } + + template void fillMCPHistograms(T const& jet, float weight = 1.0) { @@ -330,7 +524,7 @@ struct JetFinderHFQATask { registry.fill(HIST("h3_jet_r_part_jet_pt_part_track_phi_part"), jet.r() / 100.0, jet.pt(), constituent.phi(), weight); } - for (auto& hfcandidate : jet.template hfcandidates_as>()) { + for (auto& hfcandidate : jet.template hfcandidates_as>()) { registry.fill(HIST("h3_jet_r_part_jet_pt_part_track_pt_part"), jet.r() / 100.0, jet.pt(), hfcandidate.pt(), weight); registry.fill(HIST("h3_jet_r_part_jet_pt_part_track_eta_part"), jet.r() / 100.0, jet.pt(), hfcandidate.eta(), weight); @@ -343,69 +537,245 @@ struct JetFinderHFQATask { } } - template - void fillMCMatchedHistograms(T const& mcdjet, float weight = 1.0) + template + void fillMatchedHistograms(T const& jetBase, float weight = 1.0) { float pTHat = 10. / (std::pow(weight, 1.0 / pTHatExponent)); - if (mcdjet.pt() > pTHatMaxMCD * pTHat) { + if (jetBase.pt() > pTHatMaxMCD * pTHat) { return; } - - for (auto& mcpjet : mcdjet.template matchedJetCand_as>()) { - - if (mcpjet.pt() > pTHatMaxMCP * pTHat) { - continue; + auto candidateBasePt = 0.0; + auto candidateBasePhi = 0.0; + auto candidateBaseEta = 0.0; + auto candidateTagPt = 0.0; + auto candidateTagPhi = 0.0; + auto candidateTagEta = 0.0; + + auto candidateBase = jetBase.template hfcandidates_first_as>(); + candidateBasePt = candidateBase.pt(); + candidateBasePhi = candidateBase.phi(); + candidateBaseEta = candidateBase.eta(); + + if (jetBase.has_matchedJetGeo()) { + for (auto& jetTag : jetBase.template matchedJetGeo_as>()) { + if (jetTag.pt() > pTHatMaxMCP * pTHat) { + continue; + } + auto candidateTag = jetTag.template hfcandidates_first_as>(); + candidateTagPt = candidateTag.pt(); + candidateTagPhi = candidateTag.phi(); + candidateTagEta = candidateTag.eta(); + + registry.fill(HIST("h3_jet_r_jet_pt_tag_jet_pt_base_matchedgeo"), jetBase.r() / 100.0, jetTag.pt(), jetBase.pt(), weight); + registry.fill(HIST("h3_jet_r_jet_eta_tag_jet_eta_base_matchedgeo"), jetBase.r() / 100.0, jetTag.eta(), jetBase.eta(), weight); + registry.fill(HIST("h3_jet_r_jet_phi_tag_jet_phi_base_matchedgeo"), jetBase.r() / 100.0, jetTag.phi(), jetBase.phi(), weight); + registry.fill(HIST("h3_jet_r_jet_ntracks_tag_jet_ntracks_base_matchedgeo"), jetBase.r() / 100.0, jetTag.tracks().size(), jetBase.tracks().size(), weight); + registry.fill(HIST("h3_jet_r_candidate_pt_tag_candidate_pt_base_matchedgeo"), jetBase.r() / 100.0, candidateTagPt, candidateBasePt, weight); + registry.fill(HIST("h3_jet_r_candidate_eta_tag_candidate_eta_base_matchedgeo"), jetBase.r() / 100.0, candidateTagEta, candidateBaseEta, weight); + registry.fill(HIST("h3_jet_r_candidate_phi_tag_candidate_phi_base_matchedgeo"), jetBase.r() / 100.0, candidateTagPhi, candidateBasePhi, weight); + registry.fill(HIST("h3_jet_r_jet_pt_tag_jet_pt_base_diff_matchedgeo"), jetBase.r() / 100.0, jetTag.pt(), (jetTag.pt() - jetBase.pt()) / jetTag.pt(), weight); + registry.fill(HIST("h3_jet_r_jet_pt_tag_jet_eta_base_diff_matchedgeo"), jetBase.r() / 100.0, jetTag.pt(), (jetTag.eta() - jetBase.eta()) / jetTag.eta(), weight); + registry.fill(HIST("h3_jet_r_jet_pt_tag_jet_phi_base_diff_matchedgeo"), jetBase.r() / 100.0, jetTag.pt(), (jetTag.phi() - jetBase.phi()) / jetTag.phi(), weight); + + if (jetBase.r() == round(selectedJetsRadius * 100.0f)) { + registry.fill(HIST("h3_jet_pt_tag_jet_eta_tag_jet_eta_base_matchedgeo"), jetTag.pt(), jetTag.eta(), jetBase.eta(), weight); + registry.fill(HIST("h3_jet_pt_tag_jet_phi_tag_jet_phi_base_matchedgeo"), jetTag.pt(), jetTag.phi(), jetBase.phi(), weight); + registry.fill(HIST("h3_jet_pt_tag_jet_ntracks_tag_jet_ntracks_base_matchedgeo"), jetTag.pt(), jetTag.tracks().size(), jetBase.tracks().size(), weight); + } } + } + if (jetBase.has_matchedJetPt()) { - auto mcdCandPt = 0.0; - auto mcdCandPhi = 0.0; - auto mcdCandEta = 0.0; - auto mcdCandY = 0.0; - auto mcpCandPt = 0.0; - auto mcpCandPhi = 0.0; - auto mcpCandEta = 0.0; - auto mcpCandY = 0.0; - for (auto& hfcandidate_mcd : mcdjet.template hfcandidates_as>()) { - - mcdCandPt = hfcandidate_mcd.pt(); - mcdCandPhi = hfcandidate_mcd.phi(); - mcdCandEta = hfcandidate_mcd.eta(); - mcdCandY = hfcandidate_mcd.y(candMass); + for (auto& jetTag : jetBase.template matchedJetPt_as>()) { + if (jetTag.pt() > pTHatMaxMCP * pTHat) { + continue; + } + auto candidateTag = jetTag.template hfcandidates_first_as>(); + candidateTagPt = candidateTag.pt(); + candidateTagPhi = candidateTag.phi(); + candidateTagEta = candidateTag.eta(); + + registry.fill(HIST("h3_jet_r_jet_pt_tag_jet_pt_base_matchedpt"), jetBase.r() / 100.0, jetTag.pt(), jetBase.pt(), weight); + registry.fill(HIST("h3_jet_r_jet_eta_tag_jet_eta_base_matchedpt"), jetBase.r() / 100.0, jetTag.eta(), jetBase.eta(), weight); + registry.fill(HIST("h3_jet_r_jet_phi_tag_jet_phi_base_matchedpt"), jetBase.r() / 100.0, jetTag.phi(), jetBase.phi(), weight); + registry.fill(HIST("h3_jet_r_jet_ntracks_tag_jet_ntracks_base_matchedpt"), jetBase.r() / 100.0, jetTag.tracks().size(), jetBase.tracks().size(), weight); + registry.fill(HIST("h3_jet_r_candidate_pt_tag_candidate_pt_base_matchedpt"), jetBase.r() / 100.0, candidateTagPt, candidateBasePt, weight); + registry.fill(HIST("h3_jet_r_candidate_eta_tag_candidate_eta_base_matchedpt"), jetBase.r() / 100.0, candidateTagEta, candidateBaseEta, weight); + registry.fill(HIST("h3_jet_r_candidate_phi_tag_candidate_phi_base_matchedpt"), jetBase.r() / 100.0, candidateTagPhi, candidateBasePhi, weight); + registry.fill(HIST("h3_jet_r_jet_pt_tag_jet_pt_base_base_diff_matchedpt"), jetBase.r() / 100.0, jetTag.pt(), (jetTag.pt() - jetBase.pt()) / jetTag.pt(), weight); + registry.fill(HIST("h3_jet_r_jet_pt_tag_jet_eta_base_base_diff_matchedpt"), jetBase.r() / 100.0, jetTag.pt(), (jetTag.eta() - jetBase.eta()) / jetTag.eta(), weight); + registry.fill(HIST("h3_jet_r_jet_pt_tag_jet_phi_base_base_diff_matchedpt"), jetBase.r() / 100.0, jetTag.pt(), (jetTag.phi() - jetBase.phi()) / jetTag.phi(), weight); + + if (jetBase.r() == round(selectedJetsRadius * 100.0f)) { + registry.fill(HIST("h3_jet_pt_tag_jet_eta_tag_jet_eta_base_matchedpt"), jetTag.pt(), jetTag.eta(), jetBase.eta(), weight); + registry.fill(HIST("h3_jet_pt_tag_jet_phi_tag_jet_phi_base_matchedpt"), jetTag.pt(), jetTag.phi(), jetBase.phi(), weight); + registry.fill(HIST("h3_jet_pt_tag_jet_ntracks_tag_jet_ntracks_base_matchedpt"), jetTag.pt(), jetTag.tracks().size(), jetBase.tracks().size(), weight); + } } - - for (auto& hfcandidate_mcp : mcpjet.template hfcandidates_as>()) { - - mcpCandPt = hfcandidate_mcp.pt(); - mcpCandPhi = hfcandidate_mcp.phi(); - mcpCandEta = hfcandidate_mcp.eta(); - mcpCandY = hfcandidate_mcp.y(); + } + if (jetBase.has_matchedJetCand()) { + for (auto& jetTag : jetBase.template matchedJetCand_as>()) { + if (jetTag.pt() > pTHatMaxMCP * pTHat) { + continue; + } + auto candidateTag = jetTag.template hfcandidates_first_as>(); + candidateTagPt = candidateTag.pt(); + candidateTagPhi = candidateTag.phi(); + candidateTagEta = candidateTag.eta(); + + registry.fill(HIST("h3_jet_r_jet_pt_tag_jet_pt_base_matchedhf"), jetBase.r() / 100.0, jetTag.pt(), jetBase.pt(), weight); + registry.fill(HIST("h3_jet_r_jet_eta_tag_jet_eta_base_matchedghf"), jetBase.r() / 100.0, jetTag.eta(), jetBase.eta(), weight); + registry.fill(HIST("h3_jet_r_jet_phi_tag_jet_phi_base_matchedghf"), jetBase.r() / 100.0, jetTag.phi(), jetBase.phi(), weight); + registry.fill(HIST("h3_jet_r_jet_ntracks_tag_jet_ntracks_base_matchedghf"), jetBase.r() / 100.0, jetTag.tracks().size(), jetBase.tracks().size(), weight); + registry.fill(HIST("h3_jet_r_candidate_pt_tag_candidate_pt_base_matchedghf"), jetBase.r() / 100.0, candidateTagPt, candidateBasePt, weight); + registry.fill(HIST("h3_jet_r_candidate_eta_tag_candidate_eta_base_matchedghf"), jetBase.r() / 100.0, candidateTagEta, candidateBaseEta, weight); + registry.fill(HIST("h3_jet_r_candidate_phi_tag_candidate_phi_base_matchedghf"), jetBase.r() / 100.0, candidateTagPhi, candidateBasePhi, weight); + registry.fill(HIST("h3_jet_r_jet_pt_tag_jet_pt_base_diff_matchedghf"), jetBase.r() / 100.0, jetTag.pt(), (jetTag.pt() - jetBase.pt()) / jetTag.pt(), weight); + registry.fill(HIST("h3_jet_r_jet_pt_tag_jet_eta_base_diff_matchedghf"), jetBase.r() / 100.0, jetTag.pt(), (jetTag.eta() - jetBase.eta()) / jetTag.eta(), weight); + registry.fill(HIST("h3_jet_r_jet_pt_tag_jet_phi_base_diff_matchedghf"), jetBase.r() / 100.0, jetTag.pt(), (jetTag.phi() - jetBase.phi()) / jetTag.phi(), weight); + + if (jetBase.r() == round(selectedJetsRadius * 100.0f)) { + registry.fill(HIST("h3_jet_pt_tag_jet_eta_tag_jet_eta_base_matchedghf"), jetTag.pt(), jetTag.eta(), jetBase.eta(), weight); + registry.fill(HIST("h3_jet_pt_tag_jet_phi_tag_jet_phi_base_matchedghf"), jetTag.pt(), jetTag.phi(), jetBase.phi(), weight); + registry.fill(HIST("h3_jet_pt_tag_jet_ntracks_tag_jet_ntracks_base_matchedhf"), jetTag.pt(), jetTag.tracks().size(), jetBase.tracks().size(), weight); + } + } + } + if (jetBase.has_matchedJetGeo() && jetBase.has_matchedJetPt()) { + for (auto& jetTag : jetBase.template matchedJetGeo_as>()) { + if (jetTag.pt() > pTHatMaxMCP * pTHat) { + continue; + } + if (jetBase.template matchedJetGeo_first_as>().globalIndex() == jetBase.template matchedJetPt_first_as>().globalIndex()) { // not a good way to do this + + auto candidateTag = jetTag.template hfcandidates_first_as>(); + candidateTagPt = candidateTag.pt(); + candidateTagPhi = candidateTag.phi(); + candidateTagEta = candidateTag.eta(); + + registry.fill(HIST("h3_jet_r_jet_pt_tag_jet_pt_base_matchedgeopt"), jetBase.r() / 100.0, jetTag.pt(), jetBase.pt(), weight); + registry.fill(HIST("h3_jet_r_jet_eta_tag_jet_eta_base_matchedgeopt"), jetBase.r() / 100.0, jetTag.eta(), jetBase.eta(), weight); + registry.fill(HIST("h3_jet_r_jet_phi_tag_jet_phi_base_matchedgeopt"), jetBase.r() / 100.0, jetTag.phi(), jetBase.phi(), weight); + registry.fill(HIST("h3_jet_r_jet_ntracks_tag_jet_ntracks_base_matchedgeopt"), jetBase.r() / 100.0, jetTag.tracks().size(), jetBase.tracks().size(), weight); + registry.fill(HIST("h3_jet_r_candidate_pt_tag_candidate_pt_base_matchedgeopt"), jetBase.r() / 100.0, candidateTagPt, candidateBasePt, weight); + registry.fill(HIST("h3_jet_r_candidate_eta_tag_candidate_eta_base_matchedgeopt"), jetBase.r() / 100.0, candidateTagEta, candidateBaseEta, weight); + registry.fill(HIST("h3_jet_r_candidate_phi_tag_candidate_phi_base_matchedgeopt"), jetBase.r() / 100.0, candidateTagPhi, candidateBasePhi, weight); + registry.fill(HIST("h3_jet_r_jet_pt_tag_jet_pt_base_base_diff_matchedgeopt"), jetBase.r() / 100.0, jetTag.pt(), (jetTag.pt() - jetBase.pt()) / jetTag.pt(), weight); + registry.fill(HIST("h3_jet_r_jet_pt_tag_jet_eta_base_base_diff_matchedgeopt"), jetBase.r() / 100.0, jetTag.pt(), (jetTag.eta() - jetBase.eta()) / jetTag.eta(), weight); + registry.fill(HIST("h3_jet_r_jet_pt_tag_jet_phi_base_base_diff_matchedgeopt"), jetBase.r() / 100.0, jetTag.pt(), (jetTag.phi() - jetBase.phi()) / jetTag.phi(), weight); + + if (jetBase.r() == round(selectedJetsRadius * 100.0f)) { + registry.fill(HIST("h3_jet_pt_tag_jet_eta_tag_jet_eta_base_matchedgeopt"), jetTag.pt(), jetTag.eta(), jetBase.eta(), weight); + registry.fill(HIST("h3_jet_pt_tag_jet_phi_tag_jet_phi_base_matchedgeopt"), jetTag.pt(), jetTag.phi(), jetBase.phi(), weight); + registry.fill(HIST("h3_jet_pt_tag_jet_ntracks_tag_jet_ntracks_base_matchedgeopt"), jetTag.pt(), jetTag.tracks().size(), jetBase.tracks().size(), weight); + } + } + } + } + if (jetBase.has_matchedJetGeo() && jetBase.has_matchedJetCand()) { + for (auto& jetTag : jetBase.template matchedJetGeo_as>()) { + if (jetTag.pt() > pTHatMaxMCP * pTHat) { + continue; + } + if (jetBase.template matchedJetGeo_first_as>().globalIndex() == jetBase.template matchedJetCand_first_as>().globalIndex()) { // not a good way to do this + + auto candidateTag = jetTag.template hfcandidates_first_as>(); + candidateTagPt = candidateTag.pt(); + candidateTagPhi = candidateTag.phi(); + candidateTagEta = candidateTag.eta(); + + registry.fill(HIST("h3_jet_r_jet_pt_tag_jet_pt_base_matchedgeohf"), jetBase.r() / 100.0, jetTag.pt(), jetBase.pt(), weight); + registry.fill(HIST("h3_jet_r_jet_eta_tag_jet_eta_base_matchedgeohf"), jetBase.r() / 100.0, jetTag.eta(), jetBase.eta(), weight); + registry.fill(HIST("h3_jet_r_jet_phi_tag_jet_phi_base_matchedgeohf"), jetBase.r() / 100.0, jetTag.phi(), jetBase.phi(), weight); + registry.fill(HIST("h3_jet_r_jet_ntracks_tag_jet_ntracks_base_matchedgeohf"), jetBase.r() / 100.0, jetTag.tracks().size(), jetBase.tracks().size(), weight); + registry.fill(HIST("h3_jet_r_candidate_pt_tag_candidate_pt_base_matchedgeohf"), jetBase.r() / 100.0, candidateTagPt, candidateBasePt, weight); + registry.fill(HIST("h3_jet_r_candidate_eta_tag_candidate_eta_base_matchedgeohf"), jetBase.r() / 100.0, candidateTagEta, candidateBaseEta, weight); + registry.fill(HIST("h3_jet_r_candidate_phi_tag_candidate_phi_base_matchedgeohf"), jetBase.r() / 100.0, candidateTagPhi, candidateBasePhi, weight); + registry.fill(HIST("h3_jet_r_jet_pt_tag_jet_pt_base_base_diff_matchedgeohf"), jetBase.r() / 100.0, jetTag.pt(), (jetTag.pt() - jetBase.pt()) / jetTag.pt(), weight); + registry.fill(HIST("h3_jet_r_jet_pt_tag_jet_eta_base_base_diff_matchedgeohf"), jetBase.r() / 100.0, jetTag.pt(), (jetTag.eta() - jetBase.eta()) / jetTag.eta(), weight); + registry.fill(HIST("h3_jet_r_jet_pt_tag_jet_phi_base_base_diff_matchedgeohf"), jetBase.r() / 100.0, jetTag.pt(), (jetTag.phi() - jetBase.phi()) / jetTag.phi(), weight); + + if (jetBase.r() == round(selectedJetsRadius * 100.0f)) { + registry.fill(HIST("h3_jet_pt_tag_jet_eta_tag_jet_eta_base_matchedgeohf"), jetTag.pt(), jetTag.eta(), jetBase.eta(), weight); + registry.fill(HIST("h3_jet_pt_tag_jet_phi_tag_jet_phi_base_matchedgeohf"), jetTag.pt(), jetTag.phi(), jetBase.phi(), weight); + registry.fill(HIST("h3_jet_pt_tag_jet_ntracks_tag_jet_ntracks_base_matchedgeohf"), jetTag.pt(), jetTag.tracks().size(), jetBase.tracks().size(), weight); + } + } } + } + if (jetBase.has_matchedJetPt() && jetBase.has_matchedJetCand()) { + for (auto& jetTag : jetBase.template matchedJetPt_as>()) { + if (jetTag.pt() > pTHatMaxMCP * pTHat) { + continue; + } + if (jetBase.template matchedJetPt_first_as>().globalIndex() == jetBase.template matchedJetCand_first_as>().globalIndex()) { // not a good way to do this + + auto candidateTag = jetTag.template hfcandidates_first_as>(); + candidateTagPt = candidateTag.pt(); + candidateTagPhi = candidateTag.phi(); + candidateTagEta = candidateTag.eta(); + + registry.fill(HIST("h3_jet_r_jet_pt_tag_jet_pt_base_matchedpthf"), jetBase.r() / 100.0, jetTag.pt(), jetBase.pt(), weight); + registry.fill(HIST("h3_jet_r_jet_eta_tag_jet_eta_base_matchedpthf"), jetBase.r() / 100.0, jetTag.eta(), jetBase.eta(), weight); + registry.fill(HIST("h3_jet_r_jet_phi_tag_jet_phi_base_matchedpthf"), jetBase.r() / 100.0, jetTag.phi(), jetBase.phi(), weight); + registry.fill(HIST("h3_jet_r_jet_ntracks_tag_jet_ntracks_base_matchedpthf"), jetBase.r() / 100.0, jetTag.tracks().size(), jetBase.tracks().size(), weight); + registry.fill(HIST("h3_jet_r_candidate_pt_tag_candidate_pt_base_matchedpthf"), jetBase.r() / 100.0, candidateTagPt, candidateBasePt, weight); + registry.fill(HIST("h3_jet_r_candidate_eta_tag_candidate_eta_base_matchedpthf"), jetBase.r() / 100.0, candidateTagEta, candidateBaseEta, weight); + registry.fill(HIST("h3_jet_r_candidate_phi_tag_candidate_phi_base_matchedpthf"), jetBase.r() / 100.0, candidateTagPhi, candidateBasePhi, weight); + registry.fill(HIST("h3_jet_r_jet_pt_tag_jet_pt_base_base_diff_matchedpthf"), jetBase.r() / 100.0, jetTag.pt(), (jetTag.pt() - jetBase.pt()) / jetTag.pt(), weight); + registry.fill(HIST("h3_jet_r_jet_pt_tag_jet_eta_base_base_diff_matchedpthf"), jetBase.r() / 100.0, jetTag.pt(), (jetTag.eta() - jetBase.eta()) / jetTag.eta(), weight); + registry.fill(HIST("h3_jet_r_jet_pt_tag_jet_phi_base_base_diff_matchedpthf"), jetBase.r() / 100.0, jetTag.pt(), (jetTag.phi() - jetBase.phi()) / jetTag.phi(), weight); + + if (jetBase.r() == round(selectedJetsRadius * 100.0f)) { + registry.fill(HIST("h3_jet_pt_tag_jet_eta_tag_jet_eta_base_matchedpthf"), jetTag.pt(), jetTag.eta(), jetBase.eta(), weight); + registry.fill(HIST("h3_jet_pt_tag_jet_phi_tag_jet_phi_base_matchedpthf"), jetTag.pt(), jetTag.phi(), jetBase.phi(), weight); + registry.fill(HIST("h3_jet_pt_tag_jet_ntracks_tag_jet_ntracks_base_matchedpthf"), jetTag.pt(), jetTag.tracks().size(), jetBase.tracks().size(), weight); + } + } + } + } - registry.fill(HIST("h3_jet_r_jet_pt_part_jet_pt"), mcdjet.r() / 100.0, mcpjet.pt(), mcdjet.pt(), weight); - registry.fill(HIST("h3_jet_r_jet_eta_part_jet_eta"), mcdjet.r() / 100.0, mcpjet.eta(), mcdjet.eta(), weight); - registry.fill(HIST("h3_jet_r_jet_phi_part_jet_phi"), mcdjet.r() / 100.0, mcpjet.phi(), mcdjet.phi(), weight); - registry.fill(HIST("h3_jet_r_jet_ntracks_part_jet_ntracks"), mcdjet.r() / 100.0, mcpjet.tracks().size() + mcpjet.hfcandidates().size(), mcdjet.tracks().size() + mcdjet.hfcandidates().size(), weight); - registry.fill(HIST("h3_jet_r_candidate_pt_part_candidate_pt"), mcdjet.r() / 100.0, mcpCandPt, mcdCandPt, weight); - registry.fill(HIST("h3_jet_r_candidate_eta_part_candidate_eta"), mcdjet.r() / 100.0, mcpCandEta, mcdCandEta, weight); - registry.fill(HIST("h3_jet_r_candidate_phi_part_candidate_phi"), mcdjet.r() / 100.0, mcpCandPhi, mcdCandPhi, weight); - registry.fill(HIST("h3_jet_r_candidate_y_part_candidate_y"), mcdjet.r() / 100.0, mcpCandY, mcdCandY, weight); - registry.fill(HIST("h3_jet_r_jet_pt_part_jet_pt_diff"), mcdjet.r() / 100.0, mcpjet.pt(), (mcpjet.pt() - mcdjet.pt()) / mcpjet.pt(), weight); - registry.fill(HIST("h3_jet_r_jet_pt_part_jet_eta_diff"), mcdjet.r() / 100.0, mcpjet.pt(), (mcpjet.eta() - mcdjet.eta()) / mcpjet.eta(), weight); - registry.fill(HIST("h3_jet_r_jet_pt_part_jet_phi_diff"), mcdjet.r() / 100.0, mcpjet.pt(), (mcpjet.phi() - mcdjet.phi()) / mcpjet.phi(), weight); - - if (mcdjet.r() == round(selectedJetsRadius * 100.0f)) { - registry.fill(HIST("h3_jet_pt_part_jet_eta_part_jet_eta"), mcpjet.pt(), mcpjet.eta(), mcdjet.eta(), weight); - registry.fill(HIST("h3_jet_pt_part_jet_phi_part_jet_phi"), mcpjet.pt(), mcpjet.phi(), mcdjet.phi(), weight); - registry.fill(HIST("h3_jet_pt_part_jet_ntracks_part_jet_ntracks"), mcpjet.pt(), mcpjet.tracks().size() + mcpjet.hfcandidates().size(), mcdjet.tracks().size() + mcdjet.hfcandidates().size(), weight); + if (jetBase.has_matchedJetGeo() && jetBase.has_matchedJetPt() && jetBase.has_matchedJetCand()) { + for (auto& jetTag : jetBase.template matchedJetGeo_as>()) { + if (jetTag.pt() > pTHatMaxMCP * pTHat) { + continue; + } + if (jetBase.template matchedJetGeo_first_as>().globalIndex() == jetBase.template matchedJetPt_first_as>().globalIndex()) { + if (jetBase.template matchedJetGeo_first_as>().globalIndex() == jetBase.template matchedJetCand_first_as>().globalIndex()) { // not a good way to do this + + auto candidateTag = jetTag.template hfcandidates_first_as>(); + candidateTagPt = candidateTag.pt(); + candidateTagPhi = candidateTag.phi(); + candidateTagEta = candidateTag.eta(); + + registry.fill(HIST("h3_jet_r_jet_pt_tag_jet_pt_base_matchedgeopthf"), jetBase.r() / 100.0, jetTag.pt(), jetBase.pt(), weight); + registry.fill(HIST("h3_jet_r_jet_eta_tag_jet_eta_base_matchedgeopthf"), jetBase.r() / 100.0, jetTag.eta(), jetBase.eta(), weight); + registry.fill(HIST("h3_jet_r_jet_phi_tag_jet_phi_base_matchedgeopthf"), jetBase.r() / 100.0, jetTag.phi(), jetBase.phi(), weight); + registry.fill(HIST("h3_jet_r_jet_ntracks_tag_jet_ntracks_base_matchedgeopthf"), jetBase.r() / 100.0, jetTag.tracks().size(), jetBase.tracks().size(), weight); + registry.fill(HIST("h3_jet_r_candidate_pt_tag_candidate_pt_base_matchedgeopthf"), jetBase.r() / 100.0, candidateTagPt, candidateBasePt, weight); + registry.fill(HIST("h3_jet_r_candidate_eta_tag_candidate_eta_base_matchedgeopthf"), jetBase.r() / 100.0, candidateTagEta, candidateBaseEta, weight); + registry.fill(HIST("h3_jet_r_candidate_phi_tag_candidate_phi_base_matchedgeopthf"), jetBase.r() / 100.0, candidateTagPhi, candidateBasePhi, weight); + registry.fill(HIST("h3_jet_r_jet_pt_tag_jet_pt_base_base_diff_matchedgeopthf"), jetBase.r() / 100.0, jetTag.pt(), (jetTag.pt() - jetBase.pt()) / jetTag.pt(), weight); + registry.fill(HIST("h3_jet_r_jet_pt_tag_jet_eta_base_base_diff_matchedgeopthf"), jetBase.r() / 100.0, jetTag.pt(), (jetTag.eta() - jetBase.eta()) / jetTag.eta(), weight); + registry.fill(HIST("h3_jet_r_jet_pt_tag_jet_phi_base_base_diff_matchedgeopthf"), jetBase.r() / 100.0, jetTag.pt(), (jetTag.phi() - jetBase.phi()) / jetTag.phi(), weight); + + if (jetBase.r() == round(selectedJetsRadius * 100.0f)) { + registry.fill(HIST("h3_jet_pt_tag_jet_eta_tag_jet_eta_base_matchedgeopthf"), jetTag.pt(), jetTag.eta(), jetBase.eta(), weight); + registry.fill(HIST("h3_jet_pt_tag_jet_phi_tag_jet_phi_base_matchedgeopthf"), jetTag.pt(), jetTag.phi(), jetBase.phi(), weight); + registry.fill(HIST("h3_jet_pt_tag_jet_ntracks_tag_jet_ntracks_base_matchedgeopthf"), jetTag.pt(), jetTag.tracks().size(), jetBase.tracks().size(), weight); + } + } + } } } } - void fillTrackHistograms(soa::Filtered const& tracks, float weight = 1.0) + template + void fillTrackHistograms(T const& tracks, float weight = 1.0) { for (auto const& track : tracks) { - if (!JetDerivedDataUtilities::selectTrack(track, trackSelection)) { + if (!jetderiveddatautilities::selectTrack(track, trackSelection)) { continue; } registry.fill(HIST("h_track_pt"), track.pt(), weight); @@ -414,111 +784,168 @@ struct JetFinderHFQATask { } } - void processDummy(aod::Collisions const& collision) + void processDummy(JetCollisions const& collision) { } PROCESS_SWITCH(JetFinderHFQATask, processDummy, "dummy task", true); - void processJetsData(typename JetTableDataJoined::iterator const& jet, CandidateTableData const& candidates, JetTracks const& tracks) + void processJetsData(soa::Filtered::iterator const& collision, JetTableDataJoined const& jets, CandidateTableData const& candidates, JetTracks const& tracks) { - fillHistograms(jet); + for (auto const& jet : jets) { + if (!jetfindingutilities::isInEtaAcceptance(jet, jetEtaMin, jetEtaMax, trackEtaMin, trackEtaMax)) { + continue; + } + fillHistograms(jet); + } } PROCESS_SWITCH(JetFinderHFQATask, processJetsData, "jet finder HF QA data", false); - void processJetsMCD(typename JetTableMCDJoined::iterator const& jet, CandidateTableMCD const& candidates, JetTracks const& tracks) + void processJetsMCD(soa::Filtered::iterator const& collision, JetTableMCDJoined const& jets, CandidateTableMCD const& candidates, JetTracks const& tracks) { - fillHistograms(jet); + for (auto const& jet : jets) { + if (!jetfindingutilities::isInEtaAcceptance(jet, jetEtaMin, jetEtaMax, trackEtaMin, trackEtaMax)) { + continue; + } + fillHistograms(jet); + } } PROCESS_SWITCH(JetFinderHFQATask, processJetsMCD, "jet finder HF QA mcd", false); - void processJetsMCDWeighted(typename JetTableMCDWeightedJoined::iterator const& jet, CandidateTableMCD const& candidates, JetTracks const& tracks) + void processJetsMCDWeighted(soa::Filtered::iterator const& collision, JetTableMCDWeightedJoined const& jets, CandidateTableMCD const& candidates, JetTracks const& tracks) { - fillHistograms(jet, jet.eventWeight()); + for (auto const& jet : jets) { + if (!jetfindingutilities::isInEtaAcceptance(jet, jetEtaMin, jetEtaMax, trackEtaMin, trackEtaMax)) { + continue; + } + fillHistograms(jet, jet.eventWeight()); + } } PROCESS_SWITCH(JetFinderHFQATask, processJetsMCDWeighted, "jet finder HF QA mcd on weighted events", false); - void processJetsMCP(typename JetTableMCPJoined::iterator const& jet, ParticleTableMCP const& particles) + void processJetsMCP(typename JetTableMCPJoined::iterator const& jet, JetParticles const& particles, CandidateTableMCP const& candidates) { - fillMCPHistograms(jet); + if (!jetfindingutilities::isInEtaAcceptance(jet, jetEtaMin, jetEtaMax, trackEtaMin, trackEtaMax)) { + return; + } + fillMCPHistograms(jet); } PROCESS_SWITCH(JetFinderHFQATask, processJetsMCP, "jet finder HF QA mcp", false); - void processJetsMCPWeighted(typename JetTableMCDWeightedJoined::iterator const& jet, ParticleTableMCP const& particles) + void processJetsMCPWeighted(typename JetTableMCPWeightedJoined::iterator const& jet, JetParticles const& particles, CandidateTableMCP const& candidates) { - fillMCPHistograms(jet, jet.eventWeight()); + if (!jetfindingutilities::isInEtaAcceptance(jet, jetEtaMin, jetEtaMax, trackEtaMin, trackEtaMax)) { + return; + } + fillMCPHistograms(jet, jet.eventWeight()); } PROCESS_SWITCH(JetFinderHFQATask, processJetsMCPWeighted, "jet finder HF QA mcp on weighted events", false); - void processJetsMCPMCDMatched(aod::JCollision const& collision, + void processJetsMCPMCDMatched(soa::Filtered::iterator const& collision, JetTableMCDMatchedJoined const& mcdjets, JetTableMCPMatchedJoined const& mcpjets, - CandidateTableMCD const& candidates, - JetTracks const& tracks, ParticleTableMCP const& particles) + CandidateTableMCD const& candidatesMCD, + JetTracks const& tracks, JetParticles const& particles, + CandidateTableMCP const& candidatesMCP) { for (const auto& mcdjet : mcdjets) { + if (!jetfindingutilities::isInEtaAcceptance(mcdjet, jetEtaMin, jetEtaMax, trackEtaMin, trackEtaMax)) { + continue; + } - fillMCMatchedHistograms(mcdjet); + fillMatchedHistograms(mcdjet); } } PROCESS_SWITCH(JetFinderHFQATask, processJetsMCPMCDMatched, "jet finder HF QA matched mcp and mcd", false); - void processJetsMCPMCDMatchedWeighted(aod::JCollision const& collision, + void processJetsMCPMCDMatchedWeighted(soa::Filtered::iterator const& collision, JetTableMCDMatchedWeightedJoined const& mcdjets, JetTableMCPMatchedWeightedJoined const& mcpjets, - CandidateTableMCD const& candidates, - JetTracks const& tracks, ParticleTableMCP const& particles) + CandidateTableMCD const& candidatesMCD, + JetTracks const& tracks, JetParticles const& particles, + CandidateTableMCP const& candidatesMCP) { for (const auto& mcdjet : mcdjets) { + if (!jetfindingutilities::isInEtaAcceptance(mcdjet, jetEtaMin, jetEtaMax, trackEtaMin, trackEtaMax)) { + continue; + } - fillMCMatchedHistograms(mcdjet, mcdjet.eventWeight()); + fillMatchedHistograms(mcdjet, mcdjet.eventWeight()); } } PROCESS_SWITCH(JetFinderHFQATask, processJetsMCPMCDMatchedWeighted, "jet finder HF QA matched mcp and mcd on weighted events", false); - void processMCCollisionsWeighted(aod::McCollision const& collision) + void processJetsSubMatched(soa::Filtered::iterator const& collision, + JetTableDataMatchedJoined const& jets, + JetTableDataSubMatchedJoined const& jetSubs, + JetTracks const& tracks, JetTracksDataSub const& tracksSub, CandidateTableData const& candidates) { + for (const auto& jet : jets) { + if (!jetfindingutilities::isInEtaAcceptance(jet, jetEtaMin, jetEtaMax, trackEtaMin, trackEtaMax)) { + continue; + } + fillMatchedHistograms(jet); + } + } + PROCESS_SWITCH(JetFinderHFQATask, processJetsSubMatched, "jet finder HF QA matched unsubtracted and constituent subtracted jets", false); + void processMCCollisionsWeighted(JetMcCollision const& collision) + { registry.fill(HIST("h_collision_eventweight_part"), collision.weight()); } PROCESS_SWITCH(JetFinderHFQATask, processMCCollisionsWeighted, "collision QA for weighted events", false); - void processTriggeredData(soa::Join::iterator const& collision, + void processTriggeredData(soa::Join::iterator const& collision, JetTableDataJoined const& jets, CandidateTableData const& candidates, - JetTracks const& tracks) + soa::Filtered const& tracks) { registry.fill(HIST("h_collision_trigger_events"), 0.5); // all events if (collision.posZ() > vertexZCut) { return; } registry.fill(HIST("h_collision_trigger_events"), 1.5); // all events with z vertex cut - if (!JetDerivedDataUtilities::selectCollision(collision, eventSelection)) { + if (!jetderiveddatautilities::selectCollision(collision, eventSelection)) { return; } registry.fill(HIST("h_collision_trigger_events"), 2.5); // events with sel8() - if (JetDerivedDataUtilities::selectChargedTrigger(collision, JetDerivedDataUtilities::JTrigSelCh::chargedLow)) { + if (jetderiveddatautilities::selectChargedTrigger(collision, jetderiveddatautilities::JTrigSelCh::chargedLow)) { registry.fill(HIST("h_collision_trigger_events"), 3.5); // events with high pT triggered jets } - if (JetDerivedDataUtilities::selectChargedTrigger(collision, JetDerivedDataUtilities::JTrigSelCh::chargedHigh)) { + if (jetderiveddatautilities::selectChargedTrigger(collision, jetderiveddatautilities::JTrigSelCh::chargedHigh)) { registry.fill(HIST("h_collision_trigger_events"), 4.5); // events with high pT triggered jets } - if (JetDerivedDataUtilities::selectChargedTrigger(collision, JetDerivedDataUtilities::JTrigSelCh::chargedLow) && JetDerivedDataUtilities::selectChargedTrigger(collision, JetDerivedDataUtilities::JTrigSelCh::chargedHigh)) { + if (jetderiveddatautilities::selectChargedTrigger(collision, jetderiveddatautilities::JTrigSelCh::chargedLow) && jetderiveddatautilities::selectChargedTrigger(collision, jetderiveddatautilities::JTrigSelCh::chargedHigh)) { registry.fill(HIST("h_collision_trigger_events"), 5.5); // events with high pT triggered jets } for (std::size_t iJetRadius = 0; iJetRadius < jetRadiiValues.size(); iJetRadius++) { - filledJetR[iJetRadius] = false; + filledJetR_Both[iJetRadius] = false; + filledJetR_Low[iJetRadius] = false; + filledJetR_High[iJetRadius] = false; } for (auto& jet : jets) { for (std::size_t iJetRadius = 0; iJetRadius < jetRadiiValues.size(); iJetRadius++) { - if (jet.r() == round(jetRadiiValues[iJetRadius] * 100.0f) && !filledJetR[iJetRadius]) { - filledJetR[iJetRadius] = true; - for (double pt = 0.0; pt <= jet.pt(); pt += 1.0) { - registry.fill(HIST("h2_jet_r_jet_pT_triggered"), jet.r() / 100.0, pt); + if (jet.r() == round(jetRadiiValues[iJetRadius] * 100.0f)) { + if (jetderiveddatautilities::selectChargedTrigger(collision, jetderiveddatautilities::JTrigSelCh::chargedLow) && !filledJetR_Low[iJetRadius]) { + filledJetR_Low[iJetRadius] = true; + for (double pt = 0.0; pt <= jet.pt(); pt += 1.0) { + registry.fill(HIST("h2_jet_r_jet_pT_triggered_Low"), jet.r() / 100.0, pt); + } + } + if (jetderiveddatautilities::selectChargedTrigger(collision, jetderiveddatautilities::JTrigSelCh::chargedHigh) && !filledJetR_High[iJetRadius]) { + filledJetR_High[iJetRadius] = true; + for (double pt = 0.0; pt <= jet.pt(); pt += 1.0) { + registry.fill(HIST("h2_jet_r_jet_pT_triggered_High"), jet.r() / 100.0, pt); + } + } + if (jetderiveddatautilities::selectChargedTrigger(collision, jetderiveddatautilities::JTrigSelCh::chargedLow) && jetderiveddatautilities::selectChargedTrigger(collision, jetderiveddatautilities::JTrigSelCh::chargedHigh) && !filledJetR_Both[iJetRadius]) { + filledJetR_Both[iJetRadius] = true; + for (double pt = 0.0; pt <= jet.pt(); pt += 1.0) { + registry.fill(HIST("h2_jet_r_jet_pT_triggered_Both"), jet.r() / 100.0, pt); + } } - break; } } @@ -530,17 +957,17 @@ struct JetFinderHFQATask { registry.fill(HIST("h3_jet_r_jet_eta_collision"), jet.r() / 100.0, jet.eta(), 0.0); registry.fill(HIST("h3_jet_r_jet_phi_collision"), jet.r() / 100.0, jet.phi(), 0.0); - if (JetDerivedDataUtilities::selectChargedTrigger(collision, JetDerivedDataUtilities::JTrigSelCh::chargedLow)) { + if (jetderiveddatautilities::selectChargedTrigger(collision, jetderiveddatautilities::JTrigSelCh::chargedLow)) { registry.fill(HIST("h3_jet_r_jet_pt_collision"), jet.r() / 100.0, jet.pt(), 1.0); registry.fill(HIST("h3_jet_r_jet_eta_collision"), jet.r() / 100.0, jet.eta(), 1.0); registry.fill(HIST("h3_jet_r_jet_phi_collision"), jet.r() / 100.0, jet.phi(), 1.0); } - if (JetDerivedDataUtilities::selectChargedTrigger(collision, JetDerivedDataUtilities::JTrigSelCh::chargedHigh)) { + if (jetderiveddatautilities::selectChargedTrigger(collision, jetderiveddatautilities::JTrigSelCh::chargedHigh)) { registry.fill(HIST("h3_jet_r_jet_pt_collision"), jet.r() / 100.0, jet.pt(), 2.0); registry.fill(HIST("h3_jet_r_jet_eta_collision"), jet.r() / 100.0, jet.eta(), 2.0); registry.fill(HIST("h3_jet_r_jet_phi_collision"), jet.r() / 100.0, jet.phi(), 2.0); } - if (JetDerivedDataUtilities::selectChargedTrigger(collision, JetDerivedDataUtilities::JTrigSelCh::chargedLow) && JetDerivedDataUtilities::selectChargedTrigger(collision, JetDerivedDataUtilities::JTrigSelCh::chargedHigh)) { + if (jetderiveddatautilities::selectChargedTrigger(collision, jetderiveddatautilities::JTrigSelCh::chargedLow) && jetderiveddatautilities::selectChargedTrigger(collision, jetderiveddatautilities::JTrigSelCh::chargedHigh)) { registry.fill(HIST("h3_jet_r_jet_pt_collision"), jet.r() / 100.0, jet.pt(), 3.0); registry.fill(HIST("h3_jet_r_jet_eta_collision"), jet.r() / 100.0, jet.eta(), 3.0); registry.fill(HIST("h3_jet_r_jet_phi_collision"), jet.r() / 100.0, jet.phi(), 3.0); @@ -551,17 +978,17 @@ struct JetFinderHFQATask { registry.fill(HIST("h3_jet_r_jet_pt_track_eta_MB"), jet.r() / 100.0, jet.pt(), constituent.eta()); registry.fill(HIST("h3_jet_r_jet_pt_track_phi_MB"), jet.r() / 100.0, jet.pt(), constituent.phi()); - if (JetDerivedDataUtilities::selectChargedTrigger(collision, JetDerivedDataUtilities::JTrigSelCh::chargedLow)) { + if (jetderiveddatautilities::selectChargedTrigger(collision, jetderiveddatautilities::JTrigSelCh::chargedLow)) { registry.fill(HIST("h3_jet_r_jet_pt_track_pt_Triggered_Low"), jet.r() / 100.0, jet.pt(), constituent.pt()); registry.fill(HIST("h3_jet_r_jet_pt_track_eta_Triggered_Low"), jet.r() / 100.0, jet.pt(), constituent.eta()); registry.fill(HIST("h3_jet_r_jet_pt_track_phi_Triggered_Low"), jet.r() / 100.0, jet.pt(), constituent.phi()); } - if (JetDerivedDataUtilities::selectChargedTrigger(collision, JetDerivedDataUtilities::JTrigSelCh::chargedHigh)) { + if (jetderiveddatautilities::selectChargedTrigger(collision, jetderiveddatautilities::JTrigSelCh::chargedHigh)) { registry.fill(HIST("h3_jet_r_jet_pt_track_pt_Triggered_High"), jet.r() / 100.0, jet.pt(), constituent.pt()); registry.fill(HIST("h3_jet_r_jet_pt_track_eta_Triggered_High"), jet.r() / 100.0, jet.pt(), constituent.eta()); registry.fill(HIST("h3_jet_r_jet_pt_track_phi_Triggered_High"), jet.r() / 100.0, jet.pt(), constituent.phi()); } - if (JetDerivedDataUtilities::selectChargedTrigger(collision, JetDerivedDataUtilities::JTrigSelCh::chargedLow) && JetDerivedDataUtilities::selectChargedTrigger(collision, JetDerivedDataUtilities::JTrigSelCh::chargedHigh)) { + if (jetderiveddatautilities::selectChargedTrigger(collision, jetderiveddatautilities::JTrigSelCh::chargedLow) && jetderiveddatautilities::selectChargedTrigger(collision, jetderiveddatautilities::JTrigSelCh::chargedHigh)) { registry.fill(HIST("h3_jet_r_jet_pt_track_pt_Triggered_Both"), jet.r() / 100.0, jet.pt(), constituent.pt()); registry.fill(HIST("h3_jet_r_jet_pt_track_eta_Triggered_Both"), jet.r() / 100.0, jet.pt(), constituent.eta()); registry.fill(HIST("h3_jet_r_jet_pt_track_phi_Triggered_Both"), jet.r() / 100.0, jet.pt(), constituent.phi()); @@ -572,48 +999,48 @@ struct JetFinderHFQATask { registry.fill(HIST("h3_jet_r_jet_pt_candidate_pt_MB"), jet.r() / 100.0, jet.pt(), hfcandidate.pt()); registry.fill(HIST("h3_jet_r_jet_pt_candidate_eta_MB"), jet.r() / 100.0, jet.pt(), hfcandidate.eta()); registry.fill(HIST("h3_jet_r_jet_pt_candidate_phi_MB"), jet.r() / 100.0, jet.pt(), hfcandidate.phi()); - registry.fill(HIST("h3_jet_r_jet_pt_candidate_y_MB"), jet.r() / 100.0, jet.pt(), hfcandidate.y(candMass)); + registry.fill(HIST("h3_jet_r_jet_pt_candidate_y_MB"), jet.r() / 100.0, jet.pt(), hfcandidate.y()); - if (JetDerivedDataUtilities::selectChargedTrigger(collision, JetDerivedDataUtilities::JTrigSelCh::chargedLow)) { + if (jetderiveddatautilities::selectChargedTrigger(collision, jetderiveddatautilities::JTrigSelCh::chargedLow)) { registry.fill(HIST("h3_jet_r_jet_pt_candidate_pt_Triggered_Low"), jet.r() / 100.0, jet.pt(), hfcandidate.pt()); registry.fill(HIST("h3_jet_r_jet_pt_candidate_eta_Triggered_Low"), jet.r() / 100.0, jet.pt(), hfcandidate.eta()); registry.fill(HIST("h3_jet_r_jet_pt_candidate_phi_Triggered_Low"), jet.r() / 100.0, jet.pt(), hfcandidate.phi()); - registry.fill(HIST("h3_jet_r_jet_pt_candidate_y_Triggered_Low"), jet.r() / 100.0, jet.pt(), hfcandidate.y(candMass)); + registry.fill(HIST("h3_jet_r_jet_pt_candidate_y_Triggered_Low"), jet.r() / 100.0, jet.pt(), hfcandidate.y()); } - if (JetDerivedDataUtilities::selectChargedTrigger(collision, JetDerivedDataUtilities::JTrigSelCh::chargedHigh)) { + if (jetderiveddatautilities::selectChargedTrigger(collision, jetderiveddatautilities::JTrigSelCh::chargedHigh)) { registry.fill(HIST("h3_jet_r_jet_pt_candidate_pt_Triggered_High"), jet.r() / 100.0, jet.pt(), hfcandidate.pt()); registry.fill(HIST("h3_jet_r_jet_pt_candidate_eta_Triggered_High"), jet.r() / 100.0, jet.pt(), hfcandidate.eta()); registry.fill(HIST("h3_jet_r_jet_pt_candidate_phi_Triggered_High"), jet.r() / 100.0, jet.pt(), hfcandidate.phi()); - registry.fill(HIST("h3_jet_r_jet_pt_candidate_y_Triggered_High"), jet.r() / 100.0, jet.pt(), hfcandidate.y(candMass)); + registry.fill(HIST("h3_jet_r_jet_pt_candidate_y_Triggered_High"), jet.r() / 100.0, jet.pt(), hfcandidate.y()); } - if (JetDerivedDataUtilities::selectChargedTrigger(collision, JetDerivedDataUtilities::JTrigSelCh::chargedLow) && JetDerivedDataUtilities::selectChargedTrigger(collision, JetDerivedDataUtilities::JTrigSelCh::chargedHigh)) { + if (jetderiveddatautilities::selectChargedTrigger(collision, jetderiveddatautilities::JTrigSelCh::chargedLow) && jetderiveddatautilities::selectChargedTrigger(collision, jetderiveddatautilities::JTrigSelCh::chargedHigh)) { registry.fill(HIST("h3_jet_r_jet_pt_candidate_pt_Triggered_Both"), jet.r() / 100.0, jet.pt(), hfcandidate.pt()); registry.fill(HIST("h3_jet_r_jet_pt_candidate_eta_Triggered_Both"), jet.r() / 100.0, jet.pt(), hfcandidate.eta()); registry.fill(HIST("h3_jet_r_jet_pt_candidate_phi_Triggered_Both"), jet.r() / 100.0, jet.pt(), hfcandidate.phi()); - registry.fill(HIST("h3_jet_r_jet_pt_candidate_y_Triggered_Both"), jet.r() / 100.0, jet.pt(), hfcandidate.y(candMass)); + registry.fill(HIST("h3_jet_r_jet_pt_candidate_y_Triggered_Both"), jet.r() / 100.0, jet.pt(), hfcandidate.y()); } } } for (auto& track : tracks) { - if (!JetDerivedDataUtilities::selectTrack(track, trackSelection) || !JetDerivedDataUtilities::applyTrackKinematics(track, trackPtMin, trackPtMax, trackEtaMin, trackEtaMax)) { + if (!jetderiveddatautilities::selectTrack(track, trackSelection)) { continue; } registry.fill(HIST("h_track_pt_MB"), track.pt()); registry.fill(HIST("h_track_eta_MB"), track.eta()); registry.fill(HIST("h_track_phi_MB"), track.phi()); - if (JetDerivedDataUtilities::selectChargedTrigger(collision, JetDerivedDataUtilities::JTrigSelCh::chargedLow)) { + if (jetderiveddatautilities::selectChargedTrigger(collision, jetderiveddatautilities::JTrigSelCh::chargedLow)) { registry.fill(HIST("h_track_pt_Triggered_Low"), track.pt()); registry.fill(HIST("h_track_eta_Triggered_Low"), track.eta()); registry.fill(HIST("h_track_phi_Triggered_Low"), track.phi()); } - if (JetDerivedDataUtilities::selectChargedTrigger(collision, JetDerivedDataUtilities::JTrigSelCh::chargedHigh)) { + if (jetderiveddatautilities::selectChargedTrigger(collision, jetderiveddatautilities::JTrigSelCh::chargedHigh)) { registry.fill(HIST("h_track_pt_Triggered_High"), track.pt()); registry.fill(HIST("h_track_eta_Triggered_High"), track.eta()); registry.fill(HIST("h_track_phi_Triggered_High"), track.phi()); } - if (JetDerivedDataUtilities::selectChargedTrigger(collision, JetDerivedDataUtilities::JTrigSelCh::chargedLow) && JetDerivedDataUtilities::selectChargedTrigger(collision, JetDerivedDataUtilities::JTrigSelCh::chargedHigh)) { + if (jetderiveddatautilities::selectChargedTrigger(collision, jetderiveddatautilities::JTrigSelCh::chargedLow) && jetderiveddatautilities::selectChargedTrigger(collision, jetderiveddatautilities::JTrigSelCh::chargedHigh)) { registry.fill(HIST("h_track_pt_Triggered_Both"), track.pt()); registry.fill(HIST("h_track_eta_Triggered_Both"), track.eta()); registry.fill(HIST("h_track_phi_Triggered_Both"), track.phi()); @@ -623,11 +1050,11 @@ struct JetFinderHFQATask { PROCESS_SWITCH(JetFinderHFQATask, processTriggeredData, "QA for charged jet trigger", false); - void processTracks(aod::JCollision const& collision, + void processTracks(soa::Filtered::iterator const& collision, soa::Filtered const& tracks) { registry.fill(HIST("h_collisions"), 0.5); - if (!JetDerivedDataUtilities::selectCollision(collision, eventSelection)) { + if (!jetderiveddatautilities::selectCollision(collision, eventSelection)) { return; } registry.fill(HIST("h_collisions"), 1.5); @@ -635,14 +1062,14 @@ struct JetFinderHFQATask { } PROCESS_SWITCH(JetFinderHFQATask, processTracks, "QA for charged tracks", false); - void processTracksWeighted(soa::Join::iterator const& collision, - aod::JMcCollisions const& mcCollisions, + void processTracksWeighted(soa::Join::iterator const& collision, + JetMcCollisions const& mcCollisions, soa::Filtered const& tracks) { float eventWeight = collision.mcCollision().weight(); registry.fill(HIST("h_collisions"), 0.5); registry.fill(HIST("h_collisions_weighted"), 0.5, eventWeight); - if (!JetDerivedDataUtilities::selectCollision(collision, eventSelection)) { + if (!jetderiveddatautilities::selectCollision(collision, eventSelection)) { return; } registry.fill(HIST("h_collisions"), 1.5); @@ -650,11 +1077,80 @@ struct JetFinderHFQATask { fillTrackHistograms(tracks, eventWeight); } PROCESS_SWITCH(JetFinderHFQATask, processTracksWeighted, "QA for charged tracks weighted", false); + + void processTracksSub(soa::Filtered::iterator const& collision, + CandidateTableData const& candidates, + soa::Filtered const& tracks) + { + if (!jetderiveddatautilities::selectCollision(collision, eventSelection)) { + return; + } + for (auto const& candidate : candidates) { + + for (auto const& track : jethfutilities::slicedPerCandidate(tracks, candidate, perD0CandidateTracks, perLcCandidateTracks, perBplusCandidateTracks)) { + registry.fill(HIST("h_track_pt_eventwiseconstituentsubtracted"), track.pt()); + registry.fill(HIST("h_track_eta_eventwiseconstituentsubtracted"), track.eta()); + registry.fill(HIST("h_track_phi_eventwiseconstituentsubtracted"), track.phi()); + } + break; // currently only fills it for the first candidate in the event (not pT ordered) + } + } + PROCESS_SWITCH(JetFinderHFQATask, processTracksSub, "QA for charged event-wise embedded subtracted tracks", false); + + void processRho(JetCollision const& collision, CandidateTableData const& candidates, BkgRhoTable const& Rhos) + { + for (auto const& candidate : candidates) { + auto rho = jethfutilities::slicedPerCandidate(Rhos, candidate, perD0CandidateRhos, perLcCandidateRhos, perBplusCandidateRhos).iteratorAt(0); + registry.fill(HIST("h2_rho_centrality"), rho.rho(), collision.centrality()); + registry.fill(HIST("h2_rhom_centrality"), rho.rhoM(), collision.centrality()); + break; // currently only fills it for the first candidate in the event (not pT ordered) + } + } + PROCESS_SWITCH(JetFinderHFQATask, processRho, "QA for rho-area subtracted jets", false); + + void processJetsRhoAreaSubData(soa::Filtered::iterator const& collision, + BkgRhoTable const& Rhos, + JetTableDataJoined const& jets, + CandidateTableData const& candidates, + JetTracks const& tracks) + { + for (auto const& jet : jets) { + if (!jetfindingutilities::isInEtaAcceptance(jet, jetEtaMin, jetEtaMax, trackEtaMin, trackEtaMax)) { + continue; + } + auto const jetCandidate = jet.template hfcandidates_first_as(); + auto rho = jethfutilities::slicedPerCandidate(Rhos, jetCandidate, perD0CandidateRhos, perLcCandidateRhos, perBplusCandidateRhos).iteratorAt(0); + fillRhoAreaSubtractedHistograms(jet, rho.rho()); + } + } + PROCESS_SWITCH(JetFinderHFQATask, processJetsRhoAreaSubData, "jet finder HF QA for rho-area subtracted jets", false); + + void processEvtWiseConstSubJetsData(soa::Filtered::iterator const& collision, JetTableDataSubJoined const& jets, CandidateTableData const& candidates, JetTracksDataSub const& tracks) + { + for (auto const& jet : jets) { + if (!jetfindingutilities::isInEtaAcceptance(jet, jetEtaMin, jetEtaMax, trackEtaMin, trackEtaMax)) { + continue; + } + fillEventWiseConstituentSubtractedHistograms(jet); + } + } + PROCESS_SWITCH(JetFinderHFQATask, processEvtWiseConstSubJetsData, "jet finder HF QA for eventwise constituent-subtracted jets data", false); + + void processCandidates(soa::Filtered::iterator const& collision, CandidateTableData const& candidates) + { + + for (auto const& candidate : candidates) { + registry.fill(HIST("h_candidate_invmass"), candidate.m()); + registry.fill(HIST("h_candidate_pt"), candidate.pt()); + registry.fill(HIST("h_candidate_y"), candidate.y()); + } + } + PROCESS_SWITCH(JetFinderHFQATask, processCandidates, "HF candidate QA", false); }; -using JetFinderD0QATask = JetFinderHFQATask, aod::D0ChargedMCDetectorLevelJets, aod::D0ChargedMCDetectorLevelJetConstituents, aod::D0ChargedMCDetectorLevelJetsMatchedToD0ChargedMCParticleLevelJets, aod::D0ChargedMCDetectorLevelJetEventWeights, soa::Join, aod::D0ChargedMCParticleLevelJets, aod::D0ChargedMCParticleLevelJetConstituents, aod::D0ChargedMCParticleLevelJetsMatchedToD0ChargedMCDetectorLevelJets, aod::D0ChargedMCParticleLevelJetEventWeights, soa::Join>; -using JetFinderLcQATask = JetFinderHFQATask, aod::LcChargedMCDetectorLevelJets, aod::LcChargedMCDetectorLevelJetConstituents, aod::LcChargedMCDetectorLevelJetsMatchedToLcChargedMCParticleLevelJets, aod::LcChargedMCDetectorLevelJetEventWeights, soa::Join, aod::LcChargedMCParticleLevelJets, aod::LcChargedMCParticleLevelJetConstituents, aod::LcChargedMCParticleLevelJetsMatchedToLcChargedMCDetectorLevelJets, aod::LcChargedMCParticleLevelJetEventWeights, soa::Join>; -using JetFinderBplusQATask = JetFinderHFQATask, aod::BplusChargedMCDetectorLevelJets, aod::BplusChargedMCDetectorLevelJetConstituents, aod::BplusChargedMCDetectorLevelJetsMatchedToBplusChargedMCParticleLevelJets, aod::BplusChargedMCDetectorLevelJetEventWeights, soa::Join, aod::BplusChargedMCParticleLevelJets, aod::BplusChargedMCParticleLevelJetConstituents, aod::BplusChargedMCParticleLevelJetsMatchedToBplusChargedMCDetectorLevelJets, aod::BplusChargedMCParticleLevelJetEventWeights, soa::Join>; +using JetFinderD0QATask = JetFinderHFQATask; +// using JetFinderLcQATask = JetFinderHFQATask; +// using JetFinderBplusQATask = JetFinderHFQATask; WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) { @@ -664,13 +1160,13 @@ WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) SetDefaultProcesses{}, TaskName{"jet-finder-charged-d0-qa"})); - tasks.emplace_back(adaptAnalysisTask(cfgc, - SetDefaultProcesses{}, - TaskName{"jet-finder-charged-bplus-qa"})); + // tasks.emplace_back(adaptAnalysisTask(cfgc, + // SetDefaultProcesses{}, + // TaskName{"jet-finder-charged-bplus-qa"})); - tasks.emplace_back(adaptAnalysisTask(cfgc, - SetDefaultProcesses{}, - TaskName{"jet-finder-charged-lc-qa"})); + // tasks.emplace_back(adaptAnalysisTask(cfgc, + // SetDefaultProcesses{}, + // TaskName{"jet-finder-charged-lc-qa"})); return WorkflowSpec{tasks}; } diff --git a/PWGJE/Tasks/jetfragmentation.cxx b/PWGJE/Tasks/jetfragmentation.cxx index 719b2b35a2c..6b3851cfd4f 100644 --- a/PWGJE/Tasks/jetfragmentation.cxx +++ b/PWGJE/Tasks/jetfragmentation.cxx @@ -36,7 +36,6 @@ using namespace o2::framework; using namespace o2::framework::expressions; // using McTracks = soa::Filtered>; -using McTracks = soa::Join; using McDJets = soa::Join; // using MatchedMcDJets = soa::Filtered>; using McPJets = soa::Join; @@ -292,7 +291,7 @@ struct JetFragmentation { void fillDataRun3Histograms(T const& jet) { registry.fill(HIST("data/jets/jetPtEtaPhi"), jet.pt(), jet.eta(), jet.phi()); - for (const auto& track : jet.template tracks_as()) { + for (const auto& track : jet.template tracks_as()) { double chargeFrag = -1., trackProj = -1., xi = -1.; double theta = -1.; chargeFrag = ChargeFrag(jet, track); @@ -415,7 +414,7 @@ struct JetFragmentation { void fillMCDHistograms(Jet const& jet, double weight = 1.) { registry.fill(HIST("detector-level/jets/detJetPtEtaPhi"), jet.pt(), jet.eta(), jet.phi(), weight); - for (const auto& track : jet.template tracks_as()) { + for (const auto& track : jet.template tracks_as()) { double chargeFrag = -1., trackProj = -1., theta = -1., xi = -1.; chargeFrag = ChargeFrag(jet, track); trackProj = TrackProj(jet, track); @@ -437,7 +436,7 @@ struct JetFragmentation { void fillMCPHistograms(Jet const& jet, double weight = 1.) { registry.fill(HIST("particle-level/jets/partJetPtEtaPhi"), jet.pt(), jet.eta(), jet.phi(), weight); - for (const auto& track : jet.template tracks_as()) { + for (const auto& track : jet.template tracks_as()) { double chargeFrag = -1., trackProj = -1., theta = -1., xi = -1.; chargeFrag = ChargeFrag(jet, track); trackProj = TrackProj(jet, track); @@ -455,13 +454,13 @@ struct JetFragmentation { } } - void processDummy(aod::JTracks const& track) {} + void processDummy(JetTracks const& tracks) {} PROCESS_SWITCH(JetFragmentation, processDummy, "Dummy process function turned on by default", true); - void processMcD(soa::Join::iterator const& collision, - aod::JMcCollisions const& mcCollisions, + void processMcD(JetCollisionsMCD::iterator const& collision, + JetMcCollisions const& mcCollisions, McDJets const& jets, - aod::JTracks const& tracks) + JetTracks const& tracks) { float nJets = 0, nTracks = 0; double weight = collision.mcCollision().weight(); @@ -479,9 +478,9 @@ struct JetFragmentation { } PROCESS_SWITCH(JetFragmentation, processMcD, "Monte Carlo detector level", false); - void processMcP(aod::JMcCollision const& mcCollision, // Add some form of event selection? + void processMcP(JetMcCollision const& mcCollision, // Add some form of event selection? McPJets const& jets, - aod::JMcParticles const& particles) + JetParticles const& particles) { float nJets = 0, nTracks = 0; double weight = mcCollision.weight(); @@ -500,9 +499,9 @@ struct JetFragmentation { PROCESS_SWITCH(JetFragmentation, processMcP, "Monte Carlo particle level", false); - void processDataRun3(aod::JCollision const& collision, + void processDataRun3(JetCollision const& collision, soa::Join const& jets, - aod::JTracks const& tracks) + JetTracks const& tracks) { float nJets = 0, nTracks = 0; for (const auto& track : tracks) { @@ -519,13 +518,13 @@ struct JetFragmentation { } PROCESS_SWITCH(JetFragmentation, processDataRun3, "Run 3 Data", false); - void processMcMatched(soa::Join::iterator const& collision, + void processMcMatched(JetCollisionsMCD::iterator const& collision, soa::Join const& mcDetJets, - McTracks const& tracks, - aod::JMcCollisions const& mcCollisions, + JetTracksMCD const& tracks, + JetMcCollisions const& mcCollisions, McPJets const& mcPartJets, // soa::Join const& mcPartJets - aod::JMcParticles const& mcParticles) + JetParticles const& mcParticles) { double weight = collision.mcCollision().weight(); bool isFake = false; @@ -536,10 +535,10 @@ struct JetFragmentation { for (auto& partJet : detJet.template matchedJetGeo_as()) { fillMatchingHistogramsJet(detJet, partJet, weight); - for (const auto& track : detJet.tracks_as()) { + for (const auto& track : detJet.tracks_as()) { bool isTrackMatched = false; - for (const auto& particle : partJet.tracks_as()) { - if (track.has_mcParticle() && particle.globalIndex() == track.template mcParticle_as().globalIndex()) { + for (const auto& particle : partJet.tracks_as()) { + if (track.has_mcParticle() && particle.globalIndex() == track.template mcParticle_as().globalIndex()) { isTrackMatched = true; fillMatchingHistogramsConstituent(detJet, partJet, track, particle, weight); break; // No need to inspect other particles @@ -554,7 +553,7 @@ struct JetFragmentation { if (!detJet.has_matchedJetGeo()) { isFake = true; registry.fill(HIST("matching/jets/fakeDetJetPtEtaPhi"), detJet.pt(), detJet.eta(), detJet.phi(), weight); - for (const auto& track : detJet.tracks_as()) { + for (const auto& track : detJet.tracks_as()) { fillMatchingFakeOrMiss(detJet, track, isFake, weight); } } // if detJet does not have a match diff --git a/PWGJE/Tasks/jetmatchingqa.cxx b/PWGJE/Tasks/jetmatchingqa.cxx index 65caa2a9c5f..9ea3049c619 100644 --- a/PWGJE/Tasks/jetmatchingqa.cxx +++ b/PWGJE/Tasks/jetmatchingqa.cxx @@ -76,7 +76,12 @@ struct JetMatchingQA { { } - void processMCD(aod::JCollision const& collision, aod::JMcParticles const& mcParticles, soa::Join const& tracks, + void processDummy(JetMcCollisions const& mcCollisions) + { + } + PROCESS_SWITCH(JetMatchingQA, processDummy, "Dummy process", true); + + void processMCD(JetCollision const& collision, JetParticles const& mcParticles, JetTracksMCD const& tracks, BaseJetCollection const& djets, TagJetCollection const& pjets) { for (const auto& djet : djets) { @@ -102,13 +107,13 @@ struct JetMatchingQA { registry.fill(HIST("h_jet_match_hf_Nconst"), pjet.tracksIds().size(), djet.tracksIds().size()); double pjet_pt_lead = 0.; - for (auto& mcparticle : pjet.template tracks_as()) { + for (auto& mcparticle : pjet.template tracks_as()) { if (mcparticle.pt() > pjet_pt_lead) { pjet_pt_lead = mcparticle.pt(); } } double djet_pt_lead = 0.; - for (auto& track : djet.template tracks_as>()) { + for (auto& track : djet.template tracks_as()) { if (track.pt() > djet_pt_lead) { djet_pt_lead = track.pt(); } @@ -131,13 +136,13 @@ struct JetMatchingQA { registry.fill(HIST("h_jet_match_geo_Nconst"), pjet.tracksIds().size(), djet.tracksIds().size()); double pjet_pt_lead = 0.; - for (auto& mcparticle : pjet.template tracks_as()) { + for (auto& mcparticle : pjet.template tracks_as()) { if (mcparticle.pt() > pjet_pt_lead) { pjet_pt_lead = mcparticle.pt(); } } double djet_pt_lead = 0.; - for (auto& track : djet.template tracks_as>()) { + for (auto& track : djet.template tracks_as()) { if (track.pt() > djet_pt_lead) { djet_pt_lead = track.pt(); } @@ -160,13 +165,13 @@ struct JetMatchingQA { registry.fill(HIST("h_jet_match_pt_Nconst"), pjet.tracksIds().size(), djet.tracksIds().size()); double pjet_pt_lead = 0.; - for (auto& mcparticle : pjet.template tracks_as()) { + for (auto& mcparticle : pjet.template tracks_as()) { if (mcparticle.pt() > pjet_pt_lead) { pjet_pt_lead = mcparticle.pt(); } } double djet_pt_lead = 0.; - for (auto& track : djet.template tracks_as>()) { + for (auto& track : djet.template tracks_as()) { if (track.pt() > djet_pt_lead) { djet_pt_lead = track.pt(); } @@ -177,7 +182,7 @@ struct JetMatchingQA { } PROCESS_SWITCH(JetMatchingQA, processMCD, "QA on detector-level jets", true); - void processMCP(aod::JMcCollision const& collision, + void processMCP(JetMcCollision const& collision, TagJetCollection const& pjets, BaseJetCollection const& djets) { for (const auto& pjet : pjets) { @@ -205,11 +210,6 @@ struct JetMatchingQA { } } PROCESS_SWITCH(JetMatchingQA, processMCP, "QA on generator-level jets", true); - - void processDummy(aod::JMcCollision const& mcCollision) - { - } - PROCESS_SWITCH(JetMatchingQA, processDummy, "Dummy process", true); }; using ChargedDetectorLevelJets = soa::Join; diff --git a/PWGJE/Tasks/jetsubstructure.cxx b/PWGJE/Tasks/jetsubstructure.cxx index 8ee01b215c4..ebd5f517cc8 100644 --- a/PWGJE/Tasks/jetsubstructure.cxx +++ b/PWGJE/Tasks/jetsubstructure.cxx @@ -38,9 +38,11 @@ using namespace o2::framework::expressions; #include "Framework/runDataProcessing.h" -template struct JetSubstructureTask { - Produces jetSubstructureTable; + Produces jetSubstructureDataTable; + Produces jetSubstructureMCDTable; + Produces jetSubstructureMCPTable; + Produces jetSubstructureDataSubTable; OutputObj hZg{"h_jet_zg_jet_pt"}; OutputObj hRg{"h_jet_rg_jet_pt"}; OutputObj hNsd{"h_jet_nsd_jet_pt"}; @@ -66,8 +68,8 @@ struct JetSubstructureTask { jetReclusterer.algorithm = fastjet::JetAlgorithm::cambridge_algorithm; } - template - void jetReclustering(T const& jet) + template + void jetReclustering(T const& jet, U& outputTable) { jetReclustered.clear(); fastjet::ClusterSequenceArea clusterSeq(jetReclusterer.findJets(jetConstituents, jetReclustered)); @@ -98,55 +100,60 @@ struct JetSubstructureTask { daughterSubJet = parentSubJet1; } hNsd->Fill(nsd, jet.pt()); - jetSubstructureTable(zg, rg, nsd); + outputTable(zg, rg, nsd); } - void processDummy(aod::JTracks const& track) + template + void analyseCharged(T const& jet, U const& tracks, V& outputTable) + { + jetConstituents.clear(); + for (auto& jetConstituent : jet.template tracks_as()) { + fastjetutilities::fillTracks(jetConstituent, jetConstituents, jetConstituent.globalIndex()); + } + jetReclustering(jet, outputTable); + } + + void processDummy(JetTracks const& tracks) { } PROCESS_SWITCH(JetSubstructureTask, processDummy, "Dummy process function turned on by default", true); - void processChargedJets(typename JetTable::iterator const& jet, - aod::JTracks const& tracks) + void processChargedJetsData(soa::Join::iterator const& jet, + JetTracks const& tracks) { - jetConstituents.clear(); - for (auto& jetConstituent : jet.template tracks_as()) { - FastJetUtilities::fillTracks(jetConstituent, jetConstituents, jetConstituent.globalIndex()); - } - jetReclustering(jet); + analyseCharged(jet, tracks, jetSubstructureDataTable); + } + PROCESS_SWITCH(JetSubstructureTask, processChargedJetsData, "charged jet substructure", false); + + void processChargedJetsEventWiseSubData(soa::Join::iterator const& jet, + JetTracksSub const& tracks) + { + analyseCharged(jet, tracks, jetSubstructureDataSubTable); + } + PROCESS_SWITCH(JetSubstructureTask, processChargedJetsEventWiseSubData, "eventwise-constituent subtracted charged jet substructure", false); + + void processChargedJetsMCD(typename soa::Join::iterator const& jet, + JetTracks const& tracks) + { + analyseCharged(jet, tracks, jetSubstructureMCDTable); } - PROCESS_SWITCH(JetSubstructureTask, processChargedJets, "charged jet substructure", false); + PROCESS_SWITCH(JetSubstructureTask, processChargedJetsMCD, "charged jet substructure", false); - void processChargedJetsMCP(typename JetTableMCP::iterator const& jet, - aod::JMcParticles const& particles) + void processChargedJetsMCP(typename soa::Join::iterator const& jet, + JetParticles const& particles) { jetConstituents.clear(); - for (auto& jetConstituent : jet.template tracks_as()) { - FastJetUtilities::fillTracks(jetConstituent, jetConstituents, jetConstituent.globalIndex(), static_cast(JetConstituentStatus::track), pdg->Mass(jetConstituent.pdgCode())); + for (auto& jetConstituent : jet.template tracks_as()) { + fastjetutilities::fillTracks(jetConstituent, jetConstituents, jetConstituent.globalIndex(), static_cast(JetConstituentStatus::track), pdg->Mass(jetConstituent.pdgCode())); } - jetReclustering(jet); + jetReclustering(jet, jetSubstructureMCPTable); } PROCESS_SWITCH(JetSubstructureTask, processChargedJetsMCP, "charged jet substructure on MC particle level", false); }; -using JetSubstructureDataLevel = JetSubstructureTask, soa::Join, o2::aod::ChargedJetSubstructures>; -using JetSubstructureMCDetectorLevel = JetSubstructureTask, soa::Join, o2::aod::ChargedMCDetectorLevelJetSubstructures>; -using JetSubstructureMCParticleLevel = JetSubstructureTask, soa::Join, o2::aod::ChargedMCParticleLevelJetSubstructures>; WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) { - std::vector tasks; - - tasks.emplace_back(adaptAnalysisTask(cfgc, - SetDefaultProcesses{}, - TaskName{"jet-substructure-data"})); - - tasks.emplace_back(adaptAnalysisTask(cfgc, - SetDefaultProcesses{}, - TaskName{"jet-substructure-mcd"})); - - tasks.emplace_back(adaptAnalysisTask(cfgc, - SetDefaultProcesses{}, - TaskName{"jet-substructure-mcp"})); - return WorkflowSpec{tasks}; + return WorkflowSpec{adaptAnalysisTask( + cfgc, TaskName{"jet-substructure"})}; } diff --git a/PWGJE/Tasks/jetsubstructurehf.cxx b/PWGJE/Tasks/jetsubstructurehf.cxx index c7fc671bda9..9ea87a2f679 100644 --- a/PWGJE/Tasks/jetsubstructurehf.cxx +++ b/PWGJE/Tasks/jetsubstructurehf.cxx @@ -35,6 +35,7 @@ #include "PWGJE/DataModel/JetSubstructure.h" #include "PWGJE/Core/JetFinder.h" #include "PWGJE/Core/FastJetUtilities.h" +#include "PWGJE/Core/JetHFUtilities.h" using namespace o2; using namespace o2::framework; @@ -43,9 +44,12 @@ using namespace o2::framework::expressions; // NB: runDataProcessing.h must be included after customize! #include "Framework/runDataProcessing.h" -template +template struct JetSubstructureHFTask { - Produces jetSubstructurehfTable; + Produces jetSubstructureDataTable; + Produces jetSubstructureMCDTable; + Produces jetSubstructureMCPTable; + Produces jetSubstructureDataSubTable; OutputObj hZg{"h_jet_zg_jet_pt"}; OutputObj hRg{"h_jet_rg_jet_pt"}; OutputObj hNsd{"h_jet_nsd_jet_pt"}; @@ -55,7 +59,7 @@ struct JetSubstructureHFTask { Configurable beta{"beta", 0.0, "soft drop beta"}; Service pdg; - int candPDG; + int candMass; std::vector jetConstituents; std::vector jetReclustered; @@ -73,19 +77,11 @@ struct JetSubstructureHFTask { jetReclusterer.isReclustering = true; jetReclusterer.algorithm = fastjet::JetAlgorithm::cambridge_algorithm; - if constexpr (std::is_same_v, soa::Join>) { - candPDG = static_cast(o2::constants::physics::Pdg::kD0); - } - if constexpr (std::is_same_v, soa::Join>) { - candPDG = static_cast(o2::constants::physics::Pdg::kBPlus); - } - if constexpr (std::is_same_v, soa::Join>) { - candPDG = static_cast(o2::constants::physics::Pdg::kLambdaCPlus); - } + candMass = jethfutilities::getTablePDGMass(); } - template - void jetReclustering(T const& jet) + template + void jetReclustering(T const& jet, U& outputTable) { jetReclustered.clear(); fastjet::ClusterSequenceArea clusterSeq(jetReclusterer.findJets(jetConstituents, jetReclustered)); @@ -115,7 +111,7 @@ struct JetSubstructureHFTask { } bool isHFInSubjet1 = false; for (auto& subjet1Constituent : parentSubJet1.constituents()) { - if (subjet1Constituent.template user_info().getStatus() == static_cast(JetConstituentStatus::candidateHF)) { + if (subjet1Constituent.template user_info().getStatus() == static_cast(JetConstituentStatus::candidateHF)) { isHFInSubjet1 = true; break; } @@ -127,54 +123,70 @@ struct JetSubstructureHFTask { } } hNsd->Fill(nsd, jet.pt()); - jetSubstructurehfTable(zg, rg, nsd); + outputTable(zg, rg, nsd); } - void processDummy(aod::JTracks const& track) + template + void analyseCharged(T const& jet, U const& tracks, V const& candidates, M& outputTable) { - } - PROCESS_SWITCH(JetSubstructureHFTask, processDummy, "Dummy process function turned on by default", true); - void processChargedJetsHF(typename JetTable::iterator const& jet, - CandidateTable const& candidates, - aod::JTracks const& tracks) - { jetConstituents.clear(); - for (auto& jetConstituent : jet.template tracks_as()) { - FastJetUtilities::fillTracks(jetConstituent, jetConstituents, jetConstituent.globalIndex()); + for (auto& jetConstituent : jet.template tracks_as()) { + fastjetutilities::fillTracks(jetConstituent, jetConstituents, jetConstituent.globalIndex()); } - for (auto& jetHFCandidate : jet.template hfcandidates_as()) { // should only be one at the moment - FastJetUtilities::fillTracks(jetHFCandidate, jetConstituents, jetHFCandidate.globalIndex(), static_cast(JetConstituentStatus::candidateHF), pdg->Mass(candPDG)); + for (auto& jetHFCandidate : jet.template hfcandidates_as()) { // should only be one at the moment + fastjetutilities::fillTracks(jetHFCandidate, jetConstituents, jetHFCandidate.globalIndex(), static_cast(JetConstituentStatus::candidateHF), candMass); } - jetReclustering(jet); + jetReclustering(jet, outputTable); } - PROCESS_SWITCH(JetSubstructureHFTask, processChargedJetsHF, "HF jet substructure", false); - void processChargedJetsHFMCP(typename JetTableMCP::iterator const& jet, - aod::JMcParticles const& particles) + void processDummy(JetTracks const& tracks) + { + } + PROCESS_SWITCH(JetSubstructureHFTask, processDummy, "Dummy process function turned on by default", true); + + void processChargedJetsData(typename JetTableData::iterator const& jet, + CandidateTable const& candidates, + JetTracks const& tracks) + { + analyseCharged(jet, tracks, candidates, jetSubstructureDataTable); + } + PROCESS_SWITCH(JetSubstructureHFTask, processChargedJetsData, "HF jet substructure on data", false); + + void processChargedJetsDataSub(typename JetTableDataSub::iterator const& jet, + CandidateTable const& candidates, + TracksSub const& tracks) + { + analyseCharged(jet, tracks, candidates, jetSubstructureDataSubTable); + } + PROCESS_SWITCH(JetSubstructureHFTask, processChargedJetsDataSub, "HF jet substructure on data", false); + + void processChargedJetsMCD(typename JetTableMCD::iterator const& jet, + CandidateTable const& candidates, + JetTracks const& tracks) + { + analyseCharged(jet, tracks, candidates, jetSubstructureMCDTable); + } + PROCESS_SWITCH(JetSubstructureHFTask, processChargedJetsMCD, "HF jet substructure on data", false); + + void processChargedJetsMCP(typename JetTableMCP::iterator const& jet, + JetParticles const& particles, + CandidateTableMCP const& candidates) { jetConstituents.clear(); - for (auto& jetConstituent : jet.template tracks_as()) { - FastJetUtilities::fillTracks(jetConstituent, jetConstituents, jetConstituent.globalIndex(), static_cast(JetConstituentStatus::track), pdg->Mass(jetConstituent.pdgCode())); + for (auto& jetConstituent : jet.template tracks_as()) { + fastjetutilities::fillTracks(jetConstituent, jetConstituents, jetConstituent.globalIndex(), static_cast(JetConstituentStatus::track), pdg->Mass(jetConstituent.pdgCode())); } - for (auto& jetHFCandidate : jet.template hfcandidates_as()) { // should only be one at the moment - FastJetUtilities::fillTracks(jetHFCandidate, jetConstituents, jetHFCandidate.globalIndex(), static_cast(JetConstituentStatus::candidateHF), pdg->Mass(jetHFCandidate.pdgCode())); + for (auto& jetHFCandidate : jet.template hfcandidates_as()) { + fastjetutilities::fillTracks(jetHFCandidate, jetConstituents, jetHFCandidate.globalIndex(), static_cast(JetConstituentStatus::candidateHF), candMass); } - jetReclustering(jet); + jetReclustering(jet, jetSubstructureMCPTable); } - PROCESS_SWITCH(JetSubstructureHFTask, processChargedJetsHFMCP, "HF jet substructure on MC particle level", false); + PROCESS_SWITCH(JetSubstructureHFTask, processChargedJetsMCP, "HF jet substructure on MC particle level", false); }; -using JetSubstructureD0 = JetSubstructureHFTask, soa::Join, soa::Join, o2::aod::D0ChargedJetSubstructures>; -using MCDetectorLevelJetSubstructureD0 = JetSubstructureHFTask, soa::Join, soa::Join, o2::aod::D0ChargedMCDetectorLevelJetSubstructures>; -using MCParticleLevelJetSubstructureD0 = JetSubstructureHFTask, soa::Join, soa::Join, o2::aod::D0ChargedMCParticleLevelJetSubstructures>; - -// using JetSubstructureBplus = JetSubstructureHFTask,soa::Join,soa::Join,o2::aod::BplusChargedJetSubstructures>; -// using MCDetectorLevelJetSubstructureBplus = JetSubstructureHFTask,soa::Join,soa::Join,o2::aod::BplusChargedMCDetectorLevelJetSubstructures>; -// using MCParticleLevelJetSubstructureBplus = JetSubstructureHFTask,soa::Join,soa::Join,o2::aod::BplusChargedMCParticleLevelJetSubstructures>; - -// using JetSubstructureLc = JetSubstructureHFTask, soa::Join, soa::Join, o2::aod::LcChargedJetSubstructures>; -// using MCDetectorLevelJetSubstructureLc = JetSubstructureHFTask,soa::Join,soa::Join,o2::aod::LcChargedMCDetectorLevelJetSubstructures>; -// using MCParticleLevelJetSubstructureLc = JetSubstructureHFTask,soa::Join,soa::Join,o2::aod::LcChargedMCParticleLevelJetSubstructures>; +using JetSubstructureD0 = JetSubstructureHFTask, soa::Join, soa::Join, soa::Join, CandidatesD0Data, CandidatesD0MCP, aod::D0ChargedJetSubstructures, aod::D0ChargedMCDetectorLevelJetSubstructures, aod::D0ChargedMCParticleLevelJetSubstructures, aod::D0ChargedEventWiseSubtractedJetSubstructures, aod::JTrackD0Subs>; +// using JetSubstructureLc = JetSubstructureHFTask,soa::Join,soa::Join,soa::Join, CandidatesLcData, CandidatesLcMCP, aod::LcChargedJetSubstructures,aod::LcChargedMCDetectorLevelJetSubstructures,aod::LcChargedMCParticleLevelJetSubstructures, aod::LcChargedEventWiseSubtractedJetSubstructures, aod::JTrackLcSubs>; +// using JetSubstructureBplus = JetSubstructureHFTask,soa::Join,soa::Join,soa::Join, CandidatesBplusData, CandidatesBplusMCP, aod::BplusChargedJetSubstructures,aod::BplusChargedMCDetectorLevelJetSubstructures,aod::BplusChargedMCParticleLevelJetSubstructures, aod::BplusChargedEventWiseSubtractedJetSubstructures, aod::JTrackBplusSubs>; WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) { @@ -182,39 +194,15 @@ WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) tasks.emplace_back(adaptAnalysisTask(cfgc, SetDefaultProcesses{}, - TaskName{"jet-substructure-D0-data"})); - - tasks.emplace_back(adaptAnalysisTask(cfgc, - SetDefaultProcesses{}, - TaskName{"jet-substructure-D0-mcd"})); - - tasks.emplace_back(adaptAnalysisTask(cfgc, - SetDefaultProcesses{}, - TaskName{"jet-substructure-D0-mcp"})); - /* - tasks.emplace_back(adaptAnalysisTask(cfgc, - SetDefaultProcesses{}, - TaskName{"jet-substructure-Lc-data"})); - - tasks.emplace_back(adaptAnalysisTask(cfgc, - SetDefaultProcesses{}, - TaskName{"jet-substructure-Lc-mcd"})); - - tasks.emplace_back(adaptAnalysisTask(cfgc, - SetDefaultProcesses{}, - TaskName{"jet-substructure-Lc-mcp"})); - - tasks.emplace_back(adaptAnalysisTask(cfgc, - SetDefaultProcesses{}, - TaskName{"jet-substructure-Bplus-data"})); - - tasks.emplace_back(adaptAnalysisTask(cfgc, - SetDefaultProcesses{}, - TaskName{"jet-substructure-Bplus-mcd"})); - - tasks.emplace_back(adaptAnalysisTask(cfgc, - SetDefaultProcesses{}, - TaskName{"jet-substructure-Bplus-mcp"})); - */ - return WorkflowSpec{tasks}; + TaskName{"jet-substructure-D0"})); + /* + tasks.emplace_back(adaptAnalysisTask(cfgc, + SetDefaultProcesses{}, + TaskName{"jet-substructure-Lc"})); + + tasks.emplace_back(adaptAnalysisTask(cfgc, + SetDefaultProcesses{}, + TaskName{"jet-substructure-Bplus"})); + */ + return WorkflowSpec{tasks}; } diff --git a/PWGJE/Tasks/jetsubstructurehfoutput.cxx b/PWGJE/Tasks/jetsubstructurehfoutput.cxx index 98accfaa77c..3c9814bead0 100644 --- a/PWGJE/Tasks/jetsubstructurehfoutput.cxx +++ b/PWGJE/Tasks/jetsubstructurehfoutput.cxx @@ -31,6 +31,7 @@ #include "PWGJE/DataModel/Jet.h" #include "PWGJE/DataModel/JetSubstructure.h" #include "PWGJE/Core/JetFinder.h" +#include "PWGJE/Core/JetFindingUtilities.h" using namespace o2; using namespace o2::framework; @@ -39,17 +40,38 @@ using namespace o2::framework::expressions; // NB: runDataProcessing.h must be included after customize! #include "Framework/runDataProcessing.h" -template +template struct JetSubstructureHFOutputTask { + Produces collisionOutputTableData; Produces jetOutputTableData; Produces jetSubstructureOutputTableData; + Produces collisionOutputTableDataSub; + Produces jetOutputTableDataSub; + Produces jetSubstructureOutputTableDataSub; + Produces collisionOutputTableMCD; Produces jetOutputTableMCD; Produces jetSubstructureOutputTableMCD; + Produces collisionOutputTableMCP; Produces jetOutputTableMCP; Produces jetSubstructureOutputTableMCP; + Produces hfCollisionsTable; + Produces candidateTable; + Produces candidateParsTable; + Produces candidateParExtrasTable; + Produces candidateSelsTable; + Produces candidateMcsTable; + Produces hfParticlesTable; Configurable jetPtMin{"jetPtMin", 0.0, "minimum jet pT cut"}; Configurable> jetRadii{"jetRadii", std::vector{0.4}, "jet resolution parameters"}; + Configurable jetEtaMin{"jetEtaMin", -99.0, "minimum jet pseudorapidity"}; + Configurable jetEtaMax{"jetEtaMax", 99.0, "maximum jet pseudorapidity"}; + + Configurable trackEtaMin{"trackEtaMin", -0.9, "minimum track pseudorapidity"}; + Configurable trackEtaMax{"trackEtaMax", 0.9, "maximum track pseudorapidity"}; + + std::map candidateMapping; + std::map candidateCollisionMapping; std::vector jetRadiiValues; @@ -61,97 +83,210 @@ struct JetSubstructureHFOutputTask { Filter jetSelection = aod::jet::pt >= jetPtMin; template - void fillTables(T const& collision, U const& jet, V const& cand, M& jetOutputTable, N& jetSubstructureOutputTable, std::vector geoMatching, std::vector ptMatching, std::vector candMatching) + void fillTables(T const& jet, U const& cand, int32_t collisionIndex, int32_t candidateIndex, V& collisionOutputTable, M& jetOutputTable, N& jetSubstructureOutputTable, std::vector geoMatching, std::vector ptMatching, std::vector candMatching) { - jetOutputTable(collision.globalIndex(), jet.globalIndex(), cand.globalIndex(), geoMatching, ptMatching, candMatching, jet.pt(), jet.phi(), jet.eta(), jet.r(), jet.tracks().size() + jet.hfcandidates().size()); - jetSubstructureOutputTable(jet.globalIndex(), jet.zg(), jet.rg(), jet.nsd()); + jetOutputTable(collisionIndex, candidateIndex, geoMatching, ptMatching, candMatching, jet.pt(), jet.phi(), jet.eta(), jet.r(), jet.tracks().size() + jet.hfcandidates().size()); // here we take the decision to keep the collision index consistent with the JE framework in case it is later needed to join to other tables. The candidate Index however can be linked to the HF tables + jetSubstructureOutputTable(jetOutputTable.lastIndex(), jet.zg(), jet.rg(), jet.nsd()); } - void processDummy(aod::JCollision const& collision) {} - PROCESS_SWITCH(JetSubstructureHFOutputTask, processDummy, "Dummy process function turned on by default", true); - - void processOutputData(aod::JCollision const& collision, - JetTableData const& jets, - aod::JTracks const& tracks, - CandidateTableData const& candidates) + template + void analyseCharged(T const& collision, U const& jets, V const& jetsTag, M const& tracks, N const& candidates, O& collisionOutputTable, P& jetOutputTable, S& jetSubstructureOutputTable) { - std::vector geoMatching{-1}; - std::vector ptMatching{-1}; - std::vector candMatching{-1}; + + int nJetInCollision = 0; + int32_t collisionIndex = -1; for (const auto& jet : jets) { + if (!jetfindingutilities::isInEtaAcceptance(jet, jetEtaMin, jetEtaMax, trackEtaMin, trackEtaMax)) { + continue; + } for (const auto& jetRadiiValue : jetRadiiValues) { if (jet.r() == round(jetRadiiValue * 100.0f)) { - auto cands = jet.template hfcandidates_as(); - auto cand = cands[0]; - fillTables(collision, jet, cand, jetOutputTableData, jetSubstructureOutputTableData, geoMatching, ptMatching, candMatching); + auto candidate = jet.template hfcandidates_first_as(); + std::vector geoMatching; + std::vector ptMatching; + std::vector hfMatching; + if (jet.has_matchedJetGeo()) { + for (auto& jetTag : jet.template matchedJetGeo_as()) { + geoMatching.push_back(jetTag.globalIndex()); + } + } + if (jet.has_matchedJetPt()) { + for (auto& jetTag : jet.template matchedJetPt_as()) { + ptMatching.push_back(jetTag.globalIndex()); + } + } + if (jet.has_matchedJetCand()) { + for (auto& jetTag : jet.template matchedJetCand_as()) { + hfMatching.push_back(jetTag.globalIndex()); + } + } + + int32_t candidateIndex = -1; + auto candidateTableIndex = candidateMapping.find(candidate.globalIndex()); + if (candidateTableIndex != candidateMapping.end()) { + candidateIndex = candidateTableIndex->second; + } + + if (nJetInCollision == 0) { + collisionOutputTable(collision.posZ(), collision.centrality(), collision.eventSel()); + collisionIndex = collisionOutputTable.lastIndex(); + } + nJetInCollision++; + fillTables(jet, candidate, collisionIndex, candidateIndex, collisionOutputTable, jetOutputTable, jetSubstructureOutputTable, geoMatching, ptMatching, hfMatching); } } } } - PROCESS_SWITCH(JetSubstructureHFOutputTask, processOutputData, "hf jet substructure output Data", false); - void processOutputMCD(aod::JCollision const& collision, - JetTableMCD const& mcdjets, - JetTableMCP const& mcpjets, - aod::JTracks const& tracks, - CandidateTableMCD const& candidates) + template + void analyseCandidates(T const& jets, U const& candidateCollisions, V const& candidates) { - for (const auto& mcdjet : mcdjets) { + + int nJetInCollision = 0; + int32_t candidateCollisionIndex = -1; + for (const auto& jet : jets) { + if (!jetfindingutilities::isInEtaAcceptance(jet, jetEtaMin, jetEtaMax, trackEtaMin, trackEtaMax)) { + continue; + } for (const auto& jetRadiiValue : jetRadiiValues) { - if (mcdjet.r() == round(jetRadiiValue * 100.0f)) { - auto cands = mcdjet.template hfcandidates_as(); - auto cand = cands[0]; - std::vector geoMatching; - std::vector ptMatching; - std::vector candMatching; - for (auto& mcpjet : mcdjet.template matchedJetGeo_as()) { - geoMatching.push_back(mcpjet.globalIndex()); - } - for (auto& mcpjet : mcdjet.template matchedJetPt_as()) { - ptMatching.push_back(mcpjet.globalIndex()); + if (jet.r() == round(jetRadiiValue * 100.0f)) { + + auto candidate = jet.template hfcandidates_first_as(); + + auto candidateTableIndex = candidateMapping.find(candidate.globalIndex()); + if (candidateTableIndex != candidateMapping.end()) { + continue; } - for (auto& mcpjet : mcdjet.template matchedJetCand_as()) { - candMatching.push_back(mcpjet.globalIndex()); + + auto candidateCollision = jethfutilities::getCandidateCollision(candidate, candidateCollisions); // this is getting the wrong object + if (nJetInCollision == 0) { + auto candidateCollisionTableIndex = candidateCollisionMapping.find(candidateCollision.globalIndex()); + if (candidateCollisionTableIndex == candidateCollisionMapping.end()) { + jethfutilities::fillHFCollisionTable(candidateCollision, candidates, hfCollisionsTable, candidateCollisionIndex); + candidateCollisionMapping.insert(std::make_pair(candidateCollision.globalIndex(), candidateCollisionIndex)); + } else { + candidateCollisionIndex = candidateCollisionTableIndex->second; + } } - fillTables(collision, mcdjet, cand, jetOutputTableMCD, jetSubstructureOutputTableMCD, geoMatching, ptMatching, candMatching); + nJetInCollision++; + int32_t candidateIndex = -1; + jethfutilities::fillCandidateTable(candidate, candidateCollisionIndex, candidateTable, candidateParsTable, candidateParExtrasTable, candidateSelsTable, candidateMcsTable, candidateIndex); + candidateMapping.insert(std::make_pair(candidate.globalIndex(), candidateIndex)); } } } } + + void processDummy(JetCollisions const& collisions) {} + PROCESS_SWITCH(JetSubstructureHFOutputTask, processDummy, "Dummy process function turned on by default", true); + + void processOutputHFData(JetCollision const& collision, + JetTableData const& jets, + CandidateCollisionTable const& canidateCollisions, + CandidateTable const& candidates) + { + + analyseCandidates(jets, canidateCollisions, candidates); + } + PROCESS_SWITCH(JetSubstructureHFOutputTask, processOutputHFData, "hf output Data", false); + + void processOutputHFDataSub(JetCollision const& collision, + JetTableDataSub const& jets, + CandidateCollisionTable const& canidateCollisions, + CandidateTable const& candidates) + { + + analyseCandidates(jets, canidateCollisions, candidates); + } + PROCESS_SWITCH(JetSubstructureHFOutputTask, processOutputHFDataSub, "hf output Data eventwise constituent subtracted", false); + + void processOutputHFMCD(JetCollision const& collision, + JetTableMCD const& jets, + CandidateCollisionTable const& canidateCollisions, + CandidateTable const& candidates) + { + + analyseCandidates(jets, canidateCollisions, candidates); + } + PROCESS_SWITCH(JetSubstructureHFOutputTask, processOutputHFMCD, "hf output MCD", false); + + void processOutputData(JetCollision const& collision, + JetTableData const& jets, + JetTableDataSub const& jetsTag, + JetTracks const& tracks, + CandidateCollisionTable const& canidateCollisions, + CandidateTable const& candidates) + { + analyseCharged(collision, jets, jetsTag, tracks, candidates, collisionOutputTableData, jetOutputTableData, jetSubstructureOutputTableData); + } + PROCESS_SWITCH(JetSubstructureHFOutputTask, processOutputData, "hf jet substructure output Data", false); + + void processOutputDataSub(JetCollision const& collision, + JetTableDataSub const& jets, + JetTableData const& jetsTag, + TracksSub const& tracks, + CandidateCollisionTable const& canidateCollisions, + CandidateTable const& candidates) + { + analyseCharged(collision, jets, jetsTag, tracks, candidates, collisionOutputTableDataSub, jetOutputTableDataSub, jetSubstructureOutputTableDataSub); + } + PROCESS_SWITCH(JetSubstructureHFOutputTask, processOutputDataSub, "hf jet substructure output event-wise subtracted Data", false); + + void processOutputMCD(JetCollision const& collision, + JetTableMCD const& jets, + JetTableMCP const& jetsTag, + JetTracks const& tracks, + CandidateCollisionTable const& canidateCollisions, + CandidateTable const& candidates) + { + analyseCharged(collision, jets, jetsTag, tracks, candidates, collisionOutputTableMCD, jetOutputTableMCD, jetSubstructureOutputTableMCD); + } PROCESS_SWITCH(JetSubstructureHFOutputTask, processOutputMCD, "hf jet substructure output MCD", false); - void processOutputMCP(aod::JMcCollision const& collision, - JetTableMCP const& mcpjets, - JetTableMCD const& mcdjets, - ParticleTable const& particles) + void processOutputMCP(JetMcCollision const& collision, + JetTableMCP const& jets, + JetTableMCD const& jetsTag, + JetParticles const& particles, + CandidateTableMCP const& candidates) { - for (const auto& mcpjet : mcpjets) { + for (const auto& jet : jets) { + if (!jetfindingutilities::isInEtaAcceptance(jet, jetEtaMin, jetEtaMax, trackEtaMin, trackEtaMax)) { + continue; + } for (const auto& jetRadiiValue : jetRadiiValues) { - if (mcpjet.r() == round(jetRadiiValue * 100.0f)) { - auto cands = mcpjet.template hfcandidates_as(); - auto cand = cands[0]; + if (jet.r() == round(jetRadiiValue * 100.0f)) { + auto candidate = jet.template hfcandidates_first_as(); std::vector geoMatching; std::vector ptMatching; - std::vector candMatching; - for (auto& mcdjet : mcpjet.template matchedJetGeo_as()) { - geoMatching.push_back(mcdjet.globalIndex()); + std::vector hfMatching; + if (jet.has_matchedJetGeo()) { + for (auto& jetTag : jet.template matchedJetGeo_as()) { + geoMatching.push_back(jetTag.globalIndex()); + } } - for (auto& mcdjet : mcpjet.template matchedJetPt_as()) { - ptMatching.push_back(mcdjet.globalIndex()); + if (jet.has_matchedJetPt()) { + for (auto& jetTag : jet.template matchedJetPt_as()) { + ptMatching.push_back(jetTag.globalIndex()); + } } - for (auto& mcdjet : mcpjet.template matchedJetCand_as()) { - candMatching.push_back(mcdjet.globalIndex()); + if (jet.has_matchedJetCand()) { + for (auto& jetTag : jet.template matchedJetCand_as()) { + hfMatching.push_back(jetTag.globalIndex()); + } } - fillTables(collision, mcpjet, cand, jetOutputTableMCP, jetSubstructureOutputTableMCP, geoMatching, ptMatching, candMatching); + int32_t candidateIndex = -1; + jethfutilities::fillCandidateMcTable(candidate, hfParticlesTable, candidateIndex); + + fillTables(jet, candidate, -1, candidateIndex, collisionOutputTableMCP, jetOutputTableMCP, jetSubstructureOutputTableMCP, geoMatching, ptMatching, hfMatching); } } } } PROCESS_SWITCH(JetSubstructureHFOutputTask, processOutputMCP, "hf jet substructure output MCP", false); }; -using JetSubstructureOutputD0 = JetSubstructureHFOutputTask, soa::Join, soa::Join, soa::Filtered>, aod::D0ChargedJetOutput, aod::D0ChargedJetSubstructureOutput, soa::Filtered>, aod::D0ChargedMCDetectorLevelJetOutput, aod::D0ChargedMCDetectorLevelJetSubstructureOutput, soa::Filtered>, aod::D0ChargedMCParticleLevelJetOutput, aod::D0ChargedMCParticleLevelJetSubstructureOutput>; -// using JetSubstructureOutputLc = JetSubstructureHFOutputTask, soa::Join, soa::Join, soa::Filtered>, aod::LcChargedJetOutput, aod::LcChargedJetSubstructureOutput,soa::Filtered>, aod::LcChargedMCDetectorLevelJetOutput, aod::LcChargedMCDetectorLevelJetSubstructureOutput, soa::Filtered>, aod::LcChargedMCParticleLevelJetOutput, aod::LcChargedMCParticleLevelJetSubstructureOutput>; -// using JetSubstructureOutputBplus = JetSubstructureHFOutputTask, soa::Join, soa::Join, soa::Filtered>, aod::BplusChargedJetOutput, aod::BplusChargedJetSubstructureOutput,soa::Filtered>, aod::BplusChargedMCDetectorLevelJetOutput, aod::BplusChargedMCDetectorLevelJetSubstructureOutput, soa::Filtered>, aod::BplusChargedMCParticleLevelJetOutput, aod::BplusChargedMCParticleLevelJetSubstructureOutput>; +using JetSubstructureOutputD0 = JetSubstructureHFOutputTask>, aod::D0ChargedJetCollisionOutputs, aod::D0ChargedJetOutputs, aod::D0ChargedJetSubstructureOutputs, soa::Filtered>, aod::D0ChargedMCDetectorLevelJetCollisionOutputs, aod::D0ChargedMCDetectorLevelJetOutputs, aod::D0ChargedMCDetectorLevelJetSubstructureOutputs, soa::Filtered>, aod::D0ChargedMCParticleLevelJetCollisionOutputs, aod::D0ChargedMCParticleLevelJetOutputs, aod::D0ChargedMCParticleLevelJetSubstructureOutputs, soa::Filtered>, aod::D0ChargedEventWiseSubtractedJetCollisionOutputs, aod::D0ChargedEventWiseSubtractedJetOutputs, aod::D0ChargedEventWiseSubtractedJetSubstructureOutputs, aod::StoredHfD0CollBase, aod::StoredHfD0Bases, aod::StoredHfD0Pars, aod::StoredHfD0ParEs, aod::StoredHfD0Sels, aod::StoredHfD0Mcs, aod::StoredHfD0PBases>; +// using JetSubstructureOutputLc = JetSubstructureHFOutputTask>, aod::LcChargedJetCollisionOutputs, aod::LcChargedJetOutputs, aod::LcChargedJetSubstructureOutputs, soa::Filtered>, aod::LcChargedMCDetectorLevelJetCollisionOutputs, aod::LcChargedMCDetectorLevelJetOutputs, aod::LcChargedMCDetectorLevelJetSubstructureOutputs, soa::Filtered>, aod::LcChargedMCParticleLevelJetCollisionOutputs, aod::LcChargedMCParticleLevelJetOutputs, aod::LcChargedMCParticleLevelJetSubstructureOutputs, soa::Filtered>, aod::LcChargedEventWiseSubtractedJetCollisionOutputs, aod::LcChargedEventWiseSubtractedJetOutputs, aod::LcChargedEventWiseSubtractedJetSubstructureOutputs, aod::StoredHfLcCollBase, aod::StoredHfLcBases, aod::StoredHfLcPars, aod::StoredHfLcParEs, aod::StoredHfLcSels, aod::StoredHfLcMcs, aod::StoredHfLcPBases>; +// using JetSubstructureOutputBplus = JetSubstructureHFOutputTask>, aod::BplusChargedJetCollisionOutputs, aod::BplusChargedJetOutputs, aod::BplusChargedJetSubstructureOutputs, soa::Filtered>, aod::BplusChargedMCDetectorLevelJetCollisionOutputs, aod::BplusChargedMCDetectorLevelJetOutputs, aod::BplusChargedMCDetectorLevelJetSubstructureOutputs, soa::Filtered>, aod::BplusChargedMCParticleLevelJetCollisionOutputs, aod::BplusChargedMCParticleLevelJetOutputs, aod::BplusChargedMCParticleLevelJetSubstructureOutputs, soa::Filtered>, aod::BplusChargedEventWiseSubtractedJetCollisionOutputs, aod::BplusChargedEventWiseSubtractedJetOutputs, aod::BplusChargedEventWiseSubtractedJetSubstructureOutputs, aod::StoredHfBplusCollBase, aod::StoredHfBplusBases, aod::StoredHfBplusPars, aod::StoredHfBplusParEs, aod::StoredHfBplusSels, aod::StoredHfBplusMcs, aod::StoredHfBplusPBases>; WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) { diff --git a/PWGJE/Tasks/jetsubstructureoutput.cxx b/PWGJE/Tasks/jetsubstructureoutput.cxx index 397e66630c3..01842acda41 100644 --- a/PWGJE/Tasks/jetsubstructureoutput.cxx +++ b/PWGJE/Tasks/jetsubstructureoutput.cxx @@ -26,6 +26,7 @@ #include "Common/DataModel/TrackSelectionTables.h" #include "PWGJE/Core/JetFinder.h" +#include "PWGJE/Core/JetFindingUtilities.h" #include "PWGJE/DataModel/Jet.h" #include "PWGJE/DataModel/JetSubstructure.h" @@ -36,17 +37,28 @@ using namespace o2::framework::expressions; // NB: runDataProcessing.h must be included after customize! #include "Framework/runDataProcessing.h" -template struct JetSubstructureOutputTask { - Produces jetOutputTableData; - Produces jetSubstructureOutputTableData; - Produces jetOutputTableMCD; - Produces jetSubstructureOutputTableMCD; - Produces jetOutputTableMCP; - Produces jetSubstructureOutputTableMCP; + + Produces collisionOutputTableData; + Produces jetOutputTableData; + Produces jetSubstructureOutputTableData; + Produces collisionOutputTableDataSub; + Produces jetOutputTableDataSub; + Produces jetSubstructureOutputTableDataSub; + Produces collisionOutputTableMCD; + Produces jetOutputTableMCD; + Produces jetSubstructureOutputTableMCD; + Produces collisionOutputTableMCP; + Produces jetOutputTableMCP; + Produces jetSubstructureOutputTableMCP; Configurable jetPtMin{"jetPtMin", 0.0, "minimum jet pT cut"}; Configurable> jetRadii{"jetRadii", std::vector{0.4}, "jet resolution parameters"}; + Configurable jetEtaMin{"jetEtaMin", -99.0, "minimum jet pseudorapidity"}; + Configurable jetEtaMax{"jetEtaMax", 99.0, "maximum jet pseudorapidity"}; + + Configurable trackEtaMin{"trackEtaMin", -0.9, "minimum track pseudorapidity"}; + Configurable trackEtaMax{"trackEtaMax", 0.9, "maximum track pseudorapidity"}; std::vector jetRadiiValues; @@ -58,87 +70,113 @@ struct JetSubstructureOutputTask { Filter jetSelection = aod::jet::pt >= jetPtMin; template - void fillTables(T const& collision, U const& jet, V& jetOutputTable, M& jetSubstructureOutputTable, std::vector geoMatching, std::vector ptMatching, std::vector candMatching) + void fillTables(T const& jet, int32_t collisionIndex, U& collisionOutputTable, V& jetOutputTable, M& jetSubstructureOutputTable, std::vector geoMatching, std::vector ptMatching, std::vector candMatching) { - jetOutputTable(collision.globalIndex(), jet.globalIndex(), -1, geoMatching, ptMatching, candMatching, jet.pt(), jet.phi(), jet.eta(), jet.r(), jet.tracks().size()); - jetSubstructureOutputTable(jet.globalIndex(), jet.zg(), jet.rg(), jet.nsd()); + jetOutputTable(collisionIndex, -1, geoMatching, ptMatching, candMatching, jet.pt(), jet.phi(), jet.eta(), jet.r(), jet.tracks().size()); + jetSubstructureOutputTable(jetOutputTable.lastIndex(), jet.zg(), jet.rg(), jet.nsd()); } - void processDummy(aod::JCollision const& collision) {} - PROCESS_SWITCH(JetSubstructureOutputTask, processDummy, "Dummy process function turned on by default", true); - - void processOutputData(aod::JCollision const& collision, - JetTableData const& jets, - aod::JTracks const& tracks) + template + void analyseCharged(T const& collision, U const& jets, V const& jetsTag, M& collisionOutputTable, N& jetOutputTable, O& jetSubstructureOutputTable) { - std::vector geoMatching{-1}; - std::vector ptMatching{-1}; + std::vector candMatching{-1}; + int nJetInCollision = 0; + int32_t collisionIndex = -1; for (const auto& jet : jets) { - for (const auto& jetRadiiValue : jetRadiiValues) { - if (jet.r() == round(jetRadiiValue * 100.0f)) { - fillTables(collision, jet, jetOutputTableData, jetSubstructureOutputTableData, geoMatching, ptMatching, candMatching); - } + if (!jetfindingutilities::isInEtaAcceptance(jet, jetEtaMin, jetEtaMax, trackEtaMin, trackEtaMax)) { + continue; } - } - } - PROCESS_SWITCH(JetSubstructureOutputTask, processOutputData, "jet substructure output Data", false); - - void processOutputMCD(aod::JCollision const& collision, - JetTableMCD const& mcdjets, - JetTableMCP const& mcpjets, - aod::JTracks const& tracks) - { - std::vector candMatching{-1}; - for (const auto& mcdjet : mcdjets) { for (const auto& jetRadiiValue : jetRadiiValues) { - if (mcdjet.r() == round(jetRadiiValue * 100.0f)) { + if (jet.r() == round(jetRadiiValue * 100.0f)) { std::vector geoMatching; std::vector ptMatching; - for (auto& mcpjet : mcdjet.template matchedJetGeo_as()) { - geoMatching.push_back(mcpjet.globalIndex()); + if (jet.has_matchedJetGeo()) { + for (auto& jetTag : jet.template matchedJetGeo_as()) { + geoMatching.push_back(jetTag.globalIndex()); + } + } + if (jet.has_matchedJetPt()) { + for (auto& jetTag : jet.template matchedJetPt_as()) { + ptMatching.push_back(jetTag.globalIndex()); + } } - for (auto& mcpjet : mcdjet.template matchedJetPt_as()) { - ptMatching.push_back(mcpjet.globalIndex()); + if (nJetInCollision == 0) { + collisionOutputTable(collision.posZ(), collision.centrality(), collision.eventSel()); + collisionIndex = collisionOutputTable.lastIndex(); } - fillTables(collision, mcdjet, jetOutputTableMCD, jetSubstructureOutputTableMCD, geoMatching, ptMatching, candMatching); + nJetInCollision++; + fillTables(jet, collisionIndex, collisionOutputTable, jetOutputTable, jetSubstructureOutputTable, geoMatching, ptMatching, candMatching); } } } } + + void processDummy(JetCollisions const& collisions) {} + PROCESS_SWITCH(JetSubstructureOutputTask, processDummy, "Dummy process function turned on by default", true); + + void processOutputData(JetCollision const& collision, + soa::Filtered> const& jets, + aod::ChargedEventWiseSubtractedJets const& jetsTag, + JetTracks const& tracks) + { + analyseCharged(collision, jets, jetsTag, collisionOutputTableData, jetOutputTableData, jetSubstructureOutputTableData); + } + PROCESS_SWITCH(JetSubstructureOutputTask, processOutputData, "jet substructure output Data", false); + + void processOutputDataSub(JetCollision const& collision, + soa::Filtered> const& jets, + aod::ChargedJets const& jetsTag, + JetTracks const& tracks) + { + analyseCharged(collision, jets, jetsTag, collisionOutputTableDataSub, jetOutputTableDataSub, jetSubstructureOutputTableDataSub); + } + PROCESS_SWITCH(JetSubstructureOutputTask, processOutputDataSub, "jet substructure output event-wise subtracted Data", false); + + void processOutputMCD(JetCollision const& collision, + soa::Filtered> const& jets, + aod::ChargedMCParticleLevelJets const& jetsTag, + JetTracks const& tracks) + { + analyseCharged(collision, jets, jetsTag, collisionOutputTableMCD, jetOutputTableMCD, jetSubstructureOutputTableMCD); + } PROCESS_SWITCH(JetSubstructureOutputTask, processOutputMCD, "jet substructure output MCD", false); - void processOutputMCP(aod::JMcCollision const& collision, - JetTableMCP const& mcpjets, - JetTableMCD const& mcdjets, - aod::JMcParticles const& particles) + void processOutputMCP(JetMcCollision const& collision, + soa::Filtered> const& jets, + aod::ChargedMCDetectorLevelJets const& jetsTag, + JetParticles const& particles) { std::vector candMatching{-1}; - for (const auto& mcpjet : mcpjets) { + for (const auto& jet : jets) { + if (!jetfindingutilities::isInEtaAcceptance(jet, jetEtaMin, jetEtaMax, trackEtaMin, trackEtaMax)) { + continue; + } for (const auto& jetRadiiValue : jetRadiiValues) { - if (mcpjet.r() == round(jetRadiiValue * 100.0f)) { + if (jet.r() == round(jetRadiiValue * 100.0f)) { std::vector geoMatching; std::vector ptMatching; - for (auto& mcdjet : mcpjet.template matchedJetGeo_as()) { - geoMatching.push_back(mcdjet.globalIndex()); + if (jet.has_matchedJetGeo()) { + for (auto& jetTag : jet.template matchedJetGeo_as()) { + geoMatching.push_back(jetTag.globalIndex()); + } } - for (auto& mcdjet : mcpjet.template matchedJetPt_as()) { - ptMatching.push_back(mcdjet.globalIndex()); + if (jet.has_matchedJetPt()) { + for (auto& jetTag : jet.template matchedJetPt_as()) { + ptMatching.push_back(jetTag.globalIndex()); + } } - fillTables(collision, mcpjet, jetOutputTableMCP, jetSubstructureOutputTableMCP, geoMatching, ptMatching, candMatching); + fillTables(jet, -1, collisionOutputTableMCP, jetOutputTableMCP, jetSubstructureOutputTableMCP, geoMatching, ptMatching, candMatching); } } } } PROCESS_SWITCH(JetSubstructureOutputTask, processOutputMCP, "jet substructure output MCP", false); }; -using JetSubstructureOutput = JetSubstructureOutputTask>, aod::ChargedJetOutput, aod::ChargedJetSubstructureOutput, soa::Filtered>, aod::ChargedMCDetectorLevelJetOutput, aod::ChargedMCDetectorLevelJetSubstructureOutput, soa::Filtered>, aod::ChargedMCParticleLevelJetOutput, aod::ChargedMCParticleLevelJetSubstructureOutput>; WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) { - std::vector tasks; - - tasks.emplace_back(adaptAnalysisTask(cfgc, SetDefaultProcesses{}, TaskName{"jet-substructure-output"})); - return WorkflowSpec{tasks}; + return WorkflowSpec{adaptAnalysisTask( + cfgc, TaskName{"jet-substructure-output"})}; } diff --git a/PWGJE/Tasks/jetvalidationqa.cxx b/PWGJE/Tasks/jetvalidationqa.cxx index 0cc2e09824b..f8161f01532 100644 --- a/PWGJE/Tasks/jetvalidationqa.cxx +++ b/PWGJE/Tasks/jetvalidationqa.cxx @@ -34,7 +34,7 @@ #include "Framework/HistogramRegistry.h" #include "PWGJE/DataModel/Jet.h" -#include "PWGJE/TableProducer/jetfinder.h" +#include "PWGJE/Core/JetDerivedDataUtilities.h" #include "Common/DataModel/EventSelection.h" #include "Common/Core/TrackSelection.h" @@ -66,7 +66,7 @@ struct jetTrackCollisionQa { void init(InitContext const&) { - trackSelection = JetDerivedDataUtilities::initialiseTrackSelection(static_cast(trackSelections)); + trackSelection = jetderiveddatautilities::initialiseTrackSelection(static_cast(trackSelections)); // histograms const AxisSpec vtxZAxis{nBins, -20, 20, "Vtx_{z} (cm)"}; @@ -75,7 +75,7 @@ struct jetTrackCollisionQa { const AxisSpec ptAxis{BinsPt, "#it{p}_{T} (GeV/#it{c})"}; // set trackselections - trackSelection = JetDerivedDataUtilities::initialiseTrackSelection(static_cast(trackSelections)); + trackSelection = jetderiveddatautilities::initialiseTrackSelection(static_cast(trackSelections)); // histograms // 1)Jetvalidation on data mHistManager.add("collisionVtxZ", "selected collsion VtxZ ", HistType::kTH1D, {vtxZAxis}); @@ -184,13 +184,13 @@ struct jetTrackCollisionQa { Filter etafilter = (aod::jtrack::eta <= etaup) && (aod::jtrack::eta >= etalow); Filter ptfilter = (aod::jtrack::pt <= ptUp) && (aod::jtrack::pt >= ptLow); using Tracks = soa::Join; - using TracksJE = soa::Filtered>; + using TracksJE = soa::Filtered>; - void processESD(aod::JCollision const& collision, soa::Join const& jets, TracksJE const& tracks, Tracks const& originalTracks) + void processESD(JetCollision const& collision, soa::Join const& jets, TracksJE const& tracks, Tracks const& originalTracks) { mHistManager.fill(HIST("controlCollisionVtxZ"), collision.posZ()); if (evSel == true) { - if (!JetDerivedDataUtilities::selectCollision(collision, JetDerivedDataUtilities::JCollisionSel::sel7) || fabs(collision.posZ()) > 10) { + if (!jetderiveddatautilities::selectCollision(collision, jetderiveddatautilities::JCollisionSel::sel7) || fabs(collision.posZ()) > 10) { return; } } else { @@ -206,7 +206,7 @@ struct jetTrackCollisionQa { double leadingTrackEta = -1; // qa histograms for selected tracks in collision for (const auto& t : tracks) { - if (t.collisionId() == collision.globalIndex() && JetDerivedDataUtilities::selectTrack(t, trackSelection)) { + if (t.collisionId() == collision.globalIndex() && jetderiveddatautilities::selectTrack(t, trackSelection)) { auto track = t.track_as(); fillTrackQA(track); if (track.pt() > leadingTrackPt) { @@ -254,10 +254,10 @@ struct jetTrackCollisionQa { PROCESS_SWITCH(jetTrackCollisionQa, processESD, "validate jet-finder output on run2 ESD", true); // process for run3 AOD's - void processRun3AOD(aod::JCollision const& collision, soa::Join const& jets, TracksJE const& tracks, Tracks const& originalTracks) + void processRun3AOD(JetCollision const& collision, soa::Join const& jets, TracksJE const& tracks, Tracks const& originalTracks) { if (evSel == true) { - if (!JetDerivedDataUtilities::selectCollision(collision, JetDerivedDataUtilities::JCollisionSel::sel8) || fabs(collision.posZ()) > 10) { + if (!jetderiveddatautilities::selectCollision(collision, jetderiveddatautilities::JCollisionSel::sel8) || fabs(collision.posZ()) > 10) { return; } } else { @@ -271,7 +271,7 @@ struct jetTrackCollisionQa { double leadingTrackEta = -1; // qa histograms for selected tracks in collision for (const auto& t : tracks) { - if (t.collisionId() == collision.globalIndex() && JetDerivedDataUtilities::selectTrack(t, trackSelection)) { + if (t.collisionId() == collision.globalIndex() && jetderiveddatautilities::selectTrack(t, trackSelection)) { auto track = t.track_as(); fillTrackQA(track); if (track.pt() > leadingTrackPt) { @@ -319,7 +319,7 @@ struct jetTrackCollisionQa { PROCESS_SWITCH(jetTrackCollisionQa, processRun3AOD, "validate jet-finder output on run3 AOD", false); // dummy process to run jetfinder validation code on ESD, but MC validation for run3 on hyperloop - void processDummy(aod::JCollisions const& collision) + void processDummy(JetCollisions const& collisions) { } PROCESS_SWITCH(jetTrackCollisionQa, processDummy, "Dummy process function turned on by default", false); @@ -347,7 +347,7 @@ struct mcJetTrackCollisionQa { void init(InitContext const&) { // set trackselection - trackSelection = JetDerivedDataUtilities::initialiseTrackSelection(static_cast(trackSelections)); + trackSelection = jetderiveddatautilities::initialiseTrackSelection(static_cast(trackSelections)); // histograms const AxisSpec vtxZAxis{nBins, -20, 20, "Vtx_{z} (cm)"}; const AxisSpec ptAxis{BinsPt, "#it{p}_{T} (GeV/#it{c})"}; @@ -423,7 +423,7 @@ struct mcJetTrackCollisionQa { void fillMcTrackHistos(ValidationTracks const& mct, coll collision, bool mc) // could give collision as argument for additional association { for (const auto& track : mct) { - if (!JetDerivedDataUtilities::selectTrack(track, trackSelection) || !(track.collisionId() == collision.globalIndex())) { + if (!jetderiveddatautilities::selectTrack(track, trackSelection) || !(track.collisionId() == collision.globalIndex())) { continue; } if (mc == true) { @@ -488,12 +488,12 @@ struct mcJetTrackCollisionQa { Filter etafilter = (aod::jtrack::eta < etaup) && (aod::jtrack::eta > etalow); Filter ptfilter = (aod::jtrack::pt < ptUp) && (aod::jtrack::pt > ptLow); - using MCTracksJE = soa::Filtered>; + using MCTracksJE = soa::Filtered; - void processMcRun2(soa::Join::iterator const& collision, + void processMcRun2(JetCollisionsMCD::iterator const& collision, soa::Join const& mcPartJets, soa::Join const& mcDetJets, - aod::JMcParticles const& mcParticles, aod::JMcCollisions const& mcCollisions, + JetParticles const& mcParticles, JetMcCollisions const& mcCollisions, MCTracksJE const& tracks) { if (fabs(collision.posZ()) > 10) { @@ -506,12 +506,12 @@ struct mcJetTrackCollisionQa { for (const auto& genJet : mcPartJets) { if (genJet.mcCollisionId() == collision.globalIndex()) { fillMcPartJets(genJet); - for (auto& mcParticle : genJet.tracks_as()) { + for (auto& mcParticle : genJet.tracks_as()) { fillMcPartJetConstituents(mcParticle); } } } // end of loop particle level jets - } // end if has mc collision + } // end if has mc collision fillMcTrackHistos(tracks, collision, false); for (const auto& detJet : mcDetJets) { if (detJet.collisionId() == collision.globalIndex()) { @@ -524,10 +524,10 @@ struct mcJetTrackCollisionQa { } // end processMcRun2 PROCESS_SWITCH(mcJetTrackCollisionQa, processMcRun2, "validate jet-finder output on converted run2 mc AOD's", false); - void processMcRun3(soa::Join::iterator const& collision, + void processMcRun3(JetCollisionsMCD::iterator const& collision, soa::Join const& mcPartJets, soa::Join const& mcDetJets, - aod::JMcParticles const& mcParticles, aod::JMcCollisions const& mcCollisions, + JetParticles const& mcParticles, JetMcCollisions const& mcCollisions, MCTracksJE const& tracks) { if (fabs(collision.posZ()) > 10) { @@ -540,12 +540,12 @@ struct mcJetTrackCollisionQa { for (const auto& genJet : mcPartJets) { if (genJet.mcCollisionId() == collision.globalIndex()) { fillMcPartJets(genJet); - for (auto& mcParticle : genJet.tracks_as()) { + for (auto& mcParticle : genJet.tracks_as()) { fillMcPartJetConstituents(mcParticle); } } } // end of loop particle level jets - } // end of loop if mc collision + } // end of loop if mc collision fillMcTrackHistos(tracks, collision, false); for (const auto& detJet : mcDetJets) { if (detJet.collisionId() == collision.globalIndex()) { @@ -559,7 +559,7 @@ struct mcJetTrackCollisionQa { PROCESS_SWITCH(mcJetTrackCollisionQa, processMcRun3, "validate jet-finder output on run3 mc AOD's", false); // dummy process to run jetfinder validation code on AO2D's, but MC validation for run3 on hyperloop - void processDummy(aod::JCollisions const& collision) + void processDummy(JetMcCollisions const& collisions) { } PROCESS_SWITCH(mcJetTrackCollisionQa, processDummy, "Dummy process function turned off by default", true); diff --git a/PWGJE/Tasks/nSubjettiness.cxx b/PWGJE/Tasks/nSubjettiness.cxx index ae83127e540..8fa16550605 100644 --- a/PWGJE/Tasks/nSubjettiness.cxx +++ b/PWGJE/Tasks/nSubjettiness.cxx @@ -36,9 +36,6 @@ using namespace o2; using namespace o2::framework; using namespace o2::framework::expressions; -using Collisions = soa::Join; -using Tracks = soa::Join; - template struct nSubJettiness { @@ -104,7 +101,7 @@ struct nSubJettiness { void jetToPseudoJet(JetTableElement const& jet, fastjet::PseudoJet& pseudoJet, std::vector jetConstituents, fastjet::ClusterSequence& clusterSeqInput) { for (auto& jetConstituent : jet.template tracks_as()) { - FastJetUtilities::fillTracks(jetConstituent, jetConstituents, jetConstituent.globalIndex()); + fastjetutilities::fillTracks(jetConstituent, jetConstituents, jetConstituent.globalIndex()); } fastjet::JetDefinition jet_def(fastjet::JetAlgorithm::kt_algorithm, 2.5 * jet.r() / 100); @@ -197,20 +194,20 @@ struct nSubJettiness { } PROCESS_SWITCH(nSubJettiness, processJetsWeighted, "Process function with weighted events, turned off by default", false); - void processDummy(aod::JTracks const& track) + void processDummy(JetTracks const& tracks) { } PROCESS_SWITCH(nSubJettiness, processDummy, "Dummy process function, turned on by default", true); }; -using NSubjettinessChargedJetMCParticleLevel = nSubJettiness, aod::ChargedMCParticleLevelJetEventWeights, aod::JMcParticles>; -using NSubjettinessChargedJetMCDetectorLevel = nSubJettiness, aod::ChargedMCDetectorLevelJetEventWeights, aod::JTracks>; -// using NSubjettinessChargedJetMCParticleLevel = nSubJettiness, aod::JMcParticles>; -// using NSubjettinessChargedJetMCDetectorLevel = nSubJettiness, aod::JTracks>; -// using NSubjettinessChargedJetDataLevel = nSubJettiness, aod::JTracks>; - -// using NSubjettinessD0ChargedJetMCParticleLevel = nSubJettiness, aod::JMcParticles>; -// using NSubjettinessD0ChargedJetMCDetectorLevel = nSubJettiness, aod::JTracks>; -// // using NSubjettinessD0ChargedJetDataLevel = nSubJettiness, aod::JTracks>; +using NSubjettinessChargedJetMCParticleLevel = nSubJettiness, aod::ChargedMCParticleLevelJetEventWeights, JetParticles>; +using NSubjettinessChargedJetMCDetectorLevel = nSubJettiness, aod::ChargedMCDetectorLevelJetEventWeights, JetTracks>; +// using NSubjettinessChargedJetMCParticleLevel = nSubJettiness, JetParticles>; +// using NSubjettinessChargedJetMCDetectorLevel = nSubJettiness, JetTracks; +// using NSubjettinessChargedJetDataLevel = nSubJettiness, JetTracks>; + +// using NSubjettinessD0ChargedJetMCParticleLevel = nSubJettiness, JetParticles>; +// using NSubjettinessD0ChargedJetMCDetectorLevel = nSubJettiness, JetTracks>; +// // using NSubjettinessD0ChargedJetDataLevel = nSubJettiness, JetTracks>; WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) { diff --git a/PWGJE/Tasks/phiInJets.cxx b/PWGJE/Tasks/phiInJets.cxx index 16e42aa8fe4..f2426d50f4c 100644 --- a/PWGJE/Tasks/phiInJets.cxx +++ b/PWGJE/Tasks/phiInJets.cxx @@ -159,7 +159,7 @@ struct phiInJets { LFhistos.add("hMultFT0M", "hMultFT0M", kTH1F, {MultAxis}); // EVENT SELECTION - eventSelection = JetDerivedDataUtilities::initialiseEventSelection(static_cast(cfgeventSelections)); + eventSelection = jetderiveddatautilities::initialiseEventSelection(static_cast(cfgeventSelections)); } // end of init @@ -309,7 +309,7 @@ struct phiInJets { } // MinvReconstruction int nEvents = 0; - void processJetTracks(aod::JCollision const& collision, soa::Filtered const& chargedjets, soa::Join const& tracks, TrackCandidates const&) + void processJetTracks(JetCollision const& collision, soa::Filtered const& chargedjets, soa::Join const& tracks, TrackCandidates const&) { if (cDebugLevel > 0) { nEvents++; @@ -318,7 +318,7 @@ struct phiInJets { } JEhistos.fill(HIST("nEvents"), 0.5); - if (!JetDerivedDataUtilities::selectCollision(collision, eventSelection)) + if (!jetderiveddatautilities::selectCollision(collision, eventSelection)) return; for (auto& [track1, track2] : combinations(o2::soa::CombinationsFullIndexPolicy(tracks, tracks))) { diff --git a/PWGJE/Tasks/trackJetqa.cxx b/PWGJE/Tasks/trackJetqa.cxx index f13a87dd4a9..5cfd6d40109 100644 --- a/PWGJE/Tasks/trackJetqa.cxx +++ b/PWGJE/Tasks/trackJetqa.cxx @@ -29,7 +29,7 @@ #include "PWGJE/DataModel/Jet.h" #include "PWGJE/DataModel/TrackJetQa.h" -#include "PWGJE/TableProducer/jetfinder.h" +#include "PWGJE/Core/JetDerivedDataUtilities.h" #include "Common/DataModel/Centrality.h" #include "Common/DataModel/Multiplicity.h" diff --git a/PWGJE/Tasks/triggerCorrelations.cxx b/PWGJE/Tasks/triggerCorrelations.cxx index e0d551b5968..f8490c9480f 100644 --- a/PWGJE/Tasks/triggerCorrelations.cxx +++ b/PWGJE/Tasks/triggerCorrelations.cxx @@ -65,18 +65,18 @@ struct TriggerCorrelationsTask { aod::EMCALClusterDefinition clusterDef = aod::emcalcluster::getClusterDefinitionFromString(clusterDefinition.value); Filter clusterDefinitionSelection = o2::aod::jcluster::definition == static_cast(clusterDef); - void processTriggeredCorrelations(aod::JCollision const& collision, + void processTriggeredCorrelations(JetCollision const& collision, soa::Join const& jetsCharged, soa::Join const& jetsFull, - soa::Filtered const& clusters, - aod::JTracks const& tracks) + soa::Filtered const& clusters, + JetTracks const& tracks) { registry.fill(HIST("h_collision_trigger_events"), 0.5); // all events if (collision.posZ() < vertexZCut) { registry.fill(HIST("h_collision_trigger_events"), 1.5); // all events with z vertex cut } - if (JetDerivedDataUtilities::selectCollision(collision, JetDerivedDataUtilities::JCollisionSel::sel8)) { + if (jetderiveddatautilities::selectCollision(collision, jetderiveddatautilities::JCollisionSel::sel8)) { registry.fill(HIST("h_collision_trigger_events"), 2.5); // events with sel8() } if (collision.alias_bit(triggerAliases::kTVXinEMC)) { @@ -86,7 +86,7 @@ struct TriggerCorrelationsTask { float jetsChargedLeadingPt = -1.0; float jetsFullLeadingPt = -1.0; float gammaLeadingPt = -1.0; - if (JetDerivedDataUtilities::selectCollision(collision, JetDerivedDataUtilities::JCollisionSel::sel8)) { + if (jetderiveddatautilities::selectCollision(collision, jetderiveddatautilities::JCollisionSel::sel8)) { if (doChargedJetTrigger) { for (auto& jetCharged : jetsCharged) { if (jetCharged.r() == round(jetsChargedR * 100.0f)) { diff --git a/Tutorials/Skimming/jetProvider.cxx b/Tutorials/Skimming/jetProvider.cxx index 5b5c30dbecb..5883d3471c9 100644 --- a/Tutorials/Skimming/jetProvider.cxx +++ b/Tutorials/Skimming/jetProvider.cxx @@ -37,21 +37,13 @@ struct JetProviderTask { Filter jetCuts = aod::jet::pt > jetPtMin; void process(soa::Filtered>::iterator const& jet, - aod::Tracks const& tracks, - aod::ChargedJetConstituentsSub const& constituentsSub) + aod::Tracks const& tracks) { outputJets(jet.pt(), jet.eta(), jet.phi(), jet.energy(), jet.mass(), jet.area()); if (keepConstituents) { - if (DoConstSub) { - outputConstituents.reserve(constituentsSub.size()); - for (const auto& constituent : constituentsSub) { - outputConstituents(outputJets.lastIndex(), constituent.pt(), constituent.eta(), constituent.phi()); - } - } else { - outputConstituents.reserve(jet.tracks().size()); - for (const auto& constituent : jet.tracks_as()) { - outputConstituents(outputJets.lastIndex(), constituent.pt(), constituent.eta(), constituent.phi()); - } + outputConstituents.reserve(jet.tracks().size()); + for (const auto& constituent : jet.tracks_as()) { + outputConstituents(outputJets.lastIndex(), constituent.pt(), constituent.eta(), constituent.phi()); } } } diff --git a/Tutorials/Skimming/jetSpectraReference.cxx b/Tutorials/Skimming/jetSpectraReference.cxx index 4e10a48a90f..79aa60fa70a 100644 --- a/Tutorials/Skimming/jetSpectraReference.cxx +++ b/Tutorials/Skimming/jetSpectraReference.cxx @@ -38,26 +38,16 @@ struct JetSpectraReference { {"hNJetConstituents", "Number of constituents;N;entries", {HistType::kTH1F, {{100, -0.5, 99.5}}}}, {"hConstituentPt", "Constituent pT; Constituent #it{p}_{T} (GeV/#it{c});entries", {HistType::kTH1F, {{100, 0., 100.}}}}}}; - //Configurable f_jetPtMin{"f_jetPtMin", 0.0, "minimum jet pT cut"}; - Configurable b_DoConstSub{"b_DoConstSub", false, "do constituent subtraction"}; - - //Filter jetCuts = aod::jet::pt > f_jetPtMin; //how does this work? + // Configurable f_jetPtMin{"f_jetPtMin", 0.0, "minimum jet pT cut"}; + // Filter jetCuts = aod::jet::pt > f_jetPtMin; //how does this work? void process(soa::Join::iterator const& jet, - aod::Tracks const& tracks, - aod::ChargedJetConstituentsSub const& constituentsSub) + aod::Tracks const& tracks) { registry.fill(HIST("hJetPt"), jet.pt()); - if (b_DoConstSub) { - registry.fill(HIST("hNJetConstituents"), constituentsSub.size()); - for (const auto& constituent : constituentsSub) { - registry.fill(HIST("hConstituentPt"), constituent.pt()); - } - } else { - registry.fill(HIST("hNJetConstituents"), jet.tracks().size()); - for (auto& constituent : jet.tracks_as()) { - registry.fill(HIST("hConstituentPt"), constituent.pt()); - } + registry.fill(HIST("hNJetConstituents"), jet.tracks().size()); + for (auto& constituent : jet.tracks_as()) { + registry.fill(HIST("hConstituentPt"), constituent.pt()); } } };