|
| 1 | +// Copyright 2019-2020 CERN and copyright holders of ALICE O2. |
| 2 | +// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders. |
| 3 | +// All rights not expressly granted are reserved. |
| 4 | +// |
| 5 | +// This software is distributed under the terms of the GNU General Public |
| 6 | +// License v3 (GPL Version 3), copied verbatim in the file "COPYING". |
| 7 | +// |
| 8 | +// In applying this license CERN does not waive the privileges and immunities |
| 9 | +// granted to it by virtue of its status as an Intergovernmental Organization |
| 10 | +// or submit itself to any jurisdiction. |
| 11 | + |
| 12 | +/// \file HFTreeCreator3Prong.cxx |
| 13 | +/// \brief Writer of the 3 prong candidates in the form of flat tables to be stored in TTrees. |
| 14 | +/// Intended for debug or for the local optimization of analysis on small samples. |
| 15 | +/// In this file are defined and filled the output tables |
| 16 | +/// |
| 17 | +/// \author Alessandro De Falco <alessandro.de.falco@ca.infn.it>, Università/INFN Cagliari |
| 18 | +/// \note based on O2Physics/Tasks/PWGHF/HFTreeCreatorXToJPsiPiPi.cxx |
| 19 | +/// \author Luca Micheletti <luca.micheletti@to.infn.it>, INFN |
| 20 | + |
| 21 | +#include "Framework/runDataProcessing.h" |
| 22 | +#include "Framework/AnalysisTask.h" |
| 23 | +#include "DetectorsVertexing/DCAFitterN.h" |
| 24 | +#include "PWGHF/DataModel/HFSecondaryVertex.h" |
| 25 | +#include "PWGHF/DataModel/HFCandidateSelectionTables.h" |
| 26 | +#include "Common/Core/trackUtilities.h" |
| 27 | +#include "ReconstructionDataFormats/DCA.h" |
| 28 | + |
| 29 | +using namespace o2; |
| 30 | +using namespace o2::aod; |
| 31 | +using namespace o2::framework; |
| 32 | +using namespace o2::aod::hf_cand_chic; |
| 33 | + |
| 34 | +namespace o2::aod |
| 35 | +{ |
| 36 | +namespace full |
| 37 | +{ |
| 38 | +DECLARE_SOA_COLUMN(ImpactParameterNormalised0, impactParameterNormalised0, float); |
| 39 | +DECLARE_SOA_COLUMN(RSecondaryVertex, rSecondaryVertex, float); |
| 40 | +DECLARE_SOA_COLUMN(DecayLength, decayLength, float); |
| 41 | +DECLARE_SOA_COLUMN(DecayLengthXY, decayLengthXY, float); |
| 42 | +DECLARE_SOA_COLUMN(PtProng0, ptProng0, float); |
| 43 | +DECLARE_SOA_COLUMN(PProng0, pProng0, float); |
| 44 | +DECLARE_SOA_COLUMN(PtProng1, ptProng1, float); |
| 45 | +DECLARE_SOA_COLUMN(PProng1, pProng1, float); |
| 46 | +DECLARE_SOA_COLUMN(Alpha, alpha, float); |
| 47 | +DECLARE_SOA_COLUMN(Qt, qt, float); |
| 48 | +DECLARE_SOA_COLUMN(CandidateSelFlag, candidateSelFlag, int8_t); |
| 49 | +DECLARE_SOA_COLUMN(M, m, float); |
| 50 | +DECLARE_SOA_COLUMN(Pt, pt, float); |
| 51 | +DECLARE_SOA_COLUMN(P, p, float); |
| 52 | +DECLARE_SOA_COLUMN(CPA, cpa, float); |
| 53 | +DECLARE_SOA_COLUMN(CPAXY, cpaXY, float); |
| 54 | +DECLARE_SOA_COLUMN(Ct, ct, float); |
| 55 | +DECLARE_SOA_COLUMN(Eta, eta, float); |
| 56 | +DECLARE_SOA_COLUMN(Phi, phi, float); |
| 57 | +DECLARE_SOA_COLUMN(Y, y, float); |
| 58 | +DECLARE_SOA_COLUMN(E, e, float); |
| 59 | +DECLARE_SOA_COLUMN(MCflag, mcflag, int8_t); |
| 60 | +// Events |
| 61 | +DECLARE_SOA_COLUMN(IsEventReject, isEventReject, int); |
| 62 | +DECLARE_SOA_COLUMN(RunNumber, runNumber, int); |
| 63 | +} // namespace full |
| 64 | + |
| 65 | +DECLARE_SOA_TABLE(HfCandChicFull, "AOD", "HFCANDChicFull", |
| 66 | + collision::BCId, |
| 67 | + collision::NumContrib, |
| 68 | + collision::PosX, |
| 69 | + collision::PosY, |
| 70 | + collision::PosZ, |
| 71 | + full::ImpactParameterNormalised0, |
| 72 | + full::RSecondaryVertex, |
| 73 | + full::DecayLength, |
| 74 | + full::DecayLengthXY, |
| 75 | + full::PtProng0, |
| 76 | + full::PProng0, |
| 77 | + full::PtProng1, |
| 78 | + full::PProng1, |
| 79 | + full::Alpha, |
| 80 | + full::Qt, |
| 81 | + hf_cand::Chi2PCA, |
| 82 | + hf_cand::ImpactParameter0, |
| 83 | + full::CandidateSelFlag, |
| 84 | + full::M, |
| 85 | + full::Pt, |
| 86 | + full::P, |
| 87 | + full::CPA, |
| 88 | + full::CPAXY, |
| 89 | + full::Ct, |
| 90 | + full::Eta, |
| 91 | + full::Phi, |
| 92 | + full::Y, |
| 93 | + hf_cand_chic::JpsiToMuMuMass, |
| 94 | + full::MCflag); |
| 95 | + |
| 96 | +DECLARE_SOA_TABLE(HfCandChicFullEvents, "AOD", "HFCANDChicFullE", |
| 97 | + collision::BCId, |
| 98 | + collision::NumContrib, |
| 99 | + collision::PosX, |
| 100 | + collision::PosY, |
| 101 | + collision::PosZ, |
| 102 | + full::IsEventReject, |
| 103 | + full::RunNumber); |
| 104 | + |
| 105 | +DECLARE_SOA_TABLE(HfCandChicFullParticles, "AOD", "HFCANDChicFullP", |
| 106 | + collision::BCId, |
| 107 | + full::Pt, |
| 108 | + full::Eta, |
| 109 | + full::Phi, |
| 110 | + full::Y, |
| 111 | + hf_cand_chic::JpsiToMuMuMass, |
| 112 | + full::MCflag); |
| 113 | + |
| 114 | +} // namespace o2::aod |
| 115 | + |
| 116 | +/// Writes the full information in an output TTree |
| 117 | +struct HfTreeCreatorChicToJpsiGamma { |
| 118 | + Produces<o2::aod::HfCandChicFull> rowCandidateFull; |
| 119 | + Produces<o2::aod::HfCandChicFullEvents> rowCandidateFullEvents; |
| 120 | + Produces<o2::aod::HfCandChicFullParticles> rowCandidateFullParticles; |
| 121 | + |
| 122 | + void init(InitContext const&) |
| 123 | + { |
| 124 | + } |
| 125 | + |
| 126 | + void process(aod::Collisions const& collisions, |
| 127 | + aod::McCollisions const& mccollisions, |
| 128 | + soa::Join<aod::HfCandChic, aod::HfCandChicMCRec, aod::HFSelChicToJpsiGammaCandidate> const& candidates, |
| 129 | + soa::Join<aod::McParticles, aod::HfCandChicMCGen> const& particles, |
| 130 | + aod::BigTracksPID const& tracks, |
| 131 | + aod::HfCandProng2 const& jpsiCands) |
| 132 | + { |
| 133 | + |
| 134 | + // Filling event properties |
| 135 | + rowCandidateFullEvents.reserve(collisions.size()); |
| 136 | + for (auto& collision : collisions) { |
| 137 | + rowCandidateFullEvents( |
| 138 | + collision.bcId(), |
| 139 | + collision.numContrib(), |
| 140 | + collision.posX(), |
| 141 | + collision.posY(), |
| 142 | + collision.posZ(), |
| 143 | + 0, |
| 144 | + 1); |
| 145 | + } |
| 146 | + |
| 147 | + // Filling candidate properties |
| 148 | + int indexCand = 0; |
| 149 | + rowCandidateFull.reserve(candidates.size()); |
| 150 | + for (auto& candidate : candidates) { |
| 151 | + array<float, 3> pvecChic = {candidate.px(), candidate.py(), candidate.pz()}; |
| 152 | + array<float, 3> pvecJpsi = {candidate.pxProng0(), candidate.pyProng0(), candidate.pzProng0()}; |
| 153 | + array<float, 3> pvecGamma = {candidate.pxProng1(), candidate.pyProng1(), candidate.pzProng1()}; |
| 154 | + auto pchic = RecoDecay::P(pvecChic); |
| 155 | + auto pjpsi = RecoDecay::P(pvecJpsi); |
| 156 | + auto pl1 = std::abs(RecoDecay::dotProd(pvecChic, pvecJpsi)) / pchic; |
| 157 | + auto pl2 = std::abs(RecoDecay::dotProd(pvecChic, pvecGamma)) / pchic; |
| 158 | + auto alpha = (pl1 - pl2) / (pl1 + pl2); |
| 159 | + auto qt = std::sqrt(pjpsi * pjpsi - pl1 * pl1); |
| 160 | + |
| 161 | + indexCand++; |
| 162 | + auto fillTable = [&](int CandFlag, |
| 163 | + int FunctionSelection, |
| 164 | + float FunctionInvMass, |
| 165 | + float FunctionCt, |
| 166 | + float FunctionY) { |
| 167 | + if (FunctionSelection >= 1) { |
| 168 | + rowCandidateFull( |
| 169 | + candidate.index0().index0_as<aod::BigTracksPID>().collision().bcId(), |
| 170 | + candidate.index0().index0_as<aod::BigTracksPID>().collision().numContrib(), |
| 171 | + candidate.posX(), |
| 172 | + candidate.posY(), |
| 173 | + candidate.posZ(), |
| 174 | + candidate.impactParameterNormalised0(), |
| 175 | + candidate.rSecondaryVertex(), |
| 176 | + candidate.decayLength(), |
| 177 | + candidate.decayLengthXY(), |
| 178 | + candidate.ptProng0(), |
| 179 | + RecoDecay::P(candidate.pxProng0(), candidate.pyProng0(), candidate.pzProng0()), |
| 180 | + candidate.ptProng1(), |
| 181 | + RecoDecay::P(candidate.pxProng1(), candidate.pyProng1(), candidate.pzProng1()), |
| 182 | + alpha, |
| 183 | + qt, |
| 184 | + candidate.chi2PCA(), |
| 185 | + candidate.impactParameter0(), |
| 186 | + 1 << CandFlag, |
| 187 | + FunctionInvMass, |
| 188 | + candidate.pt(), |
| 189 | + candidate.p(), |
| 190 | + candidate.cpa(), |
| 191 | + candidate.cpaXY(), |
| 192 | + FunctionCt, |
| 193 | + candidate.eta(), |
| 194 | + candidate.phi(), |
| 195 | + FunctionY, |
| 196 | + candidate.jpsiToMuMuMass(), |
| 197 | + candidate.flagMCMatchRec()); |
| 198 | + } |
| 199 | + }; |
| 200 | + fillTable(0, candidate.isSelChicToJpsiToMuMuGamma(), InvMassChicToJpsiGamma(candidate), CtChic(candidate), YChic(candidate)); |
| 201 | + // fillTable(1, candidate.isSelChicToJpsiToEEGamma(), InvMassChicToJpsiGamma(candidate), CtChic(candidate), YChic(candidate)); |
| 202 | + } |
| 203 | + |
| 204 | + // Filling particle properties |
| 205 | + float massChic = RecoDecay::getMassPDG(pdg::Code::kChic1); |
| 206 | + rowCandidateFullParticles.reserve(particles.size()); |
| 207 | + for (auto& particle : particles) { |
| 208 | + if (std::abs(particle.flagMCMatchGen()) == 1 << DecayType::ChicToJpsiToEEGamma || std::abs(particle.flagMCMatchGen()) == 1 << DecayType::ChicToJpsiToMuMuGamma) { |
| 209 | + rowCandidateFullParticles( |
| 210 | + particle.mcCollision().bcId(), |
| 211 | + particle.pt(), |
| 212 | + particle.eta(), |
| 213 | + particle.phi(), |
| 214 | + RecoDecay::Y(array{particle.px(), particle.py(), particle.pz()}, massChic), |
| 215 | + 0., // put here the jpsi mass |
| 216 | + particle.flagMCMatchGen()); |
| 217 | + } |
| 218 | + } |
| 219 | + } |
| 220 | +}; |
| 221 | + |
| 222 | +WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) |
| 223 | +{ |
| 224 | + WorkflowSpec workflow; |
| 225 | + workflow.push_back(adaptAnalysisTask<HfTreeCreatorChicToJpsiGamma>(cfgc)); |
| 226 | + return workflow; |
| 227 | +} |
0 commit comments