|
10 | 10 | #include "Framework/runDataProcessing.h" |
11 | 11 | #include "Framework/AnalysisTask.h" |
12 | 12 | #include "Framework/AnalysisDataModel.h" |
| 13 | +#include "Analysis/SecondaryVertex.h" |
13 | 14 | #include "DetectorsBase/DCAFitter.h" |
14 | 15 | #include "ReconstructionDataFormats/Track.h" |
15 | 16 |
|
16 | 17 | #include <TFile.h> |
17 | 18 | #include <TH1F.h> |
18 | 19 | #include <cmath> |
19 | 20 | #include <array> |
20 | | -namespace o2::aod |
21 | | -{ |
22 | | -namespace secvtx2prong |
23 | | -{ |
24 | | -DECLARE_SOA_COLUMN(CollisionId, collisionId, int, "fCollisionsID"); |
25 | | -DECLARE_SOA_COLUMN(Posdecayx, posdecayx, float, "fPosdecayx"); |
26 | | -DECLARE_SOA_COLUMN(Posdecayy, posdecayy, float, "fPosdecayy"); |
27 | | -DECLARE_SOA_COLUMN(Posdecayz, posdecayz, float, "fPosdecayz"); |
28 | | -DECLARE_SOA_COLUMN(Index0, index0, int, "fIndex0"); |
29 | | -DECLARE_SOA_COLUMN(Px0, px0, float, "fPx0"); |
30 | | -DECLARE_SOA_COLUMN(Py0, py0, float, "fPy0"); |
31 | | -DECLARE_SOA_COLUMN(Pz0, pz0, float, "fPz0"); |
32 | | -DECLARE_SOA_COLUMN(Index1, index1, int, "fIndex1"); |
33 | | -DECLARE_SOA_COLUMN(Px1, px1, float, "fPx1"); |
34 | | -DECLARE_SOA_COLUMN(Py1, py1, float, "fPy1"); |
35 | | -DECLARE_SOA_COLUMN(Pz1, pz1, float, "fPz1"); |
36 | | -DECLARE_SOA_COLUMN(IndexDCApair, indexDCApair, int, "fIndexDCApair"); |
37 | | -DECLARE_SOA_COLUMN(Mass, mass, float, "fMass"); |
38 | | -DECLARE_SOA_COLUMN(Massbar, massbar, float, "fMassbar"); |
39 | | -DECLARE_SOA_DYNAMIC_COLUMN(DecaylengthXY, decaylengthXY, [](float xvtxd, float yvtxd, float xvtxp, float yvtxp) { return sqrtf((yvtxd - yvtxp) * (yvtxd - yvtxp) + (xvtxd - xvtxp) * (xvtxd - xvtxp)); }); |
40 | | -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)); }); |
41 | | - |
42 | | -//old way of doing it |
43 | | -//DECLARE_SOA_COLUMN(Decaylength, decaylength, float, "fDecaylength"); |
44 | | -//DECLARE_SOA_COLUMN(DecaylengthXY, decaylengthXY, float, "fDecaylengthXY"); |
45 | | - |
46 | | -} // namespace secvtx2prong |
47 | | -namespace cand2prong |
48 | | -{ |
49 | | -DECLARE_SOA_COLUMN(CollisionId, collisionId, int, "fCollisionsID"); |
50 | | -DECLARE_SOA_COLUMN(MassD0, massD0, float, "fMassD0"); |
51 | | -DECLARE_SOA_COLUMN(MassD0bar, massD0bar, float, "fMassD0bar"); |
52 | | -} // namespace cand2prong |
53 | | - |
54 | | -DECLARE_SOA_TABLE(SecVtx2Prong, "AOD", "CAND2PRONG", |
55 | | - secvtx2prong::CollisionId, collision::PosX, collision::PosY, collision::PosZ, |
56 | | - secvtx2prong::Posdecayx, secvtx2prong::Posdecayy, secvtx2prong::Posdecayz, |
57 | | - secvtx2prong::Index0, secvtx2prong::Px0, secvtx2prong::Py0, secvtx2prong::Pz0, |
58 | | - secvtx2prong::Index1, secvtx2prong::Px1, secvtx2prong::Py1, secvtx2prong::Pz1, |
59 | | - secvtx2prong::IndexDCApair, secvtx2prong::Mass, secvtx2prong::Massbar, |
60 | | - secvtx2prong::DecaylengthXY<secvtx2prong::Posdecayx, secvtx2prong::Posdecayy, collision::PosX, collision::PosY>, |
61 | | - secvtx2prong::Decaylength<secvtx2prong::Posdecayx, secvtx2prong::Posdecayy, secvtx2prong::Posdecayz, collision::PosX, collision::PosY, collision::PosZ>); |
62 | | - |
63 | | -DECLARE_SOA_TABLE(Cand2Prong, "AOD", "CANDDZERO", |
64 | | - cand2prong::CollisionId, cand2prong::MassD0, cand2prong::MassD0bar); |
65 | | -} // namespace o2::aod |
66 | | - |
67 | | -using namespace o2; |
68 | | -using namespace o2::framework; |
69 | | - |
70 | | -float decaylengthXY(float xvtxp, float yvtxp, float xvtxd, float yvtxd) |
71 | | -{ |
72 | | - float decl_ = sqrtf((yvtxd - yvtxp) * (yvtxd - yvtxp) + (xvtxd - xvtxp) * (xvtxd - xvtxp)); |
73 | | - return decl_; |
74 | | -}; |
75 | | - |
76 | | -float decaylength(float xvtxp, float yvtxp, float zvtxp, float xvtxd, float yvtxd, float zvtxd) |
77 | | -{ |
78 | | - float decl_ = sqrtf((yvtxd - yvtxp) * (yvtxd - yvtxp) + (xvtxd - xvtxp) * (xvtxd - xvtxp) + (zvtxd - zvtxp) * (zvtxd - zvtxp)); |
79 | | - return decl_; |
80 | | -}; |
81 | | - |
82 | | -float energy(float px, float py, float pz, float mass) |
83 | | -{ |
84 | | - float en_ = sqrtf(mass * mass + px * px + py * py + pz * pz); |
85 | | - return en_; |
86 | | -}; |
87 | | - |
88 | | -float invmass2prongs(float px0, float py0, float pz0, float mass0, |
89 | | - float px1, float py1, float pz1, float mass1) |
90 | | -{ |
91 | | - |
92 | | - float energy0_ = energy(px0, py0, pz0, mass0); |
93 | | - float energy1_ = energy(px1, py1, pz1, mass1); |
94 | | - float energytot = energy0_ + energy1_; |
95 | | - |
96 | | - float psum2 = (px0 + px1) * (px0 + px1) + (py0 + py1) * (py0 + py1) + (pz0 + pz1) * (pz0 + pz1); |
97 | | - float mass = sqrtf(energytot * energytot - psum2); |
98 | | - return mass; |
99 | | -}; |
100 | 21 |
|
101 | 22 | struct CandidateBuilding2Prong { |
102 | 23 | // secondary vertex position |
@@ -208,7 +129,8 @@ struct CandidateBuildingDzero { |
208 | 129 |
|
209 | 130 | for (auto& secVtx2prong : secVtx2Prongs) { |
210 | 131 | //example to access the track at the index saved in the secVtx2Prongs |
211 | | - LOGF(INFO, " I am now accessing track information looping over secondary vertices %f", (tracks.begin() + secVtx2prong.index0()).y()); |
| 132 | + LOGF(INFO, " I am now accessing track information looping over secondary vertices %d", secVtx2prong.index0Id()); |
| 133 | + LOGF(INFO, " I am now accessing track information looping over secondary vertices %f", secVtx2prong.index0().y()); |
212 | 134 | float masspion = 0.140; |
213 | 135 | float masskaon = 0.494; |
214 | 136 | float mass_ = invmass2prongs(secVtx2prong.px0(), secVtx2prong.py0(), secVtx2prong.pz0(), masspion, |
|
0 commit comments