Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -938,6 +938,8 @@ struct IdentifiedBfFilterTracks {
MatchRecoGenSpecies trackIdentification(TrackObject const& track);
template <typename TrackObject>
int8_t AcceptTrack(TrackObject const& track);
template <typename ParticleObject, typename MCCollisionObject>
int8_t AcceptParticle(ParticleObject& particle, MCCollisionObject const&);
template <typename CollisionObjects, typename TrackObject>
int8_t selectTrackAmbiguousCheck(CollisionObjects const& collisions, TrackObject const& track);
template <typename ParticleObject>
Expand Down Expand Up @@ -1182,7 +1184,6 @@ template <typename ParticleObject>
inline MatchRecoGenSpecies IdentifiedBfFilterTracks::IdentifyParticle(ParticleObject const& particle)
{
using namespace identifiedbffilter;

constexpr int pdgcodeEl = 11;
constexpr int pdgcodePi = 211;
constexpr int pdgcodeKa = 321;
Comment on lines 1187 to 1189

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would suggest using named constants from TPDGCode.h (https://root.cern/doc/v632/TPDGCode_8h.html) for the next iteration

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you Victor. I will do this for the next iteration.

Expand Down Expand Up @@ -1361,7 +1362,6 @@ template <typename TrackObject>
MatchRecoGenSpecies IdentifiedBfFilterTracks::trackIdentification(TrackObject const& track)
{
using namespace identifiedbffilter;

MatchRecoGenSpecies sp = kWrongSpecies;
if (recoIdMethod == 0) {
sp = kIdBfCharged;
Expand Down Expand Up @@ -1424,6 +1424,41 @@ inline int8_t IdentifiedBfFilterTracks::AcceptTrack(TrackObject const& track)
return -1;
}

/// \brief Accepts or not the passed generated particle
/// \param track the particle of interest
/// \return `true` if the particle is accepted, `false` otherwise
template <typename ParticleObject, typename MCCollisionObject>
inline int8_t IdentifiedBfFilterTracks::AcceptParticle(ParticleObject& particle, MCCollisionObject const&)
{
/* overall momentum cut */
if (!(overallminp < particle.p())) {
return kWrongSpecies;
}

float charge = getCharge(particle);

if (particle.isPhysicalPrimary()) {
if ((particle.mcCollisionId() == 0) && traceCollId0) {
LOGF(info, "Particle %d passed isPhysicalPrimary", particle.globalIndex());
}

if (ptlow < particle.pt() && particle.pt() < ptup && etalow < particle.eta() && particle.eta() < etaup) {
MatchRecoGenSpecies sp = IdentifyParticle(particle);
if (charge == 1) {
return speciesChargeValue1[sp];

} else if (charge == -1) {
return speciesChargeValue1[sp] + 1;
}
}
} else {
if ((particle.mcCollisionId() == 0) && traceCollId0) {
LOGF(info, "Particle %d NOT passed isPhysicalPrimary", particle.globalIndex());
}
}
return kWrongSpecies;
}

template <typename CollisionObjects, typename TrackObject>
int8_t IdentifiedBfFilterTracks::selectTrackAmbiguousCheck(CollisionObjects const& collisions, TrackObject const& track)
{
Expand Down
57 changes: 11 additions & 46 deletions PWGCF/TwoParticleCorrelations/TableProducer/identifiedBfFilter.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ namespace analysis
namespace identifiedbffilter
{

const std::vector<int> pdgcodes = {11, 211, 321, 2212};

/// \enum MatchRecoGenSpecies
/// \brief The species considered by the matching test
enum MatchRecoGenSpecies {
Expand Down Expand Up @@ -128,6 +130,8 @@ enum CentMultEstimatorType {
knCentMultEstimators ///< number of centrality/mutiplicity estimator
};

float overallminp = 0.0f;

/// \enum TriggerSelectionType
/// \brief The type of trigger to apply for event selection
enum TriggerSelectionType {
Expand Down Expand Up @@ -716,54 +720,15 @@ void exploreMothers(ParticleObject& particle, MCCollisionObject& collision)
}
}

/// \brief Accepts or not the passed generated particle
/// \param track the particle of interest
/// \return the internal particle id, -1 if not accepted
/// TODO: the PID implementation
/// For the time being we keep the convention
/// - positive particle pid even
/// - negative particle pid odd
/// - charged hadron 0/1
template <typename ParticleObject, typename MCCollisionObject>
inline int8_t AcceptParticle(ParticleObject& particle, MCCollisionObject const& collision)
template <typename ParticleObject>
inline float getCharge(ParticleObject& particle)
{
float charge = (fPDG->GetParticle(particle.pdgCode())->Charge() / 3 >= 1) ? 1.0 : ((fPDG->GetParticle(particle.pdgCode())->Charge() / 3 <= -1) ? -1.0 : 0.0);

if (particle.isPhysicalPrimary()) {
if ((particle.mcCollisionId() == 0) && traceCollId0) {
LOGF(info, "Particle %d passed isPhysicalPrimary", particle.globalIndex());
}
if (useOwnParticleSelection) {
float dcaxy = TMath::Sqrt((particle.vx() - collision.posX()) * (particle.vx() - collision.posX()) +
(particle.vy() - collision.posY()) * (particle.vy() - collision.posY()));
float dcaz = TMath::Abs(particle.vz() - collision.posZ());
if (!((dcaxy < particleMaxDCAxy) && (dcaz < particleMaxDCAZ))) {
if ((particle.mcCollisionId() == 0) && traceCollId0) {
LOGF(info, "Rejecting particle with dcaxy: %.2f and dcaz: %.2f", dcaxy, dcaz);
LOGF(info, " assigned collision Id: %d, looping on collision Id: %d", particle.mcCollisionId(), collision.globalIndex());
LOGF(info, " Collision x: %.5f, y: %.5f, z: %.5f", collision.posX(), collision.posY(), collision.posZ());
LOGF(info, " Particle x: %.5f, y: %.5f, z: %.5f", particle.vx(), particle.vy(), particle.vz());
LOGF(info, " index: %d, pdg code: %d", particle.globalIndex(), particle.pdgCode());

exploreMothers(particle, collision);
}
return -1;
}
}
if (ptlow < particle.pt() && particle.pt() < ptup && etalow < particle.eta() && particle.eta() < etaup) {
if (charge > 0) {
return 0;
}
if (charge < 0) {
return 1;
}
}
} else {
if ((particle.mcCollisionId() == 0) && traceCollId0) {
LOGF(info, "Particle %d NOT passed isPhysicalPrimary", particle.globalIndex());
}
float charge = 0.0;
TParticlePDG* pdgparticle = fPDG->GetParticle(particle.pdgCode());
if (pdgparticle != nullptr) {
charge = (pdgparticle->Charge() / 3 >= 1) ? 1.0 : ((pdgparticle->Charge() / 3 <= -1) ? -1.0 : 0);
}
return -1;
return charge;
}

} // namespace identifiedbffilter
Expand Down