Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions PWGHF/HFL/Tasks/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,11 @@ o2physics_add_dpl_workflow(task-single-muon-mult
PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore
COMPONENT_NAME Analysis)

o2physics_add_dpl_workflow(task-single-muon-mult-mc
SOURCES taskSingleMuonMultMc.cxx
PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore
COMPONENT_NAME Analysis)

o2physics_add_dpl_workflow(task-single-muon-reader
SOURCES taskSingleMuonReader.cxx
PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore O2Physics::PWGDQCore
Expand Down
87 changes: 52 additions & 35 deletions PWGHF/HFL/Tasks/taskSingleMuonMultMc.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -17,25 +17,34 @@
#include "Common/DataModel/EventSelection.h"
#include "Common/DataModel/TrackSelectionTables.h"

#include "CommonConstants/PhysicsConstants.h"
#include "Framework/ASoAHelpers.h"
#include "Framework/AnalysisDataModel.h"
#include "Framework/AnalysisTask.h"
#include "Framework/HistogramRegistry.h"
#include "Framework/O2DatabasePDGPlugin.h"
#include "Framework/runDataProcessing.h"
#include "ReconstructionDataFormats/TrackFwd.h"
#include <Framework/ASoA.h>
#include <Framework/AnalysisDataModel.h>
#include <Framework/AnalysisHelpers.h>
#include <Framework/AnalysisTask.h>
#include <Framework/Configurable.h>

#include <Framework/HistogramRegistry.h>
#include <Framework/HistogramSpec.h>
#include <Framework/InitContext.h>
#include <Framework/O2DatabasePDGPlugin.h>
#include <Framework/OutputObjHeader.h>
#include <Framework/runDataProcessing.h>

#include <TPDGCode.h>
#include <TString.h>

#include <Rtypes.h>

#include <cstdint>
#include <cstdlib>

using namespace o2;
using namespace o2::aod;
using namespace o2::framework;
using namespace o2::framework::expressions;
using namespace o2::aod::fwdtrack;

auto static constexpr MinCharge = 3.f;
// Minimum PDG charge (in units of 1/3 e)
auto static constexpr ChargeMin = 3.f;

namespace
{
Expand Down Expand Up @@ -257,92 +266,92 @@ struct HfTaskSingleMuonMultMc {
}

// particle has an associated MC particle
bool isIdentified(const uint16_t& mask)
bool isIdentified(const uint16_t mask)
{
return (TESTBIT(mask, IsIdentified));
}
// this particle is muon
bool isMuon(const uint16_t& mask)
bool isMuon(const uint16_t mask)
{
return (TESTBIT(mask, IsIdentified) && TESTBIT(mask, IsMuon));
}

// this muon comes from transport
bool isSecondaryMu(const uint16_t& mask)
bool isSecondaryMu(const uint16_t mask)
{
return (isMuon(mask) && TESTBIT(mask, IsSecondary));
}

// this muon comes from light flavor quark decay
bool isLightDecayMu(const uint16_t& mask)
bool isLightDecayMu(const uint16_t mask)
{
return (isMuon(mask) && TESTBIT(mask, HasLightParent) && (!TESTBIT(mask, IsSecondary)));
}

// this muon comes from tau decays
bool isTauDecayMu(const uint16_t& mask)
bool isTauDecayMu(const uint16_t mask)
{
return (isMuon(mask) && TESTBIT(mask, HasTauParent) && (!TESTBIT(mask, HasWParent)) && (!TESTBIT(mask, HasZParent)) && (!TESTBIT(mask, HasBeautyParent)) && (!TESTBIT(mask, HasCharmParent)));
}

// this muon comes from W+- decay
bool isWBosonDecayMu(const uint16_t& mask)
bool isWBosonDecayMu(const uint16_t mask)
{
return (isMuon(mask) && TESTBIT(mask, HasWParent) && (!TESTBIT(mask, HasZParent)) && (!TESTBIT(mask, HasTauParent)) && (!TESTBIT(mask, HasLightParent)) && (!TESTBIT(mask, IsSecondary)));
}

// this muon comes from Z decay
bool isZBosonDecayMu(const uint16_t& mask)
bool isZBosonDecayMu(const uint16_t mask)
{
return (isMuon(mask) && TESTBIT(mask, HasZParent) && (!TESTBIT(mask, HasWParent)) && (!TESTBIT(mask, HasTauParent)) && (!TESTBIT(mask, HasLightParent)) && (!TESTBIT(mask, IsSecondary)));
}

// this muon comes from quarkonium decay
bool isQuarkoniumDecayMu(const uint16_t& mask)
bool isQuarkoniumDecayMu(const uint16_t mask)
{
return (isMuon(mask) && TESTBIT(mask, HasQuarkoniumParent) && (!TESTBIT(mask, HasBeautyParent)) && (!TESTBIT(mask, HasCharmParent)) && (!TESTBIT(mask, HasLightParent)));
}

// this muon comes from beauty decay and does not have light flavor parent
bool isBeautyMu(const uint16_t& mask)
bool isBeautyMu(const uint16_t mask)
{
return (isMuon(mask) && TESTBIT(mask, HasBeautyParent) && (!TESTBIT(mask, HasQuarkoniumParent)) && (!TESTBIT(mask, HasLightParent)) && (!TESTBIT(mask, IsSecondary)));
}

// this muon comes directly from beauty decay
bool isBeautyDecayMu(const uint16_t& mask)
bool isBeautyDecayMu(const uint16_t mask)
{
return (isBeautyMu(mask) && (!TESTBIT(mask, HasCharmParent) && (!TESTBIT(mask, HasQuarkoniumParent))) && (!TESTBIT(mask, HasLightParent)) && (!TESTBIT(mask, IsSecondary)));
}

// this muon comes from non-prompt charm decay and does not have light flavor parent
bool isNonpromptCharmMu(const uint16_t& mask)
bool isNonpromptCharmMu(const uint16_t mask)
{
return (isBeautyMu(mask) && TESTBIT(mask, HasCharmParent) && (!TESTBIT(mask, HasQuarkoniumParent)) && (!TESTBIT(mask, HasLightParent)) && (!TESTBIT(mask, IsSecondary)));
}

// this muon comes from prompt charm decay and does not have light flavor parent
bool isPromptCharmMu(const uint16_t& mask)
bool isPromptCharmMu(const uint16_t mask)
{
return (isMuon(mask) && TESTBIT(mask, HasCharmParent) && (!TESTBIT(mask, HasBeautyParent)) && (!TESTBIT(mask, HasQuarkoniumParent)) && (!TESTBIT(mask, HasLightParent)) && (!TESTBIT(mask, IsSecondary)));
}

// this muon comes from other sources which have not classified above.
bool isOtherMu(const uint16_t& mask)
bool isOtherMu(const uint16_t mask)
{
return (isMuon(mask) && (!isSecondaryMu(mask)) && (!isLightDecayMu(mask)) && (!isTauDecayMu(mask)) && (!isWBosonDecayMu(mask)) && (!isZBosonDecayMu(mask)) && (!isQuarkoniumDecayMu(mask)) && (!isBeautyMu(mask)) && (!isPromptCharmMu(mask)));
}

// this is a hadron
bool isHadron(const uint16_t& mask)
bool isHadron(const uint16_t mask)
{
return (TESTBIT(mask, IsIdentified) && (!TESTBIT(mask, IsMuon)));
}

// this particle is unidentified
bool isUnidentified(const uint16_t& mask)
bool isUnidentified(const uint16_t mask)
{
return ((!TESTBIT(mask, IsIdentified)));
return (!TESTBIT(mask, IsIdentified));
}

// fill the histograms of each particle types
Expand Down Expand Up @@ -398,7 +407,10 @@ struct HfTaskSingleMuonMultMc {
}
}

void process(McGenCollisions::iterator const& mccollision, McMuons const& muons, aod::McParticles const&, McRecCollisions const& collisions)
void process(McGenCollisions::iterator const& mccollision,
McMuons const& muons,
aod::McParticles const&,
McRecCollisions const& collisions)
{

// event selections
Expand All @@ -409,14 +421,14 @@ struct HfTaskSingleMuonMultMc {
registry.fill(HIST("hNEventGenMu"), 1);

for (const auto& muon : muons) {
if (!(muon.has_mcParticle())) {
if (!muon.has_mcParticle()) {
continue;
}
auto mcPart(muon.mcParticle());
auto pdgGen(mcPart.pdgCode());
auto etaGen(mcPart.eta());

if (!(std::abs(pdgGen) == kMuonMinus)) {
if (std::abs(pdgGen) != kMuonMinus) {
continue;
}
if ((etaGen >= etaMax) || (etaGen < etaMin)) {
Expand All @@ -439,7 +451,7 @@ struct HfTaskSingleMuonMultMc {
continue;
}

if (!(muon.has_mcParticle())) {
if (!muon.has_mcParticle()) {
continue;
}
const auto pt(muon.pt()), eta(muon.eta()), rAbsorb(muon.rAtAbsorberEnd()), pDca(muon.pDca()), chi2(muon.chi2MatchMCHMFT());
Expand Down Expand Up @@ -474,7 +486,10 @@ struct HfTaskSingleMuonMultMc {
}
}

void processResTrack(McGenCollisions::iterator const& mccollision, McRecCollisions const& collisions, aod::McParticles const& particles, MyTracks const& tracks)
void processResTrack(McGenCollisions::iterator const& mccollision,
McRecCollisions const& collisions,
aod::McParticles const& particles,
MyTracks const& tracks)
{
// event selections
if (std::abs(mccollision.posZ()) > zVtxMax) {
Expand All @@ -496,7 +511,7 @@ struct HfTaskSingleMuonMultMc {
charge = p->Charge();
}

if (std::abs(charge) < MinCharge) {
if (std::abs(charge) < ChargeMin) {
continue;
}
if (particle.pt() < ptTrackMin || std::abs(particle.eta()) >= etaTrackMax) {
Expand All @@ -514,17 +529,19 @@ struct HfTaskSingleMuonMultMc {
auto nTrk = 0;
auto tracksample = tracks.sliceBy(perCol, collision.globalIndex());
for (const auto& track : tracksample) {
if (!track.isGlobalTrack())
if (!track.isGlobalTrack()) {
continue;
}
registry.fill(HIST("hParticleRec"), track.pt(), track.eta());
++nTrk;
}
if (nTrk < 1)
if (nTrk < 1) {
continue;
}
registry.fill(HIST("hTrackResponse"), nP, nTrk);
}
}
PROCESS_SWITCH(HfTaskSingleMuonMultMc, processResTrack, "Process Track Reconstruction/Generation", true);
PROCESS_SWITCH(HfTaskSingleMuonMultMc, processResTrack, "Process Track Reconstruction/Generation", false);
};

WorkflowSpec defineDataProcessing(ConfigContext const& cfgc)
Expand Down
Loading