21 return std::bit_cast<uint64_t>(
x);
23 constexpr void hash_combine(uint64_t&
h, uint64_t
x) {
24 h ^=
x + 0x9e3779b97f4a7c15ULL + (
h << 6) + (
h >> 2);
26 constexpr uint64_t track_keep_hash(uint64_t eventNumber,
double d0,
double z0,
27 double phi0,
double theta,
double qOverP) {
29 hash_combine(
h, bits_of(d0));
30 hash_combine(
h, bits_of(z0));
31 hash_combine(
h, bits_of(phi0));
32 hash_combine(
h, bits_of(
theta));
33 hash_combine(
h, bits_of(qOverP));
39 150, 150, 150, 150, 150, 150, 150, 150, 150, 150,
40 150, 150, 150, 150, 150, 150, 150, 150, 150, 150,
41 150, 150, 150, 150, 150, 124.261, 111.448, 97.7357, 85.5616, 72.3294,
42 61.0017, 50.8592, 41.6827, 33.7413, 26.9884, 21.3822, 16.8352, 13.1081, 10.2368, 7.96723,
43 6.23636, 4.91757, 3.91519, 3.15519, 2.57768, 2.13622, 1.80524, 1.53102, 1.30677, 1.13582
49 const IInterface* p ) :
71 for(
size_t ip = 0; ip <= 50; ++ip ) {
72 m_pTbins.emplace_back( pow( 10, 2.0 + 0.04 * ip ) );
78 return StatusCode::SUCCESS;
87 return StatusCode::SUCCESS;
100 size_t nTracks = importedTrackParticles->size();
101 if (nTracks==0)
return StatusCode::SUCCESS;
104 std::vector<bool> mask;
105 mask.assign(nTracks,
false);
113 std::vector<int>
entries = m_parser->evaluateAsVector();
114 unsigned int nEntries =
entries.size();
116 if (nTracks != nEntries ) {
117 ATH_MSG_ERROR(
"Sizes incompatible! Are you sure your selection string used ID TrackParticles?");
118 return StatusCode::FAILURE;
121 for (
unsigned int i=0; i<nTracks; ++i)
if (
entries[i]==1) mask[i]=
true;
131 for(
const auto* vtx : *primaryVertices ) {
138 if( !priVtx )
return StatusCode::SUCCESS;
140 auto getBin = [&](
const double pT ) ->
size_t {
141 for(
size_t ip = 0; ip <
m_pTbins.size()-1; ip++ ) {
150 for (
size_t i=0; i<nTracks; ++i) {
152 const auto* trk = importedTrackParticles->at(i);
155 if( trk->numberOfIBLOverflowsdEdx() > 0 ) {
157 mask.at(i) =
true; ++
m_npass;
continue;
165 mask.at(i) =
true; ++
m_npass;
continue;
177 if( std::abs( trk->z0() - priVtx->
z() + trk->vz() ) >
m_z0Cut ) {
182 if( std::abs( trk->eta() ) >
m_etaCut ) {
187 auto bin =
getBin( std::abs( trk->pt() ) );
190 const auto preScale10 = std::max(
static_cast<unsigned long long>( std::floor(
m_preScales.at(
bin ) *
m_globalScale / 10. ) ), 1ull );
199 const uint64_t keepHash = track_keep_hash(
200 static_cast<uint64_t
>( ctx.eventID().event_number() ),
201 trk->d0(), trk->z0(), trk->phi0(), trk->theta(), trk->qOverP() );
204 static const float dEdxThr {
static_cast<float>(pow( 10, 0.1 )) };
205 if( dEdx > dEdxThr ) {
207 mask.at(i) = ( (keepHash % preScale10) == 0 );
210 }
else if( dEdx > 0. ) {
212 mask.at(i) = ( (keepHash % preScale) == 0 );
220 if( mask.back() ) { ++
m_npass; }
224 assert( importedTrackParticles->size() == mask.size() );
227 importedTrackParticles.
keep (mask);
229 return StatusCode::SUCCESS;
Scalar theta() const
theta method
#define ATH_CHECK
Evaluate an expression and check for errors.
int getBin(double x, double min, double step, int clamp_max)
virtual void lock()=0
Interface to allow an object to lock itself when made const in SG.
Handle for requesting thinning for a data object.
Header file for AthHistogramAlgorithm.
DoubleProperty m_globalScale
StringProperty m_streamName
virtual StatusCode finalize() override
static const std::vector< double > m_preScales
StringProperty m_selectionString
virtual StatusCode initialize() override
std::atomic< unsigned int > m_ntot
DoubleProperty m_unprescalePtCut
DoubleProperty m_d0SignifCut
PixeldEdxTrackParticleThinning(const std::string &t, const std::string &n, const IInterface *p)
SG::ReadHandleKey< xAOD::VertexContainer > m_vertexContainerKey
std::atomic< unsigned int > m_npass
virtual StatusCode doThinning(const EventContext &ctx) const override
std::vector< double > m_pTbins
SG::ThinningHandleKey< xAOD::TrackParticleContainer > m_inDetParticlesKey
virtual bool isValid() override final
Can the handle be successfully dereferenced?
void keep(size_t ndx)
Mark that index ndx in the container should be kept (not thinned away).
Handle for requesting thinning for a data object.
float z() const
Returns the z position.
double d0significance(const xAOD::TrackParticle *tp, double d0_uncert_beam_spot_2)
Vertex_v1 Vertex
Define the latest version of the vertex class.
@ pixeldEdx
the dE/dx estimate, calculated using the pixel clusters [?