|
12 | 12 | //// authors: Rashi Gupta (rashi.gupta@cern.ch) |
13 | 13 | /// authors: Ravindra Singh (ravindra.singh@cern.ch) |
14 | 14 | /// ============================================================================ |
| 15 | +o2::eventgen::Trigger selectPionEtaWithinAcc(TString pdgPartForAccCut = "111;221", double rapidityMin = -1.5, double rapidityMax = 1.5, int minNb = 1) |
| 16 | +{ |
| 17 | + return [pdgPartForAccCut, rapidityMin, rapidityMax, minNb](const std::vector<TParticle>& particles) -> bool { |
| 18 | + TObjArray* obj = pdgPartForAccCut.Tokenize(";"); |
| 19 | + int count = 0; |
| 20 | + for (const auto& particle : particles) { |
| 21 | + int pdg = TMath::Abs(particle.GetPdgCode()); |
| 22 | + double y = particle.Y(); |
15 | 23 |
|
| 24 | + if (y < rapidityMin || y > rapidityMax) continue; |
16 | 25 |
|
| 26 | + for (int i = 0; i < obj->GetEntriesFast(); ++i) { |
| 27 | + int pdgCode = std::stoi(obj->At(i)->GetName()); |
17 | 28 |
|
18 | | - |
19 | | -o2::eventgen::Trigger selectPionEtaWithinAcc(Int_t pdgPartForAccCut = 111; 221, double rapidityMin = -1.5, double rapidityMax = 1.5, int minNb = 1) |
20 | | -{ |
21 | | - return [pdgPartForAccCut, rapidityMin, rapidityMax, minNb](const std::vector<TParticle>& particles) -> bool { |
22 | | - int count = 0; |
23 | | - for (const auto& particle : particles) { |
24 | | - Int_t pdg = TMath::Abs(particle.GetPdgCode()); |
25 | | - if (pdg == pdgPartForAccCut) { // select π⁰ (111) or η (221) |
26 | | - double y = particle.Y(); |
27 | | - if (y >= rapidityMin && y <= rapidityMax) { |
28 | | - count++; |
29 | | - } |
30 | | - } |
| 29 | + if (pdg == pdgCode) { |
| 30 | + count++; |
| 31 | + break; |
31 | 32 | } |
32 | | - |
| 33 | + } |
| 34 | + } |
33 | 35 | // Only accept events with at least minNb π⁰/η |
34 | 36 | if (count >= minNb) |
35 | 37 | return kTRUE; |
|
0 commit comments