Skip to content

Commit dca8320

Browse files
author
Christopher Klumm
committed
Implementation for Production of Derived Data
1 parent df5e6b8 commit dca8320

File tree

1 file changed

+194
-2
lines changed

1 file changed

+194
-2
lines changed

PWGCF/FemtoDream/TableProducer/femtoDreamProducerTaskForSpecificAnalysis.cxx

Lines changed: 194 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,10 @@ struct FemtoDreamProducerTaskForSpecificAnalysis {
5353
Configurable<bool> confRequireBitmask{"confRequireBitmask", false, "Require bitmask selection for candidates"};
5454

5555
// Number of candidates required
56-
Configurable<int> confNumberOfTracks{"confNumberOfTracks", 3, "Number of tracks"};
57-
Configurable<int> confNumberOfV0{"confNumberOfV0", 0, "Number of V0"};
56+
Configurable<int> confNumberOfTracks{"confNumberOfTracks", 0, "Number of tracks"};
57+
Configurable<int> confNumberOfV0{"confNumberOfV0", 1, "Number of V0"};
5858
Configurable<int> confNumberOfCascades{"confNumberOfCascades", 0, "Number of Cascades"};
59+
Configurable<int> confNumberOfReso{"confNumberOfV0", 1, "Number of Reso"};
5960

6061
/// Track selection
6162
Configurable<float> confPIDthrMom{"confPIDthrMom", 1.f, "Momentum threshold from which TPC and TOF are required for PID"};
@@ -83,10 +84,41 @@ struct FemtoDreamProducerTaskForSpecificAnalysis {
8384
Configurable<float> confMinInvMassCascade{"confMinInvMassCascade", 1.2, "Minimum invariant mass of Cascade (particle)"};
8485
Configurable<float> confMaxInvMassCascade{"confMaxInvMassCascade", 1.5, "Maximum invariant mass of Cascade (particle)"};
8586

87+
88+
struct : ConfigurableGroup { //set loosest cuts
89+
std::string prefix = std::string("Reso");
90+
Configurable<int> pdgCode{"pdgCode", 333, "PDG code of particle 2 Reso"};
91+
92+
Configurable<float> confMinInvMassReso{"confMinInvMassReso", 0.86, "Minimum invariant mass of Reso (particle)"};
93+
Configurable<float> confMaxInvMassReso{"confMaxInvMassReso", 1.3, "Maximum invariant mass of Reso (particle)"};
94+
95+
96+
Configurable<femtodreamparticle::cutContainerType> daughPosCutBit{"daughPosCutBit", 2401446, "Selection bit for positive child of V02"}; // K+
97+
Configurable<femtodreamparticle::cutContainerType> daughPosTPCBit{"daughPosTPCBit", 4096, "PID TPC bit for positive child of V02"};
98+
Configurable<femtodreamparticle::cutContainerType> daughPosTPCTOFBit{"daughPosTPCTOFBit", 2048, "PID TOF bit for positive child of V02"};
99+
Configurable<femtodreamparticle::cutContainerType> daughNegCutBit{"daughNegCutBit", 2401445, "Selection bit for negative child of V02"}; // K-
100+
Configurable<femtodreamparticle::cutContainerType> daughNegMergedTPCBit{"daughNegMergedTPCBit", 16386, "PID TPC bit for negative child of V02"};
101+
Configurable<femtodreamparticle::cutContainerType> daughNegMergedTPCTOFBit{"daughNegMergedTPCTOFBit", 8194, "PID TOF bit for negative child of V02"};
102+
103+
Configurable<aod::femtodreamparticle::partType> partType1{"partType1", kResoPosdaughTPC_NegdaughTPC};
104+
Configurable<aod::femtodreamparticle::partType> partType2{"partType2", kResoPosdaughTOF_NegdaughTOF};
105+
Configurable<aod::femtodreamparticle::partType> partType3{"partType3", kResoPosdaughTOF_NegdaughTPC};
106+
Configurable<aod::femtodreamparticle::partType> partType4{"partType4", kResoPosdaughTPC_NegdaughTOF};
107+
108+
} Reso;
109+
86110
// Partition for selected particles
87111
Partition<aod::FDParticles> selectedV0s = (aod::femtodreamparticle::partType == uint8_t(aod::femtodreamparticle::ParticleType::kV0));
88112
Partition<aod::FDParticles> selectedCascades = (aod::femtodreamparticle::partType == uint8_t(aod::femtodreamparticle::ParticleType::kCascade));
89113

114+
Partition<aod::FDParticles> selectedResos = (ifnode(aod::femtodreamparticle::partType == uint8_t(Reso.partType1), ncheckbit(aod::femtodreamparticle::pidcut, Reso2.daughPosTPCBit) && ncheckbit(aod::femtodreamparticle::cut, Reso2.daughNegMergedTPCBit), false) ||
115+
ifnode(aod::femtodreamparticle::partType == uint8_t(Reso.partType1), ncheckbit(aod::femtodreamparticle::pidcut, Reso2.daughPosTPCTOFBit) && ncheckbit(aod::femtodreamparticle::cut, Reso2.daughNegMergedTPCTOFBit), false) ||
116+
ifnode(aod::femtodreamparticle::partType == uint8_t(Reso.partType1), ncheckbit(aod::femtodreamparticle::pidcut, Reso2.daughPosTPCTOFBit) && ncheckbit(aod::femtodreamparticle::cut, Reso2.daughNegMergedTPCBit), false) ||
117+
ifnode(aod::femtodreamparticle::partType == uint8_t(Reso.partType1), ncheckbit(aod::femtodreamparticle::pidcut, Reso2.daughPosTPCBit) && ncheckbit(aod::femtodreamparticle::cut, Reso2.daughNegMergedTPCTOFBit), false)) &&
118+
(aod::femtodreamparticle::mLambda > Reso.confMinInvMassReso) &&
119+
(aod::femtodreamparticle::mLambda < Reso.confMaxInvMassReso);
120+
121+
90122
HistogramRegistry eventRegistry{"eventRegistry", {}, OutputObjHandlingPolicy::AnalysisObject};
91123

92124
static constexpr uint32_t kSignPlusMask = 1 << 1;
@@ -386,6 +418,166 @@ struct FemtoDreamProducerTaskForSpecificAnalysis {
386418
createSpecifiedDerivedDataTrkCascade<false>(col, thegroupSelectedParts, thegroupSelectedCascades, parts);
387419
}
388420
PROCESS_SWITCH(FemtoDreamProducerTaskForSpecificAnalysis, processCollisionsWithNTracksAndNCascades, "Enable producing data with tracks and Cascades collisions for data", true);
421+
422+
423+
template <bool isMC, typename PartitionType, typename PartType>
424+
void createSpecifiedDerivedDataV0Reso(const o2::aod::FDCollision& col, PartitionType groupSelectedV0s, PartitionType groupSelectedResos, PartType parts)
425+
{
426+
//check v0's
427+
int v0Count = 0;
428+
int antiV0Count = 0;
429+
int ResoCount = 0; // no antiparticles
430+
431+
for (const auto& V0 : groupSelectedV0s) {
432+
if ((V0.mLambda() > confMinInvMassV0) && (V0.mLambda() < confMaxInvMassV0)) {
433+
if (confRequireBitmask) {
434+
if (ncheckbit(V0.cut(), confCutV0SameForAntipart)) {
435+
const auto& posChild = parts.iteratorAt(V0.index() - 2);
436+
const auto& negChild = parts.iteratorAt(V0.index() - 1);
437+
if (((posChild.cut() & confChildPosCutV0) == confChildPosCutV0 &&
438+
(posChild.pidcut() & confChildPosTPCBitV0) == confChildPosTPCBitV0 &&
439+
(negChild.cut() & confChildNegCutV0) == confChildNegCutV0 &&
440+
(negChild.pidcut() & confChildNegTPCBitV0) == confChildNegTPCBitV0)) {
441+
v0Count++;
442+
}
443+
}
444+
} else {
445+
v0Count++;
446+
}
447+
} else if ((V0.mAntiLambda() > confMinInvMassAntiV0) && (V0.mAntiLambda() < confMaxInvMassAntiV0)) {
448+
if (confRequireBitmask) {
449+
if (ncheckbit(V0.cut(), confCutV0SameForAntipart)) {
450+
const auto& posChild = parts.iteratorAt(V0.index() - 2);
451+
const auto& negChild = parts.iteratorAt(V0.index() - 1);
452+
if (((posChild.cut() & confChildPosCutV0) == confChildPosCutV0 &&
453+
(posChild.pidcut() & confChildNegTPCBitV0) == confChildNegTPCBitV0 && // exchanged values because checking antiparticle daughters and pid of particles exchange
454+
(negChild.cut() & confChildNegCutV0) == confChildNegCutV0 &&
455+
(negChild.pidcut() & confChildPosTPCBitV0) == confChildPosTPCBitV0)) { // exchanged values because checking antiparticle daughters and pid of particles exchange
456+
antiV0Count++;
457+
}
458+
}
459+
} else {
460+
antiV0Count++;
461+
}
462+
}
463+
}
464+
465+
466+
for (const auto& reso : groupSelectedResos) {
467+
468+
if (confRequireBitmask) {
469+
470+
const auto& posChild = parts.iteratorAt(reso.index() - 2);
471+
const auto& negChild = parts.iteratorAt(reso.index() - 1);
472+
473+
if (((posresoChild.cut() & Reso2.daughPosCutBit) == Reso2.daughPosCutBit) &&
474+
((negresoChild.cut() & Reso2.daughNegCutBit) == Reso2.daughNegCutBit)) {
475+
476+
ResoCount++;
477+
}
478+
} else {
479+
ResoCount++;
480+
}
481+
482+
}
483+
484+
std::vector<int> tmpIDtrack;
485+
486+
if ((v0Count >= confNumberOfV0 && ResoCount >= confNumberOfReso) || (antiV0Count >= confNumberOfV0 && confNumberOfReso >= confNumberOfReso)) {
487+
eventRegistry.fill(HIST("hStatistiscs"), 1);
488+
outputCollision(col.posZ(), col.multV0M(), col.multNtr(), col.sphericity(), col.magField());
489+
for (const auto& femtoParticle : parts) {
490+
if (aod::femtodreamparticle::ParticleType::kResoChild == femtoParticle.partType()) { //
491+
std::vector<int> childIDs = {0, 0};
492+
outputParts(outputCollision.lastIndex(),
493+
femtoParticle.pt(),
494+
femtoParticle.eta(),
495+
femtoParticle.phi(),
496+
femtoParticle.partType(),
497+
femtoParticle.cut(),
498+
femtoParticle.pidcut(),
499+
femtoParticle.tempFitVar(),
500+
childIDs,
501+
femtoParticle.mLambda(),
502+
femtoParticle.mAntiLambda());
503+
tmpIDtrack.push_back(femtoParticle.index());
504+
}
505+
if (aod::femtodreamparticle::ParticleType::kV0Child == femtoParticle.partType()) {
506+
std::vector<int> childIDs = {0, 0};
507+
const auto& children = femtoParticle.childrenIds();
508+
int childId = (children[0] != 0) ? children[0] : children[1]; //??
509+
if (childId != -1) {
510+
int rowInPrimaryTrackTable = getRowDaughters(childId, tmpIDtrack);
511+
childIDs = (children[0] != 0) ? std::vector<int>{rowInPrimaryTrackTable, 0} : std::vector<int>{0, rowInPrimaryTrackTable};
512+
} else {
513+
childIDs = (children[0] != 0) ? std::vector<int>{-1, 0} : std::vector<int>{0, -1};
514+
}
515+
outputParts(outputCollision.lastIndex(),
516+
femtoParticle.pt(),
517+
femtoParticle.eta(),
518+
femtoParticle.phi(),
519+
femtoParticle.partType(),
520+
femtoParticle.cut(),
521+
femtoParticle.pidcut(),
522+
femtoParticle.tempFitVar(),
523+
childIDs,
524+
femtoParticle.mLambda(),
525+
femtoParticle.mAntiLambda());
526+
}
527+
if (aod::femtodreamparticle::ParticleType::kV0 == femtoParticle.partType()) {
528+
// If the order in primary producer is changed of storing first pos, neg daughters and then V0 - this must be updated
529+
const int rowOfLastTrack = outputParts.lastIndex();
530+
std::vector<int> childIDs = {rowOfLastTrack - 1, rowOfLastTrack};
531+
outputParts(outputCollision.lastIndex(),
532+
femtoParticle.pt(),
533+
femtoParticle.eta(),
534+
femtoParticle.phi(),
535+
femtoParticle.partType(),
536+
femtoParticle.cut(),
537+
femtoParticle.pidcut(),
538+
femtoParticle.tempFitVar(),
539+
childIDs,
540+
femtoParticle.mLambda(),
541+
femtoParticle.mAntiLambda());
542+
}
543+
544+
if ( (Reso.partType1 == femtoParticle.partType()) ||
545+
(Reso.partType2 == femtoParticle.partType()) ||
546+
(Reso.partType3 == femtoParticle.partType()) ||
547+
(Reso.partType4 == femtoParticle.partType()) ) {
548+
549+
const int rowOfLastTrack = outputParts.lastIndex(); //überprüfen
550+
std::vector<int> childIDs = {rowOfLastTrack - 1, rowOfLastTrack}; //überprüfen
551+
outputParts(outputCollision.lastIndex(),
552+
femtoParticle.pt(),
553+
femtoParticle.eta(),
554+
femtoParticle.phi(),
555+
femtoParticle.partType(),
556+
femtoParticle.cut(),
557+
femtoParticle.pidcut(),
558+
femtoParticle.tempFitVar(),
559+
childIDs,
560+
femtoParticle.mLambda(),
561+
femtoParticle.mAntiLambda());
562+
}
563+
}
564+
} else {
565+
eventRegistry.fill(HIST("hStatistiscs"), 2);
566+
}
567+
}
568+
569+
570+
void processCollisionsWithNV0AndNReso(const o2::aod::FDCollision& col,
571+
const o2::aod::FDParticles& parts)
572+
{
573+
eventRegistry.fill(HIST("hStatistiscs"), 0);
574+
auto thegroupSelectedResos = selectedResos->sliceByCached(aod::femtodreamparticle::fdCollisionId, col.globalIndex(), cache);
575+
auto thegroupSelectedV0s = selectedV0s->sliceByCached(aod::femtodreamparticle::fdCollisionId, col.globalIndex(), cache);
576+
577+
createSpecifiedDerivedDataV0Reso<false>(col, thegroupSelectedV0s, thegroupSelectedResos, parts);
578+
}
579+
PROCESS_SWITCH(FemtoDreamProducerTaskForSpecificAnalysis, processCollisionsWithNV0AndNReso, "Enable producing data with pp collisions for data v0-reso", true);
580+
389581
};
390582

391583
WorkflowSpec defineDataProcessing(ConfigContext const& cfgc)

0 commit comments

Comments
 (0)