Skip to content

Commit c4d1e20

Browse files
committed
Feat: add multiplicity estimation for mc only case
1 parent 233d427 commit c4d1e20

2 files changed

Lines changed: 27 additions & 1 deletion

File tree

PWGCF/Femto/Core/mcBuilder.h

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ struct ConfMc : o2::framework::ConfigurableGroup {
4343
std::string prefix = std::string("MonteCarlo");
4444
o2::framework::Configurable<bool> passThrough{"passThrough", false, "Passthrough all MC collisions and particles"};
4545
o2::framework::Configurable<bool> findLastPartonicMother{"findLastPartonicMother", true, "If true, the partonic mother will be the first parton directly after the initial collision. If false, the partonic mother will be the last parton before hadronization"};
46+
o2::framework::Configurable<float> etaAcceptanceMcOnly{"etaAcceptanceMcOnly", 0.8, "For MC ONLY processing. |eta| acceptance for estimating primary track multiplicity"};
4647
};
4748

4849
struct McBuilderProducts : o2::framework::ProducesGroup {
@@ -152,6 +153,7 @@ class McBuilder
152153
return;
153154
}
154155
mPassThrough = config.passThrough.value;
156+
mEtaAcceptanceMcOnly = config.etaAcceptanceMcOnly.value;
155157
mFindLastPartonicMother = config.findLastPartonicMother.value;
156158
LOG(info) << "Initialization done...";
157159
}
@@ -201,6 +203,28 @@ class McBuilder
201203
mCollisionMap.emplace(mcCol.globalIndex(), mcProducts.producedMcCollisions.lastIndex());
202204
}
203205

206+
// for mc only
207+
template <typename T1, typename T2, typename T3>
208+
void fillMcCollision(T1 const& mcCol, T2 const& mcParticles, T3& mcProducts)
209+
{
210+
float centrality = 0; // no centrality estimator for mc only, so set to 0
211+
float multiplicity = 0; // no multiplicity estimator for mc only
212+
213+
// define multiplicity ourselves by counting primary particles for |eta|,0.8
214+
// this is similar to how define it in data
215+
for (auto const& mcParticle : mcParticles) {
216+
if (mcParticle.isPhysicalPrimary() && (std::fabs(mcParticle.eta()) < mEtaAcceptanceMcOnly)) {
217+
multiplicity += 1;
218+
}
219+
}
220+
221+
mcProducts.producedMcCollisions(
222+
mcCol.posZ(),
223+
multiplicity,
224+
centrality);
225+
mCollisionMap.emplace(mcCol.globalIndex(), mcProducts.producedMcCollisions.lastIndex());
226+
}
227+
204228
template <modes::System system, typename T1, typename T2, typename T3, typename T4>
205229
void fillMcParticle(T1 const& mcParticle, T2 const& mcParticles, T3 const& mcCol, T4& mcProducts)
206230
{
@@ -591,6 +615,8 @@ class McBuilder
591615
bool mProduceOmegaLabels = false;
592616
bool mProduceMcMotherLabels = false;
593617

618+
float mEtaAcceptanceMcOnly = 0.8;
619+
594620
std::unordered_map<int64_t, int64_t> mCollisionMap;
595621

596622
std::unordered_map<int64_t, int64_t> mMcParticleMap;

PWGCF/Femto/TableProducer/femtoProducer.cxx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -546,7 +546,7 @@ struct FemtoProducer {
546546
{
547547
mcBuilder.reset(mcParticles);
548548
for (const auto& mcCol : mcCols) {
549-
mcBuilder.fillMcCollision<modes::System::kMC>(mcCol, mcProducts);
549+
mcBuilder.fillMcCollision(mcCol, mcParticles, mcProducts);
550550
auto particlesThisCollision = mcParticles.sliceBy(perMcCollision, mcCol.globalIndex());
551551
for (const auto& mcParticle : particlesThisCollision) {
552552
mcBuilder.fillMcParticle<modes::System::kMC>(mcParticle, mcParticles, mcCol, mcProducts);

0 commit comments

Comments
 (0)