|
30 | 30 | #include "TF1.h"
|
31 | 31 | #include "Framework/Logger.h"
|
32 | 32 | #include "Common/Core/RecoDecay.h"
|
| 33 | +#include "Common/Core/trackUtilities.h" |
33 | 34 | #include "PWGJE/Core/JetUtilities.h"
|
34 | 35 |
|
35 | 36 | enum JetTaggingSpecies {
|
@@ -149,7 +150,7 @@ int jetParticleFromHFShower(T const& jet, U const& particles, typename U::iterat
|
149 | 150 | {
|
150 | 151 |
|
151 | 152 | int origin = -1;
|
152 |
| - for (auto& particle : jet.template tracks_as<U>()) { |
| 153 | + for (const auto& particle : jet.template tracks_as<U>()) { |
153 | 154 | origin = RecoDecay::getCharmHadronOrigin(particles, particle, true);
|
154 | 155 | if (origin == 1 || origin == 2) { // 1=charm , 2=beauty
|
155 | 156 | hfparticle = particle;
|
@@ -213,7 +214,7 @@ int mcdJetFromHFShower(T const& jet, U const& tracks, V const& particles, float
|
213 | 214 | * @param dRMax maximum distance in eta-phi of initiating heavy-flavour quark from the jet axis
|
214 | 215 | */
|
215 | 216 |
|
216 |
| -template <typename T, typename U, typename V> |
| 217 | +template <typename T, typename U> |
217 | 218 | int mcpJetFromHFShower(T const& jet, U const& particles, float dRMax = 0.25)
|
218 | 219 | {
|
219 | 220 |
|
@@ -282,6 +283,46 @@ int jetOrigin(T const& jet, U const& particles, float dRMax = 0.25)
|
282 | 283 | return 0;
|
283 | 284 | }
|
284 | 285 |
|
| 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 | + |
285 | 326 | /**
|
286 | 327 | * return geometric sign which is calculated scalar product between jet axis with DCA (track propagated to PV )
|
287 | 328 | * positive and negative value are expected from primary vertex
|
|
0 commit comments