<html>
  <head>

    <meta http-equiv="content-type" content="text/html; charset=utf-8">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <p>Hi Michael,</p>
    <p>during testing we found that your analysis plugin crashes for
      certain events<br>
      when trying to calculate the median pTDensity.</p>
    <p>Could I please ask you to have a look at these code snippets.</p>
    <p><br>
    </p>
    <p><font size="+1"><tt>      // Get the jet pT densities</tt><tt><br>
        </tt><tt>      vector< vector<double> >
          ptDensities(_eta_bins_areaoffset.size()-1);</tt><tt><br>
        </tt><tt>      FastJets fastjets = apply<FastJets>(event,
          "KtJetsD05");</tt><tt><br>
        </tt><tt>      const
          shared_ptr<fastjet::ClusterSequenceArea> clust_seq_area
          = fastjets.clusterSeqArea();</tt><tt><br>
        </tt><tt>      for (const Jet& jet : fastjets.jets()) {</tt><tt><br>
        </tt><tt>        const double area =
          clust_seq_area->area(jet); //< Implicit call to
          pseudojet()</tt><tt><br>
        </tt><tt>        <b>/// <font color="#3333ff">@todo Should be
              1e-4</font>?</b></tt><tt><br>
        </tt><tt>        if (area > <font color="#3333ff"><b>10e-4</b></font>
          && jet.abseta() < _eta_bins_areaoffset.back()) {</tt><tt><br>
        </tt><tt>          ptDensities.at(getEtaBin(jet.abseta(), true))
          += jet.pT()/area;</tt><tt><br>
        </tt><tt>        }</tt><tt><br>
        </tt><tt>      }</tt><tt><br>
        </tt><tt><br>
        </tt><tt>      // Now compute the median energy densities</tt><tt><br>
        </tt><tt>      vector<double> ptDensity;</tt><tt><br>
        </tt><tt>      for (size_t b = 0; b <
          _eta_bins_areaoffset.size()-1; ++b) {</tt><tt><br>
        </tt><tt>        <b><font color="#ff0000">if
              (ptDensities[b].size() >0 )</font></b> ptDensity +=
          median(ptDensities[b]);</tt><tt>                                                                     
        </tt><tt><br>
        </tt><tt>      }</tt><tt><br>
        </tt></font></p>
    <p>The red bit was added by us to prevent calculating the median of
      an empty vector --- do you remember<br>
      what the logic in your analysis code was for cases like that?</p>
    <p>If you find the time, could you please comment on the blue bit as
      well?</p>
    <p>You can find the version of the code in the current release here:</p>
    <blockquote>
      <p><a class="moz-txt-link-freetext" href="https://rivet.hepforge.org/hg/rivet/file/0175188f89df/src/Analyses/ATLAS_2010_S8914702.cc">https://rivet.hepforge.org/hg/rivet/file/0175188f89df/src/Analyses/ATLAS_2010_S8914702.cc</a></p>
      <p><br>
      </p>
    </blockquote>
    <p>Cheers,<br>
      Holger<br>
    </p>
  </body>
</html>