diff --git a/PWGCF/FemtoDream/TableProducer/femtoDreamProducerTaskForSpecificAnalysis.cxx b/PWGCF/FemtoDream/TableProducer/femtoDreamProducerTaskForSpecificAnalysis.cxx index 33f07d2772e..0f43b4ff8e0 100644 --- a/PWGCF/FemtoDream/TableProducer/femtoDreamProducerTaskForSpecificAnalysis.cxx +++ b/PWGCF/FemtoDream/TableProducer/femtoDreamProducerTaskForSpecificAnalysis.cxx @@ -53,9 +53,10 @@ struct FemtoDreamProducerTaskForSpecificAnalysis { Configurable confRequireBitmask{"confRequireBitmask", false, "Require bitmask selection for candidates"}; // Number of candidates required - Configurable confNumberOfTracks{"confNumberOfTracks", 3, "Number of tracks"}; - Configurable confNumberOfV0{"confNumberOfV0", 0, "Number of V0"}; + Configurable confNumberOfTracks{"confNumberOfTracks", 0, "Number of tracks"}; + Configurable confNumberOfV0{"confNumberOfV0", 1, "Number of V0"}; Configurable confNumberOfCascades{"confNumberOfCascades", 0, "Number of Cascades"}; + Configurable confNumberOfReso{"confNumberOfReso", 1, "Number of Reso"}; /// Track selection Configurable confPIDthrMom{"confPIDthrMom", 1.f, "Momentum threshold from which TPC and TOF are required for PID"}; @@ -83,13 +84,40 @@ struct FemtoDreamProducerTaskForSpecificAnalysis { Configurable confMinInvMassCascade{"confMinInvMassCascade", 1.2, "Minimum invariant mass of Cascade (particle)"}; Configurable confMaxInvMassCascade{"confMaxInvMassCascade", 1.5, "Maximum invariant mass of Cascade (particle)"}; + struct : ConfigurableGroup { // set loosest cuts + std::string prefix = std::string("Reso"); + Configurable pdgCode{"pdgCode", 333, "PDG code of particle 2 Reso"}; + + Configurable confMinInvMassReso{"confMinInvMassReso", 0.86, "Minimum invariant mass of Reso (particle)"}; + Configurable confMaxInvMassReso{"confMaxInvMassReso", 1.3, "Maximum invariant mass of Reso (particle)"}; + + Configurable daughPosCutBit{"daughPosCutBit", 2401446, "Selection bit for positive child of Reso"}; + Configurable daughNegCutBit{"daughNegCutBit", 2401445, "Selection bit for negative child of Reso"}; + } Reso; + // Partition for selected particles Partition selectedV0s = (aod::femtodreamparticle::partType == uint8_t(aod::femtodreamparticle::ParticleType::kV0)); Partition selectedCascades = (aod::femtodreamparticle::partType == uint8_t(aod::femtodreamparticle::ParticleType::kCascade)); + Partition selectedK0Short = (aod::femtodreamparticle::partType == uint8_t(aod::femtodreamparticle::ParticleType::kV0K0Short)); + + Partition selectedPhi = ((aod::femtodreamparticle::partType == uint8_t(aod::femtodreamparticle::kResoPosdaughTPC_NegdaughTPC)) || + (aod::femtodreamparticle::partType == uint8_t(aod::femtodreamparticle::kResoPosdaughTOF_NegdaughTOF)) || + (aod::femtodreamparticle::partType == uint8_t(aod::femtodreamparticle::kResoPosdaughTOF_NegdaughTPC)) || + (aod::femtodreamparticle::partType == uint8_t(aod::femtodreamparticle::kResoPosdaughTPC_NegdaughTOF))) && + ((aod::femtodreamparticle::mLambda > Reso.confMinInvMassReso) && + (aod::femtodreamparticle::mLambda < Reso.confMaxInvMassReso)); + + Partition selectedKStar = ((aod::femtodreamparticle::partType == uint8_t(aod::femtodreamparticle::kResoKStarPosdaughTPC_NegdaughTPC)) || + (aod::femtodreamparticle::partType == uint8_t(aod::femtodreamparticle::kResoKStarPosdaughTPC_NegdaughTOF)) || + (aod::femtodreamparticle::partType == uint8_t(aod::femtodreamparticle::kResoKStarPosdaughTOF_NegdaughTPC)) || + (aod::femtodreamparticle::partType == uint8_t(aod::femtodreamparticle::kResoKStarPosdaughTOF_NegdaughTOF))) && + ((aod::femtodreamparticle::mLambda > Reso.confMinInvMassReso) && + (aod::femtodreamparticle::mLambda < Reso.confMaxInvMassReso)); + HistogramRegistry eventRegistry{"eventRegistry", {}, OutputObjHandlingPolicy::AnalysisObject}; - static constexpr uint32_t kSignPlusMask = 1 << 1; + static constexpr uint32_t KSignPlusMask = 1 << 1; template int getRowDaughters(int daughID, T const& vecID) @@ -252,7 +280,7 @@ struct FemtoDreamProducerTaskForSpecificAnalysis { createSpecifiedDerivedData(col, thegroupSelectedParts, thegroupSelectedV0s, parts); } - PROCESS_SWITCH(FemtoDreamProducerTaskForSpecificAnalysis, processCollisionsWithNTracksAndNV0, "Enable producing data with ppp collisions for data", true); + PROCESS_SWITCH(FemtoDreamProducerTaskForSpecificAnalysis, processCollisionsWithNTracksAndNV0, "Enable producing data with ppp collisions for data", false); /// This function stores accepted collisions in derived data /// @tparam PartitionType @@ -280,7 +308,7 @@ struct FemtoDreamProducerTaskForSpecificAnalysis { int ascadeCount = 0; int antiCascadeCount = 0; for (const auto& casc : groupSelectedCascades) { - if ((casc.cut() & kSignPlusMask) == kSignPlusMask) { + if ((casc.cut() & KSignPlusMask) == KSignPlusMask) { ascadeCount++; } else { antiCascadeCount++; @@ -385,7 +413,323 @@ struct FemtoDreamProducerTaskForSpecificAnalysis { createSpecifiedDerivedDataTrkCascade(col, thegroupSelectedParts, thegroupSelectedCascades, parts); } - PROCESS_SWITCH(FemtoDreamProducerTaskForSpecificAnalysis, processCollisionsWithNTracksAndNCascades, "Enable producing data with tracks and Cascades collisions for data", true); + PROCESS_SWITCH(FemtoDreamProducerTaskForSpecificAnalysis, processCollisionsWithNTracksAndNCascades, "Enable producing data with tracks and Cascades collisions for data", false); + + template + void createSpecifiedDerivedDataV0Phi(const o2::aod::FDCollision& col, PartitionType groupSelectedV0s, PartitionType groupSelectedResos, PartType parts) + { + // check v0's + int v0Count = 0; + int antiV0Count = 0; + int resoCount = 0; // no antiparticles + + for (const auto& V0 : groupSelectedV0s) { + if ((V0.mLambda() > confMinInvMassV0) && (V0.mLambda() < confMaxInvMassV0)) { + if (confRequireBitmask) { + if (ncheckbit(V0.cut(), confCutV0SameForAntipart)) { + const auto& posChild = parts.iteratorAt(V0.index() - 2); + const auto& negChild = parts.iteratorAt(V0.index() - 1); + if (((posChild.cut() & confChildPosCutV0) == confChildPosCutV0 && + (posChild.pidcut() & confChildPosTPCBitV0) == confChildPosTPCBitV0 && + (negChild.cut() & confChildNegCutV0) == confChildNegCutV0 && + (negChild.pidcut() & confChildNegTPCBitV0) == confChildNegTPCBitV0)) { + v0Count++; + } + } + } else { + v0Count++; + } + } else if ((V0.mAntiLambda() > confMinInvMassAntiV0) && (V0.mAntiLambda() < confMaxInvMassAntiV0)) { + if (confRequireBitmask) { + if (ncheckbit(V0.cut(), confCutV0SameForAntipart)) { + const auto& posChild = parts.iteratorAt(V0.index() - 2); + const auto& negChild = parts.iteratorAt(V0.index() - 1); + if (((posChild.cut() & confChildPosCutV0) == confChildPosCutV0 && + (posChild.pidcut() & confChildNegTPCBitV0) == confChildNegTPCBitV0 && // exchanged values because checking antiparticle daughters and pid of particles exchange + (negChild.cut() & confChildNegCutV0) == confChildNegCutV0 && + (negChild.pidcut() & confChildPosTPCBitV0) == confChildPosTPCBitV0)) { // exchanged values because checking antiparticle daughters and pid of particles exchange + antiV0Count++; + } + } + } else { + antiV0Count++; + } + } + } + + for (const auto& reso : groupSelectedResos) { + if (confRequireBitmask) { + + const auto& posresoChild = parts.iteratorAt(reso.index() - 2); + const auto& negresoChild = parts.iteratorAt(reso.index() - 1); + + if (((posresoChild.cut() & Reso.daughPosCutBit) == Reso.daughPosCutBit) && + ((negresoChild.cut() & Reso.daughNegCutBit) == Reso.daughNegCutBit)) { + + resoCount++; + } + } else { + resoCount++; + } + } + + std::vector tmpIDtrack; + + if ((v0Count >= confNumberOfV0 && resoCount >= confNumberOfReso) || (antiV0Count >= confNumberOfV0 && resoCount >= confNumberOfReso)) { + eventRegistry.fill(HIST("hStatistiscs"), 1); + outputCollision(col.posZ(), col.multV0M(), col.multNtr(), col.sphericity(), col.magField()); + + for (const auto& femtoParticle : parts) { + + if (aod::femtodreamparticle::ParticleType::kResoChild == femtoParticle.partType()) { + std::vector childIDs; + const auto& children = femtoParticle.childrenIds(); + childIDs.push_back(children[0]); + childIDs.push_back(children[1]); + outputParts(outputCollision.lastIndex(), + femtoParticle.pt(), + femtoParticle.eta(), + femtoParticle.phi(), + femtoParticle.partType(), + femtoParticle.cut(), + femtoParticle.pidcut(), + femtoParticle.tempFitVar(), + childIDs, + femtoParticle.mLambda(), + femtoParticle.mAntiLambda()); + } + + if ((aod::femtodreamparticle::kResoPosdaughTPC_NegdaughTPC == femtoParticle.partType()) || + (aod::femtodreamparticle::kResoPosdaughTOF_NegdaughTOF == femtoParticle.partType()) || + (aod::femtodreamparticle::kResoPosdaughTOF_NegdaughTPC == femtoParticle.partType()) || + (aod::femtodreamparticle::kResoPosdaughTPC_NegdaughTOF == femtoParticle.partType())) { + + std::vector childIDs; + const auto& children = femtoParticle.childrenIds(); + childIDs.push_back(children[0]); + childIDs.push_back(children[1]); + outputParts(outputCollision.lastIndex(), + femtoParticle.pt(), + femtoParticle.eta(), + femtoParticle.phi(), + femtoParticle.partType(), + femtoParticle.cut(), + femtoParticle.pidcut(), + femtoParticle.tempFitVar(), + childIDs, + femtoParticle.mLambda(), + femtoParticle.mAntiLambda()); + } + + if (aod::femtodreamparticle::ParticleType::kV0Child == femtoParticle.partType()) { + std::vector childIDs; + const auto& children = femtoParticle.childrenIds(); + childIDs.push_back(children[0]); + childIDs.push_back(children[1]); + outputParts(outputCollision.lastIndex(), + femtoParticle.pt(), + femtoParticle.eta(), + femtoParticle.phi(), + femtoParticle.partType(), + femtoParticle.cut(), + femtoParticle.pidcut(), + femtoParticle.tempFitVar(), + childIDs, + femtoParticle.mLambda(), + femtoParticle.mAntiLambda()); + } + if (aod::femtodreamparticle::ParticleType::kV0 == femtoParticle.partType()) { + // If the order in primary producer is changed of storing first pos, neg daughters and then V0 - this must be updated + std::vector childIDs; + const auto& children = femtoParticle.childrenIds(); + childIDs.push_back(children[0]); + childIDs.push_back(children[1]); + outputParts(outputCollision.lastIndex(), + femtoParticle.pt(), + femtoParticle.eta(), + femtoParticle.phi(), + femtoParticle.partType(), + femtoParticle.cut(), + femtoParticle.pidcut(), + femtoParticle.tempFitVar(), + childIDs, + femtoParticle.mLambda(), + femtoParticle.mAntiLambda()); + } + } + } else { + eventRegistry.fill(HIST("hStatistiscs"), 2); + } + } + + void processCollisionsWithNV0AndNPhi(const o2::aod::FDCollision& col, + const o2::aod::FDParticles& parts) + { + eventRegistry.fill(HIST("hStatistiscs"), 0); + auto thegroupSelectedResos = selectedPhi->sliceByCached(aod::femtodreamparticle::fdCollisionId, col.globalIndex(), cache); + auto thegroupSelectedV0s = selectedV0s->sliceByCached(aod::femtodreamparticle::fdCollisionId, col.globalIndex(), cache); + + createSpecifiedDerivedDataV0Phi(col, thegroupSelectedV0s, thegroupSelectedResos, parts); + } + PROCESS_SWITCH(FemtoDreamProducerTaskForSpecificAnalysis, processCollisionsWithNV0AndNPhi, "Enable producing data with pp collisions for data v0-reso", true); + + template + void createSpecifiedDerivedDataK0ShortKStar(const o2::aod::FDCollision& col, PartitionType groupSelectedV0s, PartitionType groupSelectedResos, PartType parts) + { + // check v0's + int v0Count = 0; + int antiV0Count = 0; + int resoCount = 0; // no antiparticles + + for (const auto& V0 : groupSelectedV0s) { + if ((V0.mLambda() > confMinInvMassV0) && (V0.mLambda() < confMaxInvMassV0)) { + if (confRequireBitmask) { + if (ncheckbit(V0.cut(), confCutV0SameForAntipart)) { + const auto& posChild = parts.iteratorAt(V0.index() - 2); + const auto& negChild = parts.iteratorAt(V0.index() - 1); + if (((posChild.cut() & confChildPosCutV0) == confChildPosCutV0 && + (posChild.pidcut() & confChildPosTPCBitV0) == confChildPosTPCBitV0 && + (negChild.cut() & confChildNegCutV0) == confChildNegCutV0 && + (negChild.pidcut() & confChildNegTPCBitV0) == confChildNegTPCBitV0)) { + v0Count++; + } + } + } else { + v0Count++; + } + } else if ((V0.mAntiLambda() > confMinInvMassAntiV0) && (V0.mAntiLambda() < confMaxInvMassAntiV0)) { + if (confRequireBitmask) { + if (ncheckbit(V0.cut(), confCutV0SameForAntipart)) { + const auto& posChild = parts.iteratorAt(V0.index() - 2); + const auto& negChild = parts.iteratorAt(V0.index() - 1); + if (((posChild.cut() & confChildPosCutV0) == confChildPosCutV0 && + (posChild.pidcut() & confChildNegTPCBitV0) == confChildNegTPCBitV0 && // exchanged values because checking antiparticle daughters and pid of particles exchange + (negChild.cut() & confChildNegCutV0) == confChildNegCutV0 && + (negChild.pidcut() & confChildPosTPCBitV0) == confChildPosTPCBitV0)) { // exchanged values because checking antiparticle daughters and pid of particles exchange + antiV0Count++; + } + } + } else { + antiV0Count++; + } + } + } + + for (const auto& reso : groupSelectedResos) { + if (confRequireBitmask) { + + const auto& posresoChild = parts.iteratorAt(reso.index() - 2); + const auto& negresoChild = parts.iteratorAt(reso.index() - 1); + + if (((posresoChild.cut() & Reso.daughPosCutBit) == Reso.daughPosCutBit) && + ((negresoChild.cut() & Reso.daughNegCutBit) == Reso.daughNegCutBit)) { + + resoCount++; + } + } else { + resoCount++; + } + } + + std::vector tmpIDtrack; + + if ((v0Count >= confNumberOfV0 && resoCount >= confNumberOfReso) || (antiV0Count >= confNumberOfV0 && resoCount >= confNumberOfReso)) { + eventRegistry.fill(HIST("hStatistiscs"), 1); + outputCollision(col.posZ(), col.multV0M(), col.multNtr(), col.sphericity(), col.magField()); + + for (const auto& femtoParticle : parts) { + + if (aod::femtodreamparticle::ParticleType::kResoKStarChild == femtoParticle.partType()) { + std::vector childIDs; + const auto& children = femtoParticle.childrenIds(); + childIDs.push_back(children[0]); + childIDs.push_back(children[1]); + outputParts(outputCollision.lastIndex(), + femtoParticle.pt(), + femtoParticle.eta(), + femtoParticle.phi(), + femtoParticle.partType(), + femtoParticle.cut(), + femtoParticle.pidcut(), + femtoParticle.tempFitVar(), + childIDs, + femtoParticle.mLambda(), + femtoParticle.mAntiLambda()); + } + + if ((femtoParticle.partType() == uint8_t(aod::femtodreamparticle::kResoKStarPosdaughTPC_NegdaughTPC)) || + (femtoParticle.partType() == uint8_t(aod::femtodreamparticle::kResoKStarPosdaughTPC_NegdaughTOF)) || + (femtoParticle.partType() == uint8_t(aod::femtodreamparticle::kResoKStarPosdaughTOF_NegdaughTPC)) || + (femtoParticle.partType() == uint8_t(aod::femtodreamparticle::kResoKStarPosdaughTOF_NegdaughTOF))) { + + std::vector childIDs; + const auto& children = femtoParticle.childrenIds(); + childIDs.push_back(children[0]); + childIDs.push_back(children[1]); + outputParts(outputCollision.lastIndex(), + femtoParticle.pt(), + femtoParticle.eta(), + femtoParticle.phi(), + femtoParticle.partType(), + femtoParticle.cut(), + femtoParticle.pidcut(), + femtoParticle.tempFitVar(), + childIDs, + femtoParticle.mLambda(), + femtoParticle.mAntiLambda()); + } + + if (aod::femtodreamparticle::ParticleType::kV0K0ShortChild == femtoParticle.partType()) { + std::vector childIDs; + const auto& children = femtoParticle.childrenIds(); + childIDs.push_back(children[0]); + childIDs.push_back(children[1]); + + outputParts(outputCollision.lastIndex(), + femtoParticle.pt(), + femtoParticle.eta(), + femtoParticle.phi(), + femtoParticle.partType(), + femtoParticle.cut(), + femtoParticle.pidcut(), + femtoParticle.tempFitVar(), + childIDs, + femtoParticle.mLambda(), + femtoParticle.mAntiLambda()); + } + if (aod::femtodreamparticle::ParticleType::kV0K0Short == femtoParticle.partType()) { + std::vector childIDs; + const auto& children = femtoParticle.childrenIds(); + childIDs.push_back(children[0]); + childIDs.push_back(children[1]); + outputParts(outputCollision.lastIndex(), + femtoParticle.pt(), + femtoParticle.eta(), + femtoParticle.phi(), + femtoParticle.partType(), + femtoParticle.cut(), + femtoParticle.pidcut(), + femtoParticle.tempFitVar(), + childIDs, + femtoParticle.mLambda(), + femtoParticle.mAntiLambda()); + } + } + } else { + eventRegistry.fill(HIST("hStatistiscs"), 2); + } + } + + void createSpecifiedDerivedDataNK0ShortNKStar(const o2::aod::FDCollision& col, + const o2::aod::FDParticles& parts) + { + eventRegistry.fill(HIST("hStatistiscs"), 0); + auto thegroupSelectedResos = selectedKStar->sliceByCached(aod::femtodreamparticle::fdCollisionId, col.globalIndex(), cache); + auto thegroupSelectedV0s = selectedK0Short->sliceByCached(aod::femtodreamparticle::fdCollisionId, col.globalIndex(), cache); + + createSpecifiedDerivedDataK0ShortKStar(col, thegroupSelectedV0s, thegroupSelectedResos, parts); + } + PROCESS_SWITCH(FemtoDreamProducerTaskForSpecificAnalysis, createSpecifiedDerivedDataNK0ShortNKStar, "Enable producing data with pp collisions for data K0Short-KStar", false); }; WorkflowSpec defineDataProcessing(ConfigContext const& cfgc)