Skip to content

Commit

Permalink
PWGJE: Implementation of a tree creator for b-jets (AliceO2Group#6208)
Browse files Browse the repository at this point in the history
* Implementation of a code for b-jet analysis

* Updating the code

* Removing jet substructure part
  • Loading branch information
hahassan7 authored Jun 18, 2024
1 parent fbd207f commit 2713a10
Show file tree
Hide file tree
Showing 3 changed files with 563 additions and 2 deletions.
45 changes: 43 additions & 2 deletions PWGJE/Core/JetTaggingUtilities.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
#include "TF1.h"
#include "Framework/Logger.h"
#include "Common/Core/RecoDecay.h"
#include "Common/Core/trackUtilities.h"
#include "PWGJE/Core/JetUtilities.h"

enum JetTaggingSpecies {
Expand Down Expand Up @@ -149,7 +150,7 @@ int jetParticleFromHFShower(T const& jet, U const& particles, typename U::iterat
{

int origin = -1;
for (auto& particle : jet.template tracks_as<U>()) {
for (const auto& particle : jet.template tracks_as<U>()) {
origin = RecoDecay::getCharmHadronOrigin(particles, particle, true);
if (origin == 1 || origin == 2) { // 1=charm , 2=beauty
hfparticle = particle;
Expand Down Expand Up @@ -213,7 +214,7 @@ int mcdJetFromHFShower(T const& jet, U const& tracks, V const& particles, float
* @param dRMax maximum distance in eta-phi of initiating heavy-flavour quark from the jet axis
*/

template <typename T, typename U, typename V>
template <typename T, typename U>
int mcpJetFromHFShower(T const& jet, U const& particles, float dRMax = 0.25)
{

Expand Down Expand Up @@ -282,6 +283,46 @@ int jetOrigin(T const& jet, U const& particles, float dRMax = 0.25)
return 0;
}

/**
* return the jet flavor: 0 for lf-jet, 1 for c-jet, 2 for b-jet
*
* @param AnyJet the jet that we need to study its flavor
* @param AllMCParticles a vector of all the mc particles stack
*/
template <typename AnyJet, typename AllMCParticles>
int16_t getJetFlavor(AnyJet const& jet, AllMCParticles const& mcparticles)
{
const int arraySize = 99;

std::array<int, arraySize> countpartcode;
int count = 0;

for (auto& mcpart : mcparticles) {
int pdgcode = mcpart.pdgCode();
if (TMath::Abs(pdgcode) == 21 || (TMath::Abs(pdgcode) >= 1 && TMath::Abs(pdgcode) <= 5)) {
double dR = jetutilities::deltaR(jet, mcpart);

if (dR < jet.r() / 100.f) {
if (TMath::Abs(pdgcode) == 5) {
return 2; // Beauty jet
} else {
if (count > arraySize - 1)
return 0;
countpartcode[count] = pdgcode;
count++;
}
}
}
}

for (int ij = 0; ij < count; ij++) {
if (TMath::Abs(countpartcode[ij]) == 4)
return 1; // Charm jet
}

return 0; // Light flavor jet
}

/**
* return geometric sign which is calculated scalar product between jet axis with DCA (track propagated to PV )
* positive and negative value are expected from primary vertex
Expand Down
5 changes: 5 additions & 0 deletions PWGJE/Tasks/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -152,4 +152,9 @@ if(FastJet_FOUND)
SOURCES jetChCorr.cxx
PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::PWGJECore O2Physics::AnalysisCore
COMPONENT_NAME Analysis)
o2physics_add_dpl_workflow(bjet-tree-creator
SOURCES bjetTreeCreator.cxx
PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::PWGJECore O2Physics::AnalysisCore
COMPONENT_NAME Analysis)

endif()
Loading

0 comments on commit 2713a10

Please sign in to comment.