Skip to content

Commit 137d5fe

Browse files
alessandrodefalcoAlessandro De Falco
andauthored
PWGHF: Add (updated) chic tree creator (#299)
* Add chi_c tree creator * Add chi_c tree creator * Chic tree creator for ML with updates * Update chic tree creator * Add chi tree creator with clang fixes * updated chi_c tree creator * updated chi_c tree creator (with clang fixes) * PWGHF: add variables to chi_c trees. Co-authored-by: Alessandro De Falco <defalco@alicecerno2.cern.ch>
1 parent bf36b70 commit 137d5fe

2 files changed

Lines changed: 237 additions & 5 deletions

File tree

PWGHF/TableProducer/CMakeLists.txt

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,11 @@ o2physics_add_dpl_workflow(candidate-creator-xicc
4444
PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore O2::DetectorsVertexing ROOT::EG
4545
COMPONENT_NAME Analysis)
4646

47+
o2physics_add_dpl_workflow(candidate-creator-chic
48+
SOURCES HFCandidateCreatorChic.cxx
49+
PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore O2::DetectorsVertexing ROOT::EG
50+
COMPONENT_NAME Analysis)
51+
4752
o2physics_add_dpl_workflow(candidate-creator-lb
4853
SOURCES HFCandidateCreatorLb.cxx
4954
PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore O2::DetectorsVertexing ROOT::EG
@@ -54,11 +59,6 @@ o2physics_add_dpl_workflow(candidate-creator-x
5459
PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore O2::DetectorsVertexing ROOT::EG
5560
COMPONENT_NAME Analysis)
5661

57-
o2physics_add_dpl_workflow(candidate-creator-chic
58-
SOURCES HFCandidateCreatorChic.cxx
59-
PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore O2::DetectorsVertexing ROOT::EG
60-
COMPONENT_NAME Analysis)
61-
6262
o2physics_add_dpl_workflow(tree-creator-lc-topkpi
6363
SOURCES HFTreeCreatorLcToPKPi.cxx
6464
PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore O2::DetectorsVertexing ROOT::EG
@@ -74,6 +74,11 @@ o2physics_add_dpl_workflow(tree-creator-xicc-topkpipi
7474
PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore O2::DetectorsVertexing ROOT::EG
7575
COMPONENT_NAME Analysis)
7676

77+
o2physics_add_dpl_workflow(tree-creator-chic-tojpsigamma
78+
SOURCES HFTreeCreatorChicToJpsiGamma.cxx
79+
PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore O2::DetectorsVertexing ROOT::EG
80+
COMPONENT_NAME Analysis)
81+
7782
o2physics_add_dpl_workflow(d0-candidate-selector
7883
SOURCES HFD0CandidateSelector.cxx
7984
PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore O2::DetectorsVertexing
Lines changed: 227 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,227 @@
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

Comments
 (0)