4 #include "TransverseFuzzinessCalculator.h"
7 double TransverseFuzzinessCalculator::calculate(
8 const Event &initialParticles,
9 const Event &finalJets,
10 const double *weights,
11 const unsigned nJets,
const unsigned nParts,
12 const bool lastFinalJetIsUnclustered,
13 double *jetFuzziness,
const unsigned lenJetFuzziness)
const
18 assert(initialParticles.size() >= nParts);
19 assert(finalJets.size() >= nJets);
21 assert(lenJetFuzziness >= nJets);
23 if (ptStorage_.size() < nParts)
24 ptStorage_.resize(nParts);
25 double* ptValues = &ptStorage_[0];
26 long double ptSum = 0.0L;
27 for (
unsigned i=0; i<nParts; ++i)
29 const double pt = initialParticles[i].pt();
35 double eventFuzzinesContribution;
36 long double fuzzySum = 0.0L;
37 for (
unsigned i=0; i<nJets; ++i)
39 jetFuzziness[i] = 0.0;
40 eventFuzzinesContribution = 0.0;
41 singleJetFuzziness(ptValues, weights + i*nParts, nParts,
42 jetFuzziness+i, &eventFuzzinesContribution);
43 if ( addInQuadrature_ ) fuzzySum += eventFuzzinesContribution*eventFuzzinesContribution;
44 else fuzzySum += eventFuzzinesContribution;
49 if ( addInQuadrature_)
50 fuzzySum = std::sqrt(fuzzySum);
57 void TransverseFuzzinessCalculator::singleJetFuzziness(
58 const double *ptValues,
const double *weights,
const unsigned len,
59 double* thisJetFuzzines,
double* eventFuzzinesContribution)
const
61 long double numSum = 0.0L, denomSum = 0.0L;
65 for (
unsigned i=0; i<len; ++i)
67 const double w = weights[i];
71 assert(ptValues[i]>0.0L);
73 const double weightedPt = w*ptValues[i];
74 denomSum += weightedPt;
75 numSum += weightedPt*(1.0 - w)*ptValues[i];
76 assert(denomSum > 0.0L);
80 *eventFuzzinesContribution=0.;
84 assert(denomSum > 0.0L);
86 const double eUncert = sqrt(static_cast<double>(numSum));
87 *thisJetFuzzines = eUncert/
static_cast<double>(denomSum);
90 *eventFuzzinesContribution = eUncert;
92 *eventFuzzinesContribution = *thisJetFuzzines;