/usr/include/Pythia8/Pythia8/Analysis.h is in libpythia8-dev 8.1.86-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 | // Analysis.h is a part of the PYTHIA event generator.
// Copyright (C) 2014 Torbjorn Sjostrand.
// PYTHIA is licenced under the GNU GPL version 2, see COPYING for details.
// Please respect the MCnet Guidelines, see GUIDELINES for details.
// Header file for the Sphericity, Thrust, ClusterJet and CellJet classes.
// Sphericity: sphericity analysis of the event.
// Thrust: thrust analysis of the event.
// ClusterJet: clustering jet finder.
// CellJet: calorimetric cone jet finder.
// SlowJet: recombination algorithm; lightweight version of FastJet.
#ifndef Pythia8_Analysis_H
#define Pythia8_Analysis_H
#include "Pythia8/Basics.h"
#include "Pythia8/Event.h"
#include "Pythia8/PythiaStdlib.h"
namespace Pythia8 {
//==========================================================================
// Sphericity class.
// This class performs (optionally modified) sphericity analysis on an event.
class Sphericity {
public:
// Constructor.
Sphericity(double powerIn = 2., int selectIn = 2) : power(powerIn),
select(selectIn), nFew(0) {powerInt = 0;
if (abs(power - 1.) < 0.01) powerInt = 1;
if (abs(power - 2.) < 0.01) powerInt = 2;
powerMod = 0.5 * power - 1.;}
// Analyze event.
bool analyze(const Event& event, ostream& os = cout);
// Return info on results of analysis.
double sphericity() const {return 1.5 * (eVal2 + eVal3);}
double aplanarity() const {return 1.5 * eVal3;}
double eigenValue(int i) const {return (i < 2) ? eVal1 :
( (i < 3) ? eVal2 : eVal3 ) ;}
Vec4 eventAxis(int i) const {return (i < 2) ? eVec1 :
( (i < 3) ? eVec2 : eVec3 ) ;}
// Provide a listing of the info.
void list(ostream& os = cout) const;
// Tell how many events could not be analyzed.
int nError() const {return nFew;}
private:
// Constants: could only be changed in the code itself.
static const int NSTUDYMIN, TIMESTOPRINT;
static const double P2MIN, EIGENVALUEMIN;
// Properties of analysis.
double power;
int select, powerInt;
double powerMod;
// Outcome of analysis.
double eVal1, eVal2, eVal3;
Vec4 eVec1, eVec2, eVec3;
// Error statistics;
int nFew;
};
//==========================================================================
// Thrust class.
// This class performs thrust analysis on an event.
class Thrust {
public:
// Constructor.
Thrust(int selectIn = 2) : select(selectIn), nFew(0) {}
// Analyze event.
bool analyze(const Event& event, ostream& os = cout);
// Return info on results of analysis.
double thrust() const {return eVal1;}
double tMajor() const {return eVal2;}
double tMinor() const {return eVal3;}
double oblateness() const {return eVal2 - eVal3;}
Vec4 eventAxis(int i) const {return (i < 2) ? eVec1 :
( (i < 3) ? eVec2 : eVec3 ) ;}
// Provide a listing of the info.
void list(ostream& os = cout) const;
// Tell how many events could not be analyzed.
int nError() const {return nFew;}
private:
// Constants: could only be changed in the code itself.
static const int NSTUDYMIN, TIMESTOPRINT;
static const double MAJORMIN;
// Properties of analysis.
int select;
// Outcome of analysis.
double eVal1, eVal2, eVal3;
Vec4 eVec1, eVec2, eVec3;
// Error statistics;
int nFew;
};
//==========================================================================
// SingleClusterJet class.
// Simple helper class to ClusterJet for a jet and its contents.
class SingleClusterJet {
public:
// Constructors.
SingleClusterJet(Vec4 pJetIn = 0., int motherIn = 0) :
pJet(pJetIn), mother(motherIn), daughter(0), multiplicity(1),
isAssigned(false) {pAbs = max( PABSMIN, pJet.pAbs());}
SingleClusterJet& operator=(const SingleClusterJet& j) { if (this != &j)
{ pJet = j.pJet; mother = j.mother; daughter = j.daughter;
multiplicity = j.multiplicity; pAbs = j.pAbs;
isAssigned = j.isAssigned;} return *this; }
// Properties of jet.
// Note: mother, daughter and isAssigned only used for original
// particles, multiplicity and pTemp only for reconstructed jets.
Vec4 pJet;
int mother, daughter, multiplicity;
bool isAssigned;
double pAbs;
Vec4 pTemp;
// Distance measures (Lund, JADE, Durham) with friend.
friend double dist2Fun(int measure, const SingleClusterJet& j1,
const SingleClusterJet& j2);
private:
// Constants: could only be changed in the code itself.
static const double PABSMIN;
} ;
//--------------------------------------------------------------------------
// Namespace function declarations; friend of SingleClusterJet.
// Distance measures (Lund, JADE, Durham) with friend.
double dist2Fun(int measure, const SingleClusterJet& j1,
const SingleClusterJet& j2);
//==========================================================================
// ClusterJet class.
// This class performs a jet clustering according to different
// distance measures: Lund, JADE or Durham.
class ClusterJet {
public:
// Constructor.
ClusterJet(string measureIn = "Lund", int selectIn = 2, int massSetIn = 2,
bool preclusterIn = false, bool reassignIn = false) : measure(1),
select(selectIn), massSet(massSetIn), doPrecluster(preclusterIn),
doReassign(reassignIn), nFew(0) {
char firstChar = toupper(measureIn[0]);
if (firstChar == 'J') measure = 2;
if (firstChar == 'D') measure = 3;
}
// Analyze event.
bool analyze(const Event& event, double yScaleIn, double pTscaleIn,
int nJetMinIn = 1, int nJetMaxIn = 0, ostream& os = cout);
// Return info on jets produced.
int size() const {return jets.size();}
Vec4 p(int i) const {return jets[i].pJet;}
int mult(int i) const {return jets[i].multiplicity;}
// Return belonging of particle to one of the jets (-1 if none).
int jetAssignment(int i) const {
for (int iP = 0; iP < int(particles.size()); ++iP)
if (particles[iP].mother == i) return particles[iP].daughter;
return -1;}
// Provide a listing of the info.
void list(ostream& os = cout) const;
// Return info on clustering values.
int distanceSize() const {return distances.size();}
double distance(int i) const {
return (i < distanceSize()) ? distances[i] : 0.; }
// Tell how many events could not be analyzed.
int nError() const {return nFew;}
private:
// Constants: could only be changed in the code itself.
static const int TIMESTOPRINT;
static const double PIMASS, PABSMIN, PRECLUSTERFRAC, PRECLUSTERSTEP;
// Properties of analysis.
int measure, select, massSet;
bool doPrecluster, doReassign;
double yScale, pTscale;
int nJetMin, nJetMax;
// Temporary results.
double dist2Join, dist2BigMin, distPre, dist2Pre;
vector<SingleClusterJet> particles;
int nParticles;
// Error statistics;
int nFew;
// Member functions for some operations (for clarity).
void precluster();
void reassign();
// Outcome of analysis: ET-ordered list of jets.
vector<SingleClusterJet> jets;
// Outcome of analysis: the distance values where the jets were merged.
deque<double> distances;
};
//==========================================================================
// SingleCell class.
// Simple helper class to CellJet for a cell and its contents.
class SingleCell {
public:
// Constructor.
SingleCell(int iCellIn = 0, double etaCellIn = 0., double phiCellIn = 0.,
double eTcellIn = 0., int multiplicityIn = 0) : iCell(iCellIn),
etaCell(etaCellIn), phiCell(phiCellIn), eTcell(eTcellIn),
multiplicity(multiplicityIn), canBeSeed(true), isUsed(false),
isAssigned(false) {}
// Properties of cell.
int iCell;
double etaCell, phiCell, eTcell;
int multiplicity;
bool canBeSeed, isUsed, isAssigned;
} ;
//==========================================================================
// SingleCellJet class.
// Simple helper class to CellJet for a jet and its contents.
class SingleCellJet {
public:
// Constructor.
SingleCellJet(double eTjetIn = 0., double etaCenterIn = 0.,
double phiCenterIn = 0., double etaWeightedIn = 0.,
double phiWeightedIn = 0., int multiplicityIn = 0,
Vec4 pMassiveIn = 0.) : eTjet(eTjetIn), etaCenter(etaCenterIn),
phiCenter(phiCenterIn), etaWeighted(etaWeightedIn),
phiWeighted(phiWeightedIn), multiplicity(multiplicityIn),
pMassive(pMassiveIn) {}
// Properties of jet.
double eTjet, etaCenter, phiCenter, etaWeighted, phiWeighted;
int multiplicity;
Vec4 pMassive;
} ;
//==========================================================================
// CellJet class.
// This class performs a cone jet search in (eta, phi, E_T) space.
class CellJet {
public:
// Constructor.
CellJet(double etaMaxIn = 5., int nEtaIn = 50, int nPhiIn = 32,
int selectIn = 2, int smearIn = 0, double resolutionIn = 0.5,
double upperCutIn = 2., double thresholdIn = 0., Rndm* rndmPtrIn = 0)
: etaMax(etaMaxIn), nEta(nEtaIn), nPhi(nPhiIn), select(selectIn),
smear(smearIn), resolution(resolutionIn), upperCut(upperCutIn),
threshold(thresholdIn), nFew(0), rndmPtr(rndmPtrIn) { }
// Analyze event.
bool analyze(const Event& event, double eTjetMinIn = 20.,
double coneRadiusIn = 0.7, double eTseedIn = 1.5, ostream& os = cout);
// Return info on results of analysis.
int size() const {return jets.size();}
double eT(int i) const {return jets[i].eTjet;}
double etaCenter(int i) const {return jets[i].etaCenter;}
double phiCenter(int i) const {return jets[i].phiCenter;}
double etaWeighted(int i) const {return jets[i].etaWeighted;}
double phiWeighted(int i) const {return jets[i].phiWeighted;}
int multiplicity(int i) const {return jets[i].multiplicity;}
Vec4 pMassless(int i) const {return jets[i].eTjet * Vec4(
cos(jets[i].phiWeighted), sin(jets[i].phiWeighted),
sinh(jets[i].etaWeighted), cosh(jets[i].etaWeighted) );}
Vec4 pMassive(int i) const {return jets[i].pMassive;}
double m(int i) const {return jets[i].pMassive.mCalc();}
// Provide a listing of the info.
void list(ostream& os = cout) const;
// Tell how many events could not be analyzed: so far never.
int nError() const {return nFew;}
private:
// Constants: could only be changed in the code itself.
static const int TIMESTOPRINT;
// Properties of analysis.
double etaMax;
int nEta, nPhi, select, smear;
double resolution, upperCut, threshold;
double eTjetMin, coneRadius, eTseed;
// Error statistics;
int nFew;
// Outcome of analysis: ET-ordered list of jets.
vector<SingleCellJet> jets;
// Pointer to the random number generator (needed for energy smearing).
Rndm* rndmPtr;
};
//==========================================================================
// SlowJetHook class.
// Base class, used to derive your own class with your selection criteria.
class SlowJetHook {
public:
// Destructor.
virtual ~SlowJetHook() { }
// Method to be overloaded.
// It will be called for all final-state particles, one at a time, and
// should return true if the particle should be analyzed, false if not.
// The particle is in location iSel of the event record.
// If you wish you can also modify the four-momentum and mass that will
// be used in the analysis, without affecting the event record itself,
// by changing pSel and mSel. Remember to respect E^2 - p^2 = m^2.
virtual bool include(int iSel, const Event& event, Vec4& pSel,
double& mSel) = 0;
};
//==========================================================================
// SingleSlowJet class.
// Simple helper class to SlowJet for a jet and its contents.
class SingleSlowJet {
public:
// Constructors.
SingleSlowJet( Vec4 pIn = 0., double pT2In = 0., double yIn = 0.,
double phiIn = 0., int idxIn = 0) : p(pIn), pT2(pT2In), y(yIn),
phi(phiIn), mult(1) { idx.insert(idxIn); }
SingleSlowJet(const SingleSlowJet& ssj) : p(ssj.p), pT2(ssj.pT2),
y(ssj.y), phi(ssj.phi), mult(ssj.mult), idx(ssj.idx) { }
SingleSlowJet& operator=(const SingleSlowJet& ssj) { if (this != &ssj)
{ p = ssj.p; pT2 = ssj.pT2; y = ssj.y; phi = ssj.phi;
mult = ssj.mult; idx = ssj.idx; } return *this; }
// Properties of jet.
Vec4 p;
double pT2, y, phi;
int mult;
set<int> idx;
};
//==========================================================================
// SlowJet class.
// This class performs a recombination jet search in (y, phi, pT) space.
class SlowJet {
public:
// Constructor.
SlowJet(int powerIn, double Rin, double pTjetMinIn = 0.,
double etaMaxIn = 25., int selectIn = 2, int massSetIn = 2,
SlowJetHook* sjHookPtrIn = 0, bool useFJcoreIn = true,
bool useStandardRin = true) : power(powerIn), R(Rin),
pTjetMin(pTjetMinIn), etaMax(etaMaxIn), select(selectIn),
massSet(massSetIn), sjHookPtr(sjHookPtrIn), useFJcore(useFJcoreIn),
useStandardR(useStandardRin) { isAnti = (power < 0); isKT = (power > 0);
R2 = R*R; pT2jetMin = pTjetMin*pTjetMin; cutInEta = (etaMax <= 20.);
chargedOnly = (select > 2); visibleOnly = (select == 2);
modifyMass = (massSet < 2); noHook = (sjHookPtr == 0);}
// Analyze event, all in one go.
bool analyze(const Event& event) {
if ( !setup(event) ) return false;
if (useFJcore) return clusterFJ();
while (clSize > 0) doStep(); return true; }
// Set up list of particles to analyze, and initial distances.
bool setup(const Event& event);
// Do one recombination step, possibly giving a jet.
bool doStep();
// Do several recombinations steps, if possible.
bool doNSteps(int nStep) { if (useFJcore) return false;
while(nStep > 0 && clSize > 0) { doStep(); --nStep;}
return (nStep == 0); }
// Do recombinations until fixed numbers of clusters and jets remain.
bool stopAtN(int nStop) { if (useFJcore) return false;
while (clSize + jtSize > nStop && clSize > 0) doStep();
return (clSize + jtSize == nStop); }
// Return info on jet (+cluster) results of analysis.
int sizeOrig() const {return origSize;}
int sizeJet() const {return jtSize;}
int sizeAll() const {return jtSize + clSize;}
double pT(int i) const {return (i < jtSize)
? sqrt(jets[i].pT2) : sqrt(clusters[i - jtSize].pT2);}
double y(int i) const {return (i < jtSize)
? jets[i].y : clusters[i - jtSize].y;}
double phi(int i) const {return (i < jtSize)
? jets[i].phi : clusters[i - jtSize].phi;}
Vec4 p(int i) const {return (i < jtSize)
? jets[i].p : clusters[i - jtSize].p;}
double m(int i) const {return (i < jtSize)
? jets[i].p.mCalc() : clusters[i - jtSize].p.mCalc();}
int multiplicity(int i) const {return (i < jtSize)
? jets[i].mult : clusters[i - jtSize].mult;}
// Return info on next step to be taken.
int iNext() const {return (iMin == -1) ? -1 : iMin + jtSize;}
int jNext() const {return (jMin == -1) ? -1 : jMin + jtSize;}
double dNext() const {return dMin;}
// Provide a listing of the info.
void list(bool listAll = false, ostream& os = cout) const;
// Give a list of all particles in the jet.
vector<int> constituents(int j) { vector<int> cTemp;
for (set<int>::iterator idxTmp = jets[j].idx.begin();
idxTmp != jets[j].idx.end(); ++idxTmp)
cTemp.push_back( *idxTmp); return cTemp;
}
// Give a list of all particles in the cluster.
vector<int> clusConstituents(int j) { vector<int> cTemp;
for (set<int>::iterator idxTmp = clusters[j].idx.begin();
idxTmp != clusters[j].idx.end(); ++idxTmp)
cTemp.push_back( *idxTmp); return cTemp;
}
// Give the index of the jet that the particle i of the event record
// belongs to. Returns -1 if particle i is not found in a jet.
int jetAssignment(int i) {
for (int j = 0; j < sizeJet(); ++j)
if (jets[j].idx.find(i) != jets[j].idx.end()) return j;
return -1;
}
// Remove a jet.
void removeJet(int i) {
if (i < 0 || i >= jtSize) return;
jets.erase(jets.begin() + i);
jtSize--;
}
private:
// Constants: could only be changed in the code itself.
static const int TIMESTOPRINT;
static const double PIMASS, TINY;
// Properties of analysis as such.
int power;
double R, pTjetMin, etaMax, R2, pT2jetMin;
int select, massSet;
// SlowJetHook can be used to tailor particle selection step.
SlowJetHook* sjHookPtr;
bool useFJcore, useStandardR, isAnti, isKT, cutInEta, chargedOnly,
visibleOnly, modifyMass, noHook;
// Intermediate clustering objects and final jet objects.
vector<SingleSlowJet> clusters;
vector<SingleSlowJet> jets;
// Intermediate clustering distances.
vector<double> diB;
vector<double> dij;
// Other intermediate variables.
int origSize, clSize, clLast, jtSize, iMin, jMin;
double dPhi, dijTemp, dMin;
// Find next cluster pair to join.
void findNext();
// Use FJcore interface to perform clustering.
bool clusterFJ();
};
//==========================================================================
} // end namespace Pythia8
#endif // end Pythia8_Analysis_H
|