2#ifndef RIVET_RHIC_COMMON_HH
3#define RIVET_RHIC_COMMON_HH
5#include <unordered_map>
6#include <unordered_set>
8#include "Rivet/Projections/ChargedFinalState.hh"
9#include "Rivet/Projections/FinalState.hh"
10#include "Rivet/Projections/SingleValueProjection.hh"
11#include "Rivet/Projections/TriggerProjection.hh"
20 STAR_BES_Centrality() {
22 "STAR_BES_Centrality");
26 virtual ~STAR_BES_Centrality() { }
32 using Projection::operator=;
62 virtual ~BRAHMSCentrality() { }
65 RIVET_DEFAULT_PROJ_CLONE(BRAHMSCentrality);
68 using Projection::operator=;
93 std::unordered_set<PdgId> star_hadrons;
99 star_hadrons{PID::PI0, PID::PIPLUS, PID::ETA, PID::KPLUS, PID::K0S,
100 PID::K0L, PID::LAMBDA, PID::SIGMA0, PID::SIGMAMINUS, PID::SIGMAPLUS,
101 PID::XIMINUS, PID::XI0, PID::OMEGAMINUS} {
105 RIVET_DEFAULT_PROJ_CLONE(STARHadrons);
108 using Projection::operator=;
114 _theParticles.clear();
115 std::unordered_map<int, ConstGenParticlePtr> found;
116 std::unordered_set<int> decay_products;
119 for (ConstGenParticlePtr
p : HepMCUtils::particles(e.
genEvent())) {
120 if (
p->status() == 1) {
121 found[HepMCUtils::uniqueId(
p)] =
p;
125 for (ConstGenParticlePtr
p : HepMCUtils::particles(e.
genEvent())) {
126 bool hasDecayed =
p->status() == 2;
127 bool decayNotAllowed = star_hadrons.count(abs(
p->pdg_id()));
128 if (hasDecayed && decayNotAllowed) {
130 found[HepMCUtils::uniqueId(
p)] =
p;
132 ConstGenVertexPtr pv =
p->end_vertex();
134 for (ConstGenParticlePtr d : HepMCUtils::particles(pv, Relatives::DESCENDANTS)) {
135 decay_products.insert(HepMCUtils::uniqueId(d));
142 for (
const auto& pair : found) {
143 ConstGenParticlePtr
p = pair.second;
144 if (!decay_products.count(HepMCUtils::uniqueId(
p))) {
145 _theParticles.push_back(
p);
virtual void project(const Event &e)
Definition RHICCommon.hh:74
virtual CmpState compare(const Projection &p) const
Definition RHICCommon.hh:80
Project only charged final state particles.
Definition ChargedFinalState.hh:11
Representation of a HepMC event, and enabler of Projection caching.
Definition Event.hh:22
const GenEvent * genEvent() const
The generated HepMC event pointer obtained from an external event generator.
Definition Event.hh:80
FinalState(const Cut &c=Cuts::OPEN)
Construction using Cuts object.
std::enable_if_t< std::is_base_of< Projection, PROJ >::value, const PROJ & > apply(const Event &evt, const Projection &proj) const
Apply the supplied projection on event evt.
Definition ProjectionApplier.hh:124
const PROJ & declare(const PROJ &proj, const std::string &name) const
Register a contained projection (user-facing version).
Definition ProjectionApplier.hh:205
Base class for all Rivet projections.
Definition Projection.hh:29
void setName(const std::string &name)
Used by derived classes to set their name.
Definition Projection.hh:146
Cmp< Projection > mkNamedPCmp(const Projection &otherparent, const std::string &pname) const
virtual void project(const Event &e)
Apply the projection to the event.
Definition RHICCommon.hh:112
virtual CmpState compare(const Projection &p) const
Compare projections.
Definition RHICCommon.hh:43
RIVET_DEFAULT_PROJ_CLONE(STAR_BES_Centrality)
Clone on the heap.
void project(const Event &e)
Definition RHICCommon.hh:36
void setValue(double v)
Set the value.
Definition SingleValueProjection.hh:49
SingleValueProjection()
The default constructor.
Definition SingleValueProjection.hh:21
void clear()
Unset the value.
Definition SingleValueProjection.hh:55
double p(const ParticleBase &p)
Unbound function access to p.
Definition ParticleBaseUtils.hh:819
const Cut & open()
Fully open cut singleton, accepts everything.
Definition LHCbCommon.hh:9