Skip to content

Commit 8e98c64

Browse files
lucamicheletti93Luca Micheletti
andauthored
PWGHF: X tree creator task (#48)
* Tree creator for X(3872) * Implementing comments * Fix of the struct name * Fixing issues with the struct name Co-authored-by: Luca Micheletti <lmichele@alicecerno2.cern.ch>
1 parent 5db87a4 commit 8e98c64

2 files changed

Lines changed: 206 additions & 0 deletions

File tree

Tasks/PWGHF/CMakeLists.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,11 @@ o2physics_add_dpl_workflow(hf-tree-creator-lc-topkpi
5454
PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisDataModel O2Physics::AnalysisCore O2::DetectorsVertexing ROOT::EG
5555
COMPONENT_NAME Analysis)
5656

57+
o2physics_add_dpl_workflow(hf-tree-creator-x-tojpsipipi
58+
SOURCES HFTreeCreatorXToJpsiPiPi.cxx
59+
PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisDataModel O2Physics::AnalysisCore O2::DetectorsVertexing ROOT::EG
60+
COMPONENT_NAME Analysis)
61+
5762
o2physics_add_dpl_workflow(hf-d0-candidate-selector
5863
SOURCES HFD0CandidateSelector.cxx
5964
PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisDataModel O2Physics::AnalysisCore O2::DetectorsVertexing
Lines changed: 201 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,201 @@
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 Luca Micheletti <luca.micheletti@to.infn.it>, INFN
18+
/// \note based on O2Physics/Tasks/PWGHF/HFTreeCreatorLcToPKPi.cxx
19+
20+
#include "Framework/runDataProcessing.h"
21+
#include "Framework/AnalysisTask.h"
22+
#include "DetectorsVertexing/DCAFitterN.h"
23+
#include "AnalysisDataModel/HFSecondaryVertex.h"
24+
#include "AnalysisDataModel/HFCandidateSelectionTables.h"
25+
#include "AnalysisCore/trackUtilities.h"
26+
#include "ReconstructionDataFormats/DCA.h"
27+
28+
using namespace o2;
29+
using namespace o2::framework;
30+
using namespace o2::aod::hf_cand_x;
31+
32+
namespace o2::aod
33+
{
34+
namespace full
35+
{
36+
DECLARE_SOA_COLUMN(RSecondaryVertex, rSecondaryVertex, float);
37+
DECLARE_SOA_COLUMN(PtProng0, ptProng0, float);
38+
DECLARE_SOA_COLUMN(PProng0, pProng0, float);
39+
DECLARE_SOA_COLUMN(PtProng1, ptProng1, float);
40+
DECLARE_SOA_COLUMN(PProng1, pProng1, float);
41+
DECLARE_SOA_COLUMN(PtProng2, ptProng2, float);
42+
DECLARE_SOA_COLUMN(PProng2, pProng2, float);
43+
DECLARE_SOA_COLUMN(CandidateSelFlag, candidateSelFlag, int8_t);
44+
DECLARE_SOA_COLUMN(M, m, float);
45+
DECLARE_SOA_COLUMN(Pt, pt, float);
46+
DECLARE_SOA_COLUMN(P, p, float);
47+
DECLARE_SOA_COLUMN(Eta, eta, float);
48+
DECLARE_SOA_COLUMN(Phi, phi, float);
49+
DECLARE_SOA_COLUMN(Y, y, float);
50+
DECLARE_SOA_COLUMN(E, e, float);
51+
DECLARE_SOA_COLUMN(DecayLength, decayLength, float);
52+
DECLARE_SOA_COLUMN(DecayLengthXY, decayLengthXY, float);
53+
DECLARE_SOA_COLUMN(DecayLengthNormalised, decayLengthNormalised, float);
54+
DECLARE_SOA_COLUMN(DecayLengthXYNormalised, decayLengthXYNormalised, float);
55+
DECLARE_SOA_COLUMN(CPA, cpa, float);
56+
DECLARE_SOA_COLUMN(CPAXY, cpaXY, float);
57+
DECLARE_SOA_COLUMN(Ct, ct, float);
58+
DECLARE_SOA_COLUMN(MCflag, mcflag, int8_t);
59+
// Events
60+
DECLARE_SOA_COLUMN(IsEventReject, isEventReject, int);
61+
DECLARE_SOA_COLUMN(RunNumber, runNumber, int);
62+
} // namespace full
63+
64+
DECLARE_SOA_TABLE(HfCandXFull, "AOD", "HFCANDXFull",
65+
collision::PosX,
66+
collision::PosY,
67+
collision::PosZ,
68+
full::PtProng0,
69+
full::PProng0,
70+
full::PtProng1,
71+
full::PProng1,
72+
full::PtProng2,
73+
full::PProng2,
74+
hf_cand::ImpactParameter0,
75+
hf_cand::ImpactParameter1,
76+
hf_cand::ImpactParameter2,
77+
full::CandidateSelFlag,
78+
full::M,
79+
full::Pt,
80+
full::P,
81+
full::CPA,
82+
full::CPAXY,
83+
full::Ct,
84+
full::Eta,
85+
full::Phi,
86+
full::Y,
87+
full::MCflag);
88+
89+
DECLARE_SOA_TABLE(HfCandXFullEvents, "AOD", "HFCANDXFullE",
90+
collision::BCId,
91+
collision::NumContrib,
92+
collision::PosX,
93+
collision::PosY,
94+
collision::PosZ,
95+
full::IsEventReject,
96+
full::RunNumber);
97+
98+
DECLARE_SOA_TABLE(HfCandXFullParticles, "AOD", "HFCANDXFullP",
99+
collision::BCId,
100+
full::Pt,
101+
full::Eta,
102+
full::Phi,
103+
full::Y,
104+
full::MCflag);
105+
106+
} // namespace o2::aod
107+
108+
/// Writes the full information in an output TTree
109+
struct HfTreeCreatorXTojpsipipi {
110+
Produces<o2::aod::HfCandXFull> rowCandidateFull;
111+
Produces<o2::aod::HfCandXFullEvents> rowCandidateFullEvents;
112+
Produces<o2::aod::HfCandXFullParticles> rowCandidateFullParticles;
113+
114+
void init(InitContext const&)
115+
{
116+
}
117+
118+
void process(aod::Collisions const& collisions,
119+
aod::McCollisions const& mccollisions,
120+
soa::Join<aod::HfCandX, aod::HfCandXMCRec, aod::HFSelXToJpsiPiPiCandidate> const& candidates,
121+
soa::Join<aod::McParticles, aod::HfCandXMCGen> const& particles,
122+
aod::BigTracksPID const& tracks)
123+
{
124+
125+
// Filling event properties
126+
rowCandidateFullEvents.reserve(collisions.size());
127+
for (auto& collision : collisions) {
128+
rowCandidateFullEvents(
129+
collision.bcId(),
130+
collision.numContrib(),
131+
collision.posX(),
132+
collision.posY(),
133+
collision.posZ(),
134+
0,
135+
1);
136+
}
137+
138+
// Filling candidate properties
139+
int indexCand = 0;
140+
rowCandidateFull.reserve(candidates.size());
141+
for (auto& candidate : candidates) {
142+
indexCand++;
143+
auto fillTable = [&](int CandFlag,
144+
int FunctionSelection,
145+
float FunctionInvMass,
146+
float FunctionCt,
147+
float FunctionY) {
148+
if (FunctionSelection >= 1) {
149+
rowCandidateFull(
150+
candidate.posX(),
151+
candidate.posY(),
152+
candidate.posZ(),
153+
candidate.ptProng0(),
154+
RecoDecay::P(candidate.pxProng0(), candidate.pyProng0(), candidate.pzProng0()),
155+
candidate.ptProng1(),
156+
RecoDecay::P(candidate.pxProng1(), candidate.pyProng1(), candidate.pzProng1()),
157+
candidate.ptProng2(),
158+
RecoDecay::P(candidate.pxProng2(), candidate.pyProng2(), candidate.pzProng2()),
159+
candidate.impactParameter0(),
160+
candidate.impactParameter1(),
161+
candidate.impactParameter2(),
162+
1 << CandFlag,
163+
FunctionInvMass,
164+
candidate.pt(),
165+
candidate.p(),
166+
candidate.cpa(),
167+
candidate.cpaXY(),
168+
FunctionCt,
169+
candidate.eta(),
170+
candidate.phi(),
171+
FunctionY,
172+
candidate.flagMCMatchRec());
173+
}
174+
};
175+
176+
fillTable(0, candidate.isSelXToJpsiPiPi(), InvMassXToJpsiPiPi(candidate), CtX(candidate), YX(candidate));
177+
}
178+
179+
// Filling particle properties
180+
float massX = 3.872;
181+
rowCandidateFullParticles.reserve(particles.size());
182+
for (auto& particle : particles) {
183+
if (std::abs(particle.flagMCMatchGen()) == 1 << DecayType::XToJpsiPiPi) {
184+
rowCandidateFullParticles(
185+
particle.mcCollision().bcId(),
186+
particle.pt(),
187+
particle.eta(),
188+
particle.phi(),
189+
RecoDecay::Y(array{particle.px(), particle.py(), particle.pz()}, massX),
190+
particle.flagMCMatchGen());
191+
}
192+
}
193+
}
194+
};
195+
196+
WorkflowSpec defineDataProcessing(ConfigContext const& cfgc)
197+
{
198+
WorkflowSpec workflow;
199+
workflow.push_back(adaptAnalysisTask<HfTreeCreatorXTojpsipipi>(cfgc));
200+
return workflow;
201+
}

0 commit comments

Comments
 (0)