Skip to content

Commit e13a589

Browse files
committed
Fix: fix mcbuilder
1 parent 7e30920 commit e13a589

2 files changed

Lines changed: 39 additions & 19 deletions

File tree

‎PWGCF/Femto/Core/mcBuilder.h‎

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -284,9 +284,14 @@ class McBuilder
284284
this->getOrCreateMcParticleRow<system>(mcParticle, mcParticles, mcCol, mcProducts);
285285
}
286286

287-
/// Write the generated primary charged particles needed for the dNch/deta calculation
288-
template <modes::System system, typename T1, typename T2, typename T3, typename T4, typename T5>
289-
void fillMcPassThrough(T1 const& mcCols, T2 const& mcParticles, T3& perMcCollision, T4& mcProducts, T5& pdgDb)
287+
/// Write all generated physical primaries within the eta acceptance.
288+
/// No charge requirement is applied here: neutral primaries (e.g. Lambdas) are needed for generator-level
289+
/// pair triggers. Charge (and any other) selection has to be done downstream.
290+
/// NOTE: FMcParticles also contains rows created through reco labels (secondaries, particles outside the
291+
/// acceptance), so a dNch/deta loop must still require origin == kPhysicalPrimary, a charged pdg code
292+
/// and the eta acceptance
293+
template <modes::System system, typename T1, typename T2, typename T3, typename T4>
294+
void fillMcPassThrough(T1 const& mcCols, T2 const& mcParticles, T3& perMcCollision, T4& mcProducts)
290295
{
291296
if (!mPassThrough) {
292297
return;
@@ -300,10 +305,6 @@ class McBuilder
300305
if (!mcParticle.isPhysicalPrimary() || std::fabs(mcParticle.eta()) > mEtaAcceptanceMcReco) {
301306
continue;
302307
}
303-
const auto* pdgParticle = pdgDb->GetParticle(mcParticle.pdgCode());
304-
if (pdgParticle == nullptr || std::fabs(pdgParticle->Charge()) < o2::constants::math::Almost0) {
305-
continue;
306-
}
307308
// NOTE: full mcParticles table, never the slice - the ancestry walk resolves global indices
308309
this->fillMcParticle<system>(mcParticle, mcParticles, mcCol, mcProducts);
309310
}

‎PWGCF/Femto/TableProducer/femtoProducer.cxx‎

Lines changed: 31 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -295,6 +295,25 @@ struct FemtoProducer {
295295
LOG(warn) << " - particles in pass-through, collisions not: the extra particle rows hang off "
296296
<< "a candidate-biased event sample, which will bias event-normalised observables.";
297297
}
298+
299+
// in mc pass-through every generated collision is written, but reco collisions of other
300+
// sub-generators are still rejected in checkCollision -> biased event-loss denominator
301+
if (mcBuilder.isPassThrough() && collisionBuilder.isPassThrough() && collisionBuilder.subGeneratorId() >= 0) {
302+
LOG(warn) << "MC and collision pass-through are enabled, but CollisionFilter.subGeneratorId = "
303+
<< collisionBuilder.subGeneratorId() << " still rejects reconstructed collisions of other sub-generators, "
304+
<< "while all generated collisions are written. Set it to -1 for unbiased event/signal-loss corrections.";
305+
}
306+
307+
// daughter tracks can be written a second time under the collision of their mother candidate;
308+
// without FTrackExtras (fillType) these rows cannot be told apart from selected tracks downstream
309+
const bool anyDaughterBuilder = k0shortBuilder.fillAnyTable() || lambdaBuilder.fillAnyTable() || antilambdaBuilder.fillAnyTable() ||
310+
xiBuilder.fillAnyTable() || omegaBuilder.fillAnyTable() ||
311+
sigmaBuilder.fillAnyTable() || sigmaPlusBuilder.fillAnyTable() ||
312+
d0Builder.fillAnyTable() || d0barBuilder.fillAnyTable() || lcBuilder.fillAnyTable() || lcBarBuilder.fillAnyTable();
313+
if (trackBuilder.isPassThrough() && anyDaughterBuilder && !trackBuilder.producingTrackExtras()) {
314+
LOG(warn) << "Track pass-through is enabled together with candidates that register daughter tracks, but FTrackExtras is not produced. "
315+
<< "Daughter-only track rows cannot be identified downstream (enable TrackTables.produceTrackExtras).";
316+
}
298317
}
299318

300319
// ---- guard: exactly one process function ---------------------------------
@@ -671,7 +690,7 @@ struct FemtoProducer {
671690
{
672691
if (mcBuilder.isPassThrough()) {
673692
mcBuilder.reset(mcCols, mcParticles);
674-
mcBuilder.fillMcPassThrough<modes::System::kPP_Run3_MC>(mcCols, mcParticles, perMcCollision, mcProducts, pdgDb);
693+
mcBuilder.fillMcPassThrough<modes::System::kPP_Run3_MC>(mcCols, mcParticles, perMcCollision, mcProducts);
675694
}
676695

677696
for (const auto& col : cols) {
@@ -694,7 +713,7 @@ struct FemtoProducer {
694713
{
695714
if (mcBuilder.isPassThrough()) {
696715
mcBuilder.reset(mcCols, mcParticles);
697-
mcBuilder.fillMcPassThrough<modes::System::kPbPb_Run3_MC>(mcCols, mcParticles, perMcCollision, mcProducts, pdgDb);
716+
mcBuilder.fillMcPassThrough<modes::System::kPbPb_Run3_MC>(mcCols, mcParticles, perMcCollision, mcProducts);
698717
}
699718

700719
for (const auto& col : cols) {
@@ -718,7 +737,7 @@ struct FemtoProducer {
718737
{
719738
if (mcBuilder.isPassThrough()) {
720739
mcBuilder.reset(mcCols, mcParticles);
721-
mcBuilder.fillMcPassThrough<modes::System::kPP_Run3_MC>(mcCols, mcParticles, perMcCollision, mcProducts, pdgDb);
740+
mcBuilder.fillMcPassThrough<modes::System::kPP_Run3_MC>(mcCols, mcParticles, perMcCollision, mcProducts);
722741
}
723742

724743
for (const auto& col : cols) {
@@ -745,7 +764,7 @@ struct FemtoProducer {
745764
{
746765
if (mcBuilder.isPassThrough()) {
747766
mcBuilder.reset(mcCols, mcParticles);
748-
mcBuilder.fillMcPassThrough<modes::System::kPbPb_Run3_MC>(mcCols, mcParticles, perMcCollision, mcProducts, pdgDb);
767+
mcBuilder.fillMcPassThrough<modes::System::kPbPb_Run3_MC>(mcCols, mcParticles, perMcCollision, mcProducts);
749768
}
750769

751770
for (const auto& col : cols) {
@@ -773,7 +792,7 @@ struct FemtoProducer {
773792
{
774793
if (mcBuilder.isPassThrough()) {
775794
mcBuilder.reset(mcCols, mcParticles);
776-
mcBuilder.fillMcPassThrough<modes::System::kPP_Run3_MC>(mcCols, mcParticles, perMcCollision, mcProducts, pdgDb);
795+
mcBuilder.fillMcPassThrough<modes::System::kPP_Run3_MC>(mcCols, mcParticles, perMcCollision, mcProducts);
777796
}
778797

779798
for (const auto& col : cols) {
@@ -804,7 +823,7 @@ struct FemtoProducer {
804823
{
805824
if (mcBuilder.isPassThrough()) {
806825
mcBuilder.reset(mcCols, mcParticles);
807-
mcBuilder.fillMcPassThrough<modes::System::kPbPb_Run3_MC>(mcCols, mcParticles, perMcCollision, mcProducts, pdgDb);
826+
mcBuilder.fillMcPassThrough<modes::System::kPbPb_Run3_MC>(mcCols, mcParticles, perMcCollision, mcProducts);
808827
}
809828

810829
for (const auto& col : cols) {
@@ -834,7 +853,7 @@ struct FemtoProducer {
834853
{
835854
if (mcBuilder.isPassThrough()) {
836855
mcBuilder.reset(mcCols, mcParticles);
837-
mcBuilder.fillMcPassThrough<modes::System::kPP_Run3_MC>(mcCols, mcParticles, perMcCollision, mcProducts, pdgDb);
856+
mcBuilder.fillMcPassThrough<modes::System::kPP_Run3_MC>(mcCols, mcParticles, perMcCollision, mcProducts);
838857
}
839858

840859
for (const auto& col : cols) {
@@ -862,7 +881,7 @@ struct FemtoProducer {
862881
{
863882
if (mcBuilder.isPassThrough()) {
864883
mcBuilder.reset(mcCols, mcParticles);
865-
mcBuilder.fillMcPassThrough<modes::System::kPP_Run3_MC>(mcCols, mcParticles, perMcCollision, mcProducts, pdgDb);
884+
mcBuilder.fillMcPassThrough<modes::System::kPP_Run3_MC>(mcCols, mcParticles, perMcCollision, mcProducts);
866885
}
867886

868887
for (const auto& col : cols) {
@@ -892,7 +911,7 @@ struct FemtoProducer {
892911
{
893912
if (mcBuilder.isPassThrough()) {
894913
mcBuilder.reset(mcCols, mcParticles);
895-
mcBuilder.fillMcPassThrough<modes::System::kPP_Run3_MC>(mcCols, mcParticles, perMcCollision, mcProducts, pdgDb);
914+
mcBuilder.fillMcPassThrough<modes::System::kPP_Run3_MC>(mcCols, mcParticles, perMcCollision, mcProducts);
896915
}
897916

898917
for (const auto& col : cols) {
@@ -919,7 +938,7 @@ struct FemtoProducer {
919938
{
920939
if (mcBuilder.isPassThrough()) {
921940
mcBuilder.reset(mcCols, mcParticles);
922-
mcBuilder.fillMcPassThrough<modes::System::kPbPb_Run3_MC>(mcCols, mcParticles, perMcCollision, mcProducts, pdgDb);
941+
mcBuilder.fillMcPassThrough<modes::System::kPbPb_Run3_MC>(mcCols, mcParticles, perMcCollision, mcProducts);
923942
}
924943

925944
for (const auto& col : cols) {
@@ -976,7 +995,7 @@ struct FemtoProducer {
976995
{
977996
if (mcBuilder.isPassThrough()) {
978997
mcBuilder.reset(mcCols, mcParticles);
979-
mcBuilder.fillMcPassThrough<modes::System::kPP_Run3_MC>(mcCols, mcParticles, perMcCollision, mcProducts, pdgDb);
998+
mcBuilder.fillMcPassThrough<modes::System::kPP_Run3_MC>(mcCols, mcParticles, perMcCollision, mcProducts);
980999
}
9811000

9821001
for (const auto& col : cols) {
@@ -1003,7 +1022,7 @@ struct FemtoProducer {
10031022
{
10041023
if (mcBuilder.isPassThrough()) {
10051024
mcBuilder.reset(mcCols, mcParticles);
1006-
mcBuilder.fillMcPassThrough<modes::System::kPbPb_Run3_MC>(mcCols, mcParticles, perMcCollision, mcProducts, pdgDb);
1025+
mcBuilder.fillMcPassThrough<modes::System::kPbPb_Run3_MC>(mcCols, mcParticles, perMcCollision, mcProducts);
10071026
}
10081027

10091028
for (const auto& col : cols) {

0 commit comments

Comments
 (0)