Skip to content
Snippets Groups Projects

RICH functors using RichPID object

Merged Maarten Van Veghel requested to merge mveghel-richfunctorsfix into master
All threads resolved!
Files
7
+ 87
0
/*****************************************************************************\
* (c) Copyright 2023 CERN for the benefit of the LHCb Collaboration *
* *
* This software is distributed under the terms of the GNU General Public *
* Licence version 3 (GPL Version 3), copied verbatim in the file "COPYING". *
* *
* In applying this licence, CERN does not waive the privileges and immunities *
* granted to it by virtue of its status as an Intergovernmental Organization *
* or submit itself to any jurisdiction. *
\*****************************************************************************/
#pragma once
#include "Event/ProtoParticle.h"
#include "Functors/Function.h"
#include "Kernel/RichParticleIDType.h"
namespace Functors::PID {
namespace details {
LHCb::RichPID const* getRichPID( LHCb::Particle const& p ) {
auto const* proto = p.proto();
return proto ? proto->richPID() : nullptr;
}
} // namespace details
template <Rich::ParticleIDType pidtype, bool scaled = false>
struct RichDLL : public Function {
auto operator()( LHCb::Particle const& p ) const {
auto const* pid = details::getRichPID( p );
if constexpr ( scaled ) {
return pid ? Functors::Optional{pid->scaledDLLForCombDLL( pidtype )} : std::nullopt;
} else {
return pid ? Functors::Optional{pid->particleDeltaLL( pidtype )} : std::nullopt;
}
}
auto operator()( LHCb::Particle const* p ) const { return ( *this )( *p ); }
};
using RichDLLe = RichDLL<Rich::ParticleIDType::Electron>;
using RichDLLmu = RichDLL<Rich::ParticleIDType::Muon>;
using RichDLLp = RichDLL<Rich::ParticleIDType::Proton>;
using RichDLLk = RichDLL<Rich::ParticleIDType::Kaon>;
using RichDLLpi = RichDLL<Rich::ParticleIDType::Pion>;
using RichDLLd = RichDLL<Rich::ParticleIDType::Deuteron>;
using RichDLLbt = RichDLL<Rich::ParticleIDType::BelowThreshold>;
using RichScaledDLLe = RichDLL<Rich::ParticleIDType::Electron, true>;
using RichScaledDLLmu = RichDLL<Rich::ParticleIDType::Muon, true>;
struct Rich1GasUsed : public Predicate {
bool operator()( LHCb::Particle const& p ) const {
auto const* pid = details::getRichPID( p );
return pid ? pid->usedRich1Gas() : false;
}
auto operator()( LHCb::Particle const* p ) const { return ( *this )( *p ); }
};
struct Rich2GasUsed : public Predicate {
bool operator()( LHCb::Particle const& p ) const {
auto const* pid = details::getRichPID( p );
return pid ? pid->usedRich2Gas() : false;
}
auto operator()( LHCb::Particle const* p ) const { return ( *this )( *p ); }
};
template <Rich::ParticleIDType pidtype>
struct RichThreshold : public Predicate {
bool operator()( LHCb::Particle const& p ) const {
auto const* pid = details::getRichPID( p );
return pid ? pid->isAboveThreshold( pidtype ) : false;
}
auto operator()( LHCb::Particle const* p ) const { return ( *this )( *p ); }
};
using RichThresholdEl = RichThreshold<Rich::ParticleIDType::Electron>;
using RichThresholdKa = RichThreshold<Rich::ParticleIDType::Kaon>;
using RichThresholdMu = RichThreshold<Rich::ParticleIDType::Muon>;
using RichThresholdPi = RichThreshold<Rich::ParticleIDType::Pion>;
using RichThresholdPr = RichThreshold<Rich::ParticleIDType::Proton>;
using RichThresholdDe = RichThreshold<Rich::ParticleIDType::Deuteron>;
} // namespace Functors::PID
Loading