forked from AliceO2Group/O2DPG
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathselectNonHfe.C
More file actions
41 lines (35 loc) · 1.43 KB
/
selectNonHfe.C
File metadata and controls
41 lines (35 loc) · 1.43 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#include <TParticle.h>
#include "Generators/Trigger.h"
#include <vector>
#include <TMath.h>
///============================================================================
/// Select π⁰ and η within a given rapidity window for enhancement
/// pdgPartForAccCut: PDG of the particle to select (111=π⁰, 221=η)
/// minNb: minimum number of such particles per event for enhancement
//// authors: Rashi Gupta (rashi.gupta@cern.ch)
/// authors: Ravindra Singh (ravindra.singh@cern.ch)
/// ============================================================================
o2::eventgen::Trigger selectPionEtaWithinAcc(TString pdgPartForAccCut = "111;221", double rapidityMin = -1.5, double rapidityMax = 1.5, int minNb = 1)
{
return [pdgPartForAccCut, rapidityMin, rapidityMax, minNb](const std::vector<TParticle>& particles) -> bool {
TObjArray* obj = pdgPartForAccCut.Tokenize(";");
int count = 0;
for (const auto& particle : particles) {
int pdg = TMath::Abs(particle.GetPdgCode());
double y = particle.Y();
if (y < rapidityMin || y > rapidityMax) continue;
for (int i = 0; i < obj->GetEntriesFast(); ++i) {
int pdgCode = std::stoi(obj->At(i)->GetName());
if (pdg == pdgCode) {
count++;
break;
}
}
}
// Only accept events with at least minNb π⁰/η
if (count >= minNb)
return kTRUE;
else
return kFALSE;
};
}