|
| 1 | +// Copyright CERN and copyright holders of ALICE O2. This software is |
| 2 | +// distributed under the terms of the GNU General Public License v3 (GPL |
| 3 | +// Version 3), copied verbatim in the file "COPYING". |
| 4 | +// |
| 5 | +// See http://alice-o2.web.cern.ch/license for full licensing information. |
| 6 | +// |
| 7 | +// In applying this license CERN does not waive the privileges and immunities |
| 8 | +// granted to it by virtue of its status as an Intergovernmental Organization |
| 9 | +// or submit itself to any jurisdiction. |
| 10 | +#ifndef O2_ANALYSIS_SECONDARYVERTEX_H_ |
| 11 | +#define O2_ANALYSIS_SECONDARYVERTEX_H_ |
| 12 | + |
| 13 | +#include "Framework/AnalysisDataModel.h" |
| 14 | + |
| 15 | +namespace o2::aod |
| 16 | +{ |
| 17 | +namespace secvtx2prong |
| 18 | +{ |
| 19 | +DECLARE_SOA_COLUMN(CollisionId, collisionId, int, "fCollisionsID"); |
| 20 | +DECLARE_SOA_COLUMN(Posdecayx, posdecayx, float, "fPosdecayx"); |
| 21 | +DECLARE_SOA_COLUMN(Posdecayy, posdecayy, float, "fPosdecayy"); |
| 22 | +DECLARE_SOA_COLUMN(Posdecayz, posdecayz, float, "fPosdecayz"); |
| 23 | +DECLARE_SOA_COLUMN(Index0, index0, int, "fIndex0"); |
| 24 | +DECLARE_SOA_COLUMN(Px0, px0, float, "fPx0"); |
| 25 | +DECLARE_SOA_COLUMN(Py0, py0, float, "fPy0"); |
| 26 | +DECLARE_SOA_COLUMN(Pz0, pz0, float, "fPz0"); |
| 27 | +DECLARE_SOA_COLUMN(Index1, index1, int, "fIndex1"); |
| 28 | +DECLARE_SOA_COLUMN(Px1, px1, float, "fPx1"); |
| 29 | +DECLARE_SOA_COLUMN(Py1, py1, float, "fPy1"); |
| 30 | +DECLARE_SOA_COLUMN(Pz1, pz1, float, "fPz1"); |
| 31 | +DECLARE_SOA_COLUMN(IndexDCApair, indexDCApair, int, "fIndexDCApair"); |
| 32 | +DECLARE_SOA_COLUMN(Mass, mass, float, "fMass"); |
| 33 | +DECLARE_SOA_COLUMN(Massbar, massbar, float, "fMassbar"); |
| 34 | +DECLARE_SOA_DYNAMIC_COLUMN(DecaylengthXY, decaylengthXY, [](float xvtxd, float yvtxd, float xvtxp, float yvtxp) { return sqrtf((yvtxd - yvtxp) * (yvtxd - yvtxp) + (xvtxd - xvtxp) * (xvtxd - xvtxp)); }); |
| 35 | +DECLARE_SOA_DYNAMIC_COLUMN(Decaylength, decaylength, [](float xvtxd, float yvtxd, float zvtxd, float xvtxp, float yvtxp, float zvtxp) { return sqrtf((yvtxd - yvtxp) * (yvtxd - yvtxp) + (xvtxd - xvtxp) * (xvtxd - xvtxp) + (zvtxd - zvtxp) * (zvtxd - zvtxp)); }); |
| 36 | + |
| 37 | +//old way of doing it |
| 38 | +//DECLARE_SOA_COLUMN(Decaylength, decaylength, float, "fDecaylength"); |
| 39 | +//DECLARE_SOA_COLUMN(DecaylengthXY, decaylengthXY, float, "fDecaylengthXY"); |
| 40 | + |
| 41 | +} // namespace secvtx2prong |
| 42 | +namespace cand2prong |
| 43 | +{ |
| 44 | +DECLARE_SOA_COLUMN(CollisionId, collisionId, int, "fCollisionsID"); |
| 45 | +DECLARE_SOA_COLUMN(MassD0, massD0, float, "fMassD0"); |
| 46 | +DECLARE_SOA_COLUMN(MassD0bar, massD0bar, float, "fMassD0bar"); |
| 47 | +} // namespace cand2prong |
| 48 | + |
| 49 | +DECLARE_SOA_TABLE(SecVtx2Prong, "AOD", "CAND2PRONG", |
| 50 | + secvtx2prong::CollisionId, collision::PosX, collision::PosY, collision::PosZ, |
| 51 | + secvtx2prong::Posdecayx, secvtx2prong::Posdecayy, secvtx2prong::Posdecayz, |
| 52 | + secvtx2prong::Index0, secvtx2prong::Px0, secvtx2prong::Py0, secvtx2prong::Pz0, |
| 53 | + secvtx2prong::Index1, secvtx2prong::Px1, secvtx2prong::Py1, secvtx2prong::Pz1, |
| 54 | + secvtx2prong::IndexDCApair, secvtx2prong::Mass, secvtx2prong::Massbar, |
| 55 | + secvtx2prong::DecaylengthXY<secvtx2prong::Posdecayx, secvtx2prong::Posdecayy, collision::PosX, collision::PosY>, |
| 56 | + secvtx2prong::Decaylength<secvtx2prong::Posdecayx, secvtx2prong::Posdecayy, secvtx2prong::Posdecayz, collision::PosX, collision::PosY, collision::PosZ>); |
| 57 | + |
| 58 | +DECLARE_SOA_TABLE(Cand2Prong, "AOD", "CANDDZERO", |
| 59 | + cand2prong::CollisionId, cand2prong::MassD0, cand2prong::MassD0bar); |
| 60 | +} // namespace o2::aod |
| 61 | + |
| 62 | +using namespace o2; |
| 63 | +using namespace o2::framework; |
| 64 | + |
| 65 | +float decaylengthXY(float xvtxp, float yvtxp, float xvtxd, float yvtxd) |
| 66 | +{ |
| 67 | + float decl_ = sqrtf((yvtxd - yvtxp) * (yvtxd - yvtxp) + (xvtxd - xvtxp) * (xvtxd - xvtxp)); |
| 68 | + return decl_; |
| 69 | +}; |
| 70 | + |
| 71 | +float decaylength(float xvtxp, float yvtxp, float zvtxp, float xvtxd, float yvtxd, float zvtxd) |
| 72 | +{ |
| 73 | + float decl_ = sqrtf((yvtxd - yvtxp) * (yvtxd - yvtxp) + (xvtxd - xvtxp) * (xvtxd - xvtxp) + (zvtxd - zvtxp) * (zvtxd - zvtxp)); |
| 74 | + return decl_; |
| 75 | +}; |
| 76 | + |
| 77 | +float energy(float px, float py, float pz, float mass) |
| 78 | +{ |
| 79 | + float en_ = sqrtf(mass * mass + px * px + py * py + pz * pz); |
| 80 | + return en_; |
| 81 | +}; |
| 82 | + |
| 83 | +float invmass2prongs(float px0, float py0, float pz0, float mass0, |
| 84 | + float px1, float py1, float pz1, float mass1) |
| 85 | +{ |
| 86 | + |
| 87 | + float energy0_ = energy(px0, py0, pz0, mass0); |
| 88 | + float energy1_ = energy(px1, py1, pz1, mass1); |
| 89 | + float energytot = energy0_ + energy1_; |
| 90 | + |
| 91 | + float psum2 = (px0 + px1) * (px0 + px1) + (py0 + py1) * (py0 + py1) + (pz0 + pz1) * (pz0 + pz1); |
| 92 | + float mass = sqrtf(energytot * energytot - psum2); |
| 93 | + return mass; |
| 94 | +}; |
| 95 | + |
| 96 | +#endif // O2_ANALYSIS_SECONDARYVERTEX_H_ |
0 commit comments