diff --git a/PWGLF/DataModel/LFCKSSpinalignmentTables.h b/PWGLF/DataModel/LFCKSSpinalignmentTables.h new file mode 100644 index 00000000000..7e6447459cc --- /dev/null +++ b/PWGLF/DataModel/LFCKSSpinalignmentTables.h @@ -0,0 +1,101 @@ +// 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 LFCKSSpinalignmentTables.h +/// \brief DataModel for Charged KStar spin alignment +/// +/// \author Prottay Das + +#ifndef PWGLF_DATAMODEL_LFCKSSPINALIGNMENTTABLES_H_ +#define PWGLF_DATAMODEL_LFCKSSPINALIGNMENTTABLES_H_ + +#include "Common/Core/RecoDecay.h" +#include "Common/DataModel/Centrality.h" +#include "Common/DataModel/Multiplicity.h" +#include "Common/DataModel/PIDResponse.h" +#include "Common/DataModel/TrackSelectionTables.h" + +#include "Framework/ASoA.h" +#include "Framework/AnalysisDataModel.h" + +#include + +namespace o2::aod +{ +namespace kshortpionevent +{ +DECLARE_SOA_COLUMN(Cent, cent, float); +DECLARE_SOA_COLUMN(CollIndex, collIndex, float); +DECLARE_SOA_COLUMN(PsiFT0C, psiFT0C, float); +DECLARE_SOA_COLUMN(PsiFT0A, psiFT0A, float); +DECLARE_SOA_COLUMN(PsiTPC, psiTPC, float); +} // namespace kshortpionevent +DECLARE_SOA_TABLE(KShortpionEvents, "AOD", "KSHORTPIONEVENT", + o2::soa::Index<>, + kshortpionevent::Cent, + kshortpionevent::CollIndex, + kshortpionevent::PsiFT0C, + kshortpionevent::PsiFT0A, + kshortpionevent::PsiTPC) +using KShortpionEvent = KShortpionEvents::iterator; + +namespace kshortpionpair +{ +DECLARE_SOA_INDEX_COLUMN(KShortpionEvent, kshortpionevent); +DECLARE_SOA_COLUMN(V0Cospa, v0Cospa, float); //! V0 Cospa +DECLARE_SOA_COLUMN(V0Radius, v0Radius, float); //! V0 Radius +DECLARE_SOA_COLUMN(DcaPositive, dcaPositive, float); //! DCA Positive +DECLARE_SOA_COLUMN(DcaNegative, dcaNegative, float); //! DCA Negative +DECLARE_SOA_COLUMN(DcaBetweenDaughter, dcaBetweenDaughter, float); //! DCA between daughters +DECLARE_SOA_COLUMN(V0Lifetime, v0Lifetime, float); //! KShort lifetime +DECLARE_SOA_COLUMN(KShortPx, kShortPx, float); //! KShort Px +DECLARE_SOA_COLUMN(KShortPy, kShortPy, float); //! KShort Py +DECLARE_SOA_COLUMN(KShortPz, kShortPz, float); //! KShort Pz +DECLARE_SOA_COLUMN(KShortMass, kShortMass, float); //! KShort Mass +DECLARE_SOA_COLUMN(PionBachPx, pionBachPx, float); //! Bachelor Pion Px +DECLARE_SOA_COLUMN(PionBachPy, pionBachPy, float); //! Bachelor Pion Py +DECLARE_SOA_COLUMN(PionBachPz, pionBachPz, float); //! Bachelor Pion Pz +DECLARE_SOA_COLUMN(PionBachSign, pionBachSign, int); //! Bachelor Pion Sign +DECLARE_SOA_COLUMN(PionBachTPC, pionBachTPC, float); //! Bachelor Pion nsigmatpc +DECLARE_SOA_COLUMN(PionBachTOFHit, pionBachTOFHit, int); //! Bachelor Pion tof hit availability +DECLARE_SOA_COLUMN(PionBachTOF, pionBachTOF, float); //! Bachelor Pion nsigmatof +DECLARE_SOA_COLUMN(PionBachIndex, pionBachIndex, int); //! Bachelor Pion index +DECLARE_SOA_COLUMN(PionIndex1, pionIndex1, int); //! Daughter Pion index1 +DECLARE_SOA_COLUMN(PionIndex2, pionIndex2, int); //! Daughter Pion index2 +} // namespace kshortpionpair +DECLARE_SOA_TABLE(KShortpionPairs, "AOD", "KSHORTPIONPAIR", + o2::soa::Index<>, + kshortpionpair::KShortpionEventId, + kshortpionpair::V0Cospa, + kshortpionpair::V0Radius, + kshortpionpair::DcaPositive, + kshortpionpair::DcaNegative, + kshortpionpair::DcaBetweenDaughter, + kshortpionpair::V0Lifetime, + // kshortpionpair::Armenteros, + kshortpionpair::KShortPx, + kshortpionpair::KShortPy, + kshortpionpair::KShortPz, + kshortpionpair::KShortMass, + kshortpionpair::PionBachPx, + kshortpionpair::PionBachPy, + kshortpionpair::PionBachPz, + kshortpionpair::PionBachSign, + kshortpionpair::PionBachTPC, + kshortpionpair::PionBachTOFHit, + kshortpionpair::PionBachTOF, + kshortpionpair::PionBachIndex, + kshortpionpair::PionIndex1, + kshortpionpair::PionIndex2); + +using KShortpionPair = KShortpionPairs::iterator; +} // namespace o2::aod +#endif // PWGLF_DATAMODEL_LFCKSSPINALIGNMENTTABLES_H_ diff --git a/PWGLF/TableProducer/Resonances/CMakeLists.txt b/PWGLF/TableProducer/Resonances/CMakeLists.txt index 79b69b5b071..a58387288a8 100644 --- a/PWGLF/TableProducer/Resonances/CMakeLists.txt +++ b/PWGLF/TableProducer/Resonances/CMakeLists.txt @@ -49,3 +49,8 @@ o2physics_add_dpl_workflow(heptaquarktable SOURCES HeptaQuarktable.cxx PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore O2::DetectorsVertexing COMPONENT_NAME Analysis) + +o2physics_add_dpl_workflow(cksspinalignment + SOURCES cksspinalignment.cxx + PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore + COMPONENT_NAME Analysis) diff --git a/PWGLF/TableProducer/Resonances/cksspinalignment.cxx b/PWGLF/TableProducer/Resonances/cksspinalignment.cxx new file mode 100644 index 00000000000..91bb6662dbc --- /dev/null +++ b/PWGLF/TableProducer/Resonances/cksspinalignment.cxx @@ -0,0 +1,386 @@ +// 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 cksspinalignment.cxx +/// \brief Table producer for Charged KStar spin alignment +/// +/// \author prottay.das@cern.ch + +#include "PWGLF/DataModel/EPCalibrationTables.h" +#include "PWGLF/DataModel/LFCKSSpinalignmentTables.h" +#include "PWGLF/DataModel/LFStrangenessPIDTables.h" +#include "PWGLF/DataModel/LFStrangenessTables.h" +#include "PWGMM/Mult/DataModel/Index.h" // for Particles2Tracks table + +#include "Common/Core/TrackSelection.h" +#include "Common/Core/trackUtilities.h" +#include "Common/DataModel/Centrality.h" +#include "Common/DataModel/EventSelection.h" +#include "Common/DataModel/FT0Corrected.h" +#include "Common/DataModel/Multiplicity.h" +#include "Common/DataModel/PIDResponse.h" +#include "Common/DataModel/PIDResponseITS.h" +#include "Common/DataModel/TrackSelectionTables.h" + +#include "CCDB/BasicCCDBManager.h" +#include "CommonConstants/PhysicsConstants.h" +#include "Framework/ASoAHelpers.h" +#include "Framework/AnalysisDataModel.h" +#include "Framework/AnalysisTask.h" +#include "Framework/HistogramRegistry.h" +#include "Framework/StepTHn.h" +#include "Framework/runDataProcessing.h" +#include "ReconstructionDataFormats/Track.h" + +#include "Math/GenVector/Boost.h" +#include "Math/Vector2D.h" +#include "Math/Vector3D.h" +#include "Math/Vector4D.h" + +#include + +#include +#include +#include + +using namespace o2; +using namespace o2::framework; +using namespace o2::framework::expressions; +using std::array; +using namespace o2::aod::rctsel; + +struct cksspinalignment { + + Produces kshortpionEvent; + Produces kshortpionPair; + + Service ccdb; + + struct : ConfigurableGroup { + Configurable requireRCTFlagChecker{"requireRCTFlagChecker", true, "Check event quality in run condition table"}; + Configurable cfgEvtRCTFlagCheckerLabel{"cfgEvtRCTFlagCheckerLabel", "CBT_hadronPID", "Evt sel: RCT flag checker label"}; + Configurable cfgEvtRCTFlagCheckerZDCCheck{"cfgEvtRCTFlagCheckerZDCCheck", false, "Evt sel: RCT flag checker ZDC check"}; + Configurable cfgEvtRCTFlagCheckerLimitAcceptAsBad{"cfgEvtRCTFlagCheckerLimitAcceptAsBad", true, "Evt sel: RCT flag checker treat Limited Acceptance As Bad"}; + } rctCut; + + Configurable cfgCutOccupancy{"cfgCutOccupancy", 2000, "Occupancy cut"}; + + // events + Configurable cfgCutVertex{"cfgCutVertex", 10.0f, "Accepted z-vertex range"}; + Configurable cfgCutCentralityMax{"cfgCutCentralityMax", 80.0f, "Accepted maximum Centrality"}; + Configurable cfgCutCentralityMin{"cfgCutCentralityMin", 0.0f, "Accepted minimum Centrality"}; + + // Configs for track + Configurable cfgCutPt{"cfgCutPt", 0.2, "Pt cut on daughter track"}; + Configurable cfgCutEta{"cfgCutEta", 0.8, "Eta cut on daughter track"}; + + // Configs for pion + struct : ConfigurableGroup { + Configurable itsPIDSelection{"itsPIDSelection", true, "PID ITS"}; + Configurable lowITSPIDNsigma{"lowITSPIDNsigma", -3.0, "lower cut on PID nsigma for ITS"}; + Configurable highITSPIDNsigma{"highITSPIDNsigma", 3.0, "higher cut on PID nsigma for ITS"}; + Configurable itsclusterPiMeson{"itsclusterPiMeson", 5, "Minimum number of ITS cluster for pi meson track"}; + Configurable tpcCrossedRowsPiMeson{"tpcCrossedRowsPiMeson", 80, "Minimum number of TPC Crossed Rows for pi meson track"}; + Configurable cutDCAxyPiMeson{"cutDCAxyPiMeson", 0.1, "Maximum DCAxy for pi meson track"}; + Configurable cutDCAzPiMeson{"cutDCAzPiMeson", 0.1, "Maximum DCAz for pi meson track"}; + Configurable cutEtaPiMeson{"cutEtaPiMeson", 0.8, "Maximum eta for pi meson track"}; + Configurable cutPTPiMeson{"cutPTPiMeson", 0.8, "Maximum pt for pi meson track"}; + Configurable usePID{"usePID", true, "Flag for using PID selection for pi meson track"}; + Configurable nsigmaCutTPCPiMeson{"nsigmaCutTPCPiMeson", 3.0, "Maximum nsigma cut TPC for pi meson track"}; + Configurable nsigmaCutTOFPiMeson{"nsigmaCutTOFPiMeson", 3.0, "Maximum nsigma cut TOF for pi meson track"}; + Configurable cutTOFBetaPiMeson{"cutTOFBetaPiMeson", 3.0, "Maximum beta cut for pi meson track"}; + } grpPion; + + // Configs for V0 + Configurable confV0PtMin{"confV0PtMin", 0.f, "Minimum transverse momentum of V0"}; + Configurable confV0PtMax{"confV0PtMax", 1000.f, "Maximum transverse momentum of V0"}; + Configurable confV0Rap{"confV0Rap", 0.8f, "Rapidity range of V0"}; + Configurable confV0DCADaughMax{"confV0DCADaughMax", 1.0f, "Maximum DCA between the V0 daughters"}; + Configurable confV0CPAMin{"confV0CPAMin", 0.9998f, "Minimum CPA of V0"}; + Configurable confV0TranRadV0Min{"confV0TranRadV0Min", 1.5f, "Minimum transverse radius"}; + Configurable confV0TranRadV0Max{"confV0TranRadV0Max", 100.f, "Maximum transverse radius"}; + Configurable cMaxV0DCA{"cMaxV0DCA", 1.2, "Maximum V0 DCA to PV"}; + Configurable cMinV0DCAPi{"cMinV0DCAPi", 0.05, "Minimum V0 daughters DCA to PV for Pi"}; + Configurable cMaxV0LifeTime{"cMaxV0LifeTime", 50, "Maximum V0 life time"}; + Configurable qtArmenterosMin{"qtArmenterosMin", 0.2, "Minimum armenteros cut for K0s"}; + // config for V0 daughters + Configurable confDaughEta{"confDaughEta", 0.8f, "V0 Daugh sel: max eta"}; + Configurable cfgDaughPiPt{"cfgDaughPiPt", 0.2, "minimum daughter pion pt"}; + Configurable confDaughTPCnclsMin{"confDaughTPCnclsMin", 50.f, "V0 Daugh sel: Min. nCls TPC"}; + Configurable confDaughTPCncrwsMin{"confDaughTPCncrwsMin", 70.f, "V0 Daugh sel: Min. nCrws TPC"}; + Configurable confDaughPIDCuts{"confDaughPIDCuts", 3, "PID selections for Kshortpion daughters"}; + + Configurable iMNbins{"iMNbins", 50, "Number of bins in invariant mass"}; + Configurable lbinIM{"lbinIM", 1.09, "lower bin value in IM histograms"}; + Configurable hbinIM{"hbinIM", 1.14, "higher bin value in IM histograms"}; + + HistogramRegistry histos{"histos", {}, OutputObjHandlingPolicy::AnalysisObject}; + RCTFlagsChecker rctChecker; + void init(o2::framework::InitContext&) + { + rctChecker.init(rctCut.cfgEvtRCTFlagCheckerLabel, rctCut.cfgEvtRCTFlagCheckerZDCCheck, rctCut.cfgEvtRCTFlagCheckerLimitAcceptAsBad); + AxisSpec thnAxisInvMass{iMNbins, lbinIM, hbinIM, "#it{M} (GeV/#it{c}^{2})"}; + histos.add("hEvtSelInfo", "hEvtSelInfo", kTH1F, {{5, 0, 5.0}}); + histos.add("hTrkSelInfo", "hTrkSelInfo", kTH1F, {{5, 0, 5.0}}); + histos.add("hKShortMass", "hKShortMass", kTH1F, {thnAxisInvMass}); + histos.add("hV0Info", "hV0Info", kTH1F, {{5, 0, 5.0}}); + } + + template + bool selectionTrack(const T& candidate) + { + if (candidate.isGlobalTrack() && candidate.isPVContributor() && candidate.itsNCls() >= grpPion.itsclusterPiMeson && candidate.tpcNClsCrossedRows() > grpPion.tpcCrossedRowsPiMeson && std::abs(candidate.dcaXY()) <= grpPion.cutDCAxyPiMeson && std::abs(candidate.dcaZ()) <= grpPion.cutDCAzPiMeson && std::abs(candidate.eta()) <= grpPion.cutEtaPiMeson && candidate.pt() >= grpPion.cutPTPiMeson) { + return true; + } + return false; + } + + template + bool selectionPID(const T& candidate) + { + if (!candidate.hasTOF() && std::abs(candidate.tpcNSigmaPi()) < grpPion.nsigmaCutTPCPiMeson) { + return true; + } + if (candidate.hasTOF() && candidate.beta() > grpPion.cutTOFBetaPiMeson && std::abs(candidate.tpcNSigmaPi()) < grpPion.nsigmaCutTPCPiMeson && std::abs(candidate.tofNSigmaPi()) < grpPion.nsigmaCutTOFPiMeson) { + return true; + } + return false; + } + + template + bool selectionV0(Collision const& collision, V0 const& candidate) + { + if (std::abs(candidate.dcav0topv()) > cMaxV0DCA) { + return false; + } + const float pT = candidate.pt(); + const float tranRad = candidate.v0radius(); + const float dcaDaughv0 = std::abs(candidate.dcaV0daughters()); + const float cpav0 = candidate.v0cosPA(); + float ctauKShort = candidate.distovertotmom(collision.posX(), collision.posY(), collision.posZ()) * (o2::constants::physics::MassK0); + + if (pT < confV0PtMin) { + return false; + } + if (pT > confV0PtMax) { + return false; + } + if (dcaDaughv0 > confV0DCADaughMax) { + return false; + } + if (cpav0 < confV0CPAMin) { + return false; + } + if (tranRad < confV0TranRadV0Min) { + return false; + } + if (tranRad > confV0TranRadV0Max) { + return false; + } + if (std::abs(ctauKShort) > cMaxV0LifeTime) { + return false; + } + if ((candidate.qtarm() / std::abs(candidate.alpha())) < qtArmenterosMin) { + return false; + } + if (std::abs(candidate.yK0Short()) > confV0Rap) { // use full rapidity 0.8 for K0s + return false; + } + return true; + } + + template + bool isSelectedV0Daughter(V0 const& candidate) + { + auto postrack = candidate.template posTrack_as(); + auto negtrack = candidate.template negTrack_as(); + + const auto ncrfc = 0.8; + + if (postrack.sign() < 0 || negtrack.sign() > 0) { + return false; + } + if (postrack.tpcNClsCrossedRows() < confDaughTPCncrwsMin || negtrack.tpcNClsCrossedRows() < confDaughTPCncrwsMin) { + return false; + } + if (postrack.tpcNClsFound() < confDaughTPCnclsMin || negtrack.tpcNClsFound() < confDaughTPCnclsMin) { + return false; + } + if (postrack.tpcCrossedRowsOverFindableCls() < ncrfc || negtrack.tpcCrossedRowsOverFindableCls() < ncrfc) { + return false; + } + if (std::abs(postrack.tpcNSigmaPi()) > confDaughPIDCuts || std::abs(negtrack.tpcNSigmaPi()) > confDaughPIDCuts) { + return false; + } + if (candidate.positivept() < cfgDaughPiPt || candidate.negativept() < cfgDaughPiPt) { + return false; + } + if (std::abs(candidate.positiveeta()) > confDaughEta || std::abs(candidate.negativeeta()) > confDaughEta) { + return false; + } + if (std::abs(candidate.dcapostopv()) < cMinV0DCAPi || std::abs(candidate.dcanegtopv()) < cMinV0DCAPi) { + return false; + } + + return true; + } + + std::tuple getK0sTags(const auto& v0, const auto& collision) + { + // auto postrack = v0.template posTrack_as(); + // auto negtrack = v0.template negTrack_as(); + + int kshortTag = 0; + + if (isSelectedV0Daughter(v0) && v0.mK0Short() > lbinIM && v0.mK0Short() < hbinIM) { + kshortTag = 1; + } + + if (!kshortTag) { + return {0, false}; // No valid tags + } + + if (!selectionV0(collision, v0)) { + return {0, false}; // Fails selection + } + + return {kshortTag, true}; // Valid candidate + } + + ROOT::Math::PxPyPzMVector kshort, pion, pionbach, antiPion; + ROOT::Math::PxPyPzMVector kshortDummy, pionDummy; + + Filter collisionFilter = nabs(aod::collision::posZ) < cfgCutVertex; + Filter centralityFilter = (nabs(aod::cent::centFT0C) < cfgCutCentralityMax && nabs(aod::cent::centFT0C) > cfgCutCentralityMin); + Filter acceptanceFilter = (nabs(aod::track::eta) < cfgCutEta && (aod::track::pt) > cfgCutPt); + + using EventCandidates = soa::Filtered>; + using AllTrackCandidates = soa::Filtered>; + using ResoV0s = aod::V0Datas; + void processData(EventCandidates::iterator const& collision, AllTrackCandidates const& tracks, ResoV0s const& V0s) + { + o2::aod::ITSResponse itsResponse; + std::vector kshortMother, pionBachelor; + std::vector v0Cospa = {}; + std::vector v0Radius = {}; + std::vector dcaPositive = {}; + std::vector dcaNegative = {}; + std::vector positiveIndex = {}; + std::vector negativeIndex = {}; + std::vector dcaBetweenDaughter = {}; + std::vector v0Lifetime = {}; + // std::vector armenteros = {}; + std::vector pionBachelorIndex = {}; + std::vector pionBachelorSign = {}; + std::vector pionBachelorTPC = {}; + std::vector pionBachelorTOF = {}; + std::vector pionBachelorTOFHit = {}; + + int numbV0 = 0; + auto centrality = collision.centFT0C(); + // auto vz = collision.posZ(); + int occupancy = collision.trackOccupancyInTimeRange(); + auto psiFT0C = collision.psiFT0C(); + auto psiFT0A = collision.psiFT0A(); + auto psiTPC = collision.psiTPC(); + // auto psiTPCR = collision.psiTPCR(); + // auto psiTPCL = collision.psiTPCL(); + histos.fill(HIST("hEvtSelInfo"), 0.5); + if ((rctCut.requireRCTFlagChecker && rctChecker(collision)) && collision.selection_bit(aod::evsel::kNoSameBunchPileup) && collision.selection_bit(aod::evsel::kIsGoodZvtxFT0vsPV) && collision.selection_bit(aod::evsel::kNoTimeFrameBorder) && collision.selection_bit(aod::evsel::kNoITSROFrameBorder) && collision.selection_bit(o2::aod::evsel::kNoCollInTimeRangeStandard) && collision.sel8() && collision.selection_bit(o2::aod::evsel::kIsGoodITSLayersAll) && occupancy < cfgCutOccupancy) { + histos.fill(HIST("hEvtSelInfo"), 1.5); + if (collision.triggereventep()) { + histos.fill(HIST("hEvtSelInfo"), 2.5); + + for (const auto& track1 : tracks) { + histos.fill(HIST("hTrkSelInfo"), 0.5); + if (!selectionTrack(track1)) { + continue; + } + histos.fill(HIST("hTrkSelInfo"), 1.5); + + if (grpPion.itsPIDSelection && !(itsResponse.nSigmaITS(track1) > grpPion.lowITSPIDNsigma && itsResponse.nSigmaITS(track1) < grpPion.highITSPIDNsigma)) { + continue; + } + histos.fill(HIST("hTrkSelInfo"), 2.5); + + if (grpPion.usePID && !selectionPID(track1)) { + continue; + } + histos.fill(HIST("hTrkSelInfo"), 3.5); + + auto track1ID = track1.globalIndex(); + auto track1sign = track1.sign(); + auto track1nsigTPC = track1.tpcNSigmaPi(); + auto track1nsigTOF = -999.9; + auto track1TOFHit = -1; + if (track1.hasTOF()) { + track1TOFHit = 1; + track1nsigTOF = track1.tofNSigmaPi(); + histos.fill(HIST("hTrkSelInfo"), 4.5); + } + pionbach = ROOT::Math::PxPyPzMVector(track1.px(), track1.py(), track1.pz(), o2::constants::physics::MassPionCharged); + for (const auto& v0 : V0s) { + histos.fill(HIST("hV0Info"), 0.5); + auto [kshortTag, isValid] = getK0sTags(v0, collision); + if (kshortTag && isValid) { + histos.fill(HIST("hV0Info"), 1.5); + auto postrack1 = v0.template posTrack_as(); + auto negtrack1 = v0.template negTrack_as(); + positiveIndex.push_back(postrack1.globalIndex()); + negativeIndex.push_back(negtrack1.globalIndex()); + v0Cospa.push_back(v0.v0cosPA()); + v0Radius.push_back(v0.v0radius()); + dcaPositive.push_back(std::abs(v0.dcapostopv())); + dcaNegative.push_back(std::abs(v0.dcanegtopv())); + dcaBetweenDaughter.push_back(std::abs(v0.dcaV0daughters())); + v0Lifetime.push_back(v0.distovertotmom(collision.posX(), collision.posY(), collision.posZ()) * (o2::constants::physics::MassK0)); + // armenteros.push_back((v0.qtarm() / std::abs(v0.alpha()))); + + pion = ROOT::Math::PxPyPzMVector(v0.pxpos(), v0.pypos(), v0.pzpos(), o2::constants::physics::MassPionCharged); + antiPion = ROOT::Math::PxPyPzMVector(v0.pxneg(), v0.pyneg(), v0.pzneg(), o2::constants::physics::MassPionCharged); + kshort = pion + antiPion; + // chargedkstar = kshort + pionbach; + kshortMother.push_back(kshort); + // chargedkstarMother.push_back(chargedkstar); + pionBachelor.push_back(pionbach); + pionBachelorIndex.push_back(track1ID); + pionBachelorSign.push_back(track1sign); + pionBachelorTPC.push_back(track1nsigTPC); + pionBachelorTOF.push_back(track1nsigTOF); + pionBachelorTOFHit.push_back(track1TOFHit); + histos.fill(HIST("hKShortMass"), kshort.M()); + } + numbV0 = numbV0 + 1; + } + } + if (numbV0 > 1 && v0Cospa.size() > 1) { + histos.fill(HIST("hEvtSelInfo"), 3.5); + kshortpionEvent(centrality, collision.index(), psiFT0C, psiFT0A, psiTPC); + auto indexEvent = kshortpionEvent.lastIndex(); + //// Fill track table for Charged KStar////////////////// + for (auto icks = kshortMother.begin(); icks != kshortMother.end(); ++icks) { + auto iter = std::distance(kshortMother.begin(), icks); + kshortDummy = kshortMother.at(iter); + // chargedkstarDummy = chargedkstarMother.at(iter); + pionDummy = pionBachelor.at(iter); + + kshortpionPair(indexEvent, v0Cospa.at(iter), v0Radius.at(iter), dcaPositive.at(iter), dcaNegative.at(iter), dcaBetweenDaughter.at(iter), v0Lifetime.at(iter), kshortDummy.Px(), kshortDummy.Py(), kshortDummy.Pz(), kshortDummy.M(), pionDummy.Px(), pionDummy.Py(), pionDummy.Pz(), pionBachelorSign.at(iter), pionBachelorTPC.at(iter), pionBachelorTOFHit.at(iter), pionBachelorTOF.at(iter), pionBachelorIndex.at(iter), positiveIndex.at(iter), negativeIndex.at(iter)); + } + } + } + } + } + PROCESS_SWITCH(cksspinalignment, processData, "Process data", true); +}; +WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) +{ + return WorkflowSpec{adaptAnalysisTask(cfgc)}; +}