Skip to content

Commit c674eb0

Browse files
Tao-Fangalibuildfgrosa
authored
[PWGHF] Add centrality information to Xic0 (AliceO2Group#9128)
Co-authored-by: ALICE Action Bot <[email protected]> Co-authored-by: Fabrizio <[email protected]>
1 parent b833caa commit c674eb0

File tree

1 file changed

+115
-11
lines changed

1 file changed

+115
-11
lines changed

PWGHF/TableProducer/treeCreatorToXiPi.cxx

Lines changed: 115 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,13 @@
1515
///
1616
/// \author Federica Zanone <[email protected]>, Heidelberg University
1717

18+
#include "CommonConstants/PhysicsConstants.h"
1819
#include "Framework/AnalysisTask.h"
1920
#include "Framework/runDataProcessing.h"
2021

22+
#include "Common/DataModel/Centrality.h"
23+
#include "Common/DataModel/Multiplicity.h"
24+
2125
#include "Common/Core/RecoDecay.h"
2226

2327
#include "PWGHF/DataModel/CandidateReconstructionTables.h"
@@ -31,9 +35,20 @@ namespace o2::aod
3135
namespace full
3236
{
3337
// collision info
38+
DECLARE_SOA_INDEX_COLUMN(Collision, collision);
39+
DECLARE_SOA_INDEX_COLUMN(McCollision, mcCollision);
3440
DECLARE_SOA_COLUMN(IsEventSel8, isEventSel8, bool);
3541
DECLARE_SOA_COLUMN(IsEventSelZ, isEventSelZ, bool);
42+
DECLARE_SOA_COLUMN(RunNumber, runNumber, int);
43+
DECLARE_SOA_COLUMN(IsEventReject, isEventReject, int);
44+
DECLARE_SOA_COLUMN(CentFT0A, centFT0A, float);
45+
DECLARE_SOA_COLUMN(CentFT0C, centFT0C, float);
46+
DECLARE_SOA_COLUMN(CentFT0M, centFT0M, float);
47+
DECLARE_SOA_COLUMN(CentFV0A, centFV0A, float);
48+
DECLARE_SOA_COLUMN(CentFDDM, centFDDM, float);
49+
DECLARE_SOA_COLUMN(MultZeqNTracksPV, multZeqNTracksPV, float);
3650
// from creator
51+
DECLARE_SOA_COLUMN(Cent, cent, float);
3752
DECLARE_SOA_COLUMN(XPv, xPv, float);
3853
DECLARE_SOA_COLUMN(YPv, yPv, float);
3954
DECLARE_SOA_COLUMN(ZPv, zPv, float);
@@ -147,9 +162,23 @@ DECLARE_SOA_COLUMN(TofNSigmaPrFromLambda, tofNSigmaPrFromLambda, float);
147162
} // namespace full
148163

149164
DECLARE_SOA_TABLE(HfToXiPiEvs, "AOD", "HFTOXIPIEV",
150-
full::IsEventSel8, full::IsEventSelZ);
165+
full::IsEventSel8, full::IsEventSelZ,
166+
full::McCollisionId,
167+
collision::NumContrib,
168+
collision::PosX,
169+
collision::PosY,
170+
collision::PosZ,
171+
full::IsEventReject,
172+
full::RunNumber,
173+
full::CentFT0A,
174+
full::CentFT0C,
175+
full::CentFT0M,
176+
full::CentFV0A,
177+
full::CentFDDM,
178+
full::MultZeqNTracksPV);
151179

152180
DECLARE_SOA_TABLE(HfToXiPiFulls, "AOD", "HFTOXIPIFULL",
181+
full::CollisionId,
153182
full::XPv, full::YPv, full::ZPv, collision::NumContrib, collision::Chi2,
154183
full::XDecayVtxCharmBaryon, full::YDecayVtxCharmBaryon, full::ZDecayVtxCharmBaryon,
155184
full::XDecayVtxCascade, full::YDecayVtxCascade, full::ZDecayVtxCascade,
@@ -219,8 +248,13 @@ struct HfTreeCreatorToXiPi {
219248

220249
Configurable<float> zPvCut{"zPvCut", 10., "Cut on absolute value of primary vertex z coordinate"};
221250

251+
SliceCache cache;
252+
Preslice<aod::HfCandToXiPi> candXicPerCollision = aod::hf_cand_xic0_omegac0::collisionId;
253+
254+
using Cents = soa::Join<aod::CentFV0As, aod::CentFT0Ms, aod::CentFT0As, aod::CentFT0Cs, aod::CentFDDMs>;
222255
using MyTrackTable = soa::Join<aod::Tracks, aod::TrackSelection, aod::TracksExtra>;
223256
using MyEventTable = soa::Join<aod::Collisions, aod::EvSels>;
257+
using MyEventTableWithCent = soa::Join<aod::Collisions, aod::EvSels, aod::PVMultZeqs, Cents>;
224258

225259
void init(InitContext const&)
226260
{
@@ -229,16 +263,46 @@ struct HfTreeCreatorToXiPi {
229263
}
230264
}
231265

232-
template <typename T>
266+
template <bool useCentrality, typename T>
233267
void fillEvent(const T& collision, float cutZPv)
234268
{
235-
rowEv(collision.sel8(), std::abs(collision.posZ()) < cutZPv);
269+
float centFT0A = -1.f;
270+
float centFT0C = -1.f;
271+
float centFT0M = -1.f;
272+
float centFV0A = -1.f;
273+
float centFDDM = -1.f;
274+
float multZeqNTracksPV = -1.f;
275+
if constexpr (useCentrality) {
276+
centFT0A = collision.centFT0A();
277+
centFT0C = collision.centFT0C();
278+
centFT0M = collision.centFT0M();
279+
centFV0A = collision.centFV0A();
280+
centFDDM = collision.centFDDM();
281+
multZeqNTracksPV = collision.multZeqNTracksPV();
282+
}
283+
284+
rowEv(
285+
collision.sel8(), std::abs(collision.posZ()) < cutZPv,
286+
-1,
287+
collision.numContrib(),
288+
collision.posX(),
289+
collision.posY(),
290+
collision.posZ(),
291+
0,
292+
1,
293+
centFT0A,
294+
centFT0C,
295+
centFT0M,
296+
centFV0A,
297+
centFDDM,
298+
multZeqNTracksPV);
236299
}
237300

238301
template <typename T>
239302
void fillCandidate(const T& candidate, int8_t flagMc, int8_t debugMc, int8_t originMc, bool collisionMatched)
240303
{
241304
rowCandidateFull(
305+
rowEv.lastIndex(),
242306
candidate.xPv(),
243307
candidate.yPv(),
244308
candidate.zPv(),
@@ -434,7 +498,7 @@ struct HfTreeCreatorToXiPi {
434498
// Filling event properties
435499
rowEv.reserve(collisions.size());
436500
for (const auto& collision : collisions) {
437-
fillEvent(collision, zPvCut);
501+
fillEvent<false>(collision, zPvCut);
438502
}
439503

440504
// Filling candidate properties
@@ -443,15 +507,35 @@ struct HfTreeCreatorToXiPi {
443507
fillCandidate(candidate, -7, -7, RecoDecay::OriginType::None, false);
444508
}
445509
}
446-
PROCESS_SWITCH(HfTreeCreatorToXiPi, processDataFull, "Process data with full information", true);
510+
PROCESS_SWITCH(HfTreeCreatorToXiPi, processDataFull, "Process data with full information w/o centrality", true);
511+
512+
void processDataFullWithCentrality(MyEventTableWithCent const& collisions, MyTrackTable const&,
513+
soa::Join<aod::HfCandToXiPi, aod::HfSelToXiPi> const& candidates)
514+
{
515+
// Filling event properties
516+
rowEv.reserve(collisions.size());
517+
for (const auto& collision : collisions) {
518+
auto thisCollId = collision.globalIndex();
519+
auto groupedXicCandidates = candidates.sliceBy(candXicPerCollision, thisCollId);
520+
auto sizeTableCand = groupedXicCandidates.size();
521+
fillEvent<true>(collision, zPvCut);
522+
523+
// Filling candidate properties
524+
rowCandidateFull.reserve(sizeTableCand);
525+
for (const auto& candidate : groupedXicCandidates) {
526+
fillCandidate(candidate, -7, -7, RecoDecay::OriginType::None, false);
527+
}
528+
}
529+
}
530+
PROCESS_SWITCH(HfTreeCreatorToXiPi, processDataFullWithCentrality, "Process data with full information with centrality", false);
447531

448532
void processMcFullXic0(MyEventTable const& collisions, MyTrackTable const&,
449533
soa::Join<aod::HfCandToXiPi, aod::HfSelToXiPi, aod::HfXicToXiPiMCRec> const& candidates)
450534
{
451535
// Filling event properties
452536
rowEv.reserve(collisions.size());
453537
for (const auto& collision : collisions) {
454-
fillEvent(collision, zPvCut);
538+
fillEvent<false>(collision, zPvCut);
455539
}
456540

457541
// Filling candidate properties
@@ -460,15 +544,35 @@ struct HfTreeCreatorToXiPi {
460544
fillCandidate(candidate, candidate.flagMcMatchRec(), candidate.debugMcRec(), candidate.originRec(), candidate.collisionMatched());
461545
}
462546
}
463-
PROCESS_SWITCH(HfTreeCreatorToXiPi, processMcFullXic0, "Process MC with full information for xic0", false);
547+
PROCESS_SWITCH(HfTreeCreatorToXiPi, processMcFullXic0, "Process MC with full information for xic0 w/o centrality", false);
548+
549+
void processMcFullXic0WithCentrality(MyEventTableWithCent const& collisions, MyTrackTable const&,
550+
soa::Join<aod::HfCandToXiPi, aod::HfSelToXiPi, aod::HfXicToXiPiMCRec> const& candidates)
551+
{
552+
// Filling event properties
553+
rowEv.reserve(collisions.size());
554+
for (const auto& collision : collisions) {
555+
auto thisCollId = collision.globalIndex();
556+
auto groupedXicCandidates = candidates.sliceBy(candXicPerCollision, thisCollId);
557+
auto sizeTableCand = groupedXicCandidates.size();
558+
fillEvent<true>(collision, zPvCut);
559+
560+
// Filling candidate properties
561+
rowCandidateFull.reserve(sizeTableCand);
562+
for (const auto& candidate : groupedXicCandidates) {
563+
fillCandidate(candidate, candidate.flagMcMatchRec(), candidate.debugMcRec(), candidate.originRec(), candidate.collisionMatched());
564+
}
565+
}
566+
}
567+
PROCESS_SWITCH(HfTreeCreatorToXiPi, processMcFullXic0WithCentrality, "Process MC with full information for xic0 with centrality", false);
464568

465569
void processMcFullOmegac0(MyEventTable const& collisions, MyTrackTable const&,
466570
soa::Join<aod::HfCandToXiPi, aod::HfSelToXiPi, aod::HfOmegacToXiPiMCRec> const& candidates)
467571
{
468572
// Filling event properties
469573
rowEv.reserve(collisions.size());
470574
for (const auto& collision : collisions) {
471-
fillEvent(collision, zPvCut);
575+
fillEvent<false>(collision, zPvCut);
472576
}
473577

474578
// Filling candidate properties
@@ -485,7 +589,7 @@ struct HfTreeCreatorToXiPi {
485589
// Filling event properties
486590
rowEv.reserve(collisions.size());
487591
for (const auto& collision : collisions) {
488-
fillEvent(collision, zPvCut);
592+
fillEvent<false>(collision, zPvCut);
489593
}
490594

491595
// Filling candidate properties
@@ -502,7 +606,7 @@ struct HfTreeCreatorToXiPi {
502606
// Filling event properties
503607
rowEv.reserve(collisions.size());
504608
for (const auto& collision : collisions) {
505-
fillEvent(collision, zPvCut);
609+
fillEvent<false>(collision, zPvCut);
506610
}
507611

508612
// Filling candidate properties
@@ -519,7 +623,7 @@ struct HfTreeCreatorToXiPi {
519623
// Filling event properties
520624
rowEv.reserve(collisions.size());
521625
for (const auto& collision : collisions) {
522-
fillEvent(collision, zPvCut);
626+
fillEvent<false>(collision, zPvCut);
523627
}
524628

525629
// Filling candidate properties

0 commit comments

Comments
 (0)