Skip to content

Commit 2713a10

Browse files
authored
PWGJE: Implementation of a tree creator for b-jets (AliceO2Group#6208)
* Implementation of a code for b-jet analysis * Updating the code * Removing jet substructure part
1 parent fbd207f commit 2713a10

File tree

3 files changed

+563
-2
lines changed

3 files changed

+563
-2
lines changed

PWGJE/Core/JetTaggingUtilities.h

+43-2
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
#include "TF1.h"
3131
#include "Framework/Logger.h"
3232
#include "Common/Core/RecoDecay.h"
33+
#include "Common/Core/trackUtilities.h"
3334
#include "PWGJE/Core/JetUtilities.h"
3435

3536
enum JetTaggingSpecies {
@@ -149,7 +150,7 @@ int jetParticleFromHFShower(T const& jet, U const& particles, typename U::iterat
149150
{
150151

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

216-
template <typename T, typename U, typename V>
217+
template <typename T, typename U>
217218
int mcpJetFromHFShower(T const& jet, U const& particles, float dRMax = 0.25)
218219
{
219220

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

286+
/**
287+
* return the jet flavor: 0 for lf-jet, 1 for c-jet, 2 for b-jet
288+
*
289+
* @param AnyJet the jet that we need to study its flavor
290+
* @param AllMCParticles a vector of all the mc particles stack
291+
*/
292+
template <typename AnyJet, typename AllMCParticles>
293+
int16_t getJetFlavor(AnyJet const& jet, AllMCParticles const& mcparticles)
294+
{
295+
const int arraySize = 99;
296+
297+
std::array<int, arraySize> countpartcode;
298+
int count = 0;
299+
300+
for (auto& mcpart : mcparticles) {
301+
int pdgcode = mcpart.pdgCode();
302+
if (TMath::Abs(pdgcode) == 21 || (TMath::Abs(pdgcode) >= 1 && TMath::Abs(pdgcode) <= 5)) {
303+
double dR = jetutilities::deltaR(jet, mcpart);
304+
305+
if (dR < jet.r() / 100.f) {
306+
if (TMath::Abs(pdgcode) == 5) {
307+
return 2; // Beauty jet
308+
} else {
309+
if (count > arraySize - 1)
310+
return 0;
311+
countpartcode[count] = pdgcode;
312+
count++;
313+
}
314+
}
315+
}
316+
}
317+
318+
for (int ij = 0; ij < count; ij++) {
319+
if (TMath::Abs(countpartcode[ij]) == 4)
320+
return 1; // Charm jet
321+
}
322+
323+
return 0; // Light flavor jet
324+
}
325+
285326
/**
286327
* return geometric sign which is calculated scalar product between jet axis with DCA (track propagated to PV )
287328
* positive and negative value are expected from primary vertex

PWGJE/Tasks/CMakeLists.txt

+5
Original file line numberDiff line numberDiff line change
@@ -152,4 +152,9 @@ if(FastJet_FOUND)
152152
SOURCES jetChCorr.cxx
153153
PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::PWGJECore O2Physics::AnalysisCore
154154
COMPONENT_NAME Analysis)
155+
o2physics_add_dpl_workflow(bjet-tree-creator
156+
SOURCES bjetTreeCreator.cxx
157+
PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::PWGJECore O2Physics::AnalysisCore
158+
COMPONENT_NAME Analysis)
159+
155160
endif()

0 commit comments

Comments
 (0)