12 #include <TDatabasePDG.h>
13 #include <TLorentzVector.h>
23 , mCharge(kAllCharges) {
48 if (PGenre(prt) == 0 || (mGenre != 0 && PGenre(prt) != mGenre)) {
52 if (mCharge != kAllCharges) {
54 TParticlePDG* pdg = prt.
Id().
Info();
56 bool charged = fabs(pdg->Charge()) > 0.;
59 if ((kNeutral == mCharge && charged) ||
60 (kCharged == mCharge && !charged)) {
70 if (!mParticles.empty() && mParticles.count(prt.
Id()) == 0) {
77 for (
unsigned i(0); i < mZones.size(); i++) {
78 if (mZones.at(i).Contains(prt)) {
89 Acceptance::CustomCut::~CustomCut() {
92 Acceptance::CustomCut::CustomCut()
93 : mFormula(
"CustomCutFormula",
"0")
97 , Min(-TMath::Infinity())
98 , Max(TMath::Infinity()) {
101 Acceptance::CustomCut::CustomCut(
const TString& formula,
102 double min,
double max)
103 : mFormula(
"CustomCutFormula",
"0")
110 dim = ParseInputFunction(s, Kin1, Kin2);
111 if (!IsCoreType(Kin1) || !IsCoreType(Kin2)) {
113 "ERROR! Custom acceptance is not a function of E, p, theta, phi"
116 if (1 == dim || 2 == dim) {
117 mFormula = TFormula(
"CustomCutFormula", s);
120 "ERROR! Provided custom acceptance is not of dimension 1 or 2."
124 std::cout <<
"Added custom cut " << formula << std::endl;
127 bool Acceptance::CustomCut::Contains(
129 double x = GetVariable(prt, Kin1);
132 y = GetVariable(prt, Kin2);
134 double z = mFormula.Eval(x, y);
135 return z >= Min && z < Max;
146 double phMin,
double phMax,
147 double eMin,
double eMax,
148 double pMin,
double pMax,
149 double ptmin,
double ptmax,
150 double pzmin,
double pzmax)
166 CustomCuts.push_back(cut);
171 const double theta = FixTheta(prt.
GetTheta());
172 const double phi = FixPhi(prt.
GetPhi());
173 if (theta < thetaMin || theta > thetaMax) {
175 }
else if (phi < phiMin || phi > phiMax) {
177 }
else if (prt.
GetE() < EMin || prt.
GetE() > EMax) {
179 }
else if (prt.
GetP() < PMin || prt.
GetP() > PMax) {
181 }
else if (prt.
GetPz() < pZMin || prt.
GetPz() > pZMax) {
183 }
else if (prt.
GetPt() < pTMin || prt.
GetPt() > pTMax) {
188 for (
unsigned j(0); j < CustomCuts.size(); ++j) {
189 if (!CustomCuts.at(j).Contains(prt)) {
virtual void Add(const CustomCut &)
virtual Double_t GetPhi() const =0
Zone(double theta=0., double=TMath::Pi(), double phi=0., double=TMath::TwoPi(), double E=0., double=TMath::Infinity(), double p=0., double=TMath::Infinity(), double pt=0., double=TMath::Infinity(), double pz=-TMath::Infinity(), double=TMath::Infinity())
virtual Double_t GetP() const =0
void AddZone(const Zone &)
virtual Double_t GetE() const =0
virtual Double_t GetPz() const =0
virtual Bool_t Contains(const erhic::VirtualParticle &) const
bool Is(const erhic::VirtualParticle &prt) const
virtual Double_t GetPt() const =0
void AddParticle(int particle)
TParticlePDG * Info() const
Acceptance(int genre=kAll)
virtual Pid Id() const =0
virtual Double_t GetTheta() const =0
Abstract base class for a general particle.
void SetCharge(ECharge charge)