ProteoWizard
Static Public Member Functions | List of all members
pwiz::analysis::IsoWindowHasher Class Reference

A method of hashing an isolation window to a unique long value mz is and m/z of a unique point in the isolation window, such as the lower bound, upper bound, or center. More...

#include <IPrecursorMaskCodec.hpp>

Static Public Member Functions

static MZHash Hash (double mz)
 Hash a floating-point m/z value to an integer. More...
 
static double UnHash (MZHash hashed)
 Unhash an integer to a floating-point m/z value. More...
 

Detailed Description

A method of hashing an isolation window to a unique long value mz is and m/z of a unique point in the isolation window, such as the lower bound, upper bound, or center.

This value is multiplied by 100000000 and rounded to convert the isolation m/z to an integer that is used as the hash. This creates an effective fuzzy window of +/- 5e-8 m/z. For example: a window with m/z 500.49 would be hashed to 50049000000.

Definition at line 99 of file IPrecursorMaskCodec.hpp.

Member Function Documentation

◆ Hash()

static MZHash pwiz::analysis::IsoWindowHasher::Hash ( double  mz)
inlinestatic

Hash a floating-point m/z value to an integer.

Definition at line 104 of file IPrecursorMaskCodec.hpp.

105  {
106  auto mult = mz * 100000000.0;
107  auto rounded = llround(mult);
108  return static_cast<MZHash>(rounded);
109  }

References pwiz::chemistry::Ion::mz().

Referenced by pwiz::analysis::DemuxWindow::DemuxWindow().

◆ UnHash()

static double pwiz::analysis::IsoWindowHasher::UnHash ( MZHash  hashed)
inlinestatic

Unhash an integer to a floating-point m/z value.

Definition at line 112 of file IPrecursorMaskCodec.hpp.

113  {
114  return hashed / 100000000.0;
115  }

The documentation for this class was generated from the following file:
pwiz::analysis::MZHash
uint64_t MZHash
Definition: IPrecursorMaskCodec.hpp:90
pwiz::chemistry::Ion::mz
double mz(double neutralMass, int protonDelta, int electronDelta=0, int neutronDelta=0)
Definition: Ion.hpp:78