Skip to content

Commit

Permalink
PWGJE: Adding particle level MC selections (#7587)
Browse files Browse the repository at this point in the history
* PWGJE: Adding particle level MC selections

* Formatting

* Duplicate include files
  • Loading branch information
dajones2 authored Sep 6, 2024
1 parent c2646a0 commit b291dda
Showing 1 changed file with 19 additions and 4 deletions.
23 changes: 19 additions & 4 deletions PWGJE/Tasks/jetHadronRecoil.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ struct hJetAnalysis {

Filter jetCuts = aod::jet::r == nround(jetR.node() * 100.0f);
Filter trackCuts = (aod::jtrack::pt >= trackPtMin && aod::jtrack::pt < trackPtMax && aod::jtrack::eta > trackEtaMin && aod::jtrack::eta < trackEtaMax);
Filter eventCuts = nabs(aod::jcollision::posZ) < vertexZCut;
Filter eventTrackLevelCuts = nabs(aod::jcollision::posZ) < vertexZCut;

HistogramRegistry registry{"registry",
{{"hNtrig", "number of triggers;trigger type;entries", {HistType::kTH1F, {{2, 0, 2}}}},
Expand Down Expand Up @@ -123,14 +123,16 @@ struct hJetAnalysis {
int eventSelection = -1;
int trackSelection = -1;

Service<o2::framework::O2DatabasePDG> pdg;

void init(InitContext const&)
{
eventSelection = jetderiveddatautilities::initialiseEventSelection(static_cast<std::string>(eventSelections));
trackSelection = jetderiveddatautilities::initialiseTrackSelection(static_cast<std::string>(trackSelections));

Filter jetCuts = aod::jet::r == nround(jetR.node() * 100.0f);
Filter trackCuts = (aod::jtrack::pt >= trackPtMin && aod::jtrack::pt < trackPtMax && aod::jtrack::eta > trackEtaMin && aod::jtrack::eta < trackEtaMax);
Filter eventCuts = (nabs(aod::jcollision::posZ) < vertexZCut);
Filter eventTrackLevelCuts = nabs(aod::jcollision::posZ) < vertexZCut;
}

template <typename T, typename U, typename W>
Expand Down Expand Up @@ -268,6 +270,13 @@ struct hJetAnalysis {
is_sig_col = false;

for (auto& particle : particles) {
auto pdgParticle = pdg->GetParticle(particle.pdgCode());
if (!pdgParticle) {
continue;
}
if ((pdgParticle->Charge() == 0.0) || (!particle.isPhysicalPrimary())) {
continue;
}
if (is_sig_col && particle.pt() < pt_TTsig_max && particle.pt() > pt_TTsig_min) {
phi_TT_ar.push_back(particle.phi());
n_TT++;
Expand Down Expand Up @@ -436,7 +445,7 @@ struct hJetAnalysis {
}
PROCESS_SWITCH(hJetAnalysis, processMCD, "process MC detector level", false);

void processMCDWeighted(soa::Join<JetCollisions, aod::JMcCollisionLbs>::iterator const& collision,
void processMCDWeighted(soa::Join<soa::Filtered<JetCollisions>, aod::JMcCollisionLbs>::iterator const& collision,
soa::Filtered<soa::Join<aod::ChargedMCDetectorLevelJets, aod::ChargedMCDetectorLevelJetConstituents, aod::ChargedMCDetectorLevelJetsMatchedToCharged1MCDetectorLevelJets>> const& jets,
soa::Filtered<soa::Join<aod::Charged1MCDetectorLevelJets, aod::Charged1MCDetectorLevelJetConstituents, aod::Charged1MCDetectorLevelJetsMatchedToChargedMCDetectorLevelJets>> const& jetsWTA,
soa::Filtered<JetTracks> const& tracks)
Expand All @@ -448,11 +457,14 @@ struct hJetAnalysis {
}
PROCESS_SWITCH(hJetAnalysis, processMCDWeighted, "process MC detector level with event weights", false);

void processMCP(JetMcCollision const& /*collision*/,
void processMCP(JetMcCollision const& collision,
soa::Filtered<soa::Join<aod::ChargedMCParticleLevelJets, aod::ChargedMCParticleLevelJetConstituents, aod::ChargedMCParticleLevelJetsMatchedToCharged1MCParticleLevelJets>> const& jets,
soa::Filtered<soa::Join<aod::Charged1MCParticleLevelJets, aod::Charged1MCParticleLevelJetConstituents, aod::Charged1MCParticleLevelJetsMatchedToChargedMCParticleLevelJets>> const& jetsWTA,
JetParticles const& particles)
{
if (collision.posZ() < vertexZCut) { // For some reason declaring a filter doesnt work
return;
}
fillMCPHistograms(jets, jetsWTA, particles);
}
PROCESS_SWITCH(hJetAnalysis, processMCP, "process MC particle level", false);
Expand All @@ -462,6 +474,9 @@ struct hJetAnalysis {
soa::Filtered<soa::Join<aod::Charged1MCParticleLevelJets, aod::Charged1MCParticleLevelJetConstituents, aod::Charged1MCParticleLevelJetsMatchedToChargedMCParticleLevelJets>> const& jetsWTA,
JetParticles const& particles)
{
if (collision.posZ() < vertexZCut) {
return;
}
fillMCPHistograms(jets, jetsWTA, particles, collision.weight());
}
PROCESS_SWITCH(hJetAnalysis, processMCPWeighted, "process MC particle level with event weights", false);
Expand Down

0 comments on commit b291dda

Please sign in to comment.