64  auto itb                       = trace_b.begin();
 
   65  double inner_intensity_product = 0;
 
   66  for(
const auto &peak_a : trace_a)
 
   69      double low = range.
lower();
 
   70      double up  = range.
upper();
 
   72      while((itb != trace_b.end()) && (itb->x < low))
 
   78          inner_intensity_product += peak_a.y * itb->y;
 
   82  double tracea_product = 0;
 
   84  for(
const auto &peak_a : trace_a)
 
   86      tracea_product += peak_a.y * peak_a.y;
 
   90  double traceb_product = 0;
 
   92  for(
const auto &peak_a : trace_b)
 
   94      traceb_product += peak_a.y * peak_a.y;
 
   97  return (inner_intensity_product /
 
   98          (sqrt(tracea_product) * sqrt(traceb_product)));