From 3f98ec8b866c444a9ce5e31e171f22d9e838539e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=B2=20Jacazio?= Date: Mon, 3 Feb 2025 22:31:00 +0100 Subject: [PATCH 01/16] [DPG] Update qaPIDITS.cxx (#9706) --- DPG/Tasks/AOTTrack/PID/ITS/qaPIDITS.cxx | 47 +++++++++++-------------- 1 file changed, 21 insertions(+), 26 deletions(-) diff --git a/DPG/Tasks/AOTTrack/PID/ITS/qaPIDITS.cxx b/DPG/Tasks/AOTTrack/PID/ITS/qaPIDITS.cxx index 729286f64ba..0916768fece 100644 --- a/DPG/Tasks/AOTTrack/PID/ITS/qaPIDITS.cxx +++ b/DPG/Tasks/AOTTrack/PID/ITS/qaPIDITS.cxx @@ -165,10 +165,8 @@ struct itsPidQa { ConfigurableAxis avClsBins{"avClsBins", {200, 0, 20}, "Binning in average cluster size"}; Configurable trackSelection{"trackSelection", 1, "Track selection: 0 -> No Cut, 1 -> kGlobalTrack, 2 -> kGlobalTrackWoPtEta, 3 -> kGlobalTrackWoDCA, 4 -> kQualityTracks, 5 -> kInAcceptanceTracks"}; Configurable applyRapidityCut{"applyRapidityCut", false, "Flag to apply rapidity cut"}; - Configurable enableDeDxPlot{"enableDeDxPlot", true, "Enables the dEdx plot (reduces memory footprint if off)"}; Configurable minTPCNcls{"minTPCNcls", 0, "Minimum number or TPC Clusters for tracks"}; ConfigurableAxis tpcNclsBins{"tpcNclsBins", {16, 0, 160}, "Binning in number of clusters in TPC"}; - Configurable fillTHnSparses{"fillTHnSparses", false, "Flag to fill multidimensional histograms for nsigma vs pt, eta, Ncls"}; template float averageClusterSizeTrk(const TrackType& track) @@ -196,7 +194,6 @@ struct itsPidQa { ptAxis.makeLogarithmic(); pAxis.makeLogarithmic(); } - const AxisSpec chargeAxis{2, -2.f, 2.f, "Charge"}; const AxisSpec avClsAxis{avClsBins, ""}; const AxisSpec avClsEffAxis{avClsBins, " / cosh(#eta)"}; @@ -253,8 +250,8 @@ struct itsPidQa { histos.print(); } - Filter eventFilter = (o2::aod::evsel::sel8 == true); - Filter trackFilter = (requireGlobalTrackInFilter()); + Filter eventFilter = (o2::aod::evsel::sel8 == true && nabs(o2::aod::collision::posZ) < 10.f); + // Filter trackFilter = (requireGlobalTrackInFilter()); using CollisionCandidate = soa::Filtered>::iterator; using TrackCandidates = soa::Join; void process(CollisionCandidate const& collision, - soa::Filtered const& tracks) + TrackCandidates const& tracks) { auto tracksWithPid = soa::Attach(tracks); - histos.fill(HIST("event/evsel"), 1); - if (!collision.sel8()) { - return; + if (tracks.size() != tracksWithPid.size()) { + LOG(fatal) << "Mismatch in track table size!" << tracks.size() << " vs " << tracksWithPid.size(); } - + histos.fill(HIST("event/evsel"), 1); histos.fill(HIST("event/evsel"), 2); - - if (std::abs(collision.posZ()) > 10.f) { - return; - } histos.fill(HIST("event/evsel"), 3); histos.fill(HIST("event/vertexz"), collision.posZ()); - int nTracks = -1; for (const auto& track : tracksWithPid) { - nTracks++; histos.fill(HIST("event/trackselection"), 1.f); if (!track.isGlobalTrack()) { // Skipping non global tracks continue; @@ -312,23 +302,28 @@ struct itsPidQa { histos.fill(HIST("event/length"), track.length()); histos.fill(HIST("event/pt"), track.pt()); histos.fill(HIST("event/p"), track.p()); - const auto& t = tracks.iteratorAt(nTracks); - histos.fill(HIST("event/averageClusterSize"), track.pt(), averageClusterSizeTrk(track)); - histos.fill(HIST("event/averageClusterSizePerCoslInv"), track.pt(), averageClusterSizePerCoslInv(track)); + histos.fill(HIST("event/averageClusterSize"), track.p(), averageClusterSizeTrk(track)); + histos.fill(HIST("event/averageClusterSizePerCoslInv"), track.p(), averageClusterSizePerCoslInv(track)); bool discard = false; for (int id = 0; id < 9; id++) { if (std::abs(nsigmaTPC(track, id)) > tpcSelValues[id]) { + LOG(debug) << "Discarding based on TPC hypothesis " << id << " " << std::abs(nsigmaTPC(track, id)) << ">" << tpcSelValues[id]; discard = true; + break; } - if (std::abs(nsigmaTOF(track, id)) > tofSelValues[id]) { - discard = true; + if (track.hasTOF()) { + if (std::abs(nsigmaTOF(track, id)) > tofSelValues[id]) { + LOG(debug) << "Discarding based on TOF hypothesis " << id << " " << std::abs(nsigmaTOF(track, id)) << ">" << tofSelValues[id]; + discard = true; + break; + } } } if (discard) { continue; } - histos.fill(HIST("event/SelectedAverageClusterSize"), track.pt(), averageClusterSizeTrk(track)); - histos.fill(HIST("event/SelectedAverageClusterSizePerCoslInv"), track.pt(), averageClusterSizePerCoslInv(track)); + histos.fill(HIST("event/SelectedAverageClusterSize"), track.p(), averageClusterSizeTrk(track)); + histos.fill(HIST("event/SelectedAverageClusterSizePerCoslInv"), track.p(), averageClusterSizePerCoslInv(track)); for (o2::track::PID::ID id = 0; id <= o2::track::PID::Last; id++) { if (!enableParticle[id]) { @@ -340,10 +335,10 @@ struct itsPidQa { } } const float nsigma = nsigmaITS(track, id); - if (t.sign() > 0) { - hNsigmaPos[id]->Fill(t.p(), nsigma); + if (track.sign() > 0) { + hNsigmaPos[id]->Fill(track.pt(), nsigma); } else { - hNsigmaNeg[id]->Fill(t.p(), nsigma); + hNsigmaNeg[id]->Fill(track.pt(), nsigma); } } } From 6f434d236336b3a1ecf6b825e460107a545b3356 Mon Sep 17 00:00:00 2001 From: skundu692 <86804743+skundu692@users.noreply.github.com> Date: Mon, 3 Feb 2025 23:07:33 +0100 Subject: [PATCH 02/16] [PWGLF] Add event plane dependent efficiency from MC as weight in phi meson reconstruction for flow calculation (#9711) --- PWGLF/Tasks/Resonances/phipbpb.cxx | 127 ++++++++++++++++++++++------- 1 file changed, 98 insertions(+), 29 deletions(-) diff --git a/PWGLF/Tasks/Resonances/phipbpb.cxx b/PWGLF/Tasks/Resonances/phipbpb.cxx index 0754b1d7745..2a628fffa78 100644 --- a/PWGLF/Tasks/Resonances/phipbpb.cxx +++ b/PWGLF/Tasks/Resonances/phipbpb.cxx @@ -54,6 +54,7 @@ #include "DataFormatsParameters/GRPObject.h" #include "DataFormatsParameters/GRPMagField.h" #include "CCDB/BasicCCDBManager.h" +#include "CCDB/CcdbApi.h" #include "Common/DataModel/PIDResponseITS.h" #include "PWGMM/Mult/DataModel/Index.h" // for Particles2Tracks table @@ -66,7 +67,15 @@ struct phipbpb { int mRunNumber; int multEstimator; float d_bz; + + struct : ConfigurableGroup { + Configurable cfgURL{"cfgURL", "http://alice-ccdb.cern.ch", "Address of the CCDB to browse"}; + Configurable nolaterthan{"ccdb-no-later-than", std::chrono::duration_cast(std::chrono::system_clock::now().time_since_epoch()).count(), "Latest acceptable timestamp of creation for the object"}; + } cfgCcdbParam; + + // Enable access to the CCDB for the offset and correction constants and save them in dedicated variables. Service ccdb; + o2::ccdb::CcdbApi ccdbApi; Service pdg; // CCDB options @@ -109,7 +118,7 @@ struct phipbpb { ConfigurableAxis configThnAxisCosThetaStar{"configThnAxisCosThetaStar", {10, -1.0, 1.}, "cos(#vartheta)"}; ConfigurableAxis configThnAxisCentrality{"configThnAxisCentrality", {8, 0., 80}, "Centrality"}; ConfigurableAxis configThnAxisPhiminusPsi{"configThnAxisPhiminusPsi", {6, 0.0, TMath::Pi()}, "#phi - #psi"}; - ConfigurableAxis configThnAxisV2{"configThnAxisV2", {200, -1, 1}, "V2"}; + ConfigurableAxis configThnAxisV2{"configThnAxisV2", {200, -6, 6}, "V2"}; ConfigurableAxis configThnAxisRapidity{"configThnAxisRapidity", {8, 0, 0.8}, "Rapidity"}; ConfigurableAxis configThnAxisSA{"configThnAxisSA", {200, -1, 1}, "SA"}; ConfigurableAxis configThnAxiscosthetaSA{"configThnAxiscosthetaSA", {200, 0, 1}, "costhetaSA"}; @@ -118,6 +127,9 @@ struct phipbpb { Configurable genacceptancecut{"genacceptancecut", true, "use acceptance cut for generated"}; Configurable avoidsplitrackMC{"avoidsplitrackMC", false, "avoid split track in MC"}; Configurable islike{"islike", false, "use like"}; + Configurable useWeight{"useWeight", true, "use EP dep effi weight"}; + Configurable ConfWeightPath{"ConfWeightPath", "Users/s/skundu/My/Object/mcweight", "Path to gain calibration"}; + Filter collisionFilter = nabs(aod::collision::posZ) < cfgCutVertex; Filter centralityFilter = nabs(aod::cent::centFT0C) < cfgCutCentrality; Filter acceptanceFilter = (nabs(aod::track::eta) < cfgCutEta && nabs(aod::track::pt) > cfgCutPT); @@ -232,10 +244,12 @@ struct phipbpb { // weight histos.add("hImpactParameter", "Impact parameter", kTH1F, {{200, 0.0f, 20.0f}}); - histos.add("hEventPlaneAngle", "hEventPlaneAngle", kTH1F, {{100, 0.0f, 2.0f * TMath::Pi()}}); + histos.add("hEventPlaneAngle", "hEventPlaneAngle", kTH1F, {{200, -2.0f * TMath::Pi(), 2.0f * TMath::Pi()}}); + histos.add("hEventPlaneAngleRec", "hEventPlaneAngleRec", kTH1F, {{200, -2.0f * TMath::Pi(), 2.0f * TMath::Pi()}}); histos.add("hNchVsImpactParameter", "hNchVsImpactParameter", kTH2F, {{200, 0.0f, 20.0f}, {500, -0.5f, 5000.5f}}); - histos.add("hSparseMCGenWeight", "hSparseMCGenWeight", HistType::kTHnSparseF, {thnAxisCentrality, {36, 0.0f, 2.0f * TMath::Pi()}, axisPtKaonWeight, {8, -0.8, 0.8}}); - histos.add("hSparseMCRecWeight", "hSparseMCRecWeight", HistType::kTHnSparseF, {thnAxisCentrality, {36, 0.0f, 2.0f * TMath::Pi()}, axisPtKaonWeight, {8, -0.8, 0.8}}); + histos.add("hSparseMCGenWeight", "hSparseMCGenWeight", HistType::kTHnSparseF, {thnAxisCentrality, {36, 0.0f, TMath::Pi()}, axisPtKaonWeight, {8, -0.8, 0.8}}); + histos.add("hSparseMCRecWeight", "hSparseMCRecWeight", HistType::kTHnSparseF, {thnAxisCentrality, {36, 0.0f, TMath::Pi()}, axisPtKaonWeight, {8, -0.8, 0.8}}); + histos.add("hSparseMCRecAllTrackWeight", "hSparseMCRecAllTrackWeight", HistType::kTHnSparseF, {thnAxisCentrality, {36, 0.0, TMath::Pi()}, axisPtKaonWeight, {8, -0.8, 0.8}}); } // Event selection cut additional - Alex if (additionalEvsel) { @@ -250,6 +264,12 @@ struct phipbpb { fMultMultPVCut = new TF1("fMultMultPVCut", "[0]+[1]*x+[2]*x*x", 0, 5000); fMultMultPVCut->SetParameters(-0.1, 0.785, -4.7e-05); } + + ccdb->setURL(cfgCcdbParam.cfgURL); + ccdbApi.init("http://alice-ccdb.cern.ch"); + ccdb->setCaching(true); + ccdb->setLocalObjectValidityChecking(); + ccdb->setCreatedNotAfter(std::chrono::duration_cast(std::chrono::system_clock::now().time_since_epoch()).count()); } double massKa = o2::constants::physics::MassKPlus; @@ -372,8 +392,10 @@ struct phipbpb { using BinningTypeVertexContributor = ColumnBinningPolicy; ROOT::Math::PxPyPzMVector PhiMesonMother, KaonPlus, KaonMinus, fourVecDauCM; ROOT::Math::XYZVector threeVecDauCM, threeVecDauCMXY, eventplaneVec, eventplaneVecNorm, beamvector; - - void processSameEvent(EventCandidates::iterator const& collision, TrackCandidates const& /*tracks*/, aod::BCs const&) + int currentRunNumber = -999; + int lastRunNumber = -999; + TH3D* hweight; + void processSameEvent(EventCandidates::iterator const& collision, TrackCandidates const& /*tracks, aod::BCs const&*/, aod::BCsWithTimestamps const&) { if (!collision.sel8() || !collision.triggereventep() || !collision.selection_bit(aod::evsel::kNoTimeFrameBorder) || !collision.selection_bit(aod::evsel::kNoITSROFrameBorder) || !collision.selection_bit(aod::evsel::kNoSameBunchPileup) || !collision.selection_bit(aod::evsel::kIsGoodZvtxFT0vsPV) || !collision.selection_bit(o2::aod::evsel::kNoCollInTimeRangeStandard)) { return; @@ -428,7 +450,16 @@ struct phipbpb { histos.fill(HIST("hCentrality"), centrality); histos.fill(HIST("hVtxZ"), collision.posZ()); + + auto bc = collision.bc_as(); + currentRunNumber = collision.bc_as().runNumber(); + if (useWeight && (currentRunNumber != lastRunNumber)) { + hweight = ccdb->getForTimeStamp(ConfWeightPath.value, bc.timestamp()); + } + lastRunNumber = currentRunNumber; int Npostrack = 0; + float weight1 = 1.0; + float weight2 = 1.0; for (auto track1 : posThisColl) { // track selection if (!selectionTrack(track1)) { @@ -451,6 +482,13 @@ struct phipbpb { histos.fill(HIST("hNsigmaKaonTPC"), track1.tpcNSigmaKa()); histos.fill(HIST("hNsigmaKaonTOF"), track1.tofNSigmaKa()); auto track1ID = track1.globalIndex(); + if (useWeight) { + if (track1.pt() < 10.0 && track1.pt() > 0.15) { + weight1 = hweight->GetBinContent(hweight->FindBin(centrality, GetPhiInRange(track1.phi() - psiFT0C), track1.pt() + 0.000005)); + } else { + weight1 = 1; + } + } for (auto track2 : negThisColl) { // track selection if (!selectionTrack(track2)) { @@ -482,6 +520,13 @@ struct phipbpb { if (useGlobalTrack && track2.p() < 1.0 && !(itsResponse.nSigmaITS(track2) > -2.5 && itsResponse.nSigmaITS(track2) < 2.5)) { continue; } + if (useWeight) { + if (track2.pt() < 10.0 && track2.pt() > 0.15) { + weight2 = hweight->GetBinContent(hweight->FindBin(centrality, GetPhiInRange(track2.phi() - psiFT0C), track2.pt() + 0.000005)); + } else { + weight2 = 1; + } + } KaonPlus = ROOT::Math::PxPyPzMVector(track1.px(), track1.py(), track1.pz(), massKa); KaonMinus = ROOT::Math::PxPyPzMVector(track2.px(), track2.py(), track2.pz(), massKa); PhiMesonMother = KaonPlus + KaonMinus; @@ -490,15 +535,31 @@ struct phipbpb { auto v2sin = TMath::Sin(2.0 * phiminuspsi); auto phimother = PhiMesonMother.Phi(); histos.fill(HIST("hpTvsRapidity"), PhiMesonMother.Pt(), PhiMesonMother.Rapidity()); + auto totalweight = weight1 * weight2; + if (totalweight <= 0.0005) { + totalweight = 1.0; + } + // LOGF(info, Form("weight %f %f",weight1, weight2)); if (TMath::Abs(PhiMesonMother.Rapidity()) < confRapidity) { - histos.fill(HIST("hSparseV2SameEventCosDeltaPhi"), PhiMesonMother.M(), PhiMesonMother.Pt(), v2 * QFT0C, centrality); - histos.fill(HIST("hSparseV2SameEventCosDeltaPhiSquare"), PhiMesonMother.M(), PhiMesonMother.Pt(), v2 * v2, centrality); - histos.fill(HIST("hSparseV2SameEventSinDeltaPhi"), PhiMesonMother.M(), PhiMesonMother.Pt(), v2sin * QFT0C, centrality); - - histos.fill(HIST("hSparseV2SameEventCosPhi"), PhiMesonMother.M(), PhiMesonMother.Pt(), TMath::Cos(2.0 * phimother), centrality); - histos.fill(HIST("hSparseV2SameEventSinPhi"), PhiMesonMother.M(), PhiMesonMother.Pt(), TMath::Sin(2.0 * phimother), centrality); - histos.fill(HIST("hSparseV2SameEventCosPsi"), PhiMesonMother.M(), PhiMesonMother.Pt(), TMath::Cos(2.0 * psiFT0C), centrality); - histos.fill(HIST("hSparseV2SameEventSinPsi"), PhiMesonMother.M(), PhiMesonMother.Pt(), TMath::Sin(2.0 * psiFT0C), centrality); + if (useWeight) { + histos.fill(HIST("hSparseV2SameEventCosDeltaPhi"), PhiMesonMother.M(), PhiMesonMother.Pt(), v2 * QFT0C, centrality, 1 / totalweight); + histos.fill(HIST("hSparseV2SameEventCosDeltaPhiSquare"), PhiMesonMother.M(), PhiMesonMother.Pt(), v2 * v2, centrality, 1 / totalweight); + histos.fill(HIST("hSparseV2SameEventSinDeltaPhi"), PhiMesonMother.M(), PhiMesonMother.Pt(), v2sin * QFT0C, centrality, 1 / totalweight); + + histos.fill(HIST("hSparseV2SameEventCosPhi"), PhiMesonMother.M(), PhiMesonMother.Pt(), TMath::Cos(2.0 * phimother), centrality, 1 / totalweight); + histos.fill(HIST("hSparseV2SameEventSinPhi"), PhiMesonMother.M(), PhiMesonMother.Pt(), TMath::Sin(2.0 * phimother), centrality, 1 / totalweight); + histos.fill(HIST("hSparseV2SameEventCosPsi"), PhiMesonMother.M(), PhiMesonMother.Pt(), TMath::Cos(2.0 * psiFT0C), centrality, 1 / totalweight); + histos.fill(HIST("hSparseV2SameEventSinPsi"), PhiMesonMother.M(), PhiMesonMother.Pt(), TMath::Sin(2.0 * psiFT0C), centrality, 1 / totalweight); + } else { + histos.fill(HIST("hSparseV2SameEventCosDeltaPhi"), PhiMesonMother.M(), PhiMesonMother.Pt(), v2 * QFT0C, centrality); + histos.fill(HIST("hSparseV2SameEventCosDeltaPhiSquare"), PhiMesonMother.M(), PhiMesonMother.Pt(), v2 * v2, centrality); + histos.fill(HIST("hSparseV2SameEventSinDeltaPhi"), PhiMesonMother.M(), PhiMesonMother.Pt(), v2sin * QFT0C, centrality); + + histos.fill(HIST("hSparseV2SameEventCosPhi"), PhiMesonMother.M(), PhiMesonMother.Pt(), TMath::Cos(2.0 * phimother), centrality); + histos.fill(HIST("hSparseV2SameEventSinPhi"), PhiMesonMother.M(), PhiMesonMother.Pt(), TMath::Sin(2.0 * phimother), centrality); + histos.fill(HIST("hSparseV2SameEventCosPsi"), PhiMesonMother.M(), PhiMesonMother.Pt(), TMath::Cos(2.0 * psiFT0C), centrality); + histos.fill(HIST("hSparseV2SameEventSinPsi"), PhiMesonMother.M(), PhiMesonMother.Pt(), TMath::Sin(2.0 * psiFT0C), centrality); + } } if (fillSA) { ROOT::Math::Boost boost{PhiMesonMother.BoostToCM()}; @@ -510,8 +571,13 @@ struct phipbpb { auto cosPhistarminuspsi = GetPhiInRange(fourVecDauCM.Phi() - psiFT0C); auto SA = TMath::Cos(2.0 * cosPhistarminuspsi); auto cosThetaStar = eventplaneVecNorm.Dot(threeVecDauCM) / std::sqrt(threeVecDauCM.Mag2()) / std::sqrt(eventplaneVecNorm.Mag2()); - histos.fill(HIST("hSparseV2SameEventSA"), PhiMesonMother.M(), PhiMesonMother.Pt(), SA, TMath::Abs(PhiMesonMother.Rapidity()), centrality); - histos.fill(HIST("hSparseV2SameEventCosThetaStar"), PhiMesonMother.M(), PhiMesonMother.Pt(), cosThetaStar, TMath::Abs(PhiMesonMother.Rapidity()), centrality); + if (useWeight) { + histos.fill(HIST("hSparseV2SameEventSA"), PhiMesonMother.M(), PhiMesonMother.Pt(), SA, TMath::Abs(PhiMesonMother.Rapidity()), centrality, 1 / totalweight); + histos.fill(HIST("hSparseV2SameEventCosThetaStar"), PhiMesonMother.M(), PhiMesonMother.Pt(), cosThetaStar, TMath::Abs(PhiMesonMother.Rapidity()), centrality, 1 / totalweight); + } else { + histos.fill(HIST("hSparseV2SameEventSA"), PhiMesonMother.M(), PhiMesonMother.Pt(), SA, TMath::Abs(PhiMesonMother.Rapidity()), centrality); + histos.fill(HIST("hSparseV2SameEventCosThetaStar"), PhiMesonMother.M(), PhiMesonMother.Pt(), cosThetaStar, TMath::Abs(PhiMesonMother.Rapidity())); + } } } Npostrack = Npostrack + 1; @@ -807,12 +873,11 @@ struct phipbpb { } // process MC PROCESS_SWITCH(phipbpb, processMC, "Process MC", false); - using recoTracks = soa::Join; void processMCweight(aod::McCollision const& mcCollision, soa::Join const& mcParticles, recoTracks const&) { float imp = mcCollision.impactParameter(); - float evPhi = mcCollision.eventPlaneAngle(); + float evPhi = mcCollision.eventPlaneAngle() / 2.0; float centclass = -999; if (imp >= 0 && imp < 3.49) { centclass = 2.5; @@ -841,8 +906,8 @@ struct phipbpb { if (imp >= 13.1 && imp < 14) { centclass = 75.0; } - if (evPhi < 0) - evPhi += 2. * TMath::Pi(); + // if (evPhi < 0) + // evPhi += 2. * TMath::Pi(); int nCh = 0; @@ -851,36 +916,40 @@ struct phipbpb { histos.fill(HIST("hImpactParameter"), imp); histos.fill(HIST("hEventPlaneAngle"), evPhi); for (auto const& mcParticle : mcParticles) { + + float deltaPhi = mcParticle.phi() - mcCollision.eventPlaneAngle(); // focus on bulk: e, mu, pi, k, p int pdgCode = TMath::Abs(mcParticle.pdgCode()); if (checkAllCharge && pdgCode != 11 && pdgCode != 13 && pdgCode != 211 && pdgCode != 321 && pdgCode != 2212) continue; - if (pdgCode != 321) + if (!checkAllCharge && pdgCode != 321) continue; if (!mcParticle.isPhysicalPrimary()) continue; if (TMath::Abs(mcParticle.eta()) > 0.8) // main acceptance continue; - float deltaPhi = mcParticle.phi() - mcCollision.eventPlaneAngle(); - if (deltaPhi < 0) - deltaPhi += 2. * TMath::Pi(); - if (deltaPhi > 2. * TMath::Pi()) - deltaPhi -= 2. * TMath::Pi(); - - histos.fill(HIST("hSparseMCGenWeight"), centclass, deltaPhi, mcParticle.pt(), mcParticle.eta()); + histos.fill(HIST("hSparseMCGenWeight"), centclass, GetPhiInRange(deltaPhi), mcParticle.pt(), mcParticle.eta()); nCh++; bool validGlobal = false; + bool validAny = false; if (mcParticle.has_tracks()) { auto const& tracks = mcParticle.tracks_as(); for (auto const& track : tracks) { if (track.hasTPC() && track.hasITS()) { validGlobal = true; } + if (track.hasTPC() || track.hasITS()) { + validAny = true; + } } } // if valid global, fill if (validGlobal) { - histos.fill(HIST("hSparseMCRecWeight"), centclass, deltaPhi, mcParticle.pt(), mcParticle.eta()); + histos.fill(HIST("hSparseMCRecWeight"), centclass, GetPhiInRange(deltaPhi), mcParticle.pt(), mcParticle.eta()); + } + if (validAny) { + histos.fill(HIST("hSparseMCRecAllTrackWeight"), centclass, GetPhiInRange(deltaPhi), mcParticle.pt(), mcParticle.eta()); + histos.fill(HIST("hEventPlaneAngleRec"), GetPhiInRange(deltaPhi)); } // if any track present, fill } From 7cbd89f9bec300f30f350f7fee4122f676c15577 Mon Sep 17 00:00:00 2001 From: Tanu Gahlaut <154991749+TGahlaut1@users.noreply.github.com> Date: Tue, 4 Feb 2025 04:03:05 +0530 Subject: [PATCH 03/16] [PWGCF] Update efficiency correction (#9714) --- PWGCF/EbyEFluctuations/Tasks/meanPtFlucId.cxx | 397 ++++++++---------- 1 file changed, 168 insertions(+), 229 deletions(-) diff --git a/PWGCF/EbyEFluctuations/Tasks/meanPtFlucId.cxx b/PWGCF/EbyEFluctuations/Tasks/meanPtFlucId.cxx index 1c1c03a7a62..56161b37473 100644 --- a/PWGCF/EbyEFluctuations/Tasks/meanPtFlucId.cxx +++ b/PWGCF/EbyEFluctuations/Tasks/meanPtFlucId.cxx @@ -69,23 +69,23 @@ struct MeanPtFlucId { Configurable cfgCutKaP3{"cfgCutKaP3", 1.2, "kaon p cut-3"}; Configurable cfgCutPrP1{"cfgCutPrP1", 0.9, "proton p cut-1"}; Configurable cfgCutPrP2{"cfgCutPrP2", 1.0, "proton p cut-2"}; - Configurable cfgRun3{"cfgRun3", true, ""}; - Configurable cfgRun2{"cfgRun2", false, ""}; + Configurable cfgMcTpcShiftEl{"cfgMcTpcShiftEl", 0., "Electron Shift in TPC (MC data) "}; + Configurable cfgMcTpcShiftPi{"cfgMcTpcShiftPi", 0., "Pion Shift in TPC (MC data) "}; + Configurable cfgMcTpcShiftKa{"cfgMcTpcShiftKa", 0., "Kaon Shift in TPC (MC data) "}; + Configurable cfgMcTpcShiftPr{"cfgMcTpcShiftPr", 0., "Proton Shift in TPC (MC data) "}; + Configurable cfgMcTofShiftPi{"cfgMcTofShiftPi", 0., "Pion Shift in TOF (MC data) "}; + Configurable cfgMcTofShiftKa{"cfgMcTofShiftKa", 0., "Kaon Shift in TOF (MC data) "}; + Configurable cfgMcTofShiftPr{"cfgMcTofShiftPr", 0., "Proton Shift in TOF (MC data) "}; Configurable cfgCorrection{"cfgCorrection", true, "Efficiency Correction"}; Configurable cfgPidCut{"cfgPidCut", false, ""}; Configurable cfgPDGCodeOnly{"cfgPDGCodeOnly", true, ""}; Configurable cfgMCReco{"cfgMCReco", false, ""}; Configurable cfgMCTruth{"cfgMCTruth", false, ""}; Configurable cfgPosZ{"cfgPosZ", true, "Position Z"}; - Configurable cfgSel7{"cfgSel7", true, "Run2 Sel7 trigger"}; - Configurable cfgkINT7{"cfgkINT7", true, "Run2 MB trigger"}; Configurable cfgSel8{"cfgSel8", true, "Sel8 trigger"}; - Configurable cfgNoSameBunchPileup{"cfgNoSameBunchPileup", true, "kNoSameBunchPileup"}; - Configurable cfgIsVertexITSTPC{"cfgIsVertexITSTPC", true, "kIsVertexITSTPC"}; - Configurable cfgIsGoodZvtxFT0vsPV{"cfgIsGoodZvtxFT0vsPV", true, "kIsGoodZvtxFT0vsPV"}; - Configurable cfgTVXinTRD{"cfgTVXinTRD", true, "cfgTVXinTRD"}; - Configurable cfgNoCollInTimeRangeStandard{"cfgNoCollInTimeRangeStandard", true, "cfgNoCollInTimeRangeStandard"}; - + Configurable cfgEvSel1{"cfgEvSel1", true, "kNoSameBunchPileup"}; + Configurable cfgEvSel2{"cfgEvSel2", true, "kIsGoodZvtxFT0vsPV"}; + Configurable cfgEvSel3{"cfgEvSel3", true, "kIsVertexITSTPC"}; Configurable cfgRejTrk{"cfgRejTrk", true, "Rejected Tracks"}; Configurable cfgInvMass{"cfgInvMass", true, "electron Inv Mass cut selection"}; Configurable cfgSelOR{"cfgSelOR", true, "Low OR High momentum "}; @@ -100,21 +100,21 @@ struct MeanPtFlucId { ConfigurableAxis qNBins{"qNBins", {1000, 0., 100.}, "nth moments bins"}; ConfigurableAxis tpNBins{"tpNBins", {300, 0., 3000.}, ""}; ConfigurableAxis tpDBins{"tpDBins", {100, 0., 2000.}, ""}; - Configurable> effBinsCh{"effBinsCh", {0.03, 0.09, 0.15, 0.21, 0.27, 0.33, 0.39, 0.45, 0.51, 0.57, 0.63, 0.69, 0.75, 0.81, 0.87, 0.93, 0.99, 1.05, 1.11, 1.17, 1.23, 1.29, 1.35, 1.41, 1.47, 1.53, 1.59, 1.65, 1.71, 1.77, 1.83, 1.89, 1.95, 2.01, 2.07, 2.13, 2.19, 2.25, 2.31, 2.37, 2.43, 2.49, 2.55, 2.61, 2.67, 2.73, 2.79, 2.85, 2.91, 2.97, 3.0}, "efficiency bins (pT values) Charged Particles"}; - Configurable> effValuesCh{"effValuesCh", {0, 0, 0.386169, 0.412474, 0.486779, 0.494934, 0.493291, 0.504386, 0.512249, 0.522392, 0.531644, 0.537582, 0.543185, 0.548673, 0.553815, 0.556657, 0.561914, 0.567178, 0.569732, 0.577966, 0.581782, 0.589717, 0.593475, 0.596515, 0.602142, 0.606824, 0.607538, 0.610001, 0.612192, 0.61614, 0.618019, 0.618098, 0.618342, 0.621418, 0.625931, 0.628532, 0.63625, 0.627779, 0.628692, 0.637267, 0.630396, 0.639564, 0.635291, 0.636696, 0.63482, 0.652704, 0.642795, 0.641176, 0.640547, 0.637442}, "effeciency values for Charged Particles"}; - Configurable> effBinsPi{"effBinsPi", {0, 0.03, 0.09, 0.15, 0.21, 0.27, 0.33, 0.39, 0.45, 0.51, 0.57, 0.63, 0.69, 0.75, 0.81, 0.87, 0.93, 0.99, 1.05, 1.11, 1.17, 1.23, 1.29, 1.35, 1.41, 1.47, 1.53, 1.59, 1.65, 1.71, 1.77, 1.83, 1.89, 1.95, 2.01, 2.07, 2.13, 2.19, 2.25, 2.31, 2.37, 2.43, 2.49, 2.55, 2.61, 2.67, 2.73, 2.79, 2.85, 2.91, 2.97, 3.0}, "efficiency bins (pT values) Pions"}; - Configurable> effValuesPi{"effValuesPi", {0, 0, 0, 0.400058, 0.469632, 0.481628, 0.470343, 0.479434, 0.485532, 0.399748, 0.252337, 0.242448, 0.238033, 0.241385, 0.247947, 0.251316, 0.253647, 0.259705, 0.26139, 0.26566, 0.270122, 0.273559, 0.281532, 0.28531, 0.290786, 0.296129, 0.298688, 0.302411, 0.304526, 0.309276, 0.310814, 0.319945, 0.322188, 0.323646, 0.333198, 0.342838, 0.349902, 0.349663, 0.357027, 0.361007, 0.361765, 0.366801, 0.369578, 0.369184, 0.375378, 0.392854, 0.381762, 0.393439, 0.40179, 0.388955}, "effeciency values for Pions"}; - Configurable> effBinsKa{"effBinsKa", {0, 0.03, 0.09, 0.15, 0.21, 0.27, 0.33, 0.39, 0.45, 0.51, 0.57, 0.63, 0.69, 0.75, 0.81, 0.87, 0.93, 0.99, 1.05, 1.11, 1.17, 1.23, 1.29, 1.35, 1.41, 1.47, 1.53, 1.59, 1.65, 1.71, 1.77, 1.83, 1.89, 1.95, 2.01, 2.07, 2.13, 2.19, 2.25, 2.31, 2.37, 2.43, 2.49, 2.55, 2.61, 2.67, 2.73, 2.79, 2.85, 2.91, 2.97, 3.0}, "efficiency bins (pT values) Kaons"}; - Configurable> effValuesKa{"effValuesKa", {0, 0, 0, 0, 0, 0.320159, 0.37806, 0.400326, 0.407691, 0.327176, 0.141516, 0.147491, 0.152589, 0.16269, 0.170488, 0.179455, 0.180328, 0.197179, 0.20744, 0.227318, 0.247503, 0.259692, 0.285758, 0.298513, 0.315618, 0.330743, 0.333617, 0.336713, 0.366039, 0.364117, 0.384816, 0.400722, 0.419545, 0.462212, 0.479273, 0.480745, 0.501775, 0.525096, 0.528989, 0.555031, 0.551434, 0.565997, 0.576816, 0.548424, 0.622107, 0.587852, 0.599819, 0.59486, 0.617637, 0.602063}, "effeciency values for Kaons"}; - Configurable> effBinsPr{"effBinsPr", {0, 0.03, 0.09, 0.15, 0.21, 0.27, 0.33, 0.39, 0.45, 0.51, 0.57, 0.63, 0.69, 0.75, 0.81, 0.87, 0.93, 0.99, 1.05, 1.11, 1.17, 1.23, 1.29, 1.35, 1.41, 1.47, 1.53, 1.59, 1.65, 1.71, 1.77, 1.83, 1.89, 1.95, 2.01, 2.07, 2.13, 2.19, 2.25, 2.31, 2.37, 2.43, 2.49, 2.55, 2.61, 2.67, 2.73, 2.79, 2.85, 2.91, 2.97, 3.0}, "efficiency bins (pT values) Protons"}; - Configurable> effValuesPr{"effValuesPr", {0, 0, 0, 0, 0, 0, 0, 0, 0.393911, 0.422401, 0.462856, 0.498792, 0.512802, 0.518289, 0.495488, 0.448937, 0.331976, 0.256772, 0.26324, 0.265401, 0.270093, 0.273197, 0.27106, 0.277618, 0.276226, 0.28206, 0.289245, 0.285692, 0.29644, 0.282871, 0.28963, 0.29263, 0.29947, 0.30137, 0.311748, 0.326481, 0.321903, 0.334281, 0.342607, 0.374238, 0.356596, 0.398134, 0.386997, 0.382202, 0.390039, 0.390761, 0.4034, 0.4193, 0.405995, 0.408471}, "effeciency values for Protons"}; + Configurable> effBinsCh{"effBinsCh", {0.0, 0.15, 0.21, 0.27, 0.33, 0.39, 0.45, 0.51, 0.57, 0.63, 0.69, 0.75, 0.81, 0.87, 0.93, 0.99, 1.05, 1.11, 1.17, 1.23, 1.29, 1.35, 1.41, 1.47, 1.53, 1.59, 1.65, 1.71, 1.77, 1.83, 1.89, 1.95, 2.01, 2.07, 2.13, 2.19, 2.25, 2.31, 2.37, 2.43, 2.49, 2.55, 2.61, 2.67, 2.73, 2.79, 2.85, 2.91, 2.97}, "efficiency bins (pT values) Charged Particles"}; + Configurable> effValuesCh{"effValuesCh", {0, 0, 0.435317, 0.494436, 0.503395, 0.502586, 0.512747, 0.520725, 0.529907, 0.539101, 0.54681, 0.553512, 0.560189, 0.565234, 0.569757, 0.574745, 0.57974, 0.583599, 0.589339, 0.594742, 0.60012, 0.604169, 0.607755, 0.611133, 0.613578, 0.616077, 0.618396, 0.619847, 0.621875, 0.623413, 0.627201, 0.627984, 0.631526, 0.632296, 0.63471, 0.63624, 0.637429, 0.638796, 0.640041, 0.640788, 0.641945, 0.643148, 0.643847, 0.644747, 0.645518, 0.64564, 0.64666, 0.648487, 0.648268}, "effeciency values for Charged Particles"}; + Configurable> effBinsPi{"effBinsPi", {0.0, 0.15, 0.21, 0.27, 0.33, 0.39, 0.45, 0.51, 0.57, 0.63, 0.69, 0.75, 0.81, 0.87, 0.93, 0.99, 1.05, 1.11, 1.17, 1.23, 1.29, 1.35, 1.41, 1.47, 1.53, 1.59, 1.65, 1.71, 1.77, 1.83, 1.89, 1.95, 2.01, 2.07, 2.13, 2.19, 2.25, 2.31, 2.37, 2.43, 2.49, 2.55, 2.61, 2.67, 2.73, 2.79, 2.85, 2.91, 2.97}, "efficiency bins (pT values) Pions"}; + Configurable> effValuesPi{"effValuesPi", {0, 0, 0, 0.408355, 0.488592, 0.509333, 0.497128, 0.507991, 0.496943, 0.40662, 0.258538, 0.243233, 0.241846, 0.250071, 0.262291, 0.248057, 0.267254, 0.26737, 0.265936, 0.281005, 0.274334, 0.27516, 0.300657, 0.289959, 0.282069, 0.294051, 0.301641, 0.303343, 0.307977, 0.29608, 0.331465, 0.32967, 0.336072, 0.30333, 0.348004, 0.38252, 0.327522, 0.377358, 0.367223, 0.330389, 0.34334, 0.35343, 0.358242, 0.341523, 0.369942, 0.341176, 0.317784, 0.384083, 0.359504, 0.375}, "effeciency values for Pions"}; + Configurable> effBinsKa{"effBinsKa", {0.03, 0.09, 0.15, 0.21, 0.27, 0.33, 0.39, 0.45, 0.51, 0.57, 0.63, 0.69, 0.75, 0.81, 0.87, 0.93, 0.99, 1.05, 1.11, 1.17, 1.23, 1.29, 1.35, 1.41, 1.47, 1.53, 1.59, 1.65, 1.71, 1.77, 1.83, 1.89, 1.95, 2.01, 2.07, 2.13, 2.19, 2.25, 2.31, 2.37, 2.43, 2.49, 2.55, 2.61, 2.67, 2.73, 2.79, 2.85, 2.91, 2.97}, "efficiency bins (pT values) Kaons"}; + Configurable> effValuesKa{"effValuesKa", {0, 0, 0, 0, 0, 0.365424, 0.370427, 0.386149, 0.360516, 0.266547, 0.145036, 0.145861, 0.154678, 0.15995, 0.1826, 0.198502, 0.187345, 0.187205, 0.183396, 0.223104, 0.176249, 0.215336, 0.227273, 0.233509, 0.193033, 0.25, 0.258528, 0.264529, 0.272912, 0.311301, 0.316708, 0.367816, 0.391304, 0.406897, 0.412214, 0.44843, 0.448718, 0.55665, 0.429319, 0.438272, 0.455621, 0.458647, 0.585366, 0.632812, 0.586777, 0.576087, 0.561798, 0.869565, 0.581395, 0.693548}, "effeciency values for Kaons"}; + Configurable> effBinsPr{"effBinsPr", {0.0, 0.03, 0.09, 0.15, 0.21, 0.27, 0.33, 0.39, 0.45, 0.51, 0.57, 0.63, 0.69, 0.75, 0.81, 0.87, 0.93, 0.99, 1.05, 1.11, 1.17, 1.23, 1.29, 1.35, 1.41, 1.47, 1.53, 1.59, 1.65, 1.71, 1.77, 1.83, 1.89, 1.95, 2.01, 2.07, 2.13, 2.19, 2.25, 2.31, 2.37, 2.43, 2.49, 2.55, 2.61, 2.67, 2.73, 2.79, 2.85, 2.91, 2.97}, "efficiency bins (pT values) Protons"}; + Configurable> effValuesPr{"effValuesPr", {0, 0, 0, 0, 0, 0, 0, 0, 0.595092, 0.551847, 0.519799, 0.52448, 0.52731, 0.510297, 0.495957, 0.422495, 0.348326, 0.29927, 0.263708, 0.256588, 0.261725, 0.296721, 0.240589, 0.299127, 0.292776, 0.238776, 0.319372, 0.305882, 0.27451, 0.262295, 0.302548, 0.228669, 0.301653, 0.279817, 0.271028, 0.278947, 0.370861, 0.271605, 0.421488, 0.315385, 0.322581, 0.526882, 0.397959, 0.574468, 0.564103, 0.380435, 0.296296, 0.368421, 0.480769, 0.413333}, "effeciency values for Protons"}; using MyAllTracks = soa::Join; - using MyRun3Collisions = soa::Join; - using MyRun3MCCollisions = soa::Join; + using MyCollisions = soa::Join; + using MyMCCollisions = soa::Join; using MyMCTracks = soa::Join ", kTH1D, {axisMeanPt}); @@ -325,9 +314,9 @@ struct MeanPtFlucId { hist.add("Gen/Charged/h_Q3", "Q3", qNMCHist); hist.add("Gen/Charged/h_Q4", "Q4", qNMCHist); hist.add("Gen/Charged/h_Q1_var", "Q1 vs N_{TPC}", qNMCHist); - hist.add("Gen/Charged/h_N_var", "N vs N_{TPC}", kTHnSparseD, {axisMultTPC, axisMult, axisMultFT0M}); - hist.add("Gen/Charged/h_twopart_nume_Mult_var", "twopart numerator", kTHnSparseD, {axisMultTPC, axisTpN, axisMultFT0M}); - hist.add("Gen/Charged/h_twopart_deno_Mult_var", "twopart denominator", kTHnSparseD, {axisMultTPC, axisTpD, axisMultFT0M}); + hist.add("Gen/Charged/h_N_var", "N vs N_{TPC}", kTHnSparseD, {axisMultTPC, axisMult, axisMultFT0MMC}); + hist.add("Gen/Charged/h_twopart_nume_Mult_var", "twopart numerator", kTHnSparseD, {axisMultTPC, axisTpN, axisMultFT0MMC}); + hist.add("Gen/Charged/h_twopart_deno_Mult_var", "twopart denominator", kTHnSparseD, {axisMultTPC, axisTpD, axisMultFT0MMC}); hist.add("Gen/Charged/p_mean_pT_Mult_var", " ", kTProfile, {axisMultTPC}); hist.add("Gen/Charged/p_CheckNCh", " 1/denominator vs N_{TPC} ", kTProfile, {axisMultTPC}); @@ -380,39 +369,25 @@ struct MeanPtFlucId { { hist.fill(HIST("QA/after/counts_evSelCuts"), 0); - if (cfgPosZ) { - if (std::abs(col.posZ()) > cfgCutPosZ) { - return false; - } - hist.fill(HIST("QA/after/counts_evSelCuts"), 1); - } + if (cfgPosZ && std::abs(col.posZ()) > cfgCutPosZ) + return false; + hist.fill(HIST("QA/after/counts_evSelCuts"), 1); - if (cfgSel8) { - if (!col.sel8()) { - return false; - } - hist.fill(HIST("QA/after/counts_evSelCuts"), 2); - } - if (cfgNoSameBunchPileup) { - if (!col.selection_bit(o2::aod::evsel::kNoSameBunchPileup)) { - return false; - } - hist.fill(HIST("QA/after/counts_evSelCuts"), 4); - } + if (cfgSel8 && !col.sel8()) + return false; + hist.fill(HIST("QA/after/counts_evSelCuts"), 2); - if (cfgIsGoodZvtxFT0vsPV) { - if (!col.selection_bit(o2::aod::evsel::kIsGoodZvtxFT0vsPV)) { - return false; - } - hist.fill(HIST("QA/after/counts_evSelCuts"), 5); - } + if (cfgEvSel1 && !col.selection_bit(o2::aod::evsel::kNoSameBunchPileup)) + return false; + hist.fill(HIST("QA/after/counts_evSelCuts"), 3); - if (cfgIsVertexITSTPC) { - if (!col.selection_bit(o2::aod::evsel::kIsVertexITSTPC)) { - return false; - } - hist.fill(HIST("QA/after/counts_evSelCuts"), 6); - } + if (cfgEvSel2 && !col.selection_bit(o2::aod::evsel::kIsGoodZvtxFT0vsPV)) + return false; + hist.fill(HIST("QA/after/counts_evSelCuts"), 4); + + if (cfgEvSel3 && !col.selection_bit(o2::aod::evsel::kIsVertexITSTPC)) + return false; + hist.fill(HIST("QA/after/counts_evSelCuts"), 5); return true; } @@ -421,7 +396,7 @@ struct MeanPtFlucId { template bool selTrack(T const& track) { - if (!track.isGlobalTrack()) + if (!track.isGlobalTrackWoPtEta()) return false; if (track.pt() < cfgCutPtMin) @@ -446,11 +421,11 @@ struct MeanPtFlucId { template bool rejectTracks(T const& track) { - if (((track.tpcNSigmaEl()) > -3. && - (track.tpcNSigmaEl()) < 5.) && - (std::fabs(track.tpcNSigmaPi()) > 3 && - std::fabs(track.tpcNSigmaKa()) > 3 && - std::fabs(track.tpcNSigmaPr()) > 3)) { + if (((track.tpcNSigmaEl() - cfgMcTpcShiftEl) > -3. && + (track.tpcNSigmaEl() - cfgMcTpcShiftEl) < 5.) && + (std::fabs(track.tpcNSigmaPi() - cfgMcTpcShiftPi) > 3 && + std::fabs(track.tpcNSigmaKa() - cfgMcTpcShiftKa) > 3 && + std::fabs(track.tpcNSigmaPr() - cfgMcTpcShiftPr) > 3)) { return true; } @@ -460,7 +435,7 @@ struct MeanPtFlucId { template bool selElectrons(T const& track) { - if (std::fabs(track.tpcNSigmaEl()) < cfgCutNSig3) { + if (std::fabs(track.tpcNSigmaEl() - cfgMcTpcShiftEl) < cfgCutNSig3) { return true; } @@ -469,19 +444,14 @@ struct MeanPtFlucId { // PID selction cuts for Low momentum Pions template - bool selLowPi(T const& track) + bool selLowPi(T const& track, double p) { if (track.pt() >= cfgCutPiPtMin && track.p() <= cfgCutPiThrsldP && - std::abs(track.rapidity(MassPiPlus)) < cfgCutRap) { - if (!track.hasTOF() && - std::fabs(track.tpcNSigmaPi()) < cfgCutNSig3) { - return true; - } + ((std::fabs(track.tpcNSigmaPi() - cfgMcTpcShiftPi) < cfgCutNSig3 && p <= cfgCutPiP1) || + (std::fabs(track.tpcNSigmaPi() - cfgMcTpcShiftPi) < cfgCutNSig2 && p > cfgCutPiP1 && p <= cfgCutPiP2))) { - if (track.hasTOF() && - std::fabs(track.tpcNSigmaPi()) < cfgCutNSig3 && - std::fabs(track.tofNSigmaPi()) < cfgCutNSig3) { + if (std::abs(track.rapidity(MassPiPlus)) < cfgCutRap) { return true; } } @@ -490,19 +460,14 @@ struct MeanPtFlucId { // PID selction cuts for Low momentum Kaons template - bool selLowKa(T const& track) + bool selLowKa(T const& track, double p) { if (track.pt() >= cfgCutKaPtMin && track.p() <= cfgCutKaThrsldP && - std::abs(track.rapidity(MassKPlus)) < cfgCutRap) { - if (!track.hasTOF() && - std::fabs(track.tpcNSigmaKa()) < cfgCutNSig3) { - return true; - } + ((std::fabs(track.tpcNSigmaKa() - cfgMcTpcShiftKa) < cfgCutNSig3 && p <= cfgCutKaP1) || + (std::fabs(track.tpcNSigmaKa() - cfgMcTpcShiftKa) < cfgCutNSig2 && p > cfgCutKaP1 && p <= cfgCutKaP2))) { - if (track.hasTOF() && - std::fabs(track.tpcNSigmaKa()) < cfgCutNSig3 && - std::fabs(track.tofNSigmaKa()) < cfgCutNSig3) { + if (std::abs(track.rapidity(MassKPlus)) < cfgCutRap) { return true; } } @@ -512,19 +477,14 @@ struct MeanPtFlucId { // PID selction cuts for Low momentum Protons template - bool selLowPr(T const& track) + bool selLowPr(T const& track, double p) { if (track.pt() >= cfgCutPrPtMin && track.p() <= cfgCutPrThrsldP && - std::abs(track.rapidity(MassProton)) < cfgCutRap) { - if (!track.hasTOF() && - std::fabs(track.tpcNSigmaPr()) < cfgCutNSig3) { - return true; - } + ((std::fabs(track.tpcNSigmaPr() - cfgMcTpcShiftPr) < cfgCutNSig3 && p <= cfgCutPrP1) || + (std::fabs(track.tpcNSigmaPr() - cfgMcTpcShiftPr) < cfgCutNSig2 && p > cfgCutPrP1 && p <= cfgCutPrP2))) { - if (track.hasTOF() && - std::fabs(track.tpcNSigmaPr()) < cfgCutNSig3 && - std::fabs(track.tofNSigmaPr()) < cfgCutNSig3) { + if (std::abs(track.rapidity(MassProton)) < cfgCutRap) { return true; } } @@ -538,8 +498,8 @@ struct MeanPtFlucId { { if (track.hasTOF() && track.p() > cfgCutPiThrsldP && - std::fabs(track.tpcNSigmaPi()) < cfgCutNSig3 && - std::fabs(track.tofNSigmaPi()) < cfgCutNSig3) { + std::fabs(track.tpcNSigmaPi() - cfgMcTpcShiftPi) < cfgCutNSig3 && + std::fabs(track.tofNSigmaPi() - cfgMcTofShiftPi) < cfgCutNSig3) { if (std::abs(track.rapidity(MassPiPlus)) < cfgCutRap) { return true; @@ -555,8 +515,9 @@ struct MeanPtFlucId { { if (track.hasTOF() && track.p() > cfgCutKaThrsldP && - std::fabs(track.tpcNSigmaKa()) < cfgCutNSig3 && - std::fabs(track.tofNSigmaKa()) < cfgCutNSig3) { + std::fabs(track.tpcNSigmaKa() - cfgMcTpcShiftKa) < cfgCutNSig3 && + ((std::fabs(track.tofNSigmaKa() - cfgMcTofShiftKa) < cfgCutNSig3 && track.p() <= cfgCutKaP3) || + (std::fabs(track.tofNSigmaKa() - cfgMcTofShiftKa) < cfgCutNSig2 && track.p() > cfgCutKaP3))) { if (std::abs(track.rapidity(MassKPlus)) < cfgCutRap) { return true; @@ -572,8 +533,8 @@ struct MeanPtFlucId { { if (track.hasTOF() && track.p() > cfgCutPrThrsldP && - std::fabs(track.tpcNSigmaPr()) < cfgCutNSig3 && - std::fabs(track.tofNSigmaPr()) < cfgCutNSig3) { + std::fabs(track.tpcNSigmaPr() - cfgMcTpcShiftPr) < cfgCutNSig3 && + std::fabs(track.tofNSigmaPr() - cfgMcTofShiftPr) < cfgCutNSig3) { if (std::abs(track.rapidity(MassProton)) < cfgCutRap) { return true; @@ -598,9 +559,6 @@ struct MeanPtFlucId { template void fillBeforeQAHistos(T const& col, U const& tracks) { - int nFT0M = 0, nFT0C = 0, nTPC = 0; - double centFT0C = 0; - for (const auto& track : tracks) { hist.fill(HIST("QA/before/h_Eta"), track.eta()); hist.fill(HIST("QA/before/h_Phi"), track.phi()); @@ -621,14 +579,16 @@ struct MeanPtFlucId { hist.fill(HIST("QA/before/h_VtxZ"), col.posZ()); hist.fill(HIST("QA/before/h_Counts"), 2); - nTPC = col.multNTracksHasTPC(); - nFT0M = col.multFT0M(); - nFT0C = col.multFT0C(); - centFT0C = col.centFT0C(); + int nTPC = col.multNTracksHasTPC(); + int nFT0M = col.multFT0M(); + int nFT0C = col.multFT0C(); + double centFT0C = col.centFT0C(); + double centFT0M = col.centFT0M(); - if (nTPC > 0 && nFT0M > 0) { + if (nTPC != 0 && nFT0M != 0) { hist.fill(HIST("QA/before/h_NTPC"), nTPC); hist.fill(HIST("QA/before/h_Cent"), centFT0C); + hist.fill(HIST("QA/before/h_CentM"), centFT0M); hist.fill(HIST("QA/before/h_NFT0M"), nFT0M); hist.fill(HIST("QA/before/h_NFT0C"), nFT0M); hist.fill(HIST("QA/before/h2_NTPC_NFT0M"), nFT0M, nTPC); @@ -641,18 +601,15 @@ struct MeanPtFlucId { template void fillAfterQAHistos(T const& col) { - int nTPC = 0, nFT0C = 0, nFT0M = 0; - double centFT0C = 0, centFT0M = 0; - nTPC = col.multNTracksHasTPC(); - - nFT0M = col.multFT0M(); - nFT0C = col.multFT0C(); - centFT0M = col.centFT0M(); - centFT0C = col.centFT0C(); + int nTPC = col.multNTracksHasTPC(); + int nFT0M = col.multFT0M(); + int nFT0C = col.multFT0C(); + double centFT0C = col.centFT0C(); + double centFT0M = col.centFT0M(); hist.fill(HIST("QA/after/h_VtxZ"), col.posZ()); hist.fill(HIST("QA/after/h_Counts"), 2); - if (nTPC > 0 && nFT0M > 0) { + if (nTPC != 0 && nFT0M != 0) { hist.fill(HIST("QA/after/h_NTPC"), nTPC); hist.fill(HIST("QA/after/h_Cent"), centFT0C); hist.fill(HIST("QA/after/h_CentM"), centFT0M); @@ -669,12 +626,11 @@ struct MeanPtFlucId { // Fill Charged particles QA: template - void fillChargedQAHistos(T const& track, int nFT0M) + void fillChargedQAHistos(T const& track) { hist.fill(HIST("QA/after/h_Eta"), track.eta()); hist.fill(HIST("QA/after/h_Phi"), track.phi()); hist.fill(HIST("QA/after/h_Pt"), track.pt()); - hist.fill(HIST("QA/after/h2_Pt_NFT0M"), track.pt(), nFT0M); hist.fill(HIST("QA/after/h2_PvsPinner"), track.p(), track.tpcInnerParam()); hist.fill(HIST("QA/after/h2_Pt_Eta"), track.eta(), track.pt()); hist.fill(HIST("QA/after/h_DcaZ"), track.dcaZ()); @@ -734,9 +690,10 @@ struct MeanPtFlucId { // Fill after PID cut QA hist: template - void fillIdParticleQAHistos(T const& track, std::vector effBins, std::vector effValues, double rap, double nSigmaTPC, double nSigmaTOF, int nFT0M, int& N, double& Q1, double& Q2, double& Q3, double& Q4) + void fillIdParticleQAHistos(T const& track, std::vector effBins, std::vector effValues, double rap, double nSigmaTPC, double nSigmaTOF, int& N, double& Q1, double& Q2, double& Q3, double& Q4) { double pt = track.pt(); + if (cfgCorrection == true) { int binIndex = findBin(pt, effBins); auto effVal = static_cast>(effValues); @@ -745,7 +702,6 @@ struct MeanPtFlucId { if (efficiency > 0) { float weight = 1.0 / efficiency; N += static_cast(weight); - // N ++; double ptCorrected = pt * weight; moments(ptCorrected, Q1, Q2, Q3, Q4); hist.fill(HIST(Dire[Mode]) + HIST("h_pt_weighted"), pt, weight); @@ -757,15 +713,11 @@ struct MeanPtFlucId { } hist.fill(HIST(Dire[Mode]) + HIST("h_Pt"), track.pt()); - hist.fill(HIST(Dire[Mode]) + HIST("h2_Pt_NFT0M"), track.pt(), nFT0M); - if (track.sign() > 0) { + if (track.sign() > 0) hist.fill(HIST(Dire[Mode]) + HIST("h_PtPos"), track.pt()); - hist.fill(HIST(Dire[Mode]) + HIST("h2_PtPos_NFT0M"), track.pt(), nFT0M); - } - if (track.sign() < 0) { + + if (track.sign() < 0) hist.fill(HIST(Dire[Mode]) + HIST("h_PtNeg"), track.pt()); - hist.fill(HIST(Dire[Mode]) + HIST("h2_PtNeg_NFT0M"), track.pt(), nFT0M); - } hist.fill(HIST(Dire[Mode]) + HIST("h_Eta"), track.eta()); hist.fill(HIST(Dire[Mode]) + HIST("h_Phi"), track.phi()); @@ -804,17 +756,14 @@ struct MeanPtFlucId { } template - void fillPtMCHist(double pt, int nFT0M, int pid, int pdgCodePos, int pdgCodeNeg) + void fillPtMCHist(double pt, int pid, int pdgCodePos, int pdgCodeNeg) { hist.fill(HIST(Dire[Mode]) + HIST("h_PtTruth"), pt); - hist.fill(HIST(Dire[Mode]) + HIST("h2_PtTruth_NFT0M"), pt, nFT0M); if (pid == pdgCodePos) { hist.fill(HIST(Dire[Mode]) + HIST("h_PtPosTruth"), pt); - hist.fill(HIST(Dire[Mode]) + HIST("h2_PtPosTruth_NFT0M"), pt, nFT0M); } if (pid == pdgCodeNeg) { hist.fill(HIST(Dire[Mode]) + HIST("h_PtNegTruth"), pt); - hist.fill(HIST(Dire[Mode]) + HIST("h2_PtNegTruth_NFT0M"), pt, nFT0M); } } @@ -873,15 +822,14 @@ struct MeanPtFlucId { template void fillHistos(T const& col, U const& tracks) { - int nCh = 0, nTPC = 0, nFT0M = 0, nFT0C = 0; - + int nCh = 0, nTPC = 0, nFT0M = 0; int nPi = 0, nKa = 0, nPr = 0; double ptCh = 0, q1Ch = 0, q2Ch = 0, q3Ch = 0, q4Ch = 0; double ptPi = 0, q1Pi = 0, q2Pi = 0, q3Pi = 0, q4Pi = 0; double ptPr = 0, q1Pr = 0, q2Pr = 0, q3Pr = 0, q4Pr = 0; double ptKa = 0, q1Ka = 0, q2Ka = 0, q3Ka = 0, q4Ka = 0; - int nChSim = 0, nSim = 0, nFT0CSim = 0; + int nChSim = 0, nSim = 0, NFT0CSim = 0; int nPiSim = 0, nKaSim = 0, nPrSim = 0; double ptChSim = 0, q1ChSim = 0, q2ChSim = 0, q3ChSim = 0, q4ChSim = 0; double ptPiSim = 0, q1PiSim = 0, q2PiSim = 0, q3PiSim = 0, q4PiSim = 0; @@ -908,13 +856,7 @@ struct MeanPtFlucId { hist.fill(HIST("QA/after/h_invMass_gamma"), invMassGamma); } - fillAfterQAHistos(col); - if constexpr (DataFlag) { - nTPC = col.multNTracksHasTPC(); - nFT0M = col.multFT0M(); - nFT0C = col.multFT0C(); - for (const auto& track : tracks) { if (!selTrack(track)) { continue; @@ -929,6 +871,7 @@ struct MeanPtFlucId { double rapPi = track.rapidity(MassPiPlus); double rapKa = track.rapidity(MassKPlus); double rapPr = track.rapidity(MassProton); + double innerParam = track.tpcInnerParam(); if (std::fabs(track.eta()) < 0.8) { ptCh = track.pt(); @@ -949,7 +892,7 @@ struct MeanPtFlucId { nCh++; moments(ptCh, q1Ch, q2Ch, q3Ch, q4Ch); } - fillChargedQAHistos(track, nFT0M); + fillChargedQAHistos(track); } fillBeforePIDQAHistos(track); @@ -963,32 +906,32 @@ struct MeanPtFlucId { } if (cfgSelOR == true && cfgSelAND == false) { - if (selLowPi(track) == cfgSelLow || selHighPi(track) == cfgSelHigh) { - fillIdParticleQAHistos(track, effBinsPi, effValuesPi, rapPi, nSigmaTPCPi, nSigmaTOFPi, nFT0M, nPi, q1Pi, q2Pi, q3Pi, q4Pi); + if (selLowPi(track, innerParam) == cfgSelLow || selHighPi(track) == cfgSelHigh) { + fillIdParticleQAHistos(track, effBinsPi, effValuesPi, rapPi, nSigmaTPCPi, nSigmaTOFPi, nPi, q1Pi, q2Pi, q3Pi, q4Pi); } } else if (cfgSelOR == false && cfgSelAND == true) { - if (selLowPi(track) == cfgSelLow && selHighPi(track) == cfgSelHigh) { - fillIdParticleQAHistos(track, effBinsPi, effValuesPi, rapPi, nSigmaTPCPi, nSigmaTOFPi, nFT0M, nPi, q1Pi, q2Pi, q3Pi, q4Pi); + if (selLowPi(track, innerParam) == cfgSelLow && selHighPi(track) == cfgSelHigh) { + fillIdParticleQAHistos(track, effBinsPi, effValuesPi, rapPi, nSigmaTPCPi, nSigmaTOFPi, nPi, q1Pi, q2Pi, q3Pi, q4Pi); } } if (cfgSelOR == true && cfgSelAND == false) { - if (selLowKa(track) == cfgSelLow || selHighKa(track) == cfgSelHigh) { - fillIdParticleQAHistos(track, effBinsKa, effValuesKa, rapKa, nSigmaTPCKa, nSigmaTOFKa, nFT0M, nKa, q1Ka, q2Ka, q3Ka, q4Ka); + if (selLowKa(track, innerParam) == cfgSelLow || selHighKa(track) == cfgSelHigh) { + fillIdParticleQAHistos(track, effBinsKa, effValuesKa, rapKa, nSigmaTPCKa, nSigmaTOFKa, nKa, q1Ka, q2Ka, q3Ka, q4Ka); } } else if (cfgSelOR == false && cfgSelAND == true) { - if (selLowKa(track) == cfgSelLow && selHighKa(track) == cfgSelHigh) { - fillIdParticleQAHistos(track, effBinsKa, effValuesKa, rapKa, nSigmaTPCKa, nSigmaTOFKa, nFT0M, nKa, q1Ka, q2Ka, q3Ka, q4Ka); + if (selLowKa(track, innerParam) == cfgSelLow && selHighKa(track) == cfgSelHigh) { + fillIdParticleQAHistos(track, effBinsKa, effValuesKa, rapKa, nSigmaTPCKa, nSigmaTOFKa, nKa, q1Ka, q2Ka, q3Ka, q4Ka); } } if (cfgSelOR == true && cfgSelAND == false) { - if (selLowPr(track) == cfgSelLow && selHighPr(track) == cfgSelHigh) { - fillIdParticleQAHistos(track, effBinsPr, effValuesPr, rapPr, nSigmaTPCPr, nSigmaTOFPr, nFT0M, nPr, q1Pr, q2Pr, q3Pr, q4Pr); + if (selLowPr(track, innerParam) == cfgSelLow && selHighPr(track) == cfgSelHigh) { + fillIdParticleQAHistos(track, effBinsPr, effValuesPr, rapPr, nSigmaTPCPr, nSigmaTOFPr, nPr, q1Pr, q2Pr, q3Pr, q4Pr); } } else if (cfgSelOR == false && cfgSelAND == true) { - if (selLowPr(track) == cfgSelLow && selHighPr(track) == cfgSelHigh) { - fillIdParticleQAHistos(track, effBinsPr, effValuesPr, rapPr, nSigmaTPCPr, nSigmaTOFPr, nFT0M, nPr, q1Pr, q2Pr, q3Pr, q4Pr); + if (selLowPr(track, innerParam) == cfgSelLow && selHighPr(track) == cfgSelHigh) { + fillIdParticleQAHistos(track, effBinsPr, effValuesPr, rapPr, nSigmaTPCPr, nSigmaTOFPr, nPr, q1Pr, q2Pr, q3Pr, q4Pr); } } } @@ -997,9 +940,6 @@ struct MeanPtFlucId { LOGF(warning, "No MC collision for this collision, skip..."); return; } - nTPC = col.multNTracksHasTPC(); - nFT0M = col.multFT0M(); - nFT0C = col.multFT0C(); for (const auto& track : tracks) { if (!track.has_mcParticle()) { @@ -1012,10 +952,6 @@ struct MeanPtFlucId { continue; } - if (std::abs(track.eta()) < 0.8) { - nTPC++; - } - //______________________________Reconstructed Level____________________________________________________// if (selTrack(track)) { @@ -1028,8 +964,10 @@ struct MeanPtFlucId { double rapPi = track.rapidity(MassPiPlus); double rapKa = track.rapidity(MassKPlus); double rapPr = track.rapidity(MassProton); + double innerParam = track.tpcInnerParam(); if (std::fabs(track.eta()) < 0.8) { + nCh++; ptCh = track.pt(); if (cfgCorrection == true) { int binIndex = findBin(ptCh, effBinsCh); @@ -1048,7 +986,7 @@ struct MeanPtFlucId { nCh++; moments(ptCh, q1Ch, q2Ch, q3Ch, q4Ch); } - fillChargedQAHistos(track, nFT0M); + fillChargedQAHistos(track); } fillBeforePIDQAHistos(track); @@ -1063,74 +1001,74 @@ struct MeanPtFlucId { if (cfgPDGCodeOnly == true) { if (std::abs(pid) == kPiPlus && std::abs(rapPi) < 0.5 && track.pt() >= cfgCutPiPtMin) { ptPi = track.pt(); - fillIdParticleQAHistos(track, effBinsPi, effValuesPi, rapPi, nSigmaTPCPi, nSigmaTOFPi, nFT0M, nPi, q1Pi, q2Pi, q3Pi, q4Pi); - fillPtMCHist(ptPi, nFT0M, pid, kPiPlus, kPiMinus); + fillIdParticleQAHistos(track, effBinsPi, effValuesPi, rapPi, nSigmaTPCPi, nSigmaTOFPi, nPi, q1Pi, q2Pi, q3Pi, q4Pi); + fillPtMCHist(ptPi, pid, kPiPlus, kPiMinus); } if (std::abs(pid) == kKPlus && std::abs(rapKa) < 0.5 && track.pt() >= cfgCutKaPtMin) { ptKa = track.pt(); - fillIdParticleQAHistos(track, effBinsKa, effValuesKa, rapKa, nSigmaTPCKa, nSigmaTOFKa, nFT0M, nKa, q1Ka, q2Ka, q3Ka, q4Ka); - fillPtMCHist(ptKa, nFT0M, pid, kKPlus, kKMinus); + fillIdParticleQAHistos(track, effBinsKa, effValuesKa, rapKa, nSigmaTPCKa, nSigmaTOFKa, nKa, q1Ka, q2Ka, q3Ka, q4Ka); + fillPtMCHist(ptKa, pid, kKPlus, kKMinus); } if (std::abs(pid) == kProton && std::abs(rapPr) < 0.5 && track.pt() >= cfgCutPrPtMin) { ptPr = track.pt(); - fillIdParticleQAHistos(track, effBinsPr, effValuesPr, rapPr, nSigmaTPCPr, nSigmaTOFPr, nFT0M, nPr, q1Pr, q2Pr, q3Pr, q4Pr); - fillPtMCHist(ptPr, nFT0M, pid, kProton, kProtonBar); + fillIdParticleQAHistos(track, effBinsPr, effValuesPr, rapPr, nSigmaTPCPr, nSigmaTOFPr, nPr, q1Pr, q2Pr, q3Pr, q4Pr); + fillPtMCHist(ptPr, pid, kProton, kProtonBar); } } if (cfgPidCut == true) { if (cfgSelOR == true && cfgSelAND == false) { - if (selLowPi(track) == cfgSelLow || selHighPi(track) == cfgSelHigh) { + if (selLowPi(track, innerParam) == cfgSelLow || selHighPi(track) == cfgSelHigh) { ptPi = track.pt(); - fillIdParticleQAHistos(track, effBinsPi, effValuesPi, rapPi, nSigmaTPCPi, nSigmaTOFPi, nFT0M, nPi, q1Pi, q2Pi, q3Pi, q4Pi); + fillIdParticleQAHistos(track, effBinsPi, effValuesPi, rapPi, nSigmaTPCPi, nSigmaTOFPi, nPi, q1Pi, q2Pi, q3Pi, q4Pi); if (std::abs(pid) == kPiPlus) { - fillPtMCHist(ptPi, nFT0M, pid, kPiPlus, kPiMinus); + fillPtMCHist(ptPi, pid, kPiPlus, kPiMinus); } } } else if (cfgSelOR == false && cfgSelAND == true) { - if (selLowPi(track) == cfgSelLow && selHighPi(track) == cfgSelHigh) { + if (selLowPi(track, innerParam) == cfgSelLow && selHighPi(track) == cfgSelHigh) { ptPi = track.pt(); - fillIdParticleQAHistos(track, effBinsPi, effValuesPi, rapPi, nSigmaTPCPi, nSigmaTOFPi, nFT0M, nPi, q1Pi, q2Pi, q3Pi, q4Pi); + fillIdParticleQAHistos(track, effBinsPi, effValuesPi, rapPi, nSigmaTPCPi, nSigmaTOFPi, nPi, q1Pi, q2Pi, q3Pi, q4Pi); if (std::abs(pid) == kPiPlus) { - fillPtMCHist(ptPi, nFT0M, pid, kPiPlus, kPiMinus); + fillPtMCHist(ptPi, pid, kPiPlus, kPiMinus); } } } if (cfgSelOR == true && cfgSelAND == false) { - if (selLowKa(track) == cfgSelLow || selHighKa(track) == cfgSelHigh) { + if (selLowKa(track, innerParam) == cfgSelLow || selHighKa(track) == cfgSelHigh) { ptKa = track.pt(); - fillIdParticleQAHistos(track, effBinsKa, effValuesKa, rapKa, nSigmaTPCKa, nSigmaTOFKa, nFT0M, nKa, q1Ka, q2Ka, q3Ka, q4Ka); + fillIdParticleQAHistos(track, effBinsKa, effValuesKa, rapKa, nSigmaTPCKa, nSigmaTOFKa, nKa, q1Ka, q2Ka, q3Ka, q4Ka); if (std::abs(pid) == kKPlus) { - fillPtMCHist(ptKa, nFT0M, pid, kKPlus, kKMinus); + fillPtMCHist(ptKa, pid, kKPlus, kKMinus); } } } else if (cfgSelOR == false && cfgSelAND == true) { - if (selLowKa(track) == cfgSelLow && selHighKa(track) == cfgSelHigh) { + if (selLowKa(track, innerParam) == cfgSelLow && selHighKa(track) == cfgSelHigh) { ptKa = track.pt(); - fillIdParticleQAHistos(track, effBinsKa, effValuesKa, rapKa, nSigmaTPCKa, nSigmaTOFKa, nFT0M, nKa, q1Ka, q2Ka, q3Ka, q4Ka); + fillIdParticleQAHistos(track, effBinsKa, effValuesKa, rapKa, nSigmaTPCKa, nSigmaTOFKa, nKa, q1Ka, q2Ka, q3Ka, q4Ka); if (std::abs(pid) == kKPlus) { - fillPtMCHist(ptKa, nFT0M, pid, kKPlus, kKMinus); + fillPtMCHist(ptKa, pid, kKPlus, kKMinus); } } } if (cfgSelOR == true && cfgSelAND == false) { - if (selLowPr(track) == cfgSelLow || selHighPr(track) == cfgSelHigh) { + if (selLowPr(track, innerParam) == cfgSelLow || selHighPr(track) == cfgSelHigh) { ptPr = track.pt(); - fillIdParticleQAHistos(track, effBinsPr, effValuesPr, rapPr, nSigmaTPCPr, nSigmaTOFPr, nFT0M, nPr, q1Pr, q2Pr, q3Pr, q4Pr); + fillIdParticleQAHistos(track, effBinsPr, effValuesPr, rapPr, nSigmaTPCPr, nSigmaTOFPr, nPr, q1Pr, q2Pr, q3Pr, q4Pr); if (std::abs(pid) == kProton) { - fillPtMCHist(ptPr, nFT0M, pid, kProton, kProtonBar); + fillPtMCHist(ptPr, pid, kProton, kProtonBar); } } } else if (cfgSelOR == false && cfgSelAND == true) { - if (selLowPr(track) == cfgSelLow && selHighPr(track) == cfgSelHigh) { + if (selLowPr(track, innerParam) == cfgSelLow && selHighPr(track) == cfgSelHigh) { ptPr = track.pt(); - fillIdParticleQAHistos(track, effBinsPr, effValuesPr, rapPr, nSigmaTPCPr, nSigmaTOFPr, nFT0M, nPr, q1Pr, q2Pr, q3Pr, q4Pr); + fillIdParticleQAHistos(track, effBinsPr, effValuesPr, rapPr, nSigmaTPCPr, nSigmaTOFPr, nPr, q1Pr, q2Pr, q3Pr, q4Pr); if (std::abs(pid) == kProton) { - fillPtMCHist(ptPr, nFT0M, pid, kProton, kProtonBar); + fillPtMCHist(ptPr, pid, kProton, kProtonBar); } } } @@ -1146,27 +1084,22 @@ struct MeanPtFlucId { if (std::fabs(charge) < 1e-3) { continue; } - if (std::abs(pid) != kElectron && std::abs(pid) != kMuonMinus && std::abs(pid) != kPiPlus && std::abs(pid) != kKPlus && std::abs(pid) != kProton) { - continue; - } - - if (std::fabs(mcPart.eta()) < 0.8) { + if (std::abs(mcPart.eta()) < 0.8) { nSim++; } - - if (mcPart.eta() > -3.3 || mcPart.eta() < -2.1) { - nFT0CSim++; + if (-3.3 < mcPart.eta() && mcPart.eta() < -2.1) { + NFT0CSim++; } if (mcPart.pt() > cfgCutPtMin && mcPart.pt() < cfgCutPtMax) { - if (std::abs(mcPart.eta()) < 0.8) { - nChSim++; - ptChSim = mcPart.pt(); - moments(ptChSim, q1ChSim, q2ChSim, q3ChSim, q4ChSim); - hist.fill(HIST("Gen/Charged/h_PtTruth"), mcPart.pt()); - hist.fill(HIST("Gen/Charged/h2_PtTruth_NFT0M"), mcPart.pt(), nFT0M); + if (std::abs(mcPart.eta()) > 0.8) { + continue; } + nChSim++; + ptChSim = mcPart.pt(); + moments(ptChSim, q1ChSim, q2ChSim, q3ChSim, q4ChSim); + hist.fill(HIST("Gen/Charged/h_PtTruth"), mcPart.pt()); if (std::abs(mcPart.y()) > cfgCutRap) { continue; @@ -1178,14 +1111,14 @@ struct MeanPtFlucId { nPiSim++; ptPiSim = mcPart.pt(); moments(ptPiSim, q1PiSim, q2PiSim, q3PiSim, q4PiSim); - fillPtMCHist(ptPiSim, nFT0M, pid, kPiPlus, kPiMinus); + fillPtMCHist(ptPiSim, pid, kPiPlus, kPiMinus); } } else if (cfgSelOR == false && cfgSelAND == true) { if ((cfgSelLow == true && mcPart.p() <= cfgCutPiThrsldP) && (cfgSelHigh == true && mcPart.p() > cfgCutPiThrsldP)) { nPiSim++; ptPiSim = mcPart.pt(); moments(ptPiSim, q1PiSim, q2PiSim, q3PiSim, q4PiSim); - fillPtMCHist(ptPiSim, nFT0M, pid, kPiPlus, kPiMinus); + fillPtMCHist(ptPiSim, pid, kPiPlus, kPiMinus); } } } @@ -1196,14 +1129,14 @@ struct MeanPtFlucId { nKaSim++; ptKaSim = mcPart.pt(); moments(ptKaSim, q1KaSim, q2KaSim, q3KaSim, q4KaSim); - fillPtMCHist(ptKaSim, nFT0M, pid, kKPlus, kKMinus); + fillPtMCHist(ptKaSim, pid, kKPlus, kKMinus); } } else if (cfgSelOR == false && cfgSelAND == true) { if ((cfgSelLow == true && mcPart.p() <= cfgCutKaThrsldP) && (cfgSelHigh == true && mcPart.p() > cfgCutKaThrsldP)) { nKaSim++; ptKaSim = mcPart.pt(); moments(ptKaSim, q1KaSim, q2KaSim, q3KaSim, q4KaSim); - fillPtMCHist(ptKaSim, nFT0M, pid, kKPlus, kKMinus); + fillPtMCHist(ptKaSim, pid, kKPlus, kKMinus); } } } @@ -1214,14 +1147,14 @@ struct MeanPtFlucId { nPrSim++; ptPrSim = mcPart.pt(); moments(ptPrSim, q1PrSim, q2PrSim, q3PrSim, q4PrSim); - fillPtMCHist(ptPrSim, nFT0M, pid, kProton, kProtonBar); + fillPtMCHist(ptPrSim, pid, kProton, kProtonBar); } } else if (cfgSelOR == false && cfgSelAND == true) { if ((cfgSelLow == true && mcPart.p() <= cfgCutPrThrsldP) && (cfgSelHigh == true && mcPart.p() > cfgCutPrThrsldP)) { nPrSim++; ptPrSim = mcPart.pt(); moments(ptPrSim, q1PrSim, q2PrSim, q3PrSim, q4PrSim); - fillPtMCHist(ptPrSim, nFT0M, pid, kProton, kProtonBar); + fillPtMCHist(ptPrSim, pid, kProton, kProtonBar); } } } @@ -1230,26 +1163,28 @@ struct MeanPtFlucId { hist.fill(HIST("QA/after/h_vtxZSim"), col.mcCollision().posZ()); } - if (nTPC > 0 && nCh > 0) - hist.fill(HIST("QA/after/h2_NTPC_NCh"), nTPC, nCh); + nTPC = col.multNTracksHasTPC(); + nFT0M = col.multFT0M(); if (cfgMCTruth) { - if (nSim > 0) + if (nSim != 0) hist.fill(HIST("QA/after/h_NSim"), nSim); - if (nSim > 0 && nChSim > 0) + if (nSim != 0 && nChSim != 0) hist.fill(HIST("QA/after/h2_NChSim_NSim"), nSim, nChSim); - if (nSim > 0 && nTPC > 0) + if (nSim != 0 && nTPC != 0) hist.fill(HIST("QA/after/h2_NTPC_NSim"), nSim, nTPC); - hist.fill(HIST("Gen/NTPC"), nTPC); - hist.fill(HIST("Gen/NFT0C"), nFT0CSim); - hist.fill(HIST("Gen/h2_NTPC_NFT0C"), nFT0CSim, nTPC); - hist.fill(HIST("Gen/h2_NTPC_NFT0M"), nFT0M, nTPC); + int nFT0C = col.multFT0C(); + if (nFT0C != 0 && NFT0CSim != 0) + hist.fill(HIST("QA/after/h2_NFT0C_NFT0CSim"), NFT0CSim, nFT0C); - if (nFT0C != 0 && nFT0CSim != 0) - hist.fill(HIST("QA/after/h2_NFT0C_NFT0CSim"), nFT0CSim, nFT0C); + nTPC = nSim; + + hist.fill(HIST("Gen/NTPC"), nTPC); + hist.fill(HIST("Gen/NFT0C"), NFT0CSim); + hist.fill(HIST("Gen/h2_NTPC_NFT0C"), NFT0CSim, nTPC); fillAnalysisHistos(nTPC, nFT0M, nChSim, q1ChSim, q2ChSim, q3ChSim, q4ChSim); fillAnalysisHistos(nTPC, nFT0M, nPiSim, q1PiSim, q2PiSim, q3PiSim, q4PiSim); @@ -1257,13 +1192,17 @@ struct MeanPtFlucId { fillAnalysisHistos(nTPC, nFT0M, nPrSim, q1PrSim, q2PrSim, q3PrSim, q4PrSim); } + fillAfterQAHistos(col); + if (nTPC != 0 && nCh != 0) + hist.fill(HIST("QA/after/h2_NTPC_NCh"), nTPC, nCh); + fillAnalysisHistos(nTPC, nFT0M, nCh, q1Ch, q2Ch, q3Ch, q4Ch); fillAnalysisHistos(nTPC, nFT0M, nPi, q1Pi, q2Pi, q3Pi, q4Pi); fillAnalysisHistos(nTPC, nFT0M, nKa, q1Ka, q2Ka, q3Ka, q4Ka); fillAnalysisHistos(nTPC, nFT0M, nPr, q1Pr, q2Pr, q3Pr, q4Pr); } - void processRun3(MyRun3Collisions::iterator const& col, MyAllTracks const& tracks) + void processRun3(MyCollisions::iterator const& col, MyAllTracks const& tracks) { // Before Collision and Track Cuts: fillBeforeQAHistos(col, tracks); @@ -1273,9 +1212,9 @@ struct MeanPtFlucId { fillHistos(col, tracks); } } - PROCESS_SWITCH(MeanPtFlucId, processRun3, "Process for Run-3", false); + PROCESS_SWITCH(MeanPtFlucId, processRun3, "Process for Run3", false); - void processMCRecoSimRun3(MyRun3MCCollisions::iterator const& col, aod::McCollisions const&, MyMCTracks const& tracks, aod::McParticles const&) + void processMCRecoSimRun3(MyMCCollisions::iterator const& col, aod::McCollisions const&, MyMCTracks const& tracks, aod::McParticles const&) { // Before Collision and Track Cuts: fillBeforeQAHistos(col, tracks); From ea25eb1ba77acc6109de129af978c9bbb011de6d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?BiaoZhang=20=28=E5=BC=A0=E5=BD=AA=29?= <52267892+zhangbiao-phy@users.noreply.github.com> Date: Mon, 3 Feb 2025 23:48:32 +0100 Subject: [PATCH 04/16] [PWGHF] Fix the bug of the thnsparse axis number in Lc task (#9712) --- PWGHF/D2H/Tasks/taskLc.cxx | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/PWGHF/D2H/Tasks/taskLc.cxx b/PWGHF/D2H/Tasks/taskLc.cxx index 9d63aaab496..23506554f52 100644 --- a/PWGHF/D2H/Tasks/taskLc.cxx +++ b/PWGHF/D2H/Tasks/taskLc.cxx @@ -308,13 +308,19 @@ struct HfTaskLc { std::vector axesStd, axesWithBdt, axesGen; - if (isDataStd || isMcStd) { + if (isDataStd) { + axesStd = {thnAxisMass, thnAxisPt, thnAxisCentrality, thnAxisPtProng0, thnAxisPtProng1, thnAxisPtProng2, thnAxisChi2PCA, thnAxisDecLength, thnAxisCPA, thnAxisTracklets}; + } + if (isMcStd) { axesStd = {thnAxisMass, thnAxisPt, thnAxisCentrality, thnAxisPtProng0, thnAxisPtProng1, thnAxisPtProng2, thnAxisChi2PCA, thnAxisDecLength, thnAxisCPA, thnAxisTracklets, thnAxisPtB, thnAxisCanType}; } if (isMcStd || isMcWithMl) { axesGen = {thnAxisPt, thnAxisCentrality, thnAxisY, thnAxisTracklets, thnAxisPtB, thnAxisCanType}; } - if (isDataWithMl || isMcWithMl) { + if (isDataWithMl) { + axesWithBdt = {thnAxisMass, thnAxisPt, thnAxisCentrality, thnAxisBdtScoreLcBkg, thnAxisBdtScoreLcPrompt, thnAxisBdtScoreLcNonPrompt, thnAxisTracklets}; + } + if (isMcWithMl) { axesWithBdt = {thnAxisMass, thnAxisPt, thnAxisCentrality, thnAxisBdtScoreLcBkg, thnAxisBdtScoreLcPrompt, thnAxisBdtScoreLcNonPrompt, thnAxisTracklets, thnAxisPtB, thnAxisCanType}; } From 2ab0d686d1c1eec2e7a591c453eb5b58f6f7fab4 Mon Sep 17 00:00:00 2001 From: Giovanni Malfattore <89481844+giovannimalfattore@users.noreply.github.com> Date: Tue, 4 Feb 2025 06:37:22 +0100 Subject: [PATCH 05/16] [DPG] Update qaPIDITS.cxx (#9709) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Nicolò Jacazio --- DPG/Tasks/AOTTrack/PID/ITS/qaPIDITS.cxx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/DPG/Tasks/AOTTrack/PID/ITS/qaPIDITS.cxx b/DPG/Tasks/AOTTrack/PID/ITS/qaPIDITS.cxx index 0916768fece..13d91444a87 100644 --- a/DPG/Tasks/AOTTrack/PID/ITS/qaPIDITS.cxx +++ b/DPG/Tasks/AOTTrack/PID/ITS/qaPIDITS.cxx @@ -242,10 +242,10 @@ struct itsPidQa { hNsigmaPos[id] = histos.add(Form("nsigmaPos/%s", pN[id]), axisTitle, kTH2F, {pAxis, nSigmaAxis}); hNsigmaNeg[id] = histos.add(Form("nsigmaNeg/%s", pN[id]), axisTitle, kTH2F, {pAxis, nSigmaAxis}); } - histos.add("event/averageClusterSize", "", kTH2F, {ptAxis, avClsAxis}); - histos.add("event/averageClusterSizePerCoslInv", "", kTH2F, {ptAxis, avClsEffAxis}); - histos.add("event/SelectedAverageClusterSize", "", kTH2F, {ptAxis, avClsAxis}); - histos.add("event/SelectedAverageClusterSizePerCoslInv", "", kTH2F, {ptAxis, avClsEffAxis}); + histos.add("event/averageClusterSize", "", kTH2D, {pAxis, avClsAxis}); + histos.add("event/averageClusterSizePerCoslInv", "", kTH2D, {pAxis, avClsEffAxis}); + histos.add("event/SelectedAverageClusterSize", "", kTH2D, {pAxis, avClsAxis}); + histos.add("event/SelectedAverageClusterSizePerCoslInv", "", kTH2D, {pAxis, avClsEffAxis}); LOG(info) << "QA PID ITS histograms:"; histos.print(); } From e6e4453599a409e4f86e94d168e0aa8606d70d1c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=B2=20Jacazio?= Date: Tue, 4 Feb 2025 09:15:07 +0100 Subject: [PATCH 06/16] [DPG] Update param. name (#9719) --- DPG/Tasks/AOTTrack/PID/ITS/qaPIDITS.cxx | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/DPG/Tasks/AOTTrack/PID/ITS/qaPIDITS.cxx b/DPG/Tasks/AOTTrack/PID/ITS/qaPIDITS.cxx index 13d91444a87..c93d5980498 100644 --- a/DPG/Tasks/AOTTrack/PID/ITS/qaPIDITS.cxx +++ b/DPG/Tasks/AOTTrack/PID/ITS/qaPIDITS.cxx @@ -42,6 +42,7 @@ static const std::vector tableNames{"Electron", // 0 "Helium", // 7 "Alpha"}; // 8 static const std::vector parameterNames{"enable"}; +static const std::vector selectionNames{"selection"}; static const int defaultParameters[9][nParameters]{{0}, {0}, {1}, {1}, {1}, {0}, {0}, {0}, {0}}; static const float defaultPIDSelection[9][nParameters]{{-1.f}, {-1.f}, {-1.f}, {-1.f}, {-1.f}, {-1.f}, {-1.f}, {-1.f}, {-1.f}}; static constexpr int Np = 9; @@ -146,10 +147,10 @@ struct itsPidQa { {defaultParameters[0], 9, nParameters, tableNames, parameterNames}, "Produce QA for this species: 0 - no, 1 - yes"}; Configurable> tofSelection{"tofSelection", - {defaultPIDSelection[0], 9, nParameters, tableNames, parameterNames}, + {defaultPIDSelection[0], 9, nParameters, tableNames, selectionNames}, "Selection on the TOF nsigma"}; Configurable> tpcSelection{"tpcSelection", - {defaultPIDSelection[0], 9, nParameters, tableNames, parameterNames}, + {defaultPIDSelection[0], 9, nParameters, tableNames, selectionNames}, "Selection on the TPC nsigma"}; Configurable logAxis{"logAxis", 1, "Flag to use a log momentum axis"}; @@ -214,11 +215,11 @@ struct itsPidQa { h = histos.add("event/particlehypo", "", kTH1D, {{10, 0, 10, "PID in tracking"}}); for (int id = 0; id < 9; id++) { h->GetXaxis()->SetBinLabel(id + 1, PID::getName(id)); - tpcSelValues[id] = tpcSelection->get(tableNames[id].c_str(), "enable"); + tpcSelValues[id] = tpcSelection->get(tableNames[id].c_str(), "selection"); if (tpcSelValues[id] <= 0.f) { tpcSelValues[id] = 999.f; } - tofSelValues[id] = tofSelection->get(tableNames[id].c_str(), "enable"); + tofSelValues[id] = tofSelection->get(tableNames[id].c_str(), "selection"); if (tofSelValues[id] <= 0.f) { tofSelValues[id] = 999.f; } From 425b6b6aa7faa733319945e971e488c7d259b226 Mon Sep 17 00:00:00 2001 From: altsybee Date: Tue, 4 Feb 2025 10:28:36 +0100 Subject: [PATCH 07/16] [DPG] Update timeDependentQa.cxx - add histos, tuned cuts (#9723) --- DPG/Tasks/AOTEvent/timeDependentQa.cxx | 554 +++++++++++++++++-------- 1 file changed, 379 insertions(+), 175 deletions(-) diff --git a/DPG/Tasks/AOTEvent/timeDependentQa.cxx b/DPG/Tasks/AOTEvent/timeDependentQa.cxx index b56a77812ea..cb64a2e3d91 100644 --- a/DPG/Tasks/AOTEvent/timeDependentQa.cxx +++ b/DPG/Tasks/AOTEvent/timeDependentQa.cxx @@ -24,29 +24,69 @@ #include "Framework/HistogramRegistry.h" #include "CCDB/BasicCCDBManager.h" #include "Common/DataModel/EventSelection.h" +#include "Common/CCDB/EventSelectionParams.h" #include "Common/DataModel/TrackSelectionTables.h" #include "Common/CCDB/ctpRateFetcher.h" #include "TPCCalibration/TPCMShapeCorrection.h" #include "DataFormatsParameters/GRPECSObject.h" #include "DataFormatsITSMFT/ROFRecord.h" #include "ReconstructionDataFormats/Vertex.h" +#include "Common/DataModel/Multiplicity.h" #include "TTree.h" using namespace o2; using namespace o2::framework; -using BCsRun3 = soa::Join; -using BarrelTracks = soa::Join; -const AxisSpec axisQoverPt{100, -5., 5., "q/p_{T}, 1/GeV"}; +using namespace o2::aod::evsel; + +using ColEvSels = soa::Join; +using BCsRun3 = soa::Join; + +using BarrelTracks = soa::Join; + +const AxisSpec axisQoverPt{100, -1., 1., "q/p_{T}, 1/GeV"}; const AxisSpec axisDcaR{1000, -5., 5., "DCA_{r}, cm"}; const AxisSpec axisDcaZ{1000, -5., 5., "DCA_{z}, cm"}; -const AxisSpec axisSparseQoverPt{20, -5., 5., "q/p_{T}, 1/GeV"}; -const AxisSpec axisSparseDcaR{100, -5., 5., "DCA_{r}, cm"}; -const AxisSpec axisSparseDcaZ{100, -5., 5., "DCA_{z}, cm"}; +const AxisSpec axisSparseQoverPt{20, -1., 1., "q/p_{T}, 1/GeV"}; +const AxisSpec axisSparseDcaR{100, -1., 1., "DCA_{r}, cm"}; +const AxisSpec axisSparseDcaZ{100, -1., 1., "DCA_{z}, cm"}; struct TimeDependentQaTask { Configurable confTimeBinWidthInSec{"TimeBinWidthInSec", 0.25, "Width of time bins in seconds"}; // o2-linter: disable=name/configurable Configurable confTakeVerticesWithUPCsettings{"ConsiderVerticesWithUPCsettings", 0, "Take vertices: 0 - all , 1 - only without UPC settings, 2 - only with UPC settings"}; // o2-linter: disable=name/configurable + Configurable confFillPhiVsTimeHist{"FillPhiVsTimeHist", 2, "0 - don't fill , 1 - fill only for global/7cls/TRD/TOF tracks, 2 - fill also layer-by-layer"}; // o2-linter: disable=name/configurable + Configurable confFillEtaPhiVsTimeHist{"FillEtaPhiVsTimeHist", 0, "0 - don't fill , 1 - fill"}; // o2-linter: disable=name/configurable + + enum EvSelBitsToMonitor { + enCollisionsAll, + enIsTriggerTVX, + enNoTimeFrameBorder, + enNoITSROFrameBorder, + enCollisionsSel8, + enNoSameBunchPileup, + enIsGoodZvtxFT0vsPV, + enIsVertexITSTPC, + enIsVertexTOFmatched, + enIsVertexTRDmatched, + enNoCollInTimeRangeNarrow, + enNoCollInTimeRangeStrict, + enNoCollInTimeRangeStandard, + enNoCollInRofStrict, + enNoCollInRofStandard, + enNoHighMultCollInPrevRof, + enIsGoodITSLayer3, + enIsGoodITSLayer0123, + enIsGoodITSLayersAll, + enIsLowOccupStd, + enIsLowOccupStdAlsoInPrevRof, + enIsLowOccupStdAndCut2000, + enIsLowOccupStdAlsoInPrevRofAndCut2000, + enIsLowOccupStdAndCut500, + enIsLowOccupStdAlsoInPrevRofAndCut500, + enIsLowOccupStdAlsoInPrevRofAndCut500noDeadStaves, + enNumEvSelBits, // counter + }; + Service ccdb; HistogramRegistry histos{"Histos", {}, OutputObjHandlingPolicy::AnalysisObject}; o2::tpc::TPCMShapeCorrection mshape; // object for simple access @@ -54,6 +94,7 @@ struct TimeDependentQaTask { double maxSec = 1; double minSec = 0; ctpRateFetcher mRateFetcher; + void init(InitContext&) { ccdb->setURL("http://alice-ccdb.cern.ch"); @@ -66,10 +107,12 @@ struct TimeDependentQaTask { histos.add("hQoverPtDcaZ", "", kTH2F, {axisSparseQoverPt, axisSparseDcaZ}); } - void process(aod::Collision const& col, BCsRun3 const& bcs, BarrelTracks const& tracks) + void process(ColEvSels const& cols, BCsRun3 const& bcs, BarrelTracks const& tracks, aod::FT0s const&) { int runNumber = bcs.iteratorAt(0).runNumber(); if (runNumber != lastRunNumber) { + LOGP(info, " >> QA: run number = {}", runNumber); + lastRunNumber = runNumber; std::map metadata; metadata["runNumber"] = Form("%d", runNumber); @@ -80,203 +123,364 @@ struct TimeDependentQaTask { double timeInterval = nTimeBins * confTimeBinWidthInSec; const AxisSpec axisSeconds{nTimeBins, 0, timeInterval, "seconds"}; - histos.add("hSecondsCollisions", "", kTH1F, {axisSeconds}); - - histos.add("hSecondsAsideQoverPtSumDcaR", "", kTH2F, {axisSeconds, axisSparseQoverPt}); - histos.add("hSecondsAsideQoverPtSumDcaZ", "", kTH2F, {axisSeconds, axisSparseQoverPt}); - histos.add("hSecondsCsideQoverPtSumDcaR", "", kTH2F, {axisSeconds, axisSparseQoverPt}); - histos.add("hSecondsCsideQoverPtSumDcaZ", "", kTH2F, {axisSeconds, axisSparseQoverPt}); - histos.add("hSecondsQoverPtSumDcaR", "", kTH2F, {axisSeconds, axisSparseQoverPt}); - histos.add("hSecondsQoverPtSumDcaZ", "", kTH2F, {axisSeconds, axisSparseQoverPt}); - - histos.add("hSecondsAsideSumDcaR", "", kTH1F, {axisSeconds}); - histos.add("hSecondsAsideSumDcaZ", "", kTH1F, {axisSeconds}); - histos.add("hSecondsCsideSumDcaR", "", kTH1F, {axisSeconds}); - histos.add("hSecondsCsideSumDcaZ", "", kTH1F, {axisSeconds}); - histos.add("hSecondsSumDcaR", "", kTH1F, {axisSeconds}); - histos.add("hSecondsSumDcaZ", "", kTH1F, {axisSeconds}); - histos.add("hSecondsTracks", "", kTH1F, {axisSeconds}); - histos.add("hSecondsTracksMshape", "", kTH1F, {axisSeconds}); - - histos.add("hSecondsAsideITSTPCcontrib", "", kTH1F, {axisSeconds}); - histos.add("hSecondsCsideITSTPCcontrib", "", kTH1F, {axisSeconds}); - histos.add("hSecondsIR", "", kTH1F, {axisSeconds}); + histos.add("hSecondsCollisions", "", kTH1D, {axisSeconds}); + histos.add("hSecondsIR", "", kTH1D, {axisSeconds}); + histos.add("hSecondsVz", "", kTH1D, {axisSeconds}); + histos.add("hSecondsFT0Camlp", "", kTH1D, {axisSeconds}); + histos.add("hSecondsFT0CamlpByColMult", "", kTH1D, {axisSeconds}); + histos.add("hSecondsFT0AamlpByColMult", "", kTH1D, {axisSeconds}); + histos.add("hSecondsV0Aamlp", "", kTH1D, {axisSeconds}); + + histos.add("hSecondsOccupancyByTracks", "", kTH1D, {axisSeconds}); + histos.add("hSecondsOccupancyByFT0C", "", kTH1D, {axisSeconds}); // QA for UPC settings - histos.add("hSecondsUPCvertices", "", kTH2F, {axisSeconds, {2, -0.5, 1.5, "Is vertex with UPC settings"}}); + histos.add("hSecondsUPCverticesBeforeSel8", "", kTH2F, {axisSeconds, {2, -0.5, 1.5, "Is vertex with UPC settings"}}); + histos.add("hSecondsUPCvertices", "", kTH2F, {axisSeconds, {2, -0.5, 1.5, "Is vertex with UPC settings after sel8"}}); + + // QA event selection bits + int nEvSelBits = enNumEvSelBits; + histos.add("hSecondsEventSelBits", "", kTH2F, {axisSeconds, {nEvSelBits, -0.5, nEvSelBits - 0.5, "Monitoring of event selection bits"}}); + TAxis* axSelBits = reinterpret_cast(histos.get(HIST("hSecondsEventSelBits"))->GetYaxis()); + axSelBits->SetBinLabel(1 + enCollisionsAll, "collisionsAll"); + axSelBits->SetBinLabel(1 + enIsTriggerTVX, "IsTriggerTVX"); + axSelBits->SetBinLabel(1 + enNoTimeFrameBorder, "NoTimeFrameBorder"); + axSelBits->SetBinLabel(1 + enNoITSROFrameBorder, "NoITSROFrameBorder"); + axSelBits->SetBinLabel(1 + enCollisionsSel8, "collisionsSel8"); + axSelBits->SetBinLabel(1 + enNoSameBunchPileup, "NoSameBunchPileup"); + axSelBits->SetBinLabel(1 + enIsGoodZvtxFT0vsPV, "IsGoodZvtxFT0vsPV"); + axSelBits->SetBinLabel(1 + enIsVertexITSTPC, "IsVertexITSTPC"); + axSelBits->SetBinLabel(1 + enIsVertexTOFmatched, "IsVertexTOFmatched"); + axSelBits->SetBinLabel(1 + enIsVertexTRDmatched, "IsVertexTRDmatched"); + axSelBits->SetBinLabel(1 + enNoCollInTimeRangeNarrow, "NoCollInTimeRangeNarrow"); + axSelBits->SetBinLabel(1 + enNoCollInTimeRangeStrict, "NoCollInTimeRangeStrict"); + axSelBits->SetBinLabel(1 + enNoCollInTimeRangeStandard, "NoCollInTimeRangeStandard"); + axSelBits->SetBinLabel(1 + enNoCollInRofStrict, "NoCollInRofStrict"); + axSelBits->SetBinLabel(1 + enNoCollInRofStandard, "NoCollInRofStandard"); + axSelBits->SetBinLabel(1 + enNoHighMultCollInPrevRof, "NoHighMultCollInPrevRof"); + axSelBits->SetBinLabel(1 + enIsGoodITSLayer3, "IsGoodITSLayer3"); + axSelBits->SetBinLabel(1 + enIsGoodITSLayer0123, "IsGoodITSLayer0123"); + axSelBits->SetBinLabel(1 + enIsGoodITSLayersAll, "IsGoodITSLayersAll"); + axSelBits->SetBinLabel(1 + enIsLowOccupStd, "isLowOccupStd"); + axSelBits->SetBinLabel(1 + enIsLowOccupStdAlsoInPrevRof, "isLowOccupStdAlsoInPrevRof"); + axSelBits->SetBinLabel(1 + enIsLowOccupStdAndCut2000, "isLowOccupStdAndCut2000"); + axSelBits->SetBinLabel(1 + enIsLowOccupStdAlsoInPrevRofAndCut2000, "isLowOccupStdAlsoInPrevRofAndCut2000"); + axSelBits->SetBinLabel(1 + enIsLowOccupStdAndCut500, "isLowOccupStdAndCut500"); + axSelBits->SetBinLabel(1 + enIsLowOccupStdAlsoInPrevRofAndCut500, "isLowOccupStdAlsoInPrevRofAndCut500"); + axSelBits->SetBinLabel(1 + enIsLowOccupStdAlsoInPrevRofAndCut500noDeadStaves, "isLowOccupStdAlsoInPrevRofAndCut500noDeadStaves"); + + // QA for tracks + histos.add("hSecondsTracks", "", kTH1D, {axisSeconds}); + histos.add("hSecondsQoverPtSumDcaR", "", kTH2D, {axisSeconds, axisSparseQoverPt}); + histos.add("hSecondsQoverPtSumDcaZ", "", kTH2D, {axisSeconds, axisSparseQoverPt}); + histos.add("hSecondsSumDcaR", "", kTH1D, {axisSeconds}); + histos.add("hSecondsSumDcaZ", "", kTH1D, {axisSeconds}); + histos.add("hSecondsTracksMshape", "", kTH1D, {axisSeconds}); // QA for global tracks const AxisSpec axisChi2{40, 0., 20., "chi2/ndof"}; - const AxisSpec axisNclsITS{10, -0.5, 9.5, "n ITS cls"}; + const AxisSpec axisNclsITS{9, -0.5, 8.5, "n ITS cls"}; const AxisSpec axisNclsTPC{40, -0.5, 159.5, "n TPC cls"}; const AxisSpec axisFraction{40, 0, 1., "Fraction shared cls Tpc"}; - histos.add("hSecondsAsideNumTracksGlobal", "", kTH1F, {axisSeconds}); - histos.add("hSecondsAsideSumDcaRglobal", "", kTH1F, {axisSeconds}); - histos.add("hSecondsAsideSumDcaZglobal", "", kTH1F, {axisSeconds}); - histos.add("hSecondsAsideNumClsItsGlobal", "", kTH2F, {axisSeconds, axisNclsITS}); - histos.add("hSecondsAsideChi2NClItsGlobal", "", kTH2F, {axisSeconds, axisChi2}); - histos.add("hSecondsAsideNumClsTpcGlobal", "", kTH2F, {axisSeconds, axisNclsTPC}); - histos.add("hSecondsAsideChi2NClTpcGlobal", "", kTH2F, {axisSeconds, axisChi2}); - histos.add("hSecondsAsideTpcFractionSharedClsGlobal_nTPCclsCut80", "", kTH2F, {axisSeconds, axisFraction}); - - histos.add("hSecondsCsideNumTracksGlobal", "", kTH1F, {axisSeconds}); - histos.add("hSecondsCsideSumDcaRglobal", "", kTH1F, {axisSeconds}); - histos.add("hSecondsCsideSumDcaZglobal", "", kTH1F, {axisSeconds}); - histos.add("hSecondsCsideNumClsItsGlobal", "", kTH2F, {axisSeconds, axisNclsITS}); - histos.add("hSecondsCsideChi2NClItsGlobal", "", kTH2F, {axisSeconds, axisChi2}); - histos.add("hSecondsCsideNumClsTpcGlobal", "", kTH2F, {axisSeconds, axisNclsTPC}); - histos.add("hSecondsCsideChi2NClTpcGlobal", "", kTH2F, {axisSeconds, axisChi2}); - histos.add("hSecondsCsideTpcFractionSharedClsGlobal_nTPCclsCut80", "", kTH2F, {axisSeconds, axisFraction}); - + // ### A side + histos.add("A/hSecondsTracks", "", kTH1D, {axisSeconds}); + histos.add("A/hSecondsQoverPtSumDcaR", "", kTH2D, {axisSeconds, axisSparseQoverPt}); + histos.add("A/hSecondsQoverPtSumDcaZ", "", kTH2D, {axisSeconds, axisSparseQoverPt}); + histos.add("A/hSecondsSumDcaR", "", kTH1D, {axisSeconds}); + histos.add("A/hSecondsSumDcaZ", "", kTH1D, {axisSeconds}); + + // global tracks + histos.add("A/global/hSecondsNumTracks", "", kTH1D, {axisSeconds}); + histos.add("A/global/hSecondsSumDcaR", "", kTH1D, {axisSeconds}); + histos.add("A/global/hSecondsSumDcaZ", "", kTH1D, {axisSeconds}); + histos.add("A/global/hSecondsNumClsIts", "", kTH2D, {axisSeconds, axisNclsITS}); + histos.add("A/global/hSecondsChi2NClIts", "", kTH2D, {axisSeconds, axisChi2}); + histos.add("A/global/hSecondsNumClsTpc", "", kTH2D, {axisSeconds, axisNclsTPC}); + histos.add("A/global/hSecondsChi2NClTpc", "", kTH2D, {axisSeconds, axisChi2}); + histos.add("A/global/hSecondsTpcFractionSharedClsnTPCclsCut70", "", kTH2D, {axisSeconds, axisFraction}); + + // global && PV tracks + histos.add("A/globalPV/hSecondsNumPVcontributors", "", kTH1D, {axisSeconds}); + histos.add("A/globalPV/hSecondsSumDcaR", "", kTH1D, {axisSeconds}); + histos.add("A/globalPV/hSecondsSumDcaZ", "", kTH1D, {axisSeconds}); + histos.add("A/globalPV/hSecondsNumClsIts", "", kTH2D, {axisSeconds, axisNclsITS}); + histos.add("A/globalPV/hSecondsChi2NClIts", "", kTH2D, {axisSeconds, axisChi2}); + histos.add("A/globalPV/hSecondsNumClsTpc", "", kTH2D, {axisSeconds, axisNclsTPC}); + histos.add("A/globalPV/hSecondsChi2NClTpc", "", kTH2D, {axisSeconds, axisChi2}); + histos.add("A/globalPV/hSecondsTpcFractionSharedClsnTPCclsCut70", "", kTH2D, {axisSeconds, axisFraction}); + + // ### C side + histos.add("C/hSecondsTracks", "", kTH1D, {axisSeconds}); + histos.add("C/hSecondsQoverPtSumDcaR", "", kTH2D, {axisSeconds, axisSparseQoverPt}); + histos.add("C/hSecondsQoverPtSumDcaZ", "", kTH2D, {axisSeconds, axisSparseQoverPt}); + histos.add("C/hSecondsSumDcaR", "", kTH1D, {axisSeconds}); + histos.add("C/hSecondsSumDcaZ", "", kTH1D, {axisSeconds}); + + // global tracks + histos.add("C/global/hSecondsNumTracks", "", kTH1D, {axisSeconds}); + histos.add("C/global/hSecondsSumDcaR", "", kTH1D, {axisSeconds}); + histos.add("C/global/hSecondsSumDcaZ", "", kTH1D, {axisSeconds}); + histos.add("C/global/hSecondsNumClsIts", "", kTH2D, {axisSeconds, axisNclsITS}); + histos.add("C/global/hSecondsChi2NClIts", "", kTH2D, {axisSeconds, axisChi2}); + histos.add("C/global/hSecondsNumClsTpc", "", kTH2D, {axisSeconds, axisNclsTPC}); + histos.add("C/global/hSecondsChi2NClTpc", "", kTH2D, {axisSeconds, axisChi2}); + histos.add("C/global/hSecondsTpcFractionSharedClsnTPCclsCut70", "", kTH2D, {axisSeconds, axisFraction}); + + // global && PV tracks + histos.add("C/globalPV/hSecondsNumPVcontributors", "", kTH1D, {axisSeconds}); + histos.add("C/globalPV/hSecondsSumDcaR", "", kTH1D, {axisSeconds}); + histos.add("C/globalPV/hSecondsSumDcaZ", "", kTH1D, {axisSeconds}); + histos.add("C/globalPV/hSecondsNumClsIts", "", kTH2D, {axisSeconds, axisNclsITS}); + histos.add("C/globalPV/hSecondsChi2NClIts", "", kTH2D, {axisSeconds, axisChi2}); + histos.add("C/globalPV/hSecondsNumClsTpc", "", kTH2D, {axisSeconds, axisNclsTPC}); + histos.add("C/globalPV/hSecondsChi2NClTpc", "", kTH2D, {axisSeconds, axisChi2}); + histos.add("C/globalPV/hSecondsTpcFractionSharedClsnTPCclsCut70", "", kTH2D, {axisSeconds, axisFraction}); + + // phi holes vs time const AxisSpec axisPhi{64, 0, TMath::TwoPi(), "#varphi"}; // o2-linter: disable=external-pi const AxisSpec axisEta{10, -0.8, 0.8, "#eta"}; - histos.add("hSecondsITSlayer0vsPhi", "", kTH2F, {axisSeconds, axisPhi}); - histos.add("hSecondsITSlayer1vsPhi", "", kTH2F, {axisSeconds, axisPhi}); - histos.add("hSecondsITSlayer2vsPhi", "", kTH2F, {axisSeconds, axisPhi}); - histos.add("hSecondsITSlayer3vsPhi", "", kTH2F, {axisSeconds, axisPhi}); - histos.add("hSecondsITSlayer4vsPhi", "", kTH2F, {axisSeconds, axisPhi}); - histos.add("hSecondsITSlayer5vsPhi", "", kTH2F, {axisSeconds, axisPhi}); - histos.add("hSecondsITSlayer6vsPhi", "", kTH2F, {axisSeconds, axisPhi}); - histos.add("hSecondsITS7clsVsPhi", "", kTH2F, {axisSeconds, axisPhi}); - histos.add("hSecondsITSglobalVsPhi", "", kTH2F, {axisSeconds, axisPhi}); - histos.add("hSecondsITSTRDVsPhi", "", kTH2F, {axisSeconds, axisPhi}); - histos.add("hSecondsITSTOFVsPhi", "", kTH2F, {axisSeconds, axisPhi}); - histos.add("hSecondsITSglobalVsEtaPhi", "", kTH3F, {axisSeconds, axisEta, axisPhi}); + if (confFillPhiVsTimeHist == 2) { + histos.add("hSecondsITSlayer0vsPhi", "", kTH2F, {axisSeconds, axisPhi}); + histos.add("hSecondsITSlayer1vsPhi", "", kTH2F, {axisSeconds, axisPhi}); + histos.add("hSecondsITSlayer2vsPhi", "", kTH2F, {axisSeconds, axisPhi}); + histos.add("hSecondsITSlayer3vsPhi", "", kTH2F, {axisSeconds, axisPhi}); + histos.add("hSecondsITSlayer4vsPhi", "", kTH2F, {axisSeconds, axisPhi}); + histos.add("hSecondsITSlayer5vsPhi", "", kTH2F, {axisSeconds, axisPhi}); + histos.add("hSecondsITSlayer6vsPhi", "", kTH2F, {axisSeconds, axisPhi}); + } + if (confFillPhiVsTimeHist > 0) { + histos.add("hSecondsITS7clsVsPhi", "", kTH2F, {axisSeconds, axisPhi}); + histos.add("hSecondsITSglobalVsPhi", "", kTH2F, {axisSeconds, axisPhi}); + histos.add("hSecondsITSTRDVsPhi", "", kTH2F, {axisSeconds, axisPhi}); + histos.add("hSecondsITSTOFVsPhi", "", kTH2F, {axisSeconds, axisPhi}); + } + if (confFillEtaPhiVsTimeHist) + histos.add("hSecondsITSglobalVsEtaPhi", "", kTH3F, {axisSeconds, axisEta, axisPhi}); } - auto bc = col.bc_as(); - int64_t ts = bc.timestamp(); - double secFromSOR = ts / 1000. - minSec; + // ### collision loop + for (const auto& col : cols) { + if (std::fabs(col.posZ()) > 10) + continue; + + auto bc = col.foundBC_as(); + int64_t ts = bc.timestamp(); + double secFromSOR = ts / 1000. - minSec; + + // check if a vertex is found in the UPC mode ITS ROF, flags from: https://github.com/AliceO2Group/AliceO2/blob/dev/DataFormats/Reconstruction/include/ReconstructionDataFormats/Vertex.h + ushort flags = col.flags(); + bool isVertexUPC = flags & dataformats::Vertex>::Flags::UPCMode; // is vertex with UPC settings + histos.fill(HIST("hSecondsUPCverticesBeforeSel8"), secFromSOR, isVertexUPC ? 1 : 0); + + if (confTakeVerticesWithUPCsettings > 0) { + if (confTakeVerticesWithUPCsettings == 1 && isVertexUPC) // reject vertices with UPC settings + return; + if (confTakeVerticesWithUPCsettings == 2 && !isVertexUPC) // we want to select vertices with UPC settings --> reject vertices reconstructed with "normal" settings + return; + // LOGP(info, "flags={} nTracks = {}", flags, tracks.size()); + } - // check if a vertex is found in the UPC mode ITS ROF, flags from: https://github.com/AliceO2Group/AliceO2/blob/dev/DataFormats/Reconstruction/include/ReconstructionDataFormats/Vertex.h - ushort flags = col.flags(); - bool isVertexUPC = flags & dataformats::Vertex>::Flags::UPCMode; // is vertex with UPC settings - histos.fill(HIST("hSecondsUPCvertices"), secFromSOR, isVertexUPC ? 1 : 0); + histos.fill(HIST("hSecondsEventSelBits"), secFromSOR, enCollisionsAll); + histos.fill(HIST("hSecondsEventSelBits"), secFromSOR, enIsTriggerTVX, col.selection_bit(kIsTriggerTVX)); + histos.fill(HIST("hSecondsEventSelBits"), secFromSOR, enNoTimeFrameBorder, col.selection_bit(kNoTimeFrameBorder)); + histos.fill(HIST("hSecondsEventSelBits"), secFromSOR, enNoITSROFrameBorder, col.selection_bit(kNoITSROFrameBorder)); - if (confTakeVerticesWithUPCsettings > 0) { - if (confTakeVerticesWithUPCsettings == 1 && isVertexUPC) // reject vertices with UPC settings - return; - if (confTakeVerticesWithUPCsettings == 2 && !isVertexUPC) // we want to select vertices with UPC settings --> reject vertices reconstructed with "normal" settings + // sel8 selection: + if (!col.sel8()) return; - // LOGP(info, "flags={} nTracks = {}", flags, tracks.size()); - } - histos.fill(HIST("hSecondsCollisions"), secFromSOR); + histos.fill(HIST("hSecondsUPCvertices"), secFromSOR, isVertexUPC ? 1 : 0); + histos.fill(HIST("hSecondsCollisions"), secFromSOR); + histos.fill(HIST("hSecondsVz"), secFromSOR, col.posZ()); + histos.fill(HIST("hSecondsFT0Camlp"), secFromSOR, bc.foundFT0().sumAmpC()); + histos.fill(HIST("hSecondsFT0CamlpByColMult"), secFromSOR, col.multFT0C()); + histos.fill(HIST("hSecondsFT0AamlpByColMult"), secFromSOR, col.multFT0A()); + histos.fill(HIST("hSecondsV0Aamlp"), secFromSOR, col.multFV0A()); + + histos.fill(HIST("hSecondsOccupancyByTracks"), secFromSOR, col.trackOccupancyInTimeRange()); + histos.fill(HIST("hSecondsOccupancyByFT0C"), secFromSOR, col.ft0cOccupancyInTimeRange()); + + histos.fill(HIST("hSecondsEventSelBits"), secFromSOR, enCollisionsSel8); + histos.fill(HIST("hSecondsEventSelBits"), secFromSOR, enNoSameBunchPileup, col.selection_bit(kNoSameBunchPileup)); + histos.fill(HIST("hSecondsEventSelBits"), secFromSOR, enIsGoodZvtxFT0vsPV, col.selection_bit(kIsGoodZvtxFT0vsPV)); + histos.fill(HIST("hSecondsEventSelBits"), secFromSOR, enIsVertexITSTPC, col.selection_bit(kIsVertexITSTPC)); + histos.fill(HIST("hSecondsEventSelBits"), secFromSOR, enIsVertexTOFmatched, col.selection_bit(kIsVertexTOFmatched)); + histos.fill(HIST("hSecondsEventSelBits"), secFromSOR, enIsVertexTRDmatched, col.selection_bit(kIsVertexTRDmatched)); + histos.fill(HIST("hSecondsEventSelBits"), secFromSOR, enNoCollInTimeRangeNarrow, col.selection_bit(kNoCollInTimeRangeNarrow)); + histos.fill(HIST("hSecondsEventSelBits"), secFromSOR, enNoCollInTimeRangeStrict, col.selection_bit(kNoCollInTimeRangeStrict)); + histos.fill(HIST("hSecondsEventSelBits"), secFromSOR, enNoCollInTimeRangeStandard, col.selection_bit(kNoCollInTimeRangeStandard)); + histos.fill(HIST("hSecondsEventSelBits"), secFromSOR, enNoCollInRofStrict, col.selection_bit(kNoCollInRofStrict)); + histos.fill(HIST("hSecondsEventSelBits"), secFromSOR, enNoCollInRofStandard, col.selection_bit(kNoCollInRofStandard)); + histos.fill(HIST("hSecondsEventSelBits"), secFromSOR, enNoHighMultCollInPrevRof, col.selection_bit(kNoHighMultCollInPrevRof)); + histos.fill(HIST("hSecondsEventSelBits"), secFromSOR, enIsGoodITSLayer3, col.selection_bit(kIsGoodITSLayer3)); + histos.fill(HIST("hSecondsEventSelBits"), secFromSOR, enIsGoodITSLayer0123, col.selection_bit(kIsGoodITSLayer0123)); + histos.fill(HIST("hSecondsEventSelBits"), secFromSOR, enIsGoodITSLayersAll, col.selection_bit(kIsGoodITSLayersAll)); + + // occupancy selection combinations + float occupByTracks = col.trackOccupancyInTimeRange(); + bool isLowOccupStd = col.selection_bit(kNoCollInTimeRangeStandard) && col.selection_bit(kNoCollInRofStandard); + bool isLowOccupStdAlsoInPrevRof = isLowOccupStd && col.selection_bit(kNoCollInRofStandard); + histos.fill(HIST("hSecondsEventSelBits"), secFromSOR, enIsLowOccupStd, isLowOccupStd); + histos.fill(HIST("hSecondsEventSelBits"), secFromSOR, enIsLowOccupStdAlsoInPrevRof, isLowOccupStdAlsoInPrevRof); + + bool isLowOccupStdAndCut2000 = isLowOccupStd && occupByTracks >= 0 && occupByTracks < 2000; + bool isLowOccupStdAlsoInPrevRofAndCut2000 = isLowOccupStdAlsoInPrevRof && occupByTracks >= 0 && occupByTracks < 2000; + histos.fill(HIST("hSecondsEventSelBits"), secFromSOR, enIsLowOccupStdAndCut2000, isLowOccupStdAndCut2000); + histos.fill(HIST("hSecondsEventSelBits"), secFromSOR, enIsLowOccupStdAlsoInPrevRofAndCut2000, isLowOccupStdAlsoInPrevRofAndCut2000); + + bool isLowOccupStdAndCut500 = isLowOccupStd && occupByTracks >= 0 && occupByTracks < 500; + bool isLowOccupStdAlsoInPrevRofAndCut500 = isLowOccupStdAlsoInPrevRof && occupByTracks >= 0 && occupByTracks < 500; + bool isLowOccupStdAlsoInPrevRofAndCut500noDeadStaves = isLowOccupStdAlsoInPrevRofAndCut500 && col.selection_bit(kIsGoodITSLayersAll); + histos.fill(HIST("hSecondsEventSelBits"), secFromSOR, enIsLowOccupStdAndCut500, isLowOccupStdAndCut500); + histos.fill(HIST("hSecondsEventSelBits"), secFromSOR, enIsLowOccupStdAlsoInPrevRofAndCut500, isLowOccupStdAlsoInPrevRofAndCut500); + histos.fill(HIST("hSecondsEventSelBits"), secFromSOR, enIsLowOccupStdAlsoInPrevRofAndCut500noDeadStaves, isLowOccupStdAlsoInPrevRofAndCut500noDeadStaves); + + double hadronicRate = mRateFetcher.fetch(ccdb.service, ts, runNumber, "ZNC hadronic") * 1.e-3; // kHz + histos.fill(HIST("hSecondsIR"), secFromSOR, hadronicRate); + + // checking mShape flags in time: + auto mShapeTree = ccdb->getForTimeStamp("TPC/Calib/MShapePotential", ts); + mshape.setFromTree(*mShapeTree); + bool isMshape = !mshape.getBoundaryPotential(ts).mPotential.empty(); + + for (const auto& track : tracks) { + if (!track.hasTPC() || !track.hasITS()) + continue; + if (std::fabs(track.eta()) > 0.8 || std::fabs(track.pt()) < 0.2) + continue; - double hadronicRate = mRateFetcher.fetch(ccdb.service, ts, runNumber, "ZNC hadronic") * 1.e-3; // - histos.fill(HIST("hSecondsIR"), secFromSOR, hadronicRate); + double dcaR = track.dcaXY(); + double dcaZ = track.dcaZ(); + LOGP(debug, "dcaR = {} dcaZ = {}", dcaR, dcaZ); + histos.fill(HIST("hDcaR"), dcaR); + histos.fill(HIST("hDcaZ"), dcaZ); - // checking mShape flags in time: - auto mShapeTree = ccdb->getForTimeStamp("TPC/Calib/MShapePotential", ts); - mshape.setFromTree(*mShapeTree); - bool isMshape = !mshape.getBoundaryPotential(ts).mPotential.empty(); + // now DCA cuts: + if (std::fabs(dcaR) > 1. || std::fabs(dcaZ) > 1.) + continue; - int nAsideITSTPCContrib = 0; - int nCsideITSTPCContrib = 0; - for (const auto& track : tracks) { - if (!track.hasTPC() || !track.hasITS()) { - continue; - } + histos.fill(HIST("hSecondsTracks"), secFromSOR); - float qpt = track.signed1Pt(); - float dcaR = track.dcaXY(); - float dcaZ = track.dcaZ(); - - LOGP(debug, "dcaR = {} dcaZ = {}", dcaR, dcaZ); - histos.fill(HIST("hQoverPt"), qpt); - histos.fill(HIST("hDcaR"), dcaR); - histos.fill(HIST("hDcaZ"), dcaZ); - histos.fill(HIST("hQoverPtDcaR"), qpt, dcaR); - histos.fill(HIST("hQoverPtDcaZ"), qpt, dcaZ); - histos.fill(HIST("hSecondsSumDcaR"), secFromSOR, dcaR); - histos.fill(HIST("hSecondsSumDcaZ"), secFromSOR, dcaZ); - histos.fill(HIST("hSecondsQoverPtSumDcaR"), secFromSOR, qpt, dcaR); - histos.fill(HIST("hSecondsQoverPtSumDcaZ"), secFromSOR, qpt, dcaZ); - - histos.fill(HIST("hSecondsTracks"), secFromSOR); - - if (track.tgl() > 0.) { - histos.fill(HIST("hSecondsAsideQoverPtSumDcaR"), secFromSOR, qpt, dcaR); - histos.fill(HIST("hSecondsAsideQoverPtSumDcaZ"), secFromSOR, qpt, dcaZ); - histos.fill(HIST("hSecondsAsideSumDcaR"), secFromSOR, dcaR); - histos.fill(HIST("hSecondsAsideSumDcaZ"), secFromSOR, dcaZ); - - } else { - histos.fill(HIST("hSecondsCsideQoverPtSumDcaR"), secFromSOR, qpt, dcaR); - histos.fill(HIST("hSecondsCsideQoverPtSumDcaZ"), secFromSOR, qpt, dcaZ); - histos.fill(HIST("hSecondsCsideSumDcaR"), secFromSOR, dcaR); - histos.fill(HIST("hSecondsCsideSumDcaZ"), secFromSOR, dcaZ); - } - if (isMshape) { - histos.fill(HIST("hSecondsTracksMshape"), secFromSOR); - } + double qpt = track.signed1Pt(); + histos.fill(HIST("hQoverPt"), qpt); + histos.fill(HIST("hQoverPtDcaR"), qpt, dcaR); + histos.fill(HIST("hQoverPtDcaZ"), qpt, dcaZ); - if (track.hasTPC() && track.hasITS() && std::fabs(track.eta()) < 0.8 && std::fabs(track.pt()) > 0.2) { - if (track.tgl() > 0.) { - histos.fill(HIST("hSecondsAsideNumTracksGlobal"), secFromSOR); - histos.fill(HIST("hSecondsAsideSumDcaRglobal"), secFromSOR, dcaR); - histos.fill(HIST("hSecondsAsideSumDcaZglobal"), secFromSOR, dcaZ); - histos.fill(HIST("hSecondsAsideNumClsItsGlobal"), secFromSOR, track.itsNCls()); - histos.fill(HIST("hSecondsAsideChi2NClItsGlobal"), secFromSOR, track.itsChi2NCl()); - histos.fill(HIST("hSecondsAsideNumClsTpcGlobal"), secFromSOR, track.tpcNClsFound()); - histos.fill(HIST("hSecondsAsideChi2NClTpcGlobal"), secFromSOR, track.tpcChi2NCl()); - if (track.tpcNClsFound() >= 80) - histos.fill(HIST("hSecondsAsideTpcFractionSharedClsGlobal_nTPCclsCut80"), secFromSOR, track.tpcFractionSharedCls()); - } else { - histos.fill(HIST("hSecondsCsideNumTracksGlobal"), secFromSOR); - histos.fill(HIST("hSecondsCsideSumDcaRglobal"), secFromSOR, dcaR); - histos.fill(HIST("hSecondsCsideSumDcaZglobal"), secFromSOR, dcaZ); - histos.fill(HIST("hSecondsCsideNumClsItsGlobal"), secFromSOR, track.itsNCls()); - histos.fill(HIST("hSecondsCsideChi2NClItsGlobal"), secFromSOR, track.itsChi2NCl()); - histos.fill(HIST("hSecondsCsideNumClsTpcGlobal"), secFromSOR, track.tpcNClsFound()); - histos.fill(HIST("hSecondsCsideChi2NClTpcGlobal"), secFromSOR, track.tpcChi2NCl()); - if (track.tpcNClsFound() >= 80) - histos.fill(HIST("hSecondsCsideTpcFractionSharedClsGlobal_nTPCclsCut80"), secFromSOR, track.tpcFractionSharedCls()); - } - } // end of ITS+TPC tracks + // now consider only abs values for DCAs: + dcaR = std::fabs(dcaR); + dcaZ = std::fabs(dcaZ); + + histos.fill(HIST("hSecondsSumDcaR"), secFromSOR, dcaR); + histos.fill(HIST("hSecondsSumDcaZ"), secFromSOR, dcaZ); + histos.fill(HIST("hSecondsQoverPtSumDcaR"), secFromSOR, qpt, dcaR); + histos.fill(HIST("hSecondsQoverPtSumDcaZ"), secFromSOR, qpt, dcaZ); - if (track.isPVContributor()) { if (track.tgl() > 0.) { - nAsideITSTPCContrib++; + histos.fill(HIST("A/hSecondsTracks"), secFromSOR); + histos.fill(HIST("A/hSecondsQoverPtSumDcaR"), secFromSOR, qpt, dcaR); + histos.fill(HIST("A/hSecondsQoverPtSumDcaZ"), secFromSOR, qpt, dcaZ); + histos.fill(HIST("A/hSecondsSumDcaR"), secFromSOR, dcaR); + histos.fill(HIST("A/hSecondsSumDcaZ"), secFromSOR, dcaZ); + } else { - nCsideITSTPCContrib++; + histos.fill(HIST("C/hSecondsTracks"), secFromSOR); + histos.fill(HIST("C/hSecondsQoverPtSumDcaR"), secFromSOR, qpt, dcaR); + histos.fill(HIST("C/hSecondsQoverPtSumDcaZ"), secFromSOR, qpt, dcaZ); + histos.fill(HIST("C/hSecondsSumDcaR"), secFromSOR, dcaR); + histos.fill(HIST("C/hSecondsSumDcaZ"), secFromSOR, dcaZ); } - - // select straight tracks - if (track.pt() < 1) { - continue; + if (isMshape) { + histos.fill(HIST("hSecondsTracksMshape"), secFromSOR); } - // study ITS cluster pattern vs sec - if (track.itsClusterMap() & (1 << 0)) - histos.fill(HIST("hSecondsITSlayer0vsPhi"), secFromSOR, track.phi()); - if (track.itsClusterMap() & (1 << 1)) - histos.fill(HIST("hSecondsITSlayer1vsPhi"), secFromSOR, track.phi()); - if (track.itsClusterMap() & (1 << 2)) - histos.fill(HIST("hSecondsITSlayer2vsPhi"), secFromSOR, track.phi()); - if (track.itsClusterMap() & (1 << 3)) - histos.fill(HIST("hSecondsITSlayer3vsPhi"), secFromSOR, track.phi()); - if (track.itsClusterMap() & (1 << 4)) - histos.fill(HIST("hSecondsITSlayer4vsPhi"), secFromSOR, track.phi()); - if (track.itsClusterMap() & (1 << 5)) - histos.fill(HIST("hSecondsITSlayer5vsPhi"), secFromSOR, track.phi()); - if (track.itsClusterMap() & (1 << 6)) - histos.fill(HIST("hSecondsITSlayer6vsPhi"), secFromSOR, track.phi()); - if (track.itsNCls() == 7) - histos.fill(HIST("hSecondsITS7clsVsPhi"), secFromSOR, track.phi()); - if (track.hasITS() && track.hasTPC()) { - histos.fill(HIST("hSecondsITSglobalVsPhi"), secFromSOR, track.phi()); - histos.fill(HIST("hSecondsITSglobalVsEtaPhi"), secFromSOR, track.eta(), track.phi()); + + // global tracks + if (track.isGlobalTrack()) { // A side + if (track.tgl() > 0.) { + histos.fill(HIST("A/global/hSecondsNumTracks"), secFromSOR); + histos.fill(HIST("A/global/hSecondsSumDcaR"), secFromSOR, dcaR); + histos.fill(HIST("A/global/hSecondsSumDcaZ"), secFromSOR, dcaZ); + histos.fill(HIST("A/global/hSecondsNumClsIts"), secFromSOR, track.itsNCls()); + histos.fill(HIST("A/global/hSecondsChi2NClIts"), secFromSOR, track.itsChi2NCl()); + histos.fill(HIST("A/global/hSecondsNumClsTpc"), secFromSOR, track.tpcNClsFound()); + histos.fill(HIST("A/global/hSecondsChi2NClTpc"), secFromSOR, track.tpcChi2NCl()); + if (track.tpcNClsFound() >= 70) + histos.fill(HIST("A/global/hSecondsTpcFractionSharedClsnTPCclsCut70"), secFromSOR, track.tpcFractionSharedCls()); + + if (track.isPVContributor()) { + histos.fill(HIST("A/globalPV/hSecondsNumPVcontributors"), secFromSOR); + histos.fill(HIST("A/globalPV/hSecondsSumDcaR"), secFromSOR, dcaR); + histos.fill(HIST("A/globalPV/hSecondsSumDcaZ"), secFromSOR, dcaZ); + histos.fill(HIST("A/globalPV/hSecondsNumClsIts"), secFromSOR, track.itsNCls()); + histos.fill(HIST("A/globalPV/hSecondsChi2NClIts"), secFromSOR, track.itsChi2NCl()); + histos.fill(HIST("A/globalPV/hSecondsNumClsTpc"), secFromSOR, track.tpcNClsFound()); + histos.fill(HIST("A/globalPV/hSecondsChi2NClTpc"), secFromSOR, track.tpcChi2NCl()); + if (track.tpcNClsFound() >= 70) + histos.fill(HIST("A/globalPV/hSecondsTpcFractionSharedClsnTPCclsCut70"), secFromSOR, track.tpcFractionSharedCls()); + } + } else { // C side + histos.fill(HIST("C/global/hSecondsNumTracks"), secFromSOR); + histos.fill(HIST("C/global/hSecondsSumDcaR"), secFromSOR, dcaR); + histos.fill(HIST("C/global/hSecondsSumDcaZ"), secFromSOR, dcaZ); + histos.fill(HIST("C/global/hSecondsNumClsIts"), secFromSOR, track.itsNCls()); + histos.fill(HIST("C/global/hSecondsChi2NClIts"), secFromSOR, track.itsChi2NCl()); + histos.fill(HIST("C/global/hSecondsNumClsTpc"), secFromSOR, track.tpcNClsFound()); + histos.fill(HIST("C/global/hSecondsChi2NClTpc"), secFromSOR, track.tpcChi2NCl()); + if (track.tpcNClsFound() >= 70) + histos.fill(HIST("C/global/hSecondsTpcFractionSharedClsnTPCclsCut70"), secFromSOR, track.tpcFractionSharedCls()); + + if (track.isPVContributor()) { + histos.fill(HIST("C/globalPV/hSecondsNumPVcontributors"), secFromSOR); + histos.fill(HIST("C/globalPV/hSecondsSumDcaR"), secFromSOR, dcaR); + histos.fill(HIST("C/globalPV/hSecondsSumDcaZ"), secFromSOR, dcaZ); + histos.fill(HIST("C/globalPV/hSecondsNumClsIts"), secFromSOR, track.itsNCls()); + histos.fill(HIST("C/globalPV/hSecondsChi2NClIts"), secFromSOR, track.itsChi2NCl()); + histos.fill(HIST("C/globalPV/hSecondsNumClsTpc"), secFromSOR, track.tpcNClsFound()); + histos.fill(HIST("C/globalPV/hSecondsChi2NClTpc"), secFromSOR, track.tpcChi2NCl()); + if (track.tpcNClsFound() >= 70) + histos.fill(HIST("C/globalPV/hSecondsTpcFractionSharedClsnTPCclsCut70"), secFromSOR, track.tpcFractionSharedCls()); + } + } + } // end of global tracks + + // study ITS cluster pattern vs phi vs time (pt>1 GeV/c cut selects straight tracks) + if (track.isPVContributor() && track.pt() > 1) { + // layer-by-layer check + if (confFillPhiVsTimeHist == 2) { + if (track.itsClusterMap() & (1 << 0)) + histos.fill(HIST("hSecondsITSlayer0vsPhi"), secFromSOR, track.phi()); + if (track.itsClusterMap() & (1 << 1)) + histos.fill(HIST("hSecondsITSlayer1vsPhi"), secFromSOR, track.phi()); + if (track.itsClusterMap() & (1 << 2)) + histos.fill(HIST("hSecondsITSlayer2vsPhi"), secFromSOR, track.phi()); + if (track.itsClusterMap() & (1 << 3)) + histos.fill(HIST("hSecondsITSlayer3vsPhi"), secFromSOR, track.phi()); + if (track.itsClusterMap() & (1 << 4)) + histos.fill(HIST("hSecondsITSlayer4vsPhi"), secFromSOR, track.phi()); + if (track.itsClusterMap() & (1 << 5)) + histos.fill(HIST("hSecondsITSlayer5vsPhi"), secFromSOR, track.phi()); + if (track.itsClusterMap() & (1 << 6)) + histos.fill(HIST("hSecondsITSlayer6vsPhi"), secFromSOR, track.phi()); + } + // tracks with conditions + if (confFillPhiVsTimeHist > 0) { + if (track.itsNCls() == 7) + histos.fill(HIST("hSecondsITS7clsVsPhi"), secFromSOR, track.phi()); + if (track.isGlobalTrack()) + histos.fill(HIST("hSecondsITSglobalVsPhi"), secFromSOR, track.phi()); + if (track.hasTRD()) + histos.fill(HIST("hSecondsITSTRDVsPhi"), secFromSOR, track.phi()); + if (track.hasTOF()) + histos.fill(HIST("hSecondsITSTOFVsPhi"), secFromSOR, track.phi()); + } + // eta-phi histogram for global tracks + if (confFillEtaPhiVsTimeHist && track.isGlobalTrack()) { + histos.fill(HIST("hSecondsITSglobalVsEtaPhi"), secFromSOR, track.eta(), track.phi()); + } } - if (track.hasTRD()) - histos.fill(HIST("hSecondsITSTRDVsPhi"), secFromSOR, track.phi()); - if (track.hasTOF()) - histos.fill(HIST("hSecondsITSTOFVsPhi"), secFromSOR, track.phi()); } } - histos.fill(HIST("hSecondsAsideITSTPCcontrib"), secFromSOR, nAsideITSTPCContrib); - histos.fill(HIST("hSecondsCsideITSTPCcontrib"), secFromSOR, nCsideITSTPCContrib); - } + } // end of collision loop }; WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) From c6da23c7841919a7aba057898cf31b6819fd6ec2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=B2=20Jacazio?= Date: Tue, 4 Feb 2025 12:55:32 +0100 Subject: [PATCH 08/16] [PWGLF] Update weight handling in StrJ (#9720) --- PWGLF/Tasks/Strangeness/strangenessInJets.cxx | 184 +++++++++--------- 1 file changed, 87 insertions(+), 97 deletions(-) diff --git a/PWGLF/Tasks/Strangeness/strangenessInJets.cxx b/PWGLF/Tasks/Strangeness/strangenessInJets.cxx index 7d74863eafd..a34c992f87d 100644 --- a/PWGLF/Tasks/Strangeness/strangenessInJets.cxx +++ b/PWGLF/Tasks/Strangeness/strangenessInJets.cxx @@ -170,7 +170,7 @@ struct StrangenessInJets { ccdb->setFatalWhenNull(false); if (applyReweighting) { - getReweightingHistograms(ccdb, TString(pathToFile), TString(histoNameWeightK0Jet), TString(histoNameWeightK0Ue), TString(histoNameWeightLambdaJet), TString(histoNameWeightLambdaUe), TString(histoNameWeightAntilambdaJet), TString(histoNameWeightAntilambdaUe), TString(histoNameWeightsXiInJet), TString(histoNameWeightsXiInUe), TString(histoNameWeightsAntiXiInJet), TString(histoNameWeightsAntiXiInUe)); + getReweightingHistograms(ccdb); } else { twodWeightsK0Jet = nullptr; twodWeightsK0Ue = nullptr; @@ -892,94 +892,63 @@ struct StrangenessInJets { return false; } - void getReweightingHistograms(o2::framework::Service const& ccdbObj, TString filepath, TString histname_k0_jet, TString histname_k0_ue, TString histname_lambda_jet, TString histname_lambda_ue, TString histname_antilambda_jet, TString histname_antilambda_ue, TString histname_xi_jet, TString histname_xi_ue, TString histname_antixi_jet, TString histname_antixi_ue) + void getReweightingHistograms(o2::framework::Service const& ccdbObj) { - TList* l = ccdbObj->get(filepath.Data()); - if (!l) { - LOGP(error, "Could not open the file {}", Form("%s", filepath.Data())); - return; - } + auto getWeightHistoObj = [&](Configurable name, TH2F*& histo) { + if (name.value == "") { + LOG(info) << "Getting weight histogram for " << name.name << " from " << name.value; + histo = ccdbObj->get(name); + } + }; - if (histoNameWeightPiplusJet.value != "") { - twodWeightsPiplusJet = ccdbObj->get(filepath.Data()); - LOG(info) << "Getting weight histogram for piplus in jet from " << histoNameWeightPiplusJet.value; - } - if (histoNameWeightPiplusUe.value != "") { - twodWeightsPiplusUe = ccdbObj->get(filepath.Data()); - LOG(info) << "Getting weight histogram for piplus in ue from " << histoNameWeightPiplusUe.value; - } - if (histoNameWeightPiminusJet.value != "") { - twodWeightsPiminusJet = ccdbObj->get(filepath.Data()); - LOG(info) << "Getting weight histogram for piminus in jet from " << histoNameWeightPiminusJet.value; - } - if (histoNameWeightPiminusUe.value != "") { - twodWeightsPiminusUe = ccdbObj->get(filepath.Data()); - LOG(info) << "Getting weight histogram for piminus in ue from " << histoNameWeightPiminusUe.value; - } + getWeightHistoObj(histoNameWeightPiplusJet, twodWeightsPiplusJet); + getWeightHistoObj(histoNameWeightPiplusUe, twodWeightsPiplusUe); + getWeightHistoObj(histoNameWeightPiminusJet, twodWeightsPiminusJet); + getWeightHistoObj(histoNameWeightPiminusUe, twodWeightsPiminusUe); - twodWeightsK0Jet = static_cast(l->FindObject(Form("%s", histname_k0_jet.Data()))); - if (!twodWeightsK0Jet) { - LOGP(error, "Could not open histogram {}", Form("%s", histname_k0_jet.Data())); - return; - } - twodWeightsK0Ue = static_cast(l->FindObject(Form("%s", histname_k0_ue.Data()))); - if (!twodWeightsK0Ue) { - LOGP(error, "Could not open histogram {}", Form("%s", histname_k0_ue.Data())); - return; - } - twodWeightsLambdaJet = static_cast(l->FindObject(Form("%s", histname_lambda_jet.Data()))); - if (!twodWeightsLambdaJet) { - LOGP(error, "Could not open histogram {}", Form("%s", histname_lambda_jet.Data())); - return; - } - twodWeightsLambdaUe = static_cast(l->FindObject(Form("%s", histname_lambda_ue.Data()))); - if (!twodWeightsLambdaUe) { - LOGP(error, "Could not open histogram {}", Form("%s", histname_lambda_ue.Data())); - return; - } - twodWeightsAntilambdaJet = static_cast(l->FindObject(Form("%s", histname_antilambda_jet.Data()))); - if (!twodWeightsAntilambdaJet) { - LOGP(error, "Could not open histogram {}", Form("%s", histname_antilambda_jet.Data())); - return; - } - twodWeightsAntilambdaUe = static_cast(l->FindObject(Form("%s", histname_antilambda_ue.Data()))); - if (!twodWeightsAntilambdaUe) { - LOGP(error, "Could not open histogram {}", Form("%s", histname_antilambda_ue.Data())); + TList* l = ccdbObj->get(pathToFile.value.c_str()); + if (!l) { + LOG(error) << "Could not open the file " << pathToFile.value; return; } + l->ls(); - // Secondary Lambda - weightsXiInJet = static_cast(l->FindObject(Form("%s", histname_xi_jet.Data()))); - if (!weightsXiInJet) { - LOGP(error, "Could not open histogram {}", Form("%s", histname_xi_jet.Data())); - return; - } - weightsXiInUe = static_cast(l->FindObject(Form("%s", histname_xi_ue.Data()))); - if (!weightsXiInUe) { - LOGP(error, "Could not open histogram {}", Form("%s", histname_xi_ue.Data())); - return; - } - weightsAntiXiInJet = static_cast(l->FindObject(Form("%s", histname_antixi_jet.Data()))); - if (!weightsAntiXiInJet) { - LOGP(error, "Could not open histogram {}", Form("%s", histname_antixi_jet.Data())); - return; - } - weightsAntiXiInUe = static_cast(l->FindObject(Form("%s", histname_antixi_ue.Data()))); - if (!weightsAntiXiInUe) { - LOGP(error, "Could not open histogram {}", Form("%s", histname_antixi_ue.Data())); - return; - } + auto get2DWeightHisto = [&](Configurable name, TH2F*& histo) { + LOG(info) << "Looking for 2D weight histogram '" << name.value << "' for " << name.name; + if (name.value == "") { + LOG(info) << " -> Skipping"; + } + histo = static_cast(l->FindObject(name.value.c_str())); + if (!histo) { + LOG(error) << "Could not open histogram '" << name.value << "'"; + } + LOG(info) << "Opened histogram " << histo->ClassName() << " " << histo->GetName(); + }; + + get2DWeightHisto(histoNameWeightK0Jet, twodWeightsK0Jet); + get2DWeightHisto(histoNameWeightK0Ue, twodWeightsK0Ue); + get2DWeightHisto(histoNameWeightLambdaJet, twodWeightsLambdaJet); + get2DWeightHisto(histoNameWeightLambdaUe, twodWeightsLambdaUe); + get2DWeightHisto(histoNameWeightAntilambdaJet, twodWeightsAntilambdaJet); + get2DWeightHisto(histoNameWeightAntilambdaUe, twodWeightsAntilambdaUe); + + auto get1DWeightHisto = [&](Configurable name, TH1F*& histo) { + LOG(info) << "Looking for 1D weight histogram '" << name.value << "' for " << name.name; + if (name.value == "") { + LOG(info) << " -> Skipping"; + } + histo = static_cast(l->FindObject(name.value.c_str())); + if (!histo) { + LOG(error) << "Could not open histogram '" << name.value << "'"; + } + LOG(info) << "Opened histogram " << histo->ClassName() << " " << histo->GetName(); + }; - LOGP(info, "Opened histogram {}", Form("%s", histname_k0_jet.Data())); - LOGP(info, "Opened histogram {}", Form("%s", histname_k0_ue.Data())); - LOGP(info, "Opened histogram {}", Form("%s", histname_lambda_jet.Data())); - LOGP(info, "Opened histogram {}", Form("%s", histname_lambda_ue.Data())); - LOGP(info, "Opened histogram {}", Form("%s", histname_antilambda_jet.Data())); - LOGP(info, "Opened histogram {}", Form("%s", histname_antilambda_ue.Data())); - LOGP(info, "Opened histogram {}", Form("%s", histname_xi_jet.Data())); - LOGP(info, "Opened histogram {}", Form("%s", histname_xi_ue.Data())); - LOGP(info, "Opened histogram {}", Form("%s", histname_antixi_jet.Data())); - LOGP(info, "Opened histogram {}", Form("%s", histname_antixi_ue.Data())); + // Secondary Lambda + get1DWeightHisto(histoNameWeightsXiInJet, weightsXiInJet); + get1DWeightHisto(histoNameWeightsXiInUe, weightsXiInUe); + get1DWeightHisto(histoNameWeightsAntiXiInJet, weightsAntiXiInJet); + get1DWeightHisto(histoNameWeightsAntiXiInUe, weightsAntiXiInUe); } void processData(SelCollisions::iterator const& collision, aod::V0Datas const& fullV0s, aod::CascDataExt const& Cascades, StrHadronDaughterTracks const& tracks) @@ -1525,14 +1494,25 @@ struct StrangenessInJets { double wSecLambdaInJet(1.0); double wSecLambdaInUe(1.0); int idMother = posParticle.mothersIds()[0]; - auto mother = mcParticles.iteratorAt(idMother); + const auto& mother = mcParticles.iteratorAt(idMother); int idGrandMother = mother.mothersIds()[0]; - auto grandMother = mcParticles.iteratorAt(idGrandMother); - int ibinXiInJet = weightsXiInJet->GetXaxis()->FindBin(grandMother.pt()); - int ibinXiInUe = weightsXiInUe->GetXaxis()->FindBin(grandMother.pt()); - if (std::fabs(grandMother.pdgCode()) == 3312 || std::fabs(grandMother.pdgCode()) == 3322) { - wSecLambdaInJet = weightsXiInJet->GetBinContent(ibinXiInJet); - wSecLambdaInUe = weightsXiInUe->GetBinContent(ibinXiInUe); + const auto& grandMother = mcParticles.iteratorAt(idGrandMother); + switch (grandMother.pdgCode()) { + case 3312: + case -3312: + case 3322: + case -3322: + if (weightsXiInJet) { + int ibinXiInJet = weightsXiInJet->GetXaxis()->FindBin(grandMother.pt()); + wSecLambdaInJet = weightsXiInJet->GetBinContent(ibinXiInJet); + } + if (weightsXiInUe) { + int ibinXiInUe = weightsXiInUe->GetXaxis()->FindBin(grandMother.pt()); + wSecLambdaInUe = weightsXiInUe->GetBinContent(ibinXiInUe); + } + break; + default: + break; } registryMC.fill(HIST("Secondary_Lambda_InJet"), v0.pt(), wSecLambdaInJet); registryMC.fill(HIST("Secondary_Lambda_InUe"), v0.pt(), wSecLambdaInUe); @@ -1544,16 +1524,26 @@ struct StrangenessInJets { if (!isPhysPrim) { double wSecAntiLambdaInJet(1.0); double wSecAntiLambdaInUe(1.0); - int idMother = posParticle.mothersIds()[0]; - auto mother = mcParticles.iteratorAt(idMother); + const auto& mother = mcParticles.iteratorAt(idMother); int idGrandMother = mother.mothersIds()[0]; - auto grandMother = mcParticles.iteratorAt(idGrandMother); - int ibinAntiXiInJet = weightsAntiXiInJet->GetXaxis()->FindBin(grandMother.pt()); - int ibinAntiXiInUe = weightsAntiXiInUe->GetXaxis()->FindBin(grandMother.pt()); - if (std::fabs(grandMother.pdgCode()) == 3312 || std::fabs(grandMother.pdgCode()) == 3322) { - wSecAntiLambdaInJet = weightsAntiXiInJet->GetBinContent(ibinAntiXiInJet); - wSecAntiLambdaInUe = weightsAntiXiInUe->GetBinContent(ibinAntiXiInUe); + const auto& grandMother = mcParticles.iteratorAt(idGrandMother); + switch (grandMother.pdgCode()) { + case 3312: + case -3312: + case 3322: + case -3322: + if (weightsAntiXiInJet) { + int ibinAntiXiInJet = weightsAntiXiInJet->GetXaxis()->FindBin(grandMother.pt()); + wSecAntiLambdaInJet = weightsAntiXiInJet->GetBinContent(ibinAntiXiInJet); + } + if (weightsAntiXiInUe) { + int ibinAntiXiInUe = weightsAntiXiInUe->GetXaxis()->FindBin(grandMother.pt()); + wSecAntiLambdaInUe = weightsAntiXiInUe->GetBinContent(ibinAntiXiInUe); + } + break; + default: + break; } registryMC.fill(HIST("Secondary_AntiLambda_InJet"), v0.pt(), wSecAntiLambdaInJet); registryMC.fill(HIST("Secondary_AntiLambda_InUe"), v0.pt(), wSecAntiLambdaInUe); From 580c6f1d55322f698cd2466e72000647f97edf77 Mon Sep 17 00:00:00 2001 From: sarjeetagami <162087855+sarjeetagami@users.noreply.github.com> Date: Tue, 4 Feb 2025 18:02:42 +0530 Subject: [PATCH 09/16] [PWGLF] clean up and adeed PID selection for K* flow task (#9727) Co-authored-by: sarjeeta gami --- PWGLF/Tasks/Resonances/kstarpbpb.cxx | 207 ++++++++++++++++----------- 1 file changed, 121 insertions(+), 86 deletions(-) diff --git a/PWGLF/Tasks/Resonances/kstarpbpb.cxx b/PWGLF/Tasks/Resonances/kstarpbpb.cxx index 1a433a1fc6b..71317b105f2 100644 --- a/PWGLF/Tasks/Resonances/kstarpbpb.cxx +++ b/PWGLF/Tasks/Resonances/kstarpbpb.cxx @@ -101,10 +101,10 @@ struct kstarpbpb { ConfigurableAxis configThnAxisV2{"configThnAxisV2", {200, -1, 1}, "V2"}; Configurable additionalEvsel{"additionalEvsel", false, "Additional event selcection"}; Configurable timFrameEvsel{"timFrameEvsel", false, "TPC Time frame boundary cut"}; + Configurable additionalEvselITS{"additionalEvselITS", true, "Additional event selcection for ITS"}; Configurable ispTdepPID{"ispTdepPID", true, "pT dependent PID"}; - Configurable OnlyTOF{"OnlyTOF", true, "OnlyTOF"}; + Configurable isNoTOF{"isNoTOF", true, "isNoTOF"}; Configurable strategyPID{"strategyPID", 2, "PID strategy"}; - Configurable isGI{"isGI", false, "pT dependent PID"}; Configurable cfgCutTOFBeta{"cfgCutTOFBeta", 0.0, "cut TOF beta"}; Configurable additionalQAplots{"additionalQAplots", true, "Additional QA plots"}; Configurable additionalQAplots1{"additionalQAplots1", true, "Additional QA plots"}; @@ -112,7 +112,9 @@ struct kstarpbpb { Configurable confMaxRot{"confMaxRot", 7.0 * TMath::Pi() / 6.0, "Maximum of rotation"}; Configurable nBkgRotations{"nBkgRotations", 9, "Number of rotated copies (background) per each original candidate"}; Configurable fillRotation{"fillRotation", true, "fill rotation"}; - Configurable like{"like", true, "fill rotation"}; + Configurable same{"same", true, "same event"}; + Configurable like{"like", false, "like-sign"}; + Configurable mix{"mix", false, "mix"}; Configurable fillOccupancy{"fillOccupancy", false, "fill Occupancy"}; Configurable cfgOccupancyCut{"cfgOccupancyCut", 500, "Occupancy cut"}; Configurable useSP{"useSP", true, "useSP"}; @@ -124,7 +126,6 @@ struct kstarpbpb { using EventCandidates = soa::Filtered>; using TrackCandidates = soa::Filtered>; - SliceCache cache; Partition posTracks = aod::track::signed1Pt > cfgCutCharge; Partition negTracks = aod::track::signed1Pt < cfgCutCharge; @@ -147,20 +148,25 @@ struct kstarpbpb { const AxisSpec thnAxisCentrality{configThnAxisCentrality, "Centrality (%)"}; const AxisSpec thnAxisV2{configThnAxisV2, "V2"}; AxisSpec phiAxis = {500, -6.28, 6.28, "phi"}; - AxisSpec resAxis = {400, -2, 2, "Res"}; + AxisSpec resAxis = {6000, -30, 30, "Res"}; AxisSpec centAxis = {8, 0, 80, "V0M (%)"}; AxisSpec occupancyAxis = {occupancyBinning, "Occupancy"}; - histos.add("hpTvsRapidity", "pT vs Rapidity", kTH2F, {{100, 0.0f, 10.0f}, {300, -1.5f, 1.5f}}); - histos.add("TPC_Nsigma_pi", "TPC_Nsigma_pi", kTH2F, {{60, 0.0f, 6.0f}, {500, -5, 5}}); - histos.add("TPC_Nsigma_ka", "TPC_Nsigma_ka", kTH2F, {{60, 0.0f, 6.0f}, {500, -5, 5}}); - histos.add("TOF_Nsigma_pi", "TOF_Nsigma_pi", kTH2F, {{60, 0.0f, 6.0f}, {500, -5, 5}}); - histos.add("TOF_Nsigma_ka", "TOF_Nsigma_ka", kTH2F, {{60, 0.0f, 6.0f}, {500, -5, 5}}); - histos.add("hSparseV2SASameEvent_V2", "hSparseV2SASameEvent_V2", HistType::kTHnSparseF, {thnAxisInvMass, thnAxisPt, thnAxisV2, thnAxisCentrality}); - histos.add("hSparseV2SAlikeEventNN_V2", "hSparseV2SAlikeEventNN_V2", HistType::kTHnSparseF, {thnAxisInvMass, thnAxisPt, thnAxisV2, thnAxisCentrality}); - histos.add("hSparseV2SAlikeEventPP_V2", "hSparseV2SAlikeEventPP_V2", HistType::kTHnSparseF, {thnAxisInvMass, thnAxisPt, thnAxisV2, thnAxisCentrality}); - histos.add("hSparseV2SAMixedEvent_V2", "hSparseV2SAMixedEvent_V2", HistType::kTHnSparseF, {thnAxisInvMass, thnAxisPt, thnAxisV2, thnAxisCentrality}); - histos.add("hSparseV2SASameEventRotational_V2", "hSparseV2SASameEventRotational_V2", HistType::kTHnSparseF, {thnAxisInvMass, thnAxisPt, thnAxisV2, thnAxisCentrality}); + if (same) { + histos.add("hSparseV2SASameEvent_V2", "hSparseV2SASameEvent_V2", HistType::kTHnSparseF, {thnAxisInvMass, thnAxisPt, thnAxisV2, thnAxisCentrality}); + } + if (like) { + histos.add("hSparseV2SAlikeEventNN_V2", "hSparseV2SAlikeEventNN_V2", HistType::kTHnSparseF, {thnAxisInvMass, thnAxisPt, thnAxisV2, thnAxisCentrality}); + histos.add("hSparseV2SAlikeEventPP_V2", "hSparseV2SAlikeEventPP_V2", HistType::kTHnSparseF, {thnAxisInvMass, thnAxisPt, thnAxisV2, thnAxisCentrality}); + } + if (fillRotation) { + histos.add("hRotation", "hRotation", kTH1F, {{360, 0.0, 2.0 * TMath::Pi()}}); + histos.add("hSparseV2SASameEventRotational_V2", "hSparseV2SASameEventRotational_V2", HistType::kTHnSparseF, {thnAxisInvMass, thnAxisPt, thnAxisV2, thnAxisCentrality}); + } + if (mix) { + histos.add("hSparseV2SAMixedEvent_V2", "hSparseV2SAMixedEvent_V2", HistType::kTHnSparseF, {thnAxisInvMass, thnAxisPt, thnAxisV2, thnAxisCentrality}); + } + if (additionalQAplots1) { histos.add("hFTOCvsTPCSelected", "Mult correlation FT0C vs. TPC after selection", kTH2F, {{80, 0.0f, 80.0f}, {100, -0.5f, 5999.5f}}); histos.add("hCentrality", "Centrality distribution", kTH1F, {{200, 0.0, 200.0}}); @@ -205,9 +211,7 @@ struct kstarpbpb { histos.add("QAafter/TOF_Nsigma_allpi", "TOF NSigma for pion;#it{p}_{T} (GeV/#it{c});#sigma_{TOF}^{pion};", {HistType::kTH2D, {{200, 0.0, 20.0}, {100, -6, 6}}}); histos.add("QAafter/TPC_Nsigma_allpi", "TPC NSigma for pion;#it{p}_{T} (GeV/#it{c});#sigma_{TPC}^{pion};", {HistType::kTH2D, {{200, 0.0, 20.0}, {100, -6, 6}}}); } - if (fillRotation) { - histos.add("hRotation", "hRotation", kTH1F, {{360, 0.0, 2.0 * TMath::Pi()}}); - } + // Event selection cut additional - Alex if (additionalEvsel) { fMultPVCutLow = new TF1("fMultPVCutLow", "[0]+[1]*x+[2]*x*x+[3]*x*x*x - 2.5*([4]+[5]*x+[6]*x*x+[7]*x*x*x+[8]*x*x*x*x)", 0, 100); @@ -263,17 +267,23 @@ struct kstarpbpb { bool selectionPIDNew(const T& candidate, int PID) { if (PID == 0) { - if (!candidate.hasTOF() && TMath::Abs(candidate.tpcNSigmaKa()) < nsigmaCutTPC) { + if (!isNoTOF && !candidate.hasTOF() && TMath::Abs(candidate.tpcNSigmaKa()) < nsigmaCutTPC) { + return true; + } + if (!isNoTOF && candidate.hasTOF() && TMath::Abs(candidate.tpcNSigmaKa()) < nsigmaCutTPC && TMath::Abs(candidate.tofNSigmaKa()) < nsigmaCutTOF) { return true; } - if (candidate.hasTOF() && candidate.beta() > cfgCutTOFBeta && TMath::Abs(candidate.tpcNSigmaKa()) < nsigmaCutTPC && TMath::Abs(candidate.tofNSigmaKa()) < nsigmaCutTOF) { + if (isNoTOF && std::abs(candidate.tpcNSigmaKa()) < nsigmaCutTPC) { return true; } } else if (PID == 1) { - if (!candidate.hasTOF() && TMath::Abs(candidate.tpcNSigmaPi()) < nsigmaCutTPC) { + if (!isNoTOF && !candidate.hasTOF() && TMath::Abs(candidate.tpcNSigmaPi()) < nsigmaCutTPC) { + return true; + } + if (!isNoTOF && candidate.hasTOF() && TMath::Abs(candidate.tpcNSigmaPi()) < nsigmaCutTPC && TMath::Abs(candidate.tofNSigmaPi()) < nsigmaCutTOF) { return true; } - if (candidate.hasTOF() && candidate.beta() > cfgCutTOFBeta && TMath::Abs(candidate.tpcNSigmaPi()) < nsigmaCutTPC && TMath::Abs(candidate.tofNSigmaPi()) < nsigmaCutTOF) { + if (isNoTOF && std::abs(candidate.tpcNSigmaPi()) < nsigmaCutTPC) { return true; } } @@ -284,23 +294,23 @@ struct kstarpbpb { bool selectionPID(const T& candidate, int PID) { if (PID == 0) { - if (!OnlyTOF && !candidate.hasTOF() && TMath::Abs(candidate.tpcNSigmaKa()) < nsigmaCutTPC) { + if (!isNoTOF && !candidate.hasTOF() && TMath::Abs(candidate.tpcNSigmaKa()) < nsigmaCutTPC) { return true; } - if (!OnlyTOF && candidate.hasTOF() && ((candidate.tofNSigmaKa() * candidate.tofNSigmaKa()) + (candidate.tpcNSigmaKa() * candidate.tpcNSigmaKa())) < (nsigmaCutCombined * nsigmaCutCombined)) { + if (!isNoTOF && candidate.hasTOF() && ((candidate.tofNSigmaKa() * candidate.tofNSigmaKa()) + (candidate.tpcNSigmaKa() * candidate.tpcNSigmaKa())) < (nsigmaCutCombined * nsigmaCutCombined)) { return true; } - if (OnlyTOF && candidate.hasTOF() && TMath::Abs(candidate.tofNSigmaKa()) < nsigmaCutTOF) { + if (isNoTOF && std::abs(candidate.tpcNSigmaKa()) < nsigmaCutTPC) { return true; } } else if (PID == 1) { - if (!OnlyTOF && !candidate.hasTOF() && TMath::Abs(candidate.tpcNSigmaPi()) < nsigmaCutTPC) { + if (!isNoTOF && !candidate.hasTOF() && TMath::Abs(candidate.tpcNSigmaPi()) < nsigmaCutTPC) { return true; } - if (!OnlyTOF && candidate.hasTOF() && ((candidate.tofNSigmaPi() * candidate.tofNSigmaPi()) + (candidate.tpcNSigmaPi() * candidate.tpcNSigmaPi())) < (nsigmaCutCombined * nsigmaCutCombined)) { + if (!isNoTOF && candidate.hasTOF() && ((candidate.tofNSigmaPi() * candidate.tofNSigmaPi()) + (candidate.tpcNSigmaPi() * candidate.tpcNSigmaPi())) < (nsigmaCutCombined * nsigmaCutCombined)) { return true; } - if (OnlyTOF && candidate.hasTOF() && TMath::Abs(candidate.tofNSigmaPi()) < nsigmaCutTOF) { + if (isNoTOF && std::abs(candidate.tpcNSigmaPi()) < nsigmaCutTPC) { return true; } } @@ -312,17 +322,23 @@ struct kstarpbpb { { if (PID == 0) { if (strategy == 0) { - if (candidate.pt() < 0.5 && TMath::Abs(candidate.tpcNSigmaKa()) < nsigmaCutTPC) { + if (!isNoTOF && !candidate.hasTOF() && TMath::Abs(candidate.tpcNSigmaKa()) < nsigmaCutTPC) { return true; } - if (candidate.pt() >= 0.5 && TMath::Abs(candidate.tpcNSigmaKa()) < nsigmaCutTPC && candidate.hasTOF() && TMath::Abs(candidate.tofNSigmaKa()) < nsigmaCutTOF && candidate.beta() > 0.5) { + if (!isNoTOF && candidate.hasTOF() && TMath::Abs(candidate.tpcNSigmaKa()) < nsigmaCutTPC && TMath::Abs(candidate.tofNSigmaKa()) < nsigmaCutTOF) { + return true; + } + if (isNoTOF && std::abs(candidate.tpcNSigmaKa()) < nsigmaCutTPC) { return true; } } else if (strategy == 1) { - if (candidate.pt() < 0.5 && TMath::Abs(candidate.tpcNSigmaKa()) < nsigmaCutTPC) { + if (!isNoTOF && !candidate.hasTOF() && TMath::Abs(candidate.tpcNSigmaKa()) < nsigmaCutTPC) { return true; } - if (candidate.pt() >= 0.5 && TMath::Sqrt(candidate.tpcNSigmaKa() * candidate.tpcNSigmaKa() + candidate.tofNSigmaKa() * candidate.tofNSigmaKa()) < nsigmaCutTOF && candidate.beta() > 0.5) { + if (!isNoTOF && candidate.hasTOF() && ((candidate.tofNSigmaKa() * candidate.tofNSigmaKa()) + (candidate.tpcNSigmaKa() * candidate.tpcNSigmaKa())) < (nsigmaCutCombined * nsigmaCutCombined)) { + return true; + } + if (isNoTOF && std::abs(candidate.tpcNSigmaKa()) < nsigmaCutTPC) { return true; } } else if (strategy == 2) { @@ -339,17 +355,23 @@ struct kstarpbpb { } if (PID == 1) { if (strategy == 0) { - if (candidate.pt() < 0.5 && TMath::Abs(candidate.tpcNSigmaPi()) < nsigmaCutTPC) { + if (!isNoTOF && !candidate.hasTOF() && TMath::Abs(candidate.tpcNSigmaPi()) < nsigmaCutTPC) { return true; } - if (candidate.pt() >= 0.5 && TMath::Abs(candidate.tpcNSigmaPi()) < nsigmaCutTPC && candidate.hasTOF() && TMath::Abs(candidate.tofNSigmaPi()) < nsigmaCutTOF && candidate.beta() > 0.5) { + if (!isNoTOF && candidate.hasTOF() && TMath::Abs(candidate.tpcNSigmaPi()) < nsigmaCutTPC && TMath::Abs(candidate.tofNSigmaPi()) < nsigmaCutTOF) { + return true; + } + if (isNoTOF && std::abs(candidate.tpcNSigmaPi()) < nsigmaCutTPC) { return true; } } else if (strategy == 1) { - if (candidate.pt() < 0.5 && TMath::Abs(candidate.tpcNSigmaPi()) < nsigmaCutTPC) { + if (!isNoTOF && !candidate.hasTOF() && TMath::Abs(candidate.tpcNSigmaPi()) < nsigmaCutTPC) { return true; } - if (candidate.pt() >= 0.5 && TMath::Sqrt(candidate.tpcNSigmaPi() * candidate.tpcNSigmaPi() + candidate.tofNSigmaPi() * candidate.tofNSigmaPi()) < nsigmaCutTOF && candidate.beta() > 0.5) { + if (!isNoTOF && candidate.hasTOF() && ((candidate.tofNSigmaPi() * candidate.tofNSigmaPi()) + (candidate.tpcNSigmaPi() * candidate.tpcNSigmaPi())) < (nsigmaCutCombined * nsigmaCutCombined)) { + return true; + } + if (isNoTOF && std::abs(candidate.tpcNSigmaPi()) < nsigmaCutTPC) { return true; } } else if (strategy == 2) { @@ -390,7 +412,7 @@ struct kstarpbpb { } ConfigurableAxis axisVertex{"axisVertex", {20, -10, 10}, "vertex axis for bin"}; ConfigurableAxis axisMultiplicityClass{"axisMultiplicityClass", {20, 0, 100}, "multiplicity percentile for bin"}; - ConfigurableAxis axisEPAngle{"axisEPAngle", {9, -TMath::Pi() / 2, TMath::Pi() / 2}, "event plane angle"}; + ConfigurableAxis axisEPAngle{"axisEPAngle", {6, -TMath::Pi() / 2, TMath::Pi() / 2}, "event plane angle"}; double v2, v2Rot; using BinningTypeVertexContributor = ColumnBinningPolicy; @@ -416,6 +438,9 @@ struct kstarpbpb { if (additionalEvsel && !eventSelected(collision, centrality)) { return; } + if (additionalEvselITS && !collision.selection_bit(o2::aod::evsel::kIsGoodITSLayersAll)) { + return; + } if (additionalQAplots1) { histos.fill(HIST("hFTOCvsTPCSelected"), centrality, multTPC); histos.fill(HIST("hPsiFT0C"), centrality, psiFT0C); @@ -441,10 +466,6 @@ struct kstarpbpb { continue; } track1kaon = true; - histos.fill(HIST("TPC_Nsigma_ka"), track1.p(), track1.tpcNSigmaKa()); - if (track1.hasTOF()) { - histos.fill(HIST("TOF_Nsigma_ka"), track1.p(), track1.tofNSigmaKa()); - } for (auto track2 : tracks) { if (!selectionTrack(track2)) { continue; @@ -455,10 +476,6 @@ struct kstarpbpb { continue; } track2pion = true; - histos.fill(HIST("TPC_Nsigma_pi"), track2.p(), track1.tpcNSigmaPi()); - if (track2.hasTOF()) { - histos.fill(HIST("TOF_Nsigma_pi"), track2.p(), track1.tofNSigmaPi()); - } if (track2ID == track1ID) { continue; } @@ -480,7 +497,9 @@ struct kstarpbpb { } // unlike sign if (track1.sign() * track2.sign() < 0) { - histos.fill(HIST("hSparseV2SASameEvent_V2"), KstarMother.M(), KstarMother.Pt(), v2, centrality); + if (same) { + histos.fill(HIST("hSparseV2SASameEvent_V2"), KstarMother.M(), KstarMother.Pt(), v2, centrality); + } if (fillRotation) { for (int nrotbkg = 0; nrotbkg < nBkgRotations; nrotbkg++) { auto anglestart = confMinRot; @@ -508,11 +527,13 @@ struct kstarpbpb { } // like sign if (track1.sign() * track2.sign() > 0) { - if (track1.sign() > 0 && track2.sign() > 0) { - histos.fill(HIST("hSparseV2SAlikeEventPP_V2"), KstarMother.M(), KstarMother.Pt(), v2, centrality); - } - if (track1.sign() < 0 && track2.sign() < 0) { - histos.fill(HIST("hSparseV2SAlikeEventNN_V2"), KstarMother.M(), KstarMother.Pt(), v2, centrality); + if (like) { + if (track1.sign() > 0 && track2.sign() > 0) { + histos.fill(HIST("hSparseV2SAlikeEventPP_V2"), KstarMother.M(), KstarMother.Pt(), v2, centrality); + } + if (track1.sign() < 0 && track2.sign() < 0) { + histos.fill(HIST("hSparseV2SAlikeEventNN_V2"), KstarMother.M(), KstarMother.Pt(), v2, centrality); + } } } } @@ -540,6 +561,9 @@ struct kstarpbpb { if (additionalEvSel3 && (!collision.selection_bit(o2::aod::evsel::kNoCollInTimeRangeStandard))) { return; } + if (additionalEvselITS && !collision.selection_bit(o2::aod::evsel::kIsGoodITSLayersAll)) { + return; + } int occupancy = collision.trackOccupancyInTimeRange(); auto posThisColl = posTracks->sliceByCached(aod::track::collisionId, collision.globalIndex(), cache); auto negThisColl = negTracks->sliceByCached(aod::track::collisionId, collision.globalIndex(), cache); @@ -606,7 +630,7 @@ struct kstarpbpb { continue; } auto track2ID = track2.globalIndex(); - if (isGI && (track2ID <= track1ID)) { + if (track2ID == track1ID) { continue; } if (track1.sign() * track2.sign() > 0) { @@ -645,42 +669,42 @@ struct kstarpbpb { } } } - - if (track1kaon && track2pion) { - if (additionalQAplots) { - histos.fill(HIST("QAafter/TPC_Nsigma_allka"), track1.pt(), track1.tpcNSigmaKa()); - histos.fill(HIST("QAafter/TOF_Nsigma_allka"), track1.pt(), track1.tofNSigmaKa()); - histos.fill(HIST("QAafter/trkDCAxyka"), track1.dcaXY()); - histos.fill(HIST("QAafter/trkDCAzka"), track1.dcaZ()); - histos.fill(HIST("QAafter/TOF_TPC_Mapka_allka"), track1.tofNSigmaKa(), track1.tpcNSigmaKa()); - histos.fill(HIST("QAafter/TOF_TPC_Mapka_allpi"), track2.tofNSigmaPi(), track2.tpcNSigmaPi()); - histos.fill(HIST("QAafter/TPC_Nsigma_allpi"), track2.pt(), track2.tpcNSigmaPi()); - histos.fill(HIST("QAafter/TOF_Nsigma_allpi"), track2.pt(), track2.tofNSigmaPi()); - histos.fill(HIST("QAafter/trkDCAxypi"), track2.dcaXY()); - histos.fill(HIST("QAafter/trkDCAzpi"), track2.dcaZ()); + if (same) { + if (track1kaon && track2pion) { + if (additionalQAplots) { + histos.fill(HIST("QAafter/TPC_Nsigma_allka"), track1.pt(), track1.tpcNSigmaKa()); + histos.fill(HIST("QAafter/TOF_Nsigma_allka"), track1.pt(), track1.tofNSigmaKa()); + histos.fill(HIST("QAafter/trkDCAxyka"), track1.dcaXY()); + histos.fill(HIST("QAafter/trkDCAzka"), track1.dcaZ()); + histos.fill(HIST("QAafter/TOF_TPC_Mapka_allka"), track1.tofNSigmaKa(), track1.tpcNSigmaKa()); + histos.fill(HIST("QAafter/TOF_TPC_Mapka_allpi"), track2.tofNSigmaPi(), track2.tpcNSigmaPi()); + histos.fill(HIST("QAafter/TPC_Nsigma_allpi"), track2.pt(), track2.tpcNSigmaPi()); + histos.fill(HIST("QAafter/TOF_Nsigma_allpi"), track2.pt(), track2.tofNSigmaPi()); + histos.fill(HIST("QAafter/trkDCAxypi"), track2.dcaXY()); + histos.fill(HIST("QAafter/trkDCAzpi"), track2.dcaZ()); + } + daughter1 = ROOT::Math::PxPyPzMVector(track1.px(), track1.py(), track1.pz(), massKa); + daughter2 = ROOT::Math::PxPyPzMVector(track2.px(), track2.py(), track2.pz(), massPi); + } else if (track1pion && track2kaon) { + daughter1 = ROOT::Math::PxPyPzMVector(track1.px(), track1.py(), track1.pz(), massPi); + daughter2 = ROOT::Math::PxPyPzMVector(track2.px(), track2.py(), track2.pz(), massKa); + } else { + continue; } - daughter1 = ROOT::Math::PxPyPzMVector(track1.px(), track1.py(), track1.pz(), massKa); - daughter2 = ROOT::Math::PxPyPzMVector(track2.px(), track2.py(), track2.pz(), massPi); - } else if (track1pion && track2kaon) { - daughter1 = ROOT::Math::PxPyPzMVector(track1.px(), track1.py(), track1.pz(), massPi); - daughter2 = ROOT::Math::PxPyPzMVector(track2.px(), track2.py(), track2.pz(), massKa); - } else { - continue; - } - KstarMother = daughter1 + daughter2; - histos.fill(HIST("hpTvsRapidity"), KstarMother.Pt(), KstarMother.Rapidity()); - if (TMath::Abs(KstarMother.Rapidity()) > confRapidity) { - continue; - } - auto phiminuspsi = GetPhiInRange(KstarMother.Phi() - psiFT0C); - if (useSP) { - v2 = TMath::Cos(2.0 * phiminuspsi) * QFT0C; - } - if (!useSP) { - v2 = TMath::Cos(2.0 * phiminuspsi); + KstarMother = daughter1 + daughter2; + if (TMath::Abs(KstarMother.Rapidity()) > confRapidity) { + continue; + } + auto phiminuspsi = GetPhiInRange(KstarMother.Phi() - psiFT0C); + if (useSP) { + v2 = TMath::Cos(2.0 * phiminuspsi) * QFT0C; + } + if (!useSP) { + v2 = TMath::Cos(2.0 * phiminuspsi); + } + histos.fill(HIST("hSparseV2SASameEvent_V2"), KstarMother.M(), KstarMother.Pt(), v2, centrality); } - histos.fill(HIST("hSparseV2SASameEvent_V2"), KstarMother.M(), KstarMother.Pt(), v2, centrality); if (fillRotation) { for (int nrotbkg = 0; nrotbkg < nBkgRotations; nrotbkg++) { auto anglestart = confMinRot; @@ -738,6 +762,9 @@ struct kstarpbpb { if (additionalEvSel3 && (!collision.selection_bit(o2::aod::evsel::kNoCollInTimeRangeStandard))) { return; } + if (additionalEvselITS && !collision.selection_bit(o2::aod::evsel::kIsGoodITSLayersAll)) { + return; + } int occupancy = collision.trackOccupancyInTimeRange(); auto psiFT0C = collision.psiFT0C(); if (fillOccupancy && occupancy >= cfgOccupancyCut) // occupancy info is available for this collision (*) @@ -878,6 +905,12 @@ struct kstarpbpb { if (additionalEvSel3 && (!collision2.selection_bit(o2::aod::evsel::kNoCollInTimeRangeStandard))) { continue; } + if (additionalEvselITS && !collision1.selection_bit(o2::aod::evsel::kIsGoodITSLayersAll)) { + continue; + } + if (additionalEvselITS && !collision2.selection_bit(o2::aod::evsel::kIsGoodITSLayersAll)) { + continue; + } int occupancy1 = collision1.trackOccupancyInTimeRange(); int occupancy2 = collision2.trackOccupancyInTimeRange(); auto posThisColl = posTracks->sliceByCached(aod::track::collisionId, collision1.globalIndex(), cache); @@ -973,7 +1006,9 @@ struct kstarpbpb { if (!useSP) { v2 = TMath::Cos(2.0 * phiminuspsi); } - histos.fill(HIST("hSparseV2SAMixedEvent_V2"), KstarMother.M(), KstarMother.Pt(), v2, centrality); + if (mix) { + histos.fill(HIST("hSparseV2SAMixedEvent_V2"), KstarMother.M(), KstarMother.Pt(), v2, centrality); + } } } } From 196fa3b55de6f8f89755ba221923bf4894d9bd94 Mon Sep 17 00:00:00 2001 From: Luca Aglietta <75362880+Luca610@users.noreply.github.com> Date: Tue, 4 Feb 2025 13:46:07 +0100 Subject: [PATCH 10/16] [PWGHF] Added mass cut to Resonance Task (#9729) --- PWGHF/D2H/Tasks/taskCharmResoReduced.cxx | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/PWGHF/D2H/Tasks/taskCharmResoReduced.cxx b/PWGHF/D2H/Tasks/taskCharmResoReduced.cxx index 7126e02258f..078be76881c 100644 --- a/PWGHF/D2H/Tasks/taskCharmResoReduced.cxx +++ b/PWGHF/D2H/Tasks/taskCharmResoReduced.cxx @@ -132,14 +132,16 @@ struct HfTaskCharmResoReduced { Produces hfCandResoLite; Produces hfGenResoLite; Configurable ptMinReso{"ptMinReso", -1, "Discard events with smaller pT"}; - Configurable fillTrees{"fillTrees", false, "Fill output Trees"}; + Configurable fillTrees{"fillTrees", true, "Fill output Trees"}; Configurable fillSparses{"fillSparses", false, "Fill output Sparses"}; - Configurable useDeltaMass{"useDeltaMass", false, "Use Delta Mass for resonance invariant Mass calculation"}; + Configurable useDeltaMass{"useDeltaMass", true, "Use Delta Mass for resonance invariant Mass calculation"}; Configurable fillOnlySignal{"fillOnlySignal", false, "Flag to Fill only signal candidates (MC only)"}; Configurable yCandGenMax{"yCandGenMax", 0.5, "max. gen particle rapidity"}; Configurable yCandRecoMax{"yCandRecoMax", -1, "max. cand. rapidity"}; Configurable etaTrackMax{"etaTrackMax", 0.8, "max. track pseudo-rapidity for acceptance calculation"}; Configurable ptTrackMin{"ptTrackMin", 0.1, "min. track transverse momentum for acceptance calculation"}; + Configurable massResoMin{"massResoMin", 0.49, "min. mass of resonance"}; + Configurable massResoMax{"massResoMax", 1.29, "max. mass of resonance"}; // Configurables axis for histos ConfigurableAxis axisPt{"axisPt", {VARIABLE_WIDTH, 0., 1.f, 2.f, 3.f, 4.f, 5.f, 6.f, 8.f, 12.f, 24.f, 50.f}, "#it{p}_{T} (GeV/#it{c})"}; ConfigurableAxis axisPtProng0{"axisPtProng0", {VARIABLE_WIDTH, 0., 1.f, 2.f, 3.f, 4.f, 5.f, 6.f, 8.f, 12.f, 24.f, 50.f}, "prong0 bach. #it{p}_{T} (GeV/#it{c})"}; @@ -250,6 +252,9 @@ struct HfTaskCharmResoReduced { } else { invMassReso = RecoDecay::m(std::array{bach0.pVector(), bach1.pVector()}, std::array{pdgMassBach0, pdgMassBach1}); } + if (invMassReso < massResoMin || invMassReso > massResoMax) { + return; + } invMassBach0 = invMassBach0 - invMassD0; float ptGen{-1.}; int8_t origin{-1}, flagMcMatchRec{-1}, debugMcRec{-1}, signD0{0}; From 291a6676f46d6fa3c6a1a40e3e753ed29ad14650 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=B2=20Jacazio?= Date: Tue, 4 Feb 2025 13:54:49 +0100 Subject: [PATCH 11/16] [PWGLF] Fix dca cut (#9726) --- PWGLF/Tasks/Strangeness/k0_mixed_events.cxx | 28 ++++++--------------- 1 file changed, 8 insertions(+), 20 deletions(-) diff --git a/PWGLF/Tasks/Strangeness/k0_mixed_events.cxx b/PWGLF/Tasks/Strangeness/k0_mixed_events.cxx index ba85b00e9dc..30ebaad2caa 100644 --- a/PWGLF/Tasks/Strangeness/k0_mixed_events.cxx +++ b/PWGLF/Tasks/Strangeness/k0_mixed_events.cxx @@ -91,10 +91,10 @@ struct K0MixedEvents { Configurable> multPercentileCut{"multPercentileCut", std::pair{-100.f, 1000.f}, "[min., max.] centrality range to keep events within"}; Configurable> momentumCut{"momentumCut", std::pair{0.f, 100.f}, "[min., max.] momentum range to keep candidates within"}; - Configurable> dcaxyCut{"dcaxyCut", std::pair{-100.f, 100.f}, "[min., max.] dcaXY range to keep candidates within"}; - Configurable> dcazCut{"dcazCut", std::pair{-100.f, 100.f}, "[min., max.] dcaZ range to keep candidates within"}; - Configurable> dcaxyExclusionCut{"dcaxyExclusionCut", std::pair{100.f, -100.f}, "[min., max.] dcaXY range to discard candidates within"}; - Configurable> dcazExclusionCut{"dcazExclusionCut", std::pair{100.f, -100.f}, "[min., max.] dcaZ range to discard candidates within"}; + Configurable dcaxyCut{"dcaxyCut", -100.f, "dcaXY range to keep candidates within"}; + Configurable dcazCut{"dcazCut", -100.f, "dcaZ range to keep candidates within"}; + Configurable dcaxyExclusionCut{"dcaxyExclusionCut", 100.f, "dcaXY range to discard candidates within"}; + Configurable dcazExclusionCut{"dcazExclusionCut", 100.f, "dcaZ range to discard candidates within"}; Configurable _eta{"eta", 100.0, "abs eta value limit"}; Configurable _tpcNClsFound{"minTpcNClsFound", 0, "minimum allowed number of TPC clasters"}; @@ -296,28 +296,16 @@ struct K0MixedEvents { if (track.tpcCrossedRowsOverFindableCls() < _tpcCrossedRowsOverFindableCls) { continue; } - if (track.dcaXY() < dcaxyCut.value.first) { + if (std::abs(track.dcaXY()) > dcaxyCut) { continue; } - if (track.dcaXY() > dcaxyCut.value.second) { + if (std::abs(track.dcaXY()) < dcaxyExclusionCut) { continue; } - if (track.dcaXY() > dcaxyExclusionCut.value.first) { + if (std::abs(track.dcaZ()) > dcazCut) { continue; } - if (track.dcaXY() < dcaxyExclusionCut.value.second) { - continue; - } - if (track.dcaZ() < dcazCut.value.first) { - continue; - } - if (track.dcaZ() > dcazCut.value.second) { - continue; - } - if (track.dcaZ() > dcazExclusionCut.value.first) { - continue; - } - if (track.dcaZ() < dcazExclusionCut.value.second) { + if (std::abs(track.dcaZ()) < dcazExclusionCut) { continue; } From b4cf3869a7150c68e3958fa404d1bd621b37fd6a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrea=20Tavira=20Garc=C3=ADa?= <118979672+atavirag@users.noreply.github.com> Date: Tue, 4 Feb 2025 14:39:42 +0100 Subject: [PATCH 12/16] [PWGHF] Add flag to remove ambiguous candidates (#9725) --- .../TableProducer/correlatorDMesonPairs.cxx | 27 +++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) diff --git a/PWGHF/HFC/TableProducer/correlatorDMesonPairs.cxx b/PWGHF/HFC/TableProducer/correlatorDMesonPairs.cxx index 465eb368820..b7bbb0bc723 100644 --- a/PWGHF/HFC/TableProducer/correlatorDMesonPairs.cxx +++ b/PWGHF/HFC/TableProducer/correlatorDMesonPairs.cxx @@ -73,6 +73,7 @@ struct HfCorrelatorDMesonPairs { Configurable selectSignalRegionOnly{"selectSignalRegionOnly", false, "only use events close to PDG peak"}; Configurable massCut{"massCut", 0.05, "Maximum deviation from PDG peak allowed for signal region"}; Configurable daughterTracksCutFlag{"daughterTracksCutFlag", false, "Flag to add cut on daughter tracks"}; + Configurable removeAmbiguous{"removeAmbiguous", false, "Flag to remove ambiguous candidates"}; // ML inference Configurable applyMl{"applyMl", false, "Flag to apply ML selections"}; @@ -123,6 +124,7 @@ struct HfCorrelatorDMesonPairs { {"hEta", "D meson candidates;candidate #it{#eta};entries", hTH1Y}, {"hPhi", "D meson candidates;candidate #it{#varphi};entries", hTH1Phi}, {"hY", "D meson candidates;candidate #it{y};entries", hTH1Y}, + {"hPVContrib", "D meson candidates;candidate Number of PV contributors;entries", hTH1NContrib}, // MC Gen plots {"hPtCandMcGen", "D meson candidates MC Gen;candidate #it{p}_{T} (GeV/#it{c});entries", hTH1Pt}, {"hPtCandAfterCutMcGen", "D meson candidates after pT cut;candidate #it{p}_{T} (GeV/#it{c});entries", hTH1Pt}, @@ -131,12 +133,12 @@ struct HfCorrelatorDMesonPairs { {"hPtVsYVsNContribMcGen", "D meson candidates MC Gen;candidate #it{p}_{T} (GeV/#it{c});#it{y};Number of contributors", hTH3PtVsYVsNContrib}, {"hPtVsYVsNContribMcGenPrompt", "D meson candidates MC Gen Prompt;candidate #it{p}_{T} (GeV/#it{c});#it{y};Number of contributors", hTH3PtVsYVsNContrib}, {"hPtVsYVsNContribMcGenNonPrompt", "D meson candidates MC Gen Prompt;candidate #it{p}_{T} (GeV/#it{c});#it{y};Number of contributors", hTH3PtVsYVsNContrib}, - {"hNContribMcGen", "D meson candidates MC Gen;Number of contributors", hTH1NContrib}, + {"hNContribMcGen", "D meson candidates MC Gen;Number of PV contributors", hTH1NContrib}, // MC Rec plots {"hPtVsYVsNContribMcRec", "D meson candidates MC Rec;candidate #it{p}_{T} (GeV/#it{c});#it{y};Number of contributors", hTH3PtVsYVsNContrib}, {"hPtVsYVsNContribMcRecPrompt", "D meson candidates MC Rec Prompt;candidate #it{p}_{T} (GeV/#it{c});#it{y};Number of contributors", hTH3PtVsYVsNContrib}, {"hPtVsYVsNContribMcRecNonPrompt", "D meson candidates MC Rec Non-prompt;candidate #it{p}_{T} (GeV/#it{c});#it{y};Number of contributors", hTH3PtVsYVsNContrib}, - {"hNContribMcRec", "D meson candidates MC Rec;Number of contributors", hTH1NContrib}, + {"hNContribMcRec", "D meson candidates MC Rec;Number of PV contributors", hTH1NContrib}, // PID plots ----- Not definitively here {"PID/hTofNSigmaPi", "(TOFsignal-time#pi)/tofSigPid;p[GeV/c];(TOFsignal-time#pi)/tofSigPid", hTH2Pid}, {"PID/hTofNSigmaKa", "(TOFsignal-timeK)/tofSigPid;p[GeV/c];(TOFsignal-timeK)/tofSigPid", hTH2Pid}, @@ -576,12 +578,18 @@ struct HfCorrelatorDMesonPairs { } } + // Remove ambiguous D0 candidates if flag is true + if (removeAmbiguous && (isDCand1 && isDbarCand1)) { + continue; + } + registry.fill(HIST("hPtProng0"), candidate1.ptProng0()); registry.fill(HIST("hPtProng1"), candidate1.ptProng1()); registry.fill(HIST("hEta"), candidate1.eta()); registry.fill(HIST("hPhi"), candidate1.phi()); registry.fill(HIST("hY"), candidate1.y(MassD0)); registry.fill(HIST("hPtCandAfterCut"), candidate1.pt()); + registry.fill(HIST("hPVContrib"), collision.numContrib()); if (isDCand1) { registry.fill(HIST("hMass"), hfHelper.invMassD0ToPiK(candidate1), candidate1.pt()); @@ -635,6 +643,11 @@ struct HfCorrelatorDMesonPairs { continue; } + // Remove ambiguous D0 candidates if flag is true + if (removeAmbiguous && (isDCand2 && isDbarCand2)) { + continue; + } + fillEntry(isDCand1, isDbarCand1, isDCand2, isDbarCand2, candidateType1, candidateType2, hfHelper.yD0(candidate1), hfHelper.yD0(candidate2), candidate1.pt(), candidate2.pt(), candidate1.phi(), candidate2.phi(), hfHelper.invMassD0ToPiK(candidate1), hfHelper.invMassD0barToKPi(candidate1), hfHelper.invMassD0ToPiK(candidate2), hfHelper.invMassD0barToKPi(candidate2)); @@ -719,6 +732,11 @@ struct HfCorrelatorDMesonPairs { } } + // Remove ambiguous D0 candidates if flag is true + if (removeAmbiguous && (isDCand1 && isDbarCand1)) { + continue; + } + if (isTrueDCand1) { registry.fill(HIST("hStatusSinglePart"), 5); } else if (isTrueDbarCand1) { @@ -821,6 +839,11 @@ struct HfCorrelatorDMesonPairs { continue; } + // Remove ambiguous D0 candidates if flag is true + if (removeAmbiguous && (isDCand2 && isDbarCand2)) { + continue; + } + // Fill tables fillEntry(isDCand1, isDbarCand1, isDCand2, isDbarCand2, candidateType1, candidateType2, yCandidate1, yCandidate2, phiCandidate1, phiCandidate2, ptCandidate1, ptCandidate2, massD0Cand1, massD0barCand1, massD0Cand2, massD0barCand2); From eead5eb467d224ecbaa8a9698b370068d6ecdf5f Mon Sep 17 00:00:00 2001 From: alcaliva <32872606+alcaliva@users.noreply.github.com> Date: Tue, 4 Feb 2025 14:43:05 +0100 Subject: [PATCH 13/16] [PWGLF] calculation of overlap between jet-jet, ue-ue, jet-ue (#9669) --- PWGLF/Tasks/Nuspex/nucleiInJets.cxx | 211 ++++++++++++++++++++++++++-- 1 file changed, 198 insertions(+), 13 deletions(-) diff --git a/PWGLF/Tasks/Nuspex/nucleiInJets.cxx b/PWGLF/Tasks/Nuspex/nucleiInJets.cxx index 1186d48b9e7..b2cc0e58364 100644 --- a/PWGLF/Tasks/Nuspex/nucleiInJets.cxx +++ b/PWGLF/Tasks/Nuspex/nucleiInJets.cxx @@ -97,6 +97,7 @@ struct NucleiInJets { Configurable minNparticlesInJet{"minNparticlesInJet", 2, "Minimum number of particles inside jet"}; Configurable nJetsPerEventMax{"nJetsPerEventMax", 1000, "Maximum number of jets per event"}; Configurable requireNoOverlap{"requireNoOverlap", true, "require no overlap between jets and UE cones"}; + Configurable nGhosts{"nGhosts", 1000, "number of ghost particles"}; // Track Parameters Configurable par0{"par0", 0.00164, "par 0"}; @@ -165,6 +166,7 @@ struct NucleiInJets { registryQC.add("dcaxy_vs_pt", "dcaxy_vs_pt", HistType::kTH2F, {{100, 0.0, 5.0, "#it{p}_{T} (GeV/#it{c})"}, {2000, -0.05, 0.05, "DCA_{xy} (cm)"}}); registryQC.add("dcaz_vs_pt", "dcaz_vs_pt", HistType::kTH2F, {{100, 0.0, 5.0, "#it{p}_{T} (GeV/#it{c})"}, {2000, -0.05, 0.05, "DCA_{z} (cm)"}}); registryQC.add("jet_ue_overlaps", "jet_ue_overlaps", HistType::kTH2F, {{20, 0.0, 20.0, "#it{n}_{jet}"}, {200, 0.0, 200.0, "#it{n}_{overlaps}"}}); + registryQC.add("hJetArea", "hJetArea", HistType::kTH1F, {{450, 0, 15, "Area"}}); // Event Counters registryData.add("number_of_events_data", "number of events in data", HistType::kTH1F, {{10, 0, 10, "counter"}}); @@ -239,6 +241,17 @@ struct NucleiInJets { registryMC.add("antiproton_eta_pt_pythia", "antiproton_eta_pt_pythia", HistType::kTH2F, {{200, 0.0, 10.0, "#it{p}_{T} (GeV/#it{c})"}, {20, -1.0, 1.0, "#it{#eta}"}}); registryMC.add("antiproton_eta_pt_jet", "antiproton_eta_pt_jet", HistType::kTH2F, {{200, 0.0, 10.0, "#it{p}_{T} (GeV/#it{c})"}, {20, -1.0, 1.0, "#it{#eta}"}}); registryMC.add("antiproton_eta_pt_ue", "antiproton_eta_pt_ue", HistType::kTH2F, {{200, 0.0, 10.0, "#it{p}_{T} (GeV/#it{c})"}, {20, -1.0, 1.0, "#it{#eta}"}}); + + // Detector Response Matrix + registryMC.add("detectorResponseMatrix", "detectorResponseMatrix", HistType::kTH2F, {{500, 0.0, 50.0, "#it{p}_{T}^{gen} (GeV/#it{c})"}, {500, 0.0, 50.0, "#it{p}_{T}^{rec} (GeV/#it{c})"}}); + } + + // ITS Hit + template + bool hasITSHit(T const& track, int layer) + { + int ibit = layer - 1; + return (track.itsClusterMap() & (1 << ibit)); } // Single-Track Selection for Particles inside Jets @@ -247,12 +260,14 @@ struct NucleiInJets { { if (!track.hasITS()) return false; - if (track.itsNCls() < 3) + if ((!hasITSHit(track, 1)) && (!hasITSHit(track, 2)) && (!hasITSHit(track, 3))) return false; if (!track.hasTPC()) return false; if (track.tpcNClsCrossedRows() < 70) return false; + if (track.tpcNClsCrossedRows() / track.tpcNClsFindable() < 0.8) + return false; if (track.tpcChi2NCl() > 4) return false; if (track.itsChi2NCl() > 36) @@ -261,7 +276,12 @@ struct NucleiInJets { return false; if (track.pt() < 0.15) return false; + if (std::fabs(track.dcaXY()) > 0.25) + return false; + if (std::fabs(track.dcaZ()) > 2.0) + return false; + /* // pt-dependent selection if (setDCAselectionPtDep) { if (std::fabs(track.dcaXY()) > (par0 + par1 / track.pt())) @@ -277,6 +297,7 @@ struct NucleiInJets { if (std::fabs(track.dcaZ()) > maxDcaz) return false; } + */ return true; } @@ -489,14 +510,14 @@ struct NucleiInJets { do { double dijMin(1e+06), diBmin(1e+06); - int iMin(0), jMin(0), iB_min(0); + int iMin(0), jMin(0), iBmin(0); for (int i = 0; i < static_cast(trk.size()); i++) { // o2-linter: disable=[const-ref-in-for-loop] if (trk[i].Mag() == 0) continue; double diB = 1.0 / (trk[i].Pt() * trk[i].Pt()); if (diB < diBmin) { diBmin = diB; - iB_min = i; + iBmin = i; } for (int j = (i + 1); j < static_cast(trk.size()); j++) { // o2-linter: disable=[const-ref-in-for-loop] if (trk[j].Mag() == 0) @@ -515,8 +536,8 @@ struct NucleiInJets { nParticlesRemoved++; } if (dijMin > diBmin) { - jet.push_back(trk[iB_min]); - trk[iB_min].SetXYZ(0, 0, 0); + jet.push_back(trk[iBmin]); + trk[iBmin].SetXYZ(0, 0, 0); nParticlesRemoved++; } } while (nParticlesRemoved < static_cast(trk.size())); @@ -969,14 +990,14 @@ struct NucleiInJets { do { double dijMin(1e+06), diBmin(1e+06); - int iMin(0), jMin(0), iB_min(0); + int iMin(0), jMin(0), iBmin(0); for (int i = 0; i < static_cast(trk.size()); i++) { // o2-linter: disable=[const-ref-in-for-loop] if (trk[i].Mag() == 0) continue; double diB = 1.0 / (trk[i].Pt() * trk[i].Pt()); if (diB < diBmin) { diBmin = diB; - iB_min = i; + iBmin = i; } for (int j = (i + 1); j < static_cast(trk.size()); j++) { // o2-linter: disable=[const-ref-in-for-loop] if (trk[j].Mag() == 0) @@ -995,8 +1016,8 @@ struct NucleiInJets { nParticlesRemoved++; } if (dijMin > diBmin) { - jet.push_back(trk[iB_min]); - trk[iB_min].SetXYZ(0, 0, 0); + jet.push_back(trk[iBmin]); + trk[iBmin].SetXYZ(0, 0, 0); nParticlesRemoved++; } } while (nParticlesRemoved < static_cast(trk.size())); @@ -1181,14 +1202,14 @@ struct NucleiInJets { do { double dijMin(1e+06), diBmin(1e+06); - int iMin(0), jMin(0), iB_min(0); + int iMin(0), jMin(0), iBmin(0); for (int i = 0; i < static_cast(trk.size()); i++) { // o2-linter: disable=[const-ref-in-for-loop] if (trk[i].Mag() == 0) continue; double diB = 1.0 / (trk[i].Pt() * trk[i].Pt()); if (diB < diBmin) { diBmin = diB; - iB_min = i; + iBmin = i; } for (int j = (i + 1); j < static_cast(trk.size()); j++) { // o2-linter: disable=[const-ref-in-for-loop] if (trk[j].Mag() == 0) @@ -1207,8 +1228,8 @@ struct NucleiInJets { nParticlesRemoved++; } if (dijMin > diBmin) { - jet.push_back(trk[iB_min]); - trk[iB_min].SetXYZ(0, 0, 0); + jet.push_back(trk[iBmin]); + trk[iBmin].SetXYZ(0, 0, 0); nParticlesRemoved++; } } while (nParticlesRemoved < static_cast(trk.size())); @@ -1340,6 +1361,170 @@ struct NucleiInJets { } } PROCESS_SWITCH(NucleiInJets, processAntiprotonReweighting, "Process antiproton reweighting", false); + + void processGhosts(SelectedCollisions::iterator const& collision, FullNucleiTracks const& tracks) + { + // Event Selection + if (!collision.sel8() || std::fabs(collision.posZ()) > zVtx) + return; + + // Track Selection for Jet Finding + std::vector trk; + for (auto track : tracks) { // o2-linter: disable=[const-ref-in-for-loop] + + if (!passedTrackSelectionForJetReconstruction(track)) + continue; + TVector3 momentum(track.px(), track.py(), track.pz()); + trk.push_back(momentum); + } + // int nTracks = static_cast(trk.size()); + + // Generate Ghosts + for (int i = 0; i < nGhosts; i++) { // o2-linter: disable=[const-ref-in-for-loop] + + double eta = gRandom->Uniform(-0.8, 0.8); + double phi = gRandom->Uniform(0.0, TwoPI); + double pt = 1e-100; + TVector3 ghost; + ghost.SetPtEtaPhi(pt, eta, phi); + trk.push_back(ghost); + } + + // Anti-kt Jet Finder + int nParticlesRemoved(0); + std::vector jet; + std::vector jetArea; + + do { + double dijMin(1e+06), diBmin(1e+06); + int iMin(0), jMin(0), iBmin(0); + int nGhostsInJet(0); + for (int i = 0; i < static_cast(trk.size()); i++) { // o2-linter: disable=[const-ref-in-for-loop] + if (trk[i].Mag() == 0) + continue; + double diB = 1.0 / (trk[i].Pt() * trk[i].Pt()); + if (diB < diBmin) { + diBmin = diB; + iBmin = i; + } + for (int j = (i + 1); j < static_cast(trk.size()); j++) { // o2-linter: disable=[const-ref-in-for-loop] + if (trk[j].Mag() == 0) + continue; + double dij = calculateDij(trk[i], trk[j], rJet); + if (dij < dijMin) { + dijMin = dij; + iMin = i; + jMin = j; + } + } + } + if (dijMin < diBmin) { + if (trk[iMin].Pt() == 1e-100) + nGhostsInJet++; + if (trk[jMin].Pt() == 1e-100) + nGhostsInJet++; + trk[iMin] = trk[iMin] + trk[jMin]; + trk[jMin].SetXYZ(0, 0, 0); + nParticlesRemoved++; + } + if (dijMin > diBmin) { + double area = (static_cast(nGhostsInJet) / static_cast(nGhosts)) * TwoPI * 1.6; + jetArea.push_back(area); + jet.push_back(trk[iBmin]); + trk[iBmin].SetXYZ(0, 0, 0); + nParticlesRemoved++; + } + } while (nParticlesRemoved < static_cast(trk.size())); + + for (int i = 0; i < static_cast(jet.size()); i++) { // o2-linter: disable=[const-ref-in-for-loop] + + if ((std::fabs(jet[i].Eta()) + rJet) > maxEta) + continue; + registryQC.fill(HIST("hJetArea"), jetArea[i]); + } + } + PROCESS_SWITCH(NucleiInJets, processGhosts, "Process Ghosts", false); + + void processDetResponseMatrix(SimCollisions const& collisions, MCTracks const& mcTracks, aod::McCollisions const&, const aod::McParticles&) + { + for (const auto& collision : collisions) { // o2-linter: disable=[const-ref-in-for-loop] + + // Event Selection + if (!collision.sel8() || std::fabs(collision.posZ()) > zVtx) + continue; + + // List of Tracks and Particles + std::vector trk; + std::vector part; + auto tracksPerColl = mcTracks.sliceBy(perCollision, collision.globalIndex()); + + for (auto track : tracksPerColl) { // o2-linter: disable=[const-ref-in-for-loop] + + if (!passedTrackSelectionForJetReconstruction(track)) + continue; + if (!track.has_mcParticle()) + continue; + const auto particle = track.mcParticle(); + + TVector3 recMomentum(track.px(), track.py(), track.pz()); + TVector3 genMomentum(particle.px(), particle.py(), particle.pz()); + trk.push_back(recMomentum); + part.push_back(genMomentum); + } + + // Anti-kt Jet Finder + int nParticlesRemoved(0); + std::vector jetRecMomentum; + std::vector jetGenMomentum; + + do { + double dijMin(1e+06), diBmin(1e+06); + int iMin(0), jMin(0), iBmin(0); + for (int i = 0; i < static_cast(trk.size()); i++) { // o2-linter: disable=[const-ref-in-for-loop] + if (trk[i].Mag() == 0) + continue; + double diB = 1.0 / (trk[i].Pt() * trk[i].Pt()); + if (diB < diBmin) { + diBmin = diB; + iBmin = i; + } + for (int j = (i + 1); j < static_cast(trk.size()); j++) { // o2-linter: disable=[const-ref-in-for-loop] + if (trk[j].Mag() == 0) + continue; + double dij = calculateDij(trk[i], trk[j], rJet); + if (dij < dijMin) { + dijMin = dij; + iMin = i; + jMin = j; + } + } + } + if (dijMin < diBmin) { + trk[iMin] = trk[iMin] + trk[jMin]; + part[iMin] = part[iMin] + part[jMin]; + trk[jMin].SetXYZ(0, 0, 0); + nParticlesRemoved++; + } + if (dijMin > diBmin) { + jetRecMomentum.push_back(trk[iBmin]); + jetGenMomentum.push_back(part[iBmin]); + trk[iBmin].SetXYZ(0, 0, 0); + nParticlesRemoved++; + } + } while (nParticlesRemoved < static_cast(trk.size())); + + for (int i = 0; i < static_cast(jetRecMomentum.size()); i++) { // o2-linter: disable=[const-ref-in-for-loop] + + if ((std::fabs(jetRecMomentum[i].Eta()) + rJet) > maxEta) + continue; + + double ptGen = jetGenMomentum[i].Pt(); + double ptRec = jetRecMomentum[i].Pt(); + registryMC.fill(HIST("detectorResponseMatrix"), ptGen, ptRec); + } + } + } + PROCESS_SWITCH(NucleiInJets, processDetResponseMatrix, "process detector response matrix", false); }; WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) From 2ff38356870476d2375e400fdcec9f854fd6d587 Mon Sep 17 00:00:00 2001 From: Pritam Chakraborty <47203359+prchakra@users.noreply.github.com> Date: Tue, 4 Feb 2025 14:55:06 +0100 Subject: [PATCH 14/16] [PWGCF] FemtoUniverse: Adding fraction of shared TPC clusters (#9730) --- .../Core/FemtoUniverseParticleHisto.h | 2 + .../Core/FemtoUniverseTrackSelection.h | 49 +++++++++---- PWGCF/FemtoUniverse/DataModel/FemtoDerived.h | 2 + .../femtoUniverseProducerReducedTask.cxx | 7 +- .../femtoUniverseProducerTask.cxx | 71 ++++++++++--------- .../femtoUniverseProducerTaskV0Only.cxx | 8 ++- 6 files changed, 87 insertions(+), 52 deletions(-) diff --git a/PWGCF/FemtoUniverse/Core/FemtoUniverseParticleHisto.h b/PWGCF/FemtoUniverse/Core/FemtoUniverseParticleHisto.h index 5f2b465fda7..6650292be69 100644 --- a/PWGCF/FemtoUniverse/Core/FemtoUniverseParticleHisto.h +++ b/PWGCF/FemtoUniverse/Core/FemtoUniverseParticleHisto.h @@ -79,6 +79,7 @@ class FemtoUniverseParticleHisto mHistogramRegistry->add((folderName + folderSuffix + "/hTPCcrossedRows").c_str(), "; TPC crossed rows; Entries", kTH1F, {{163, -0.5, 162.5}}); mHistogramRegistry->add((folderName + folderSuffix + "/hTPCfindableVsCrossed").c_str(), ";TPC findable clusters ; TPC crossed rows;", kTH2F, {{163, -0.5, 162.5}, {163, -0.5, 162.5}}); mHistogramRegistry->add((folderName + folderSuffix + "/hTPCshared").c_str(), "; TPC shared clusters; Entries", kTH1F, {{163, -0.5, 162.5}}); + mHistogramRegistry->add((folderName + folderSuffix + "/hTPCsharedFrac").c_str(), "; TPC fraction of shared clusters; Entries", kTH1F, {{100, 0.0, 100.0}}); mHistogramRegistry->add((folderName + folderSuffix + "/hITSclusters").c_str(), "; ITS clusters; Entries", kTH1F, {{10, -0.5, 9.5}}); mHistogramRegistry->add((folderName + folderSuffix + "/hITSclustersIB").c_str(), "; ITS clusters in IB; Entries", kTH1F, {{10, -0.5, 9.5}}); mHistogramRegistry->add((folderName + folderSuffix + "/hDCAz").c_str(), "; #it{p}_{T} (GeV/#it{c}); DCA_{z} (cm)", kTH2F, {{100, 0, 10}, {500, -5, 5}}); @@ -251,6 +252,7 @@ class FemtoUniverseParticleHisto mHistogramRegistry->fill(histFolder + HIST(o2::aod::femtouniverse_mc_particle::MCTypeName[mc]) + HIST("/hTPCcrossedRows"), part.tpcNClsCrossedRows()); mHistogramRegistry->fill(histFolder + HIST(o2::aod::femtouniverse_mc_particle::MCTypeName[mc]) + HIST("/hTPCfindableVsCrossed"), part.tpcNClsFindable(), part.tpcNClsCrossedRows()); mHistogramRegistry->fill(histFolder + HIST(o2::aod::femtouniverse_mc_particle::MCTypeName[mc]) + HIST("/hTPCshared"), part.tpcNClsShared()); + mHistogramRegistry->fill(histFolder + HIST(o2::aod::femtouniverse_mc_particle::MCTypeName[mc]) + HIST("/hTPCsharedFrac"), part.tpcFractionSharedCls()); mHistogramRegistry->fill(histFolder + HIST(o2::aod::femtouniverse_mc_particle::MCTypeName[mc]) + HIST("/hITSclusters"), part.itsNCls()); mHistogramRegistry->fill(histFolder + HIST(o2::aod::femtouniverse_mc_particle::MCTypeName[mc]) + HIST("/hITSclustersIB"), part.itsNClsInnerBarrel()); mHistogramRegistry->fill(histFolder + HIST(o2::aod::femtouniverse_mc_particle::MCTypeName[mc]) + HIST("/hDCAz"), part.pt(), part.dcaZ()); diff --git a/PWGCF/FemtoUniverse/Core/FemtoUniverseTrackSelection.h b/PWGCF/FemtoUniverse/Core/FemtoUniverseTrackSelection.h index 3724e84ce83..409af22f698 100644 --- a/PWGCF/FemtoUniverse/Core/FemtoUniverseTrackSelection.h +++ b/PWGCF/FemtoUniverse/Core/FemtoUniverseTrackSelection.h @@ -37,20 +37,21 @@ namespace o2::analysis::femto_universe namespace femto_universe_track_selection { /// The different selections this task is capable of doing -enum TrackSel { kSign, ///< Sign of the track - kpTMin, ///< Min. p_T (GeV/c) - kpTMax, ///< Max. p_T (GeV/c) - kEtaMax, ///< Max. |eta| - kTPCnClsMin, ///< Min. number of TPC clusters - kTPCfClsMin, ///< Min. fraction of crossed rows/findable TPC clusters - kTPCcRowsMin, ///< Min. number of crossed TPC rows - kTPCsClsMax, ///< Max. number of shared TPC clusters - kITSnClsMin, ///< Min. number of ITS clusters - kITSnClsIbMin, ///< Min. number of ITS clusters in the inner barrel - kDCAxyMax, ///< Max. DCA_xy (cm) - kDCAzMax, ///< Max. DCA_z (cm) - kDCAMin, ///< Min. DCA_xyz (cm) - kPIDnSigmaMax ///< Max. |n_sigma| for PID +enum TrackSel { kSign, ///< Sign of the track + kpTMin, ///< Min. p_T (GeV/c) + kpTMax, ///< Max. p_T (GeV/c) + kEtaMax, ///< Max. |eta| + kTPCnClsMin, ///< Min. number of TPC clusters + kTPCfClsMin, ///< Min. fraction of crossed rows/findable TPC clusters + kTPCcRowsMin, ///< Min. number of crossed TPC rows + kTPCsClsMax, ///< Max. number of shared TPC clusters + kTPCfracsClsMax, ///< Max. number of fraction of shared TPC clusters + kITSnClsMin, ///< Min. number of ITS clusters + kITSnClsIbMin, ///< Min. number of ITS clusters in the inner barrel + kDCAxyMax, ///< Max. DCA_xy (cm) + kDCAzMax, ///< Max. DCA_z (cm) + kDCAMin, ///< Min. DCA_xyz (cm) + kPIDnSigmaMax ///< Max. |n_sigma| for PID }; enum TrackContainerPosition { @@ -86,6 +87,7 @@ class FemtoUniverseTrackSelection : public FemtoUniverseObjectSelection kPIDspecies; ///< All the particle species for which the n_sigma values need to be stored - static constexpr int kNtrackSelection = 14; + static constexpr int kNtrackSelection = 15; static constexpr std::string_view kSelectionNames[kNtrackSelection] = {"Sign", "PtMin", "PtMax", @@ -251,6 +255,7 @@ class FemtoUniverseTrackSelection : public FemtoUniverseObjectSelectionadd((folderName + "/hTPCcrossedRows").c_str(), "; TPC crossed rows; Entries", kTH1F, {{163, 0, 163}}); mHistogramRegistry->add((folderName + "/hTPCfindableVsCrossed").c_str(), ";TPC findable clusters ; TPC crossed rows;", kTH2F, {{163, 0, 163}, {163, 0, 163}}); mHistogramRegistry->add((folderName + "/hTPCshared").c_str(), "; TPC shared clusters; Entries", kTH1F, {{163, -0.5, 162.5}}); + mHistogramRegistry->add((folderName + "/hTPCfracshared").c_str(), "; TPC fraction of shared clusters; Entries", kTH1F, {{100, 0.0, 100.0}}); mHistogramRegistry->add((folderName + "/hITSclusters").c_str(), "; ITS clusters; Entries", kTH1F, {{10, -0.5, 9.5}}); mHistogramRegistry->add((folderName + "/hITSclustersIB").c_str(), "; ITS clusters in IB; Entries", kTH1F, {{10, -0.5, 9.5}}); mHistogramRegistry->add((folderName + "/hDCAxy").c_str(), "; #it{p}_{T} (GeV/#it{c}); DCA_{xy} (cm)", kTH2F, {{100, 0, 10}, {500, -5, 5}}); @@ -341,6 +349,7 @@ void FemtoUniverseTrackSelection::init(HistogramRegistry* registry) nTPCfMinSel = getNSelections(femto_universe_track_selection::kTPCfClsMin); nTPCcMinSel = getNSelections(femto_universe_track_selection::kTPCcRowsMin); nTPCsMaxSel = getNSelections(femto_universe_track_selection::kTPCsClsMax); + nTPCsFracMaxSel = getNSelections(femto_universe_track_selection::kTPCfracsClsMax); nITScMinSel = getNSelections(femto_universe_track_selection::kITSnClsMin); nITScIbMinSel = getNSelections(femto_universe_track_selection::kITSnClsIbMin); nDCAxyMaxSel = getNSelections(femto_universe_track_selection::kDCAxyMax); @@ -355,6 +364,7 @@ void FemtoUniverseTrackSelection::init(HistogramRegistry* registry) fClsMin = getMinimalSelection(femto_universe_track_selection::kTPCfClsMin, femto_universe_selection::kLowerLimit); cTPCMin = getMinimalSelection(femto_universe_track_selection::kTPCcRowsMin, femto_universe_selection::kLowerLimit); sTPCMax = getMinimalSelection(femto_universe_track_selection::kTPCsClsMax, femto_universe_selection::kUpperLimit); + fracsTPCMax = getMinimalSelection(femto_universe_track_selection::kTPCfracsClsMax, femto_universe_selection::kUpperLimit); nITSclsMin = getMinimalSelection(femto_universe_track_selection::kITSnClsMin, femto_universe_selection::kLowerLimit); nITSclsIbMin = getMinimalSelection(femto_universe_track_selection::kITSnClsIbMin, femto_universe_selection::kLowerLimit); dcaXYMax = getMinimalSelection(femto_universe_track_selection::kDCAxyMax, femto_universe_selection::kAbsUpperLimit); @@ -389,6 +399,7 @@ bool FemtoUniverseTrackSelection::isSelectedMinimal(T const& track) const auto tpcRClsC = track.tpcCrossedRowsOverFindableCls(); const auto tpcNClsC = track.tpcNClsCrossedRows(); const auto tpcNClsS = track.tpcNClsShared(); + const auto tpcNClsFracS = track.tpcFractionSharedCls(); const auto itsNCls = track.itsNCls(); const auto itsNClsIB = track.itsNClsInnerBarrel(); const auto dcaXY = track.dcaXY(); @@ -422,6 +433,9 @@ bool FemtoUniverseTrackSelection::isSelectedMinimal(T const& track) if (nTPCsMaxSel > 0 && tpcNClsS > sTPCMax) { return false; } + if (nTPCsFracMaxSel > 0 && tpcNClsFracS > fracsTPCMax) { + return false; + } if (nITScMinSel > 0 && itsNCls < nITSclsMin) { return false; } @@ -469,6 +483,7 @@ std::array FemtoUniverseTrackSelection::getCutContainer(T c const auto tpcRClsC = track.tpcCrossedRowsOverFindableCls(); const auto tpcNClsC = track.tpcNClsCrossedRows(); const auto tpcNClsS = track.tpcNClsShared(); + const auto tpcNClsFracS = track.tpcFractionSharedCls(); const auto itsNCls = track.itsNCls(); const auto itsNClsIB = track.itsNClsInnerBarrel(); const auto dcaXY = track.dcaXY(); @@ -519,6 +534,9 @@ std::array FemtoUniverseTrackSelection::getCutContainer(T c case (femto_universe_track_selection::kTPCsClsMax): observable = tpcNClsS; break; + case (femto_universe_track_selection::kTPCfracsClsMax): + observable = tpcNClsFracS; + break; case (femto_universe_track_selection::kITSnClsMin): observable = itsNCls; break; @@ -556,6 +574,7 @@ void FemtoUniverseTrackSelection::fillQA(T const& track) mHistogramRegistry->fill(HIST(o2::aod::femtouniverseparticle::ParticleTypeName[part]) + HIST("/") + HIST(o2::aod::femtouniverseparticle::TrackTypeName[tracktype]) + HIST("/hTPCcrossedRows"), track.tpcNClsCrossedRows()); mHistogramRegistry->fill(HIST(o2::aod::femtouniverseparticle::ParticleTypeName[part]) + HIST("/") + HIST(o2::aod::femtouniverseparticle::TrackTypeName[tracktype]) + HIST("/hTPCfindableVsCrossed"), track.tpcNClsFindable(), track.tpcNClsCrossedRows()); mHistogramRegistry->fill(HIST(o2::aod::femtouniverseparticle::ParticleTypeName[part]) + HIST("/") + HIST(o2::aod::femtouniverseparticle::TrackTypeName[tracktype]) + HIST("/hTPCshared"), track.tpcNClsShared()); + mHistogramRegistry->fill(HIST(o2::aod::femtouniverseparticle::ParticleTypeName[part]) + HIST("/") + HIST(o2::aod::femtouniverseparticle::TrackTypeName[tracktype]) + HIST("/hTPCfractionSharedCls"), track.tpcFractionSharedCls()); mHistogramRegistry->fill(HIST(o2::aod::femtouniverseparticle::ParticleTypeName[part]) + HIST("/") + HIST(o2::aod::femtouniverseparticle::TrackTypeName[tracktype]) + HIST("/hITSclusters"), track.itsNCls()); mHistogramRegistry->fill(HIST(o2::aod::femtouniverseparticle::ParticleTypeName[part]) + HIST("/") + HIST(o2::aod::femtouniverseparticle::TrackTypeName[tracktype]) + HIST("/hITSclustersIB"), track.itsNClsInnerBarrel()); mHistogramRegistry->fill(HIST(o2::aod::femtouniverseparticle::ParticleTypeName[part]) + HIST("/") + HIST(o2::aod::femtouniverseparticle::TrackTypeName[tracktype]) + HIST("/hDCAxy"), track.pt(), track.dcaXY()); diff --git a/PWGCF/FemtoUniverse/DataModel/FemtoDerived.h b/PWGCF/FemtoUniverse/DataModel/FemtoDerived.h index 66aa48bc750..b5ceb44e2c8 100644 --- a/PWGCF/FemtoUniverse/DataModel/FemtoDerived.h +++ b/PWGCF/FemtoUniverse/DataModel/FemtoDerived.h @@ -123,6 +123,7 @@ DECLARE_SOA_DYNAMIC_COLUMN(P, p, //! Compute the overall momentum in GeV/c DECLARE_SOA_COLUMN(Sign, sign, int8_t); //! Sign of the track charge DECLARE_SOA_COLUMN(TpcNClsFound, tpcNClsFound, uint8_t); //! Number of TPC clusters DECLARE_SOA_COLUMN(TpcNClsCrossedRows, tpcNClsCrossedRows, uint8_t); //! Number of TPC crossed rows +DECLARE_SOA_COLUMN(TPCFractionSharedCls, tpcFractionSharedCls, float); //! Number of TPC crossed rows DECLARE_SOA_COLUMN(ItsNCls, itsNCls, uint8_t); //! Number of ITS clusters DECLARE_SOA_COLUMN(ItsNClsInnerBarrel, itsNClsInnerBarrel, uint8_t); //! Number of ITS clusters in the inner barrel //! TPC signal DECLARE_SOA_DYNAMIC_COLUMN(TpcCrossedRowsOverFindableCls, tpcCrossedRowsOverFindableCls, //! Compute the number of crossed rows over findable TPC clusters @@ -181,6 +182,7 @@ DECLARE_SOA_TABLE(FDExtParticles, "AOD", "FDEXTPARTICLE", track::TPCNClsFindable, femtouniverseparticle::TpcNClsCrossedRows, track::TPCNClsShared, + femtouniverseparticle::TPCFractionSharedCls, track::TPCInnerParam, femtouniverseparticle::ItsNCls, femtouniverseparticle::ItsNClsInnerBarrel, diff --git a/PWGCF/FemtoUniverse/TableProducer/femtoUniverseProducerReducedTask.cxx b/PWGCF/FemtoUniverse/TableProducer/femtoUniverseProducerReducedTask.cxx index 382559100e4..3b5de3fcaa1 100644 --- a/PWGCF/FemtoUniverse/TableProducer/femtoUniverseProducerReducedTask.cxx +++ b/PWGCF/FemtoUniverse/TableProducer/femtoUniverseProducerReducedTask.cxx @@ -16,8 +16,10 @@ /// \author Anton Riedel, TU München, anton.riedel@tum.de /// \author Zuzanna Chochulska, WUT Warsaw & CTU Prague, zchochul@cern.ch -#include "TMath.h" #include +#include + +#include "TMath.h" #include "PWGCF/FemtoUniverse/Core/FemtoUniverseCollisionSelection.h" #include "PWGCF/FemtoUniverse/Core/FemtoUniverseTrackSelection.h" #include "PWGCF/FemtoUniverse/DataModel/FemtoDerived.h" @@ -100,6 +102,7 @@ struct femtoUniverseProducerReducedTask { Configurable> ConfTrkTPCfCls{FemtoUniverseTrackSelection::getSelectionName(femto_universe_track_selection::kTPCfClsMin, "ConfTrk"), std::vector{0.7f, 0.83f, 0.9f}, FemtoUniverseTrackSelection::getSelectionHelper(femto_universe_track_selection::kTPCfClsMin, "Track selection: ")}; Configurable> ConfTrkTPCcRowsMin{FemtoUniverseTrackSelection::getSelectionName(femto_universe_track_selection::kTPCcRowsMin, "ConfTrk"), std::vector{70.f, 60.f, 80.f}, FemtoUniverseTrackSelection::getSelectionHelper(femto_universe_track_selection::kTPCcRowsMin, "Track selection: ")}; Configurable> ConfTrkTPCsCls{FemtoUniverseTrackSelection::getSelectionName(femto_universe_track_selection::kTPCsClsMax, "ConfTrk"), std::vector{0.1f, 160.f}, FemtoUniverseTrackSelection::getSelectionHelper(femto_universe_track_selection::kTPCsClsMax, "Track selection: ")}; + Configurable> ConfTrkTPCfracsCls{FemtoUniverseTrackSelection::getSelectionName(femto_universe_track_selection::kTPCfracsClsMax, "ConfTrk"), std::vector{0.1f, 160.f}, FemtoUniverseTrackSelection::getSelectionHelper(femto_universe_track_selection::kTPCfracsClsMax, "Track selection: ")}; Configurable> ConfTrkITSnclsMin{FemtoUniverseTrackSelection::getSelectionName(femto_universe_track_selection::kITSnClsMin, "ConfTrk"), std::vector{-1.f, 2.f, 4.f}, FemtoUniverseTrackSelection::getSelectionHelper(femto_universe_track_selection::kITSnClsMin, "Track selection: ")}; Configurable> ConfTrkITSnclsIbMin{FemtoUniverseTrackSelection::getSelectionName(femto_universe_track_selection::kITSnClsIbMin, "ConfTrk"), std::vector{-1.f, 1.f}, FemtoUniverseTrackSelection::getSelectionHelper(femto_universe_track_selection::kITSnClsIbMin, "Track selection: ")}; Configurable> ConfTrkDCAxyMax{FemtoUniverseTrackSelection::getSelectionName(femto_universe_track_selection::kDCAxyMax, "ConfTrk"), std::vector{0.1f, 0.5f}, FemtoUniverseTrackSelection::getSelectionHelper(femto_universe_track_selection::kDCAxyMax, "Track selection: ")}; /// here we need an open cut to do the DCA fits later on! @@ -129,6 +132,7 @@ struct femtoUniverseProducerReducedTask { trackCuts.setSelection(ConfTrkTPCfCls, femto_universe_track_selection::kTPCfClsMin, femto_universe_selection::kLowerLimit); trackCuts.setSelection(ConfTrkTPCcRowsMin, femto_universe_track_selection::kTPCcRowsMin, femto_universe_selection::kLowerLimit); trackCuts.setSelection(ConfTrkTPCsCls, femto_universe_track_selection::kTPCsClsMax, femto_universe_selection::kUpperLimit); + trackCuts.setSelection(ConfTrkTPCfracsCls, femto_universe_track_selection::kTPCfracsClsMax, femto_universe_selection::kUpperLimit); trackCuts.setSelection(ConfTrkITSnclsMin, femto_universe_track_selection::kITSnClsMin, femto_universe_selection::kLowerLimit); trackCuts.setSelection(ConfTrkITSnclsIbMin, femto_universe_track_selection::kITSnClsIbMin, femto_universe_selection::kLowerLimit); trackCuts.setSelection(ConfTrkDCAxyMax, femto_universe_track_selection::kDCAxyMax, femto_universe_selection::kAbsUpperLimit); @@ -289,6 +293,7 @@ struct femtoUniverseProducerReducedTask { track.tpcNClsFindable(), (uint8_t)track.tpcNClsCrossedRows(), track.tpcNClsShared(), + track.tpcFractionSharedCls(), track.tpcInnerParam(), track.itsNCls(), track.itsNClsInnerBarrel(), diff --git a/PWGCF/FemtoUniverse/TableProducer/femtoUniverseProducerTask.cxx b/PWGCF/FemtoUniverse/TableProducer/femtoUniverseProducerTask.cxx index 59f689f06a9..3a9db16b336 100644 --- a/PWGCF/FemtoUniverse/TableProducer/femtoUniverseProducerTask.cxx +++ b/PWGCF/FemtoUniverse/TableProducer/femtoUniverseProducerTask.cxx @@ -162,23 +162,27 @@ struct FemtoUniverseProducerTask { // "True: reject if neither ITS hit nor TOF timing satisfied"}; FemtoUniverseTrackSelection trackCuts; - Configurable> confTrkCharge{FemtoUniverseTrackSelection::getSelectionName(femto_universe_track_selection::kSign, "ConfTrk"), std::vector{-1, 1}, FemtoUniverseTrackSelection::getSelectionHelper(femto_universe_track_selection::kSign, "Track selection: ")}; - Configurable> confTrkPtmin{FemtoUniverseTrackSelection::getSelectionName(femto_universe_track_selection::kpTMin, "ConfTrk"), std::vector{0.5f, 0.4f, 0.6f}, FemtoUniverseTrackSelection::getSelectionHelper(femto_universe_track_selection::kpTMin, "Track selection: ")}; - Configurable> confTrkPtmax{FemtoUniverseTrackSelection::getSelectionName(femto_universe_track_selection::kpTMax, "ConfTrk"), std::vector{5.4f, 5.6f, 5.5f}, FemtoUniverseTrackSelection::getSelectionHelper(femto_universe_track_selection::kpTMax, "Track selection: ")}; - Configurable> confTrkEta{FemtoUniverseTrackSelection::getSelectionName(femto_universe_track_selection::kEtaMax, "ConfTrk"), std::vector{0.8f, 0.7f, 0.9f}, FemtoUniverseTrackSelection::getSelectionHelper(femto_universe_track_selection::kEtaMax, "Track selection: ")}; - Configurable> confTrkTPCnclsMin{FemtoUniverseTrackSelection::getSelectionName(femto_universe_track_selection::kTPCnClsMin, "ConfTrk"), std::vector{70.f}, FemtoUniverseTrackSelection::getSelectionHelper(femto_universe_track_selection::kTPCnClsMin, "Track selection: ")}; - Configurable> confTrkTPCfCls{FemtoUniverseTrackSelection::getSelectionName(femto_universe_track_selection::kTPCfClsMin, "ConfTrk"), std::vector{0.83f}, FemtoUniverseTrackSelection::getSelectionHelper(femto_universe_track_selection::kTPCfClsMin, "Track selection: ")}; - Configurable> confTrkTPCcRowsMin{FemtoUniverseTrackSelection::getSelectionName(femto_universe_track_selection::kTPCcRowsMin, "ConfTrk"), std::vector{70.f, 60.f, 80.f}, FemtoUniverseTrackSelection::getSelectionHelper(femto_universe_track_selection::kTPCcRowsMin, "Track selection: ")}; - Configurable> confTrkTPCsCls{FemtoUniverseTrackSelection::getSelectionName(femto_universe_track_selection::kTPCsClsMax, "ConfTrk"), std::vector{0.1f, 160.f}, FemtoUniverseTrackSelection::getSelectionHelper(femto_universe_track_selection::kTPCsClsMax, "Track selection: ")}; - Configurable> confTrkITSnclsMin{FemtoUniverseTrackSelection::getSelectionName(femto_universe_track_selection::kITSnClsMin, "ConfTrk"), std::vector{-1.f, 2.f, 4.f}, FemtoUniverseTrackSelection::getSelectionHelper(femto_universe_track_selection::kITSnClsMin, "Track selection: ")}; - Configurable> confTrkITSnclsIbMin{FemtoUniverseTrackSelection::getSelectionName(femto_universe_track_selection::kITSnClsIbMin, "ConfTrk"), std::vector{-1.f, 1.f}, FemtoUniverseTrackSelection::getSelectionHelper(femto_universe_track_selection::kITSnClsIbMin, "Track selection: ")}; - Configurable> confTrkDCAxyMax{FemtoUniverseTrackSelection::getSelectionName(femto_universe_track_selection::kDCAxyMax, "ConfTrk"), std::vector{0.1f, 3.5f}, FemtoUniverseTrackSelection::getSelectionHelper(femto_universe_track_selection::kDCAxyMax, "Track selection: ")}; - Configurable> confTrkDCAzMax{FemtoUniverseTrackSelection::getSelectionName(femto_universe_track_selection::kDCAzMax, "ConfTrk"), std::vector{0.2f}, FemtoUniverseTrackSelection::getSelectionHelper(femto_universe_track_selection::kDCAzMax, "Track selection: ")}; /// \todo Reintegrate PID to the general selection container - Configurable> confTrkPIDnSigmaMax{FemtoUniverseTrackSelection::getSelectionName(femto_universe_track_selection::kPIDnSigmaMax, "ConfTrk"), std::vector{3.5f, 3.f, 2.5f}, FemtoUniverseTrackSelection::getSelectionHelper(femto_universe_track_selection::kPIDnSigmaMax, "Track selection: ")}; + struct : o2::framework::ConfigurableGroup { + Configurable> confTrkCharge{FemtoUniverseTrackSelection::getSelectionName(femto_universe_track_selection::kSign, "ConfTrk"), std::vector{-1, 1}, FemtoUniverseTrackSelection::getSelectionHelper(femto_universe_track_selection::kSign, "Track selection: ")}; + Configurable> confTrkPtmin{FemtoUniverseTrackSelection::getSelectionName(femto_universe_track_selection::kpTMin, "ConfTrk"), std::vector{0.5f, 0.4f, 0.6f}, FemtoUniverseTrackSelection::getSelectionHelper(femto_universe_track_selection::kpTMin, "Track selection: ")}; + Configurable> confTrkPtmax{FemtoUniverseTrackSelection::getSelectionName(femto_universe_track_selection::kpTMax, "ConfTrk"), std::vector{5.4f, 5.6f, 5.5f}, FemtoUniverseTrackSelection::getSelectionHelper(femto_universe_track_selection::kpTMax, "Track selection: ")}; + Configurable> confTrkEta{FemtoUniverseTrackSelection::getSelectionName(femto_universe_track_selection::kEtaMax, "ConfTrk"), std::vector{0.8f, 0.7f, 0.9f}, FemtoUniverseTrackSelection::getSelectionHelper(femto_universe_track_selection::kEtaMax, "Track selection: ")}; + Configurable> confTrkTPCnclsMin{FemtoUniverseTrackSelection::getSelectionName(femto_universe_track_selection::kTPCnClsMin, "ConfTrk"), std::vector{70.f}, FemtoUniverseTrackSelection::getSelectionHelper(femto_universe_track_selection::kTPCnClsMin, "Track selection: ")}; + Configurable> confTrkTPCfCls{FemtoUniverseTrackSelection::getSelectionName(femto_universe_track_selection::kTPCfClsMin, "ConfTrk"), std::vector{0.83f}, FemtoUniverseTrackSelection::getSelectionHelper(femto_universe_track_selection::kTPCfClsMin, "Track selection: ")}; + Configurable> confTrkTPCcRowsMin{FemtoUniverseTrackSelection::getSelectionName(femto_universe_track_selection::kTPCcRowsMin, "ConfTrk"), std::vector{70.f, 60.f, 80.f}, FemtoUniverseTrackSelection::getSelectionHelper(femto_universe_track_selection::kTPCcRowsMin, "Track selection: ")}; + Configurable> confTrkTPCsCls{FemtoUniverseTrackSelection::getSelectionName(femto_universe_track_selection::kTPCsClsMax, "ConfTrk"), std::vector{0.1f, 160.f}, FemtoUniverseTrackSelection::getSelectionHelper(femto_universe_track_selection::kTPCsClsMax, "Track selection: ")}; + Configurable> confTrkTPCfracsCls{FemtoUniverseTrackSelection::getSelectionName(femto_universe_track_selection::kTPCfracsClsMax, "ConfTrk"), std::vector{0.1f, 160.f}, FemtoUniverseTrackSelection::getSelectionHelper(femto_universe_track_selection::kTPCfracsClsMax, "Track selection: ")}; + Configurable> confTrkITSnclsMin{FemtoUniverseTrackSelection::getSelectionName(femto_universe_track_selection::kITSnClsMin, "ConfTrk"), std::vector{-1.f, 2.f, 4.f}, FemtoUniverseTrackSelection::getSelectionHelper(femto_universe_track_selection::kITSnClsMin, "Track selection: ")}; + Configurable> confTrkITSnclsIbMin{FemtoUniverseTrackSelection::getSelectionName(femto_universe_track_selection::kITSnClsIbMin, "ConfTrk"), std::vector{-1.f, 1.f}, FemtoUniverseTrackSelection::getSelectionHelper(femto_universe_track_selection::kITSnClsIbMin, "Track selection: ")}; + Configurable> confTrkDCAxyMax{FemtoUniverseTrackSelection::getSelectionName(femto_universe_track_selection::kDCAxyMax, "ConfTrk"), std::vector{0.1f, 3.5f}, FemtoUniverseTrackSelection::getSelectionHelper(femto_universe_track_selection::kDCAxyMax, "Track selection: ")}; + Configurable> confTrkDCAzMax{FemtoUniverseTrackSelection::getSelectionName(femto_universe_track_selection::kDCAzMax, "ConfTrk"), std::vector{0.2f}, FemtoUniverseTrackSelection::getSelectionHelper(femto_universe_track_selection::kDCAzMax, "Track selection: ")}; /// \todo Reintegrate PID to the general selection container + Configurable> confTrkPIDnSigmaMax{FemtoUniverseTrackSelection::getSelectionName(femto_universe_track_selection::kPIDnSigmaMax, "ConfTrk"), std::vector{3.5f, 3.f, 2.5f}, FemtoUniverseTrackSelection::getSelectionHelper(femto_universe_track_selection::kPIDnSigmaMax, "Track selection: ")}; + Configurable> confTrkPIDspecies{"confTrkPIDspecies", std::vector{o2::track::PID::Pion, o2::track::PID::Kaon, o2::track::PID::Proton, o2::track::PID::Deuteron}, "Trk sel: Particles species for PID (Pion=2, Kaon=3, Proton=4, Deuteron=5)"}; + // Numbers from ~/alice/O2/DataFormats/Reconstruction/include/ReconstructionDataFormats/PID.h //static constexpr ID Pion = 2; static constexpr ID Kaon = 3; static constexpr ID Proton = 4; static constexpr ID Deuteron = 5; + } ConfTrkSelection; + Configurable confTrkPIDnSigmaOffsetTPC{"confTrkPIDnSigmaOffsetTPC", 0., "Offset for TPC nSigma because of bad calibration"}; Configurable confTrkPIDnSigmaOffsetTOF{"confTrkPIDnSigmaOffsetTOF", 0., "Offset for TOF nSigma because of bad calibration"}; - Configurable> confTrkPIDspecies{"confTrkPIDspecies", std::vector{o2::track::PID::Pion, o2::track::PID::Kaon, o2::track::PID::Proton, o2::track::PID::Deuteron}, "Trk sel: Particles species for PID (Pion=2, Kaon=3, Proton=4, Deuteron=5)"}; - // Numbers from ~/alice/O2/DataFormats/Reconstruction/include/ReconstructionDataFormats/PID.h //static constexpr ID Pion = 2; static constexpr ID Kaon = 3; static constexpr ID Proton = 4; static constexpr ID Deuteron = 5; Configurable confTOFpTmin{"confTOFpTmin", 500, "TOF pT min"}; // TrackSelection *o2PhysicsTrackSelection; @@ -473,20 +477,21 @@ struct FemtoUniverseProducerTask { colCuts.setCuts(confEvtZvtx, confEvtTriggerCheck, confEvtTriggerSel, confEvtOfflineCheck, confIsRun3, confCentFT0Min, confCentFT0Max); colCuts.init(&qaRegistry); - trackCuts.setSelection(confTrkCharge, femto_universe_track_selection::kSign, femto_universe_selection::kEqual); - trackCuts.setSelection(confTrkPtmin, femto_universe_track_selection::kpTMin, femto_universe_selection::kLowerLimit); - trackCuts.setSelection(confTrkPtmax, femto_universe_track_selection::kpTMax, femto_universe_selection::kUpperLimit); - trackCuts.setSelection(confTrkEta, femto_universe_track_selection::kEtaMax, femto_universe_selection::kAbsUpperLimit); - trackCuts.setSelection(confTrkTPCnclsMin, femto_universe_track_selection::kTPCnClsMin, femto_universe_selection::kLowerLimit); - trackCuts.setSelection(confTrkTPCfCls, femto_universe_track_selection::kTPCfClsMin, femto_universe_selection::kLowerLimit); - trackCuts.setSelection(confTrkTPCcRowsMin, femto_universe_track_selection::kTPCcRowsMin, femto_universe_selection::kLowerLimit); - trackCuts.setSelection(confTrkTPCsCls, femto_universe_track_selection::kTPCsClsMax, femto_universe_selection::kUpperLimit); - trackCuts.setSelection(confTrkITSnclsMin, femto_universe_track_selection::kITSnClsMin, femto_universe_selection::kLowerLimit); - trackCuts.setSelection(confTrkITSnclsIbMin, femto_universe_track_selection::kITSnClsIbMin, femto_universe_selection::kLowerLimit); - trackCuts.setSelection(confTrkDCAxyMax, femto_universe_track_selection::kDCAxyMax, femto_universe_selection::kAbsUpperLimit); - trackCuts.setSelection(confTrkDCAzMax, femto_universe_track_selection::kDCAzMax, femto_universe_selection::kAbsUpperLimit); - trackCuts.setSelection(confTrkPIDnSigmaMax, femto_universe_track_selection::kPIDnSigmaMax, femto_universe_selection::kAbsUpperLimit); - trackCuts.setPIDSpecies(confTrkPIDspecies); + trackCuts.setSelection(ConfTrkSelection.confTrkCharge, femto_universe_track_selection::kSign, femto_universe_selection::kEqual); + trackCuts.setSelection(ConfTrkSelection.confTrkPtmin, femto_universe_track_selection::kpTMin, femto_universe_selection::kLowerLimit); + trackCuts.setSelection(ConfTrkSelection.confTrkPtmax, femto_universe_track_selection::kpTMax, femto_universe_selection::kUpperLimit); + trackCuts.setSelection(ConfTrkSelection.confTrkEta, femto_universe_track_selection::kEtaMax, femto_universe_selection::kAbsUpperLimit); + trackCuts.setSelection(ConfTrkSelection.confTrkTPCnclsMin, femto_universe_track_selection::kTPCnClsMin, femto_universe_selection::kLowerLimit); + trackCuts.setSelection(ConfTrkSelection.confTrkTPCfCls, femto_universe_track_selection::kTPCfClsMin, femto_universe_selection::kLowerLimit); + trackCuts.setSelection(ConfTrkSelection.confTrkTPCcRowsMin, femto_universe_track_selection::kTPCcRowsMin, femto_universe_selection::kLowerLimit); + trackCuts.setSelection(ConfTrkSelection.confTrkTPCsCls, femto_universe_track_selection::kTPCsClsMax, femto_universe_selection::kUpperLimit); + trackCuts.setSelection(ConfTrkSelection.confTrkTPCfracsCls, femto_universe_track_selection::kTPCfracsClsMax, femto_universe_selection::kUpperLimit); + trackCuts.setSelection(ConfTrkSelection.confTrkITSnclsMin, femto_universe_track_selection::kITSnClsMin, femto_universe_selection::kLowerLimit); + trackCuts.setSelection(ConfTrkSelection.confTrkITSnclsIbMin, femto_universe_track_selection::kITSnClsIbMin, femto_universe_selection::kLowerLimit); + trackCuts.setSelection(ConfTrkSelection.confTrkDCAxyMax, femto_universe_track_selection::kDCAxyMax, femto_universe_selection::kAbsUpperLimit); + trackCuts.setSelection(ConfTrkSelection.confTrkDCAzMax, femto_universe_track_selection::kDCAzMax, femto_universe_selection::kAbsUpperLimit); + trackCuts.setSelection(ConfTrkSelection.confTrkPIDnSigmaMax, femto_universe_track_selection::kPIDnSigmaMax, femto_universe_selection::kAbsUpperLimit); + trackCuts.setPIDSpecies(ConfTrkSelection.confTrkPIDspecies); trackCuts.setnSigmaPIDOffset(confTrkPIDnSigmaOffsetTPC, confTrkPIDnSigmaOffsetTOF); trackCuts.init(&qaRegistry); @@ -649,7 +654,7 @@ struct FemtoUniverseProducerTask { outputDebugParts(particle.sign(), (uint8_t)particle.tpcNClsFound(), particle.tpcNClsFindable(), (uint8_t)particle.tpcNClsCrossedRows(), - particle.tpcNClsShared(), particle.tpcInnerParam(), + particle.tpcNClsShared(), particle.tpcFractionSharedCls(), particle.tpcInnerParam(), particle.itsNCls(), particle.itsNClsInnerBarrel(), particle.dcaXY(), particle.dcaZ(), particle.tpcSignal(), particle.tpcNSigmaStoreEl(), particle.tpcNSigmaStorePi(), @@ -659,14 +664,14 @@ struct FemtoUniverseProducerTask { particle.tofNSigmaStorePr(), particle.tofNSigmaStoreDe(), -999., -999., -999., -999., -999., -999.); } else if constexpr (isPhiOrD0) { - outputDebugParts(-999., -999., -999., -999., -999., -999., -999., -999., + outputDebugParts(-999., -999., -999., -999., -999., -999., -999., -999., -999., -999., -999., -999., -999., -999., -999., -999., -999., -999., -999., -999., -999., -999., -999., -999., -999., -999., -999., -999.); // QA for phi or D0/D0bar } else if constexpr (isXi) { - outputDebugParts(-999., -999., -999., -999., -999., -999., -999., -999., + outputDebugParts(-999., -999., -999., -999., -999., -999., -999., -999., -999., -999., -999., -999., -999., -999., -999., -999., -999., -999., -999., -999., -999., -999., particle.dcacascdaughters(), particle.cascradius(), @@ -674,7 +679,7 @@ struct FemtoUniverseProducerTask { particle.mOmega()); // QA for Xi Cascades (later do the same for Omegas) } else { // LOGF(info, "isTrack0orV0: %d, isPhi: %d", isTrackOrV0, isPhiOrD0); - outputDebugParts(-999., -999., -999., -999., -999., -999., -999., -999., + outputDebugParts(-999., -999., -999., -999., -999., -999., -999., -999., -999., particle.dcav0topv(), -999., -999., -999., -999., -999., -999., -999., -999., -999., -999., -999., -999., particle.dcaV0daughters(), particle.v0radius(), diff --git a/PWGCF/FemtoUniverse/TableProducer/femtoUniverseProducerTaskV0Only.cxx b/PWGCF/FemtoUniverse/TableProducer/femtoUniverseProducerTaskV0Only.cxx index 09ac22d0e30..cbb9e02b81a 100644 --- a/PWGCF/FemtoUniverse/TableProducer/femtoUniverseProducerTaskV0Only.cxx +++ b/PWGCF/FemtoUniverse/TableProducer/femtoUniverseProducerTaskV0Only.cxx @@ -14,6 +14,8 @@ /// \author Zuzanna Chochulska, WUT Warsaw & CTU Prague, zchochul@cern.ch #include +#include + #include "Common/Core/trackUtilities.h" #include "Common/DataModel/EventSelection.h" #include "Common/DataModel/Multiplicity.h" @@ -468,7 +470,7 @@ struct femtoUniverseProducerTaskV0Only { postrack.sign(), (uint8_t)postrack.tpcNClsFound(), postrack.tpcNClsFindable(), (uint8_t)postrack.tpcNClsCrossedRows(), - postrack.tpcNClsShared(), postrack.tpcInnerParam(), + postrack.tpcNClsShared(), postrack.tpcFractionSharedCls(), postrack.tpcInnerParam(), postrack.itsNCls(), postrack.itsNClsInnerBarrel(), postrack.dcaXY(), postrack.dcaZ(), postrack.tpcSignal(), postrack.tpcNSigmaStoreEl(), postrack.tpcNSigmaStorePi(), @@ -482,7 +484,7 @@ struct femtoUniverseProducerTaskV0Only { negtrack.sign(), (uint8_t)negtrack.tpcNClsFound(), negtrack.tpcNClsFindable(), (uint8_t)negtrack.tpcNClsCrossedRows(), - negtrack.tpcNClsShared(), negtrack.tpcInnerParam(), + negtrack.tpcNClsShared(), negtrack.tpcFractionSharedCls(), negtrack.tpcInnerParam(), negtrack.itsNCls(), negtrack.itsNClsInnerBarrel(), negtrack.dcaXY(), negtrack.dcaZ(), negtrack.tpcSignal(), negtrack.tpcNSigmaStoreEl(), negtrack.tpcNSigmaStorePi(), @@ -492,7 +494,7 @@ struct femtoUniverseProducerTaskV0Only { negtrack.tofNSigmaStorePr(), negtrack.tofNSigmaStoreDe(), -999., -999., -999., -999., -999., -999.); // QA for negative daughter - outputDebugParts(-999., -999., -999., -999., -999., -999., -999., + outputDebugParts(-999., -999., -999., -999., -999., -999., -999., -999., -999., -999., -999., -999., -999., -999., -999., -999., -999., -999., -999., -999., -999., -999., v0.dcaV0daughters(), v0.v0radius(), v0.x(), v0.y(), From 4293ba7098e8f55e7303c079e9a7372a7e5f78ad Mon Sep 17 00:00:00 2001 From: czhang Date: Tue, 4 Feb 2025 15:08:55 +0100 Subject: [PATCH 15/16] [Common] Analysis-level muon re-alignment task and new tables definition (#9533) --- Common/DataModel/CMakeLists.txt | 3 +- Common/DataModel/FwdTrackReAlignTables.h | 67 +++++ Common/TableProducer/CMakeLists.txt | 5 + Common/TableProducer/muonRealignment.cxx | 368 +++++++++++++++++++++++ 4 files changed, 442 insertions(+), 1 deletion(-) create mode 100644 Common/DataModel/FwdTrackReAlignTables.h create mode 100644 Common/TableProducer/muonRealignment.cxx diff --git a/Common/DataModel/CMakeLists.txt b/Common/DataModel/CMakeLists.txt index 39e83d2a2dd..da5fde3a3b0 100644 --- a/Common/DataModel/CMakeLists.txt +++ b/Common/DataModel/CMakeLists.txt @@ -23,4 +23,5 @@ o2physics_add_header_only_library(DataModel MatchMFTFT0.h MftmchMatchingML.h ZDCInterCalib.h - EseTable.h) + EseTable.h + FwdTrackReAlignTables.h) diff --git a/Common/DataModel/FwdTrackReAlignTables.h b/Common/DataModel/FwdTrackReAlignTables.h new file mode 100644 index 00000000000..14367a8a2cd --- /dev/null +++ b/Common/DataModel/FwdTrackReAlignTables.h @@ -0,0 +1,67 @@ +// 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 FwdTrackReAlignTables.h +/// \brief Table definitions for re-aligned forward tracks +/// \author Chi Zhang , CEA-Saclay + +#ifndef COMMON_DATAMODEL_FWDTRACKREALIGNTABLES_H_ +#define COMMON_DATAMODEL_FWDTRACKREALIGNTABLES_H_ + +#include "Framework/AnalysisDataModel.h" + +namespace o2::aod +{ +namespace fwdtrack +{ +// Extra columns for re-aligned forward tracks +DECLARE_SOA_COLUMN(IsRemovable, isRemovable, int); //! flag to validate the re-aligned track +} // namespace fwdtrack + +// Tracks including MCH and/or MCH (plus optionally MFT) //! +DECLARE_SOA_TABLE_FULL(StoredFwdTracksReAlign, "FwdTracksReAlign", "AOD", "FWDTRACKREALIGN", + fwdtrack::X, fwdtrack::Y, fwdtrack::Z, fwdtrack::Phi, fwdtrack::Tgl, + fwdtrack::Signed1Pt, + fwdtrack::Px, + fwdtrack::Py, + fwdtrack::Pz, + fwdtrack::Chi2, + fwdtrack::IsRemovable); + +DECLARE_SOA_EXTENDED_TABLE(FwdTracksReAlign, StoredFwdTracksReAlign, "FWDTRACKREALIGN", //! + aod::fwdtrack::Eta, + aod::fwdtrack::Pt, + aod::fwdtrack::P); + +DECLARE_SOA_TABLE_FULL(StoredFwdTrksCovReAlign, "FwdTrksCovReAlign", "AOD", "FWDTRKCOVREALIGN", //! + fwdtrack::SigmaX, fwdtrack::SigmaY, fwdtrack::SigmaPhi, fwdtrack::SigmaTgl, fwdtrack::Sigma1Pt, + fwdtrack::RhoXY, fwdtrack::RhoPhiY, fwdtrack::RhoPhiX, fwdtrack::RhoTglX, fwdtrack::RhoTglY, + fwdtrack::RhoTglPhi, fwdtrack::Rho1PtX, fwdtrack::Rho1PtY, fwdtrack::Rho1PtPhi, fwdtrack::Rho1PtTgl); + +DECLARE_SOA_EXTENDED_TABLE(FwdTrksCovReAlign, StoredFwdTrksCovReAlign, "FWDTRKCOVREALIGN", //! + aod::fwdtrack::CXX, + aod::fwdtrack::CXY, + aod::fwdtrack::CYY, + aod::fwdtrack::CPhiX, + aod::fwdtrack::CPhiY, + aod::fwdtrack::CPhiPhi, + aod::fwdtrack::CTglX, + aod::fwdtrack::CTglY, + aod::fwdtrack::CTglPhi, + aod::fwdtrack::CTglTgl, + aod::fwdtrack::C1PtX, + aod::fwdtrack::C1PtY, + aod::fwdtrack::C1PtPhi, + aod::fwdtrack::C1PtTgl, + aod::fwdtrack::C1Pt21Pt2); +} // namespace o2::aod + +#endif // COMMON_DATAMODEL_FWDTRACKREALIGNTABLES_H_ diff --git a/Common/TableProducer/CMakeLists.txt b/Common/TableProducer/CMakeLists.txt index ffa3501ee80..da33e33d0e4 100644 --- a/Common/TableProducer/CMakeLists.txt +++ b/Common/TableProducer/CMakeLists.txt @@ -144,3 +144,8 @@ o2physics_add_dpl_workflow(mftmch-matching-data-mc SOURCES match-mft-mch-data-mc.cxx PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore O2::DetectorsBase O2Physics::AnalysisCCDB O2Physics::PWGDQCore O2Physics::EventFilteringUtils COMPONENT_NAME Analysis) + +o2physics_add_dpl_workflow(muon-realignment + SOURCES muonRealignment.cxx + PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore O2::DetectorsBase O2::DetectorsCommonDataFormats O2::MathUtils O2::MCHTracking O2::DataFormatsMCH O2::GlobalTracking O2::MCHBase O2::MCHGeometryTransformer O2::CommonUtils + COMPONENT_NAME Analysis) \ No newline at end of file diff --git a/Common/TableProducer/muonRealignment.cxx b/Common/TableProducer/muonRealignment.cxx new file mode 100644 index 00000000000..16e6fa366d4 --- /dev/null +++ b/Common/TableProducer/muonRealignment.cxx @@ -0,0 +1,368 @@ +// 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 muonRealignment.cxx +/// \brief Task for muon re-alignment at analysis level +/// \author Chi Zhang , CEA-Saclay + +#include +#include +#include "Framework/AnalysisDataModel.h" +#include "Framework/AnalysisTask.h" +#include "Framework/runDataProcessing.h" + +#include "CCDB/BasicCCDBManager.h" +#include "CCDB/CCDBTimeStampUtils.h" +#include "CommonUtils/NameConf.h" +#include "CommonUtils/ConfigurableParam.h" +#include "DataFormatsMCH/Cluster.h" +#include "DataFormatsParameters/GRPObject.h" +#include "DetectorsBase/GeometryManager.h" +#include "DetectorsBase/GRPGeomHelper.h" +#include "DetectorsBase/Propagator.h" +#include "MathUtils/Cartesian.h" +#include "MCHGeometryTransformer/Transformations.h" +#include "MCHTracking/Track.h" +#include "MCHTracking/TrackExtrap.h" +#include "MCHTracking/TrackParam.h" +#include "MCHTracking/TrackFitter.h" +#include "MCHBase/TrackerParam.h" +#include "GlobalTracking/MatchGlobalFwd.h" +#include "ReconstructionDataFormats/TrackFwd.h" +#include "Common/DataModel/FwdTrackReAlignTables.h" + +using namespace std; +using namespace o2; +using namespace o2::framework; +using namespace o2::mch; +using namespace o2::framework::expressions; + +const int fgNDetElemCh[10] = {4, 4, 4, 4, 18, 18, 26, 26, 26, 26}; +const int fgSNDetElemCh[11] = {0, 4, 8, 12, 16, 34, 52, 78, 104, 130, 156}; + +struct MuonRealignment { + Produces realignFwdTrks; + Produces realignFwdTrksCov; + + Configurable ccdburl{"ccdb-url", "http://alice-ccdb.cern.ch", "url of the ccdb repository"}; + Configurable geoRefPath{"geoRefPath", "GLO/Config/GeometryAligned", "Path of the reference geometry file"}; + Configurable geoNewPath{"geoNewPath", "GLO/Config/GeometryAligned", "Path of the new geometry file"}; + Configurable grpmagPath{"grpmagPath", "GLO/Config/GRPMagField", "CCDB path of the GRPMagField object"}; + Configurable grpPathLocal{"grpPathLocal", "", "Local path of the GRP object if not using CCDB"}; + Configurable geoNewPathLocal{"geoNewPathLocal", "", "Local path of the GRP object if not using CCDB"}; + Configurable nolaterthanRef{"ccdb-no-later-than-ref", std::chrono::duration_cast(std::chrono::system_clock::now().time_since_epoch()).count(), "latest acceptable timestamp of creation for the object of reference basis"}; + Configurable nolaterthanNew{"ccdb-no-later-than-new", std::chrono::duration_cast(std::chrono::system_clock::now().time_since_epoch()).count(), "latest acceptable timestamp of creation for the object of new basis"}; + Configurable cfgChamberResolutionX{"cfgChamberResolutionX", 0.04, "Chamber resolution along X configuration for refit"}; // 0.4cm pp, 0.2cm PbPb + Configurable cfgChamberResolutionY{"cfgChamberResolutionY", 0.04, "Chamber resolution along Y configuration for refit"}; // 0.4cm pp, 0.2cm PbPb + Configurable cfgSigmaCutImprove{"cfgSigmaCutImprove", 6., "Sigma cut for track improvement"}; // 6 for pp, 4 for PbPb + Configurable fUseRemoteField{"cfgUseRemoteField", true, "Chose whether to fetch the magnetic field from ccdb or set it manually"}; + Configurable fUseRemoteGeometry{"cfgUseRemoteGeometry", false, "Chose whether to fetch new geometry from ccdb or set it manually"}; + + parameters::GRPMagField* grpmag = nullptr; + base::MatLayerCylSet* lut = nullptr; + TrackFitter trackFitter; // Track fitter from MCH tracking library + geo::TransformationCreator transformation; + map transformRef; // reference geometry w.r.t track data + map transformNew; // new geometry + globaltracking::MatchGlobalFwd mMatching; + int fCurrentRun; // needed to detect if the run changed and trigger update of calibrations etc. + double mImproveCutChi2; // Chi2 cut for track improvement. + Service ccdb; + TGeoManager* geoNew = nullptr; + TGeoManager* geoRef = nullptr; + + Preslice perMuon = aod::fwdtrkcl::fwdtrackId; + + int GetDetElemId(int iDetElemNumber) + { + // make sure detector number is valid + if (!(iDetElemNumber >= fgSNDetElemCh[0] && + iDetElemNumber < fgSNDetElemCh[10])) { + LOGF(fatal, "Invalid detector element number: %d", iDetElemNumber); + } + /// get det element number from ID + // get chamber and element number in chamber + int iCh = 0; + int iDet = 0; + for (int i = 1; i <= 10; i++) { + if (iDetElemNumber < fgSNDetElemCh[i]) { + iCh = i; + iDet = iDetElemNumber - fgSNDetElemCh[i - 1]; + break; + } + } + + // make sure detector index is valid + if (!(iCh > 0 && iCh <= 10 && iDet < fgNDetElemCh[iCh - 1])) { + LOGF(fatal, "Invalid detector element id: %d", 100 * iCh + iDet); + } + + // add number of detectors up to this chamber + return 100 * iCh + iDet; + } + + bool RemoveTrack(mch::Track& track) + { + // Refit track with re-aligned clusters + bool removeTrack = false; + try { + trackFitter.fit(track, false); + } catch (exception const& e) { + removeTrack = true; + return removeTrack; + } + + auto itStartingParam = std::prev(track.rend()); + + while (true) { + + try { + trackFitter.fit(track, true, false, (itStartingParam == track.rbegin()) ? nullptr : &itStartingParam); + } catch (exception const&) { + removeTrack = true; + break; + } + + double worstLocalChi2 = -1.0; + + track.tagRemovableClusters(0x1F, false); + + auto itWorstParam = track.end(); + + for (auto itParam = track.begin(); itParam != track.end(); ++itParam) { + if (itParam->getLocalChi2() > worstLocalChi2) { + worstLocalChi2 = itParam->getLocalChi2(); + itWorstParam = itParam; + } + } + + if (worstLocalChi2 < mImproveCutChi2) { + break; + } + + if (!itWorstParam->isRemovable()) { + removeTrack = true; + track.removable(); + break; + } + + auto itNextParam = track.removeParamAtCluster(itWorstParam); + auto itNextToNextParam = (itNextParam == track.end()) ? itNextParam : std::next(itNextParam); + itStartingParam = track.rbegin(); + + if (track.getNClusters() < 10) { + removeTrack = true; + break; + } else { + while (itNextToNextParam != track.end()) { + if (itNextToNextParam->getClusterPtr()->getChamberId() != itNextParam->getClusterPtr()->getChamberId()) { + itStartingParam = std::make_reverse_iterator(++itNextParam); + break; + } + ++itNextToNextParam; + } + } + } + + if (!removeTrack) { + for (auto& param : track) { + param.setParameters(param.getSmoothParameters()); + param.setCovariances(param.getSmoothCovariances()); + } + } + + return removeTrack; + } + + void init(InitContext const&) + { + fCurrentRun = 0; + + // Configuration for CCDB server + ccdb->setURL(ccdburl.value); + ccdb->setCaching(true); + ccdb->setLocalObjectValidityChecking(); + + // Configuration for track fitter + const auto& trackerParam = TrackerParam::Instance(); + trackFitter.setBendingVertexDispersion(trackerParam.bendingVertexDispersion); + trackFitter.setChamberResolution(cfgChamberResolutionX.value, cfgChamberResolutionY.value); + trackFitter.smoothTracks(true); + trackFitter.useChamberResolution(); + mImproveCutChi2 = 2. * cfgSigmaCutImprove.value * cfgSigmaCutImprove.value; + } + + void process(aod::Collision const& collision, aod::FwdTracks const& tracks, aod::FwdTrkCls const& clusters, aod::BCsWithTimestamps const&) + { + auto bc = collision.template bc_as(); + if (fCurrentRun != bc.runNumber()) { + // Load magnetic field information from CCDB/local + if (fUseRemoteField) { + ccdb->setCreatedNotAfter(std::chrono::duration_cast(std::chrono::system_clock::now().time_since_epoch()).count()); + grpmag = ccdb->getForTimeStamp(grpmagPath, bc.timestamp()); + if (grpmag != nullptr) { + base::Propagator::initFieldFromGRP(grpmag); + TrackExtrap::setField(); + TrackExtrap::useExtrapV2(); + } else { + LOGF(fatal, "GRP object is not available in CCDB at timestamp=%llu", bc.timestamp()); + } + } else { + if (std::filesystem::exists(grpPathLocal.value)) { + const auto grp = parameters::GRPObject::loadFrom(grpPathLocal.value); + base::Propagator::initFieldFromGRP(grp); + TrackExtrap::setField(); + TrackExtrap::useExtrapV2(); + } else { + LOGF(fatal, "GRP object is not available in local path: %s", grpPathLocal.value); + } + } + + // Load geometry information from CCDB/local + LOGF(info, "Loading reference aligned geometry from CCDB no later than %d", nolaterthanRef.value); + ccdb->setCreatedNotAfter(nolaterthanRef.value); // this timestamp has to be consistent with what has been used in reco + geoRef = ccdb->getForTimeStamp(geoRefPath, bc.timestamp()); + ccdb->clearCache(geoRefPath); + if (geoRef != nullptr) { + transformation = geo::transformationFromTGeoManager(*geoRef); + } else { + LOGF(fatal, "Reference aligned geometry object is not available in CCDB at timestamp=%llu", bc.timestamp()); + } + for (int i = 0; i < 156; i++) { + int iDEN = GetDetElemId(i); + transformRef[iDEN] = transformation(iDEN); + } + + if (fUseRemoteGeometry) { + LOGF(info, "Loading new aligned geometry from CCDB no later than %d", nolaterthanNew.value); + ccdb->setCreatedNotAfter(nolaterthanNew.value); // make sure this timestamp can be resolved regarding the reference one + geoNew = ccdb->getForTimeStamp(geoNewPath, bc.timestamp()); + ccdb->clearCache(geoNewPath); + if (geoNew != nullptr) { + transformation = geo::transformationFromTGeoManager(*geoNew); + } else { + LOGF(fatal, "New aligned geometry object is not available in CCDB at timestamp=%llu", bc.timestamp()); + } + for (int i = 0; i < 156; i++) { + int iDEN = GetDetElemId(i); + transformNew[iDEN] = transformation(iDEN); + } + } else { + LOGF(info, "Loading new aligned geometry from local path: %s", geoNewPathLocal.value); + if (std::filesystem::exists(geoNewPathLocal.value)) { + base::GeometryManager::loadGeometry(geoNewPathLocal.value); + transformation = geo::transformationFromTGeoManager(*gGeoManager); + for (int i = 0; i < 156; i++) { + int iDEN = GetDetElemId(i); + transformNew[iDEN] = transformation(iDEN); + } + } else { + LOGF(fatal, "New geometry file is not available in local path: %s", geoNewPathLocal.value); + } + } + + fCurrentRun = bc.runNumber(); + } + + // Reserve storage for output table + realignFwdTrks.reserve(tracks.size()); + realignFwdTrksCov.reserve(tracks.size()); + + // Loop over forward tracks + for (auto const& track : tracks) { + if (track.has_collision()) { + if (track.trackType() == aod::fwdtrack::ForwardTrackTypeEnum::MuonStandaloneTrack || track.trackType() == aod::fwdtrack::ForwardTrackTypeEnum::MCHStandaloneTrack) { + + auto clustersSliced = clusters.sliceBy(perMuon, track.globalIndex()); // Slice clusters by muon id + mch::Track convertedTrack = mch::Track(); // Temporary variable to store re-aligned clusters + int clIndex = -1; + // Get re-aligned clusters associated to current track + for (auto const& cluster : clustersSliced) { + clIndex += 1; + + mch::Cluster* clusterMCH = new mch::Cluster(); + + math_utils::Point3D local; + math_utils::Point3D master; + master.SetXYZ(cluster.x(), cluster.y(), cluster.z()); + + // Transformation from reference geometry frame to new geometry frame + transformRef[cluster.deId()].MasterToLocal(master, local); + transformNew[cluster.deId()].LocalToMaster(local, master); + + clusterMCH->x = master.x(); + clusterMCH->y = master.y(); + clusterMCH->z = master.z(); + + uint32_t ClUId = mch::Cluster::buildUniqueId(static_cast(cluster.deId() / 100) - 1, cluster.deId(), clIndex); + clusterMCH->uid = ClUId; + clusterMCH->ex = cluster.isGoodX() ? 0.2 : 10.0; + clusterMCH->ey = cluster.isGoodY() ? 0.2 : 10.0; + + // Add transformed cluster into temporary variable + convertedTrack.createParamAtCluster(*clusterMCH); + LOGF(debug, "Track %d, cluster DE%d: x:%g y:%g z:%g", track.globalIndex(), cluster.deId(), cluster.x(), cluster.y(), cluster.z()); + LOGF(debug, "Track %d, re-aligned cluster DE%d: x:%g y:%g z:%g", track.globalIndex(), cluster.deId(), clusterMCH->getX(), clusterMCH->getY(), clusterMCH->getZ()); + } + + // Refit the re-aligned track + int removable = 0; + if (convertedTrack.getNClusters() != 0) { + removable = RemoveTrack(convertedTrack); + } else { + LOGF(fatal, "Muon track %d has no associated clusters.", track.globalIndex()); + } + + // Get the re-aligned track parameter: track param at the first cluster + mch::TrackParam trackParam = mch::TrackParam(convertedTrack.first()); + + // Convert MCH track to FWD track and get new parameters + auto fwdtrack = mMatching.MCHtoFwd(trackParam); + fwdtrack.setTrackChi2(trackParam.getTrackChi2() / convertedTrack.getNDF()); + float sigX = TMath::Sqrt(fwdtrack.getCovariances()(0, 0)); + float sigY = TMath::Sqrt(fwdtrack.getCovariances()(1, 1)); + float sigPhi = TMath::Sqrt(fwdtrack.getCovariances()(2, 2)); + float sigTgl = TMath::Sqrt(fwdtrack.getCovariances()(3, 3)); + float sig1Pt = TMath::Sqrt(fwdtrack.getCovariances()(4, 4)); + float rhoXY = (Char_t)(128. * fwdtrack.getCovariances()(0, 1) / (sigX * sigY)); + float rhoPhiX = (Char_t)(128. * fwdtrack.getCovariances()(0, 2) / (sigPhi * sigX)); + float rhoPhiY = (Char_t)(128. * fwdtrack.getCovariances()(1, 2) / (sigPhi * sigY)); + float rhoTglX = (Char_t)(128. * fwdtrack.getCovariances()(0, 3) / (sigTgl * sigX)); + float rhoTglY = (Char_t)(128. * fwdtrack.getCovariances()(1, 3) / (sigTgl * sigY)); + float rhoTglPhi = (Char_t)(128. * fwdtrack.getCovariances()(2, 3) / (sigTgl * sigPhi)); + float rho1PtX = (Char_t)(128. * fwdtrack.getCovariances()(0, 4) / (sig1Pt * sigX)); + float rho1PtY = (Char_t)(128. * fwdtrack.getCovariances()(1, 4) / (sig1Pt * sigY)); + float rho1PtPhi = (Char_t)(128. * fwdtrack.getCovariances()(2, 4) / (sig1Pt * sigPhi)); + float rho1PtTgl = (Char_t)(128. * fwdtrack.getCovariances()(3, 4) / (sig1Pt * sigTgl)); + + LOGF(debug, "TrackParm %d, x:%g y:%g z:%g phi:%g tgl:%g InvQPt:%g chi2:%g nClusters:%d", track.globalIndex(), track.x(), track.y(), track.z(), track.phi(), track.tgl(), track.signed1Pt(), track.chi2(), track.nClusters()); + LOGF(debug, "Re-aligned trackParm %d, x:%g y:%g z:%g phi:%g tgl:%g InvQPt:%g chi2:%g nClusters:%d removable:%d", track.globalIndex(), fwdtrack.getX(), fwdtrack.getY(), fwdtrack.getZ(), fwdtrack.getPhi(), fwdtrack.getTgl(), fwdtrack.getInvQPt(), fwdtrack.getTrackChi2(), convertedTrack.getNClusters(), removable); + // Fill refitted track info + realignFwdTrks(fwdtrack.getX(), fwdtrack.getY(), fwdtrack.getZ(), fwdtrack.getPhi(), fwdtrack.getTgl(), fwdtrack.getInvQPt(), fwdtrack.getTrackChi2(), removable); + realignFwdTrksCov(sigX, sigY, sigPhi, sigTgl, sig1Pt, rhoXY, rhoPhiX, rhoPhiY, rhoTglX, rhoTglY, rhoTglPhi, rho1PtX, rho1PtY, rho1PtPhi, rho1PtTgl); + } else { + // Fill nothing for global muons + realignFwdTrks(-999., -999., -999., -999., -999., -999., -999., -999.); + realignFwdTrksCov(-999., -999., -999., -999., -999., 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); + } + } else { + // Fill nothing for tracks having no associated collision + realignFwdTrks(-999., -999., -999., -999., -999., -999., -999., -999.); + realignFwdTrksCov(-999., -999., -999., -999., -999., 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); + } + } + } +}; + +WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) +{ + return WorkflowSpec{adaptAnalysisTask(cfgc)}; +} From 484cfeef9dc0da93809f5f059e59e08e6573399a Mon Sep 17 00:00:00 2001 From: SuJeong Ji <120470463+SuJeong-Ji@users.noreply.github.com> Date: Tue, 4 Feb 2025 23:28:00 +0900 Subject: [PATCH 16/16] [PWGLF] Added 2(phi-psi) axis for inv mass (#9731) Co-authored-by: ALICE Action Bot --- PWGLF/Tasks/Resonances/chk892Flow.cxx | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/PWGLF/Tasks/Resonances/chk892Flow.cxx b/PWGLF/Tasks/Resonances/chk892Flow.cxx index a6007dec743..cee87dda909 100644 --- a/PWGLF/Tasks/Resonances/chk892Flow.cxx +++ b/PWGLF/Tasks/Resonances/chk892Flow.cxx @@ -117,8 +117,9 @@ struct Chk892Flow { Configurable cNbinsDiv{"cNbinsDiv", 1, "Integer to divide the number of bins"}; Configurable cNbinsDivQA{"cNbinsDivQA", 1, "Integer to divide the number of bins for QA"}; ConfigurableAxis cfgAxisV2{"cfgAxisV2", {200, -2, 2}, "Binning of the v2 axis"}; + ConfigurableAxis cfgAxisPhi{"cfgAxisPhi", {8, 0, constants::math::PI}, "Binning of the #phi axis"}; - /// Event cuts + // Event cuts o2::analysis::CollisonCuts colCuts; Configurable cfgEvtZvtx{"cfgEvtZvtx", 10.f, "Evt sel: Max. z-Vertex (cm)"}; Configurable cfgEvtOccupancyInTimeRangeMax{"cfgEvtOccupancyInTimeRangeMax", -1, "Evt sel: maximum track occupancy"}; @@ -245,6 +246,7 @@ struct Chk892Flow { AxisSpec ptAxis = {cfgBinsPt, "#it{p}_{T} (GeV/#it{c})"}; AxisSpec ptAxisQA = {cfgBinsPtQA, "#it{p}_{T} (GeV/#it{c})"}; AxisSpec v2Axis = {cfgAxisV2, "#v_{2}"}; + AxisSpec phiAxis = {cfgAxisPhi, "2(#phi-#Psi_{2})"}; AxisSpec radiusAxis = {50, 0, 5, "Radius (cm)"}; AxisSpec cpaAxis = {30, 0.97, 1.0, "CPA"}; AxisSpec tauAxis = {250, 0, 25, "Lifetime (cm)"}; @@ -341,8 +343,8 @@ struct Chk892Flow { // Kstar // Invariant mass nSparse - histos.add("hInvmass_Kstar", "Invariant mass of unlike-sign chK(892)", HistType::kTHnSparseD, {axisType, centAxis, ptAxis, invMassAxisReso, v2Axis}); - histos.add("hInvmass_K0s", "Invariant mass of unlike-sign K0s", HistType::kTHnSparseD, {centAxis, ptAxis, invMassAxisK0s, v2Axis}); + histos.add("hInvmass_Kstar", "Invariant mass of unlike-sign chK(892)", HistType::kTHnSparseD, {axisType, centAxis, ptAxis, invMassAxisReso, v2Axis, phiAxis}); + histos.add("hInvmass_K0s", "Invariant mass of unlike-sign K0s", HistType::kTHnSparseD, {centAxis, ptAxis, invMassAxisK0s, v2Axis, phiAxis}); // Mass QA (quick check) histos.add("QA/before/KstarRapidity", "Rapidity distribution of chK(892)", HistType::kTH1D, {yAxis}); @@ -821,7 +823,7 @@ struct Chk892Flow { histos.fill(HIST("QA/after/hInvmassSecondary"), trkkMass); histos.fill(HIST("QA/after/k0sv2vsinvmass"), lResoSecondary.M(), v2K0s); - histos.fill(HIST("hInvmass_K0s"), lCentrality, lResoSecondary.Pt(), lResoSecondary.M(), v2K0s); + histos.fill(HIST("hInvmass_K0s"), lCentrality, lResoSecondary.Pt(), lResoSecondary.M(), v2K0s, static_cast(nmode) * lPhiMinusPsiK0s); } k0sIndicies.push_back(k0sCand.index()); } @@ -854,7 +856,7 @@ struct Chk892Flow { histos.fill(HIST("QA/after/KstarRapidity"), lResoKstar.Rapidity()); histos.fill(HIST("QA/after/kstarinvmass"), lResoKstar.M()); histos.fill(HIST("QA/after/kstarv2vsinvmass"), lResoKstar.M(), v2Kstar); - histos.fill(HIST("hInvmass_Kstar"), typeKstar, lCentrality, lResoKstar.Pt(), lResoKstar.M(), v2Kstar); + histos.fill(HIST("hInvmass_Kstar"), typeKstar, lCentrality, lResoKstar.Pt(), lResoKstar.M(), v2Kstar, static_cast(nmode) * lPhiMinusPsiKstar); if (cfgFillRotBkg) { for (int i = 0; i < cfgNrotBkg; i++) { @@ -872,7 +874,7 @@ struct Chk892Flow { auto lPhiMinusPsiKstar = RecoDecay::constrainAngle(lResonanceRot.Phi() - lEPDet, 0.0, 2); // constrain angle to range 0, Pi auto v2Kstar = std::cos(static_cast(nmode) * lPhiMinusPsiKstar); typeKstar = bTrack.sign() > 0 ? BinType::kKstarP_Rot : BinType::kKstarN_Rot; - histos.fill(HIST("hInvmass_Kstar"), typeKstar, lCentrality, lResonanceRot.Pt(), lResonanceRot.M(), v2Kstar); + histos.fill(HIST("hInvmass_Kstar"), typeKstar, lCentrality, lResonanceRot.Pt(), lResonanceRot.M(), v2Kstar, static_cast(nmode) * lPhiMinusPsiKstar); } } } // IsMix