13 #ifndef Pythia8_Analysis_H 14 #define Pythia8_Analysis_H 16 #include "Pythia8/Basics.h" 17 #include "Pythia8/Event.h" 18 #include "Pythia8/PythiaStdlib.h" 32 Sphericity(
double powerIn = 2.,
int selectIn = 2) : power(powerIn),
33 select(selectIn), eVal1(), eVal2(), eVal3(), nFew(0) {powerInt = 0;
34 if (abs(power - 1.) < 0.01) powerInt = 1;
35 if (abs(power - 2.) < 0.01) powerInt = 2;
36 powerMod = 0.5 * power - 1.;}
42 double sphericity()
const {
return 1.5 * (eVal2 + eVal3);}
43 double aplanarity()
const {
return 1.5 * eVal3;}
44 double eigenValue(
int i)
const {
return (i < 2) ? eVal1 :
45 ( (i < 3) ? eVal2 : eVal3 ) ;}
46 Vec4 eventAxis(
int i)
const {
return (i < 2) ? eVec1 :
47 ( (i < 3) ? eVec2 : eVec3 ) ;}
58 static const int NSTUDYMIN, TIMESTOPRINT;
59 static const double P2MIN, EIGENVALUEMIN;
67 double eVal1, eVal2, eVal3;
68 Vec4 eVec1, eVec2, eVec3;
85 Thrust(
int selectIn = 2) : select(selectIn), eVal1(), eVal2(), eVal3(),
92 double thrust()
const {
return eVal1;}
93 double tMajor()
const {
return eVal2;}
94 double tMinor()
const {
return eVal3;}
95 double oblateness()
const {
return eVal2 - eVal3;}
96 Vec4 eventAxis(
int i)
const {
return (i < 2) ? eVec1 :
97 ( (i < 3) ? eVec2 : eVec3 ) ;}
108 static const int NSTUDYMIN, TIMESTOPRINT;
109 static const double CROSSMIN, MAJORMIN;
115 double eVal1, eVal2, eVal3;
116 Vec4 eVec1, eVec2, eVec3;
134 pJet(pJetIn), mother(motherIn), daughter(0), multiplicity(1),
135 isAssigned(false) {pAbs = max( PABSMIN, pJet.pAbs());}
137 pJet = j.
pJet; mother = j.mother; daughter = j.daughter;
138 multiplicity = j.multiplicity; pAbs = j.pAbs;
139 isAssigned = j.isAssigned; }
141 { pJet = j.
pJet; mother = j.mother; daughter = j.daughter;
142 multiplicity = j.multiplicity; pAbs = j.pAbs;
143 isAssigned = j.isAssigned;}
return *
this; }
149 int mother, daughter, multiplicity;
161 static const double PABSMIN;
184 ClusterJet(
string measureIn =
"Lund",
int selectIn = 2,
int massSetIn = 2,
185 bool preclusterIn =
false,
bool reassignIn =
false) : measure(1),
186 select(selectIn), massSet(massSetIn), doPrecluster(preclusterIn),
187 doReassign(reassignIn), yScale(), pTscale(), nJetMin(), nJetMax(),
188 dist2Join(), dist2BigMin(), distPre(), dist2Pre(), nParticles(), nFew(0)
190 char firstChar = toupper(measureIn[0]);
191 if (firstChar ==
'J') measure = 2;
192 if (firstChar ==
'D') measure = 3;
196 bool analyze(
const Event& event,
double yScaleIn,
double pTscaleIn,
197 int nJetMinIn = 1,
int nJetMaxIn = 0);
200 int size()
const {
return jets.size();}
201 Vec4 p(
int i)
const {
return jets[i].pJet;}
202 int mult(
int i)
const {
return jets[i].multiplicity;}
206 for (
int iP = 0; iP < int(particles.size()); ++iP)
207 if (particles[iP].mother == i)
return particles[iP].daughter;
215 double distance(
int i)
const {
216 return (i < distanceSize()) ? distances[i] : 0.; }
224 static const int TIMESTOPRINT;
225 static const double PIMASS, PABSMIN, PRECLUSTERFRAC, PRECLUSTERSTEP;
228 int measure, select, massSet;
229 bool doPrecluster, doReassign;
230 double yScale, pTscale;
231 int nJetMin, nJetMax;
234 double dist2Join, dist2BigMin, distPre, dist2Pre;
235 vector<SingleClusterJet> particles;
246 vector<SingleClusterJet> jets;
249 deque<double> distances;
263 SingleCell(
int iCellIn = 0,
double etaCellIn = 0.,
double phiCellIn = 0.,
264 double eTcellIn = 0.,
int multiplicityIn = 0) : iCell(iCellIn),
265 etaCell(etaCellIn), phiCell(phiCellIn), eTcell(eTcellIn),
266 multiplicity(multiplicityIn), canBeSeed(true), isUsed(false),
271 double etaCell, phiCell, eTcell;
273 bool canBeSeed, isUsed, isAssigned;
288 double phiCenterIn = 0.,
double etaWeightedIn = 0.,
289 double phiWeightedIn = 0.,
int multiplicityIn = 0,
290 Vec4 pMassiveIn = 0.) : eTjet(eTjetIn), etaCenter(etaCenterIn),
291 phiCenter(phiCenterIn), etaWeighted(etaWeightedIn),
292 phiWeighted(phiWeightedIn), multiplicity(multiplicityIn),
293 pMassive(pMassiveIn) {}
296 double eTjet, etaCenter, phiCenter, etaWeighted, phiWeighted;
312 CellJet(
double etaMaxIn = 5.,
int nEtaIn = 50,
int nPhiIn = 32,
313 int selectIn = 2,
int smearIn = 0,
double resolutionIn = 0.5,
314 double upperCutIn = 2.,
double thresholdIn = 0.,
Rndm* rndmPtrIn = 0)
315 : etaMax(etaMaxIn), nEta(nEtaIn), nPhi(nPhiIn), select(selectIn),
316 smear(smearIn), resolution(resolutionIn), upperCut(upperCutIn),
317 threshold(thresholdIn), eTjetMin(), coneRadius(), eTseed(), nFew(0),
318 rndmPtr(rndmPtrIn) { }
321 bool analyze(
const Event& event,
double eTjetMinIn = 20.,
322 double coneRadiusIn = 0.7,
double eTseedIn = 1.5);
325 int size()
const {
return jets.size();}
326 double eT(
int i)
const {
return jets[i].eTjet;}
327 double etaCenter(
int i)
const {
return jets[i].etaCenter;}
328 double phiCenter(
int i)
const {
return jets[i].phiCenter;}
329 double etaWeighted(
int i)
const {
return jets[i].etaWeighted;}
330 double phiWeighted(
int i)
const {
return jets[i].phiWeighted;}
331 int multiplicity(
int i)
const {
return jets[i].multiplicity;}
332 Vec4 pMassless(
int i)
const {
return jets[i].eTjet *
Vec4(
333 cos(jets[i].phiWeighted), sin(jets[i].phiWeighted),
334 sinh(jets[i].etaWeighted), cosh(jets[i].etaWeighted) );}
335 Vec4 pMassive(
int i)
const {
return jets[i].pMassive;}
336 double m(
int i)
const {
return jets[i].pMassive.mCalc();}
347 static const int TIMESTOPRINT;
351 int nEta, nPhi, select, smear;
352 double resolution, upperCut, threshold;
353 double eTjetMin, coneRadius, eTseed;
359 vector<SingleCellJet> jets;
385 virtual bool include(
int iSel,
const Event& event,
Vec4& pSel,
401 double phiIn = 0.,
int idxIn = 0) : p(pIn), pT2(pT2In), y(yIn),
402 phi(phiIn), mult(1) { idx.insert(idxIn); }
404 y(ssj.y),
phi(ssj.phi), mult(ssj.mult), idx(ssj.idx) { }
406 { p = ssj.
p; pT2 = ssj.pT2; y = ssj.y;
phi = ssj.phi;
407 mult = ssj.mult; idx = ssj.idx; }
return *
this; }
427 SlowJet(
int powerIn,
double Rin,
double pTjetMinIn = 0.,
428 double etaMaxIn = 25.,
int selectIn = 2,
int massSetIn = 2,
429 SlowJetHook* sjHookPtrIn = 0,
bool useFJcoreIn =
true,
430 bool useStandardRin =
true) : power(powerIn), R(Rin),
431 pTjetMin(pTjetMinIn), etaMax(etaMaxIn), select(selectIn),
432 massSet(massSetIn), sjHookPtr(sjHookPtrIn), useFJcore(useFJcoreIn),
433 useStandardR(useStandardRin), origSize(), clSize(), clLast(), jtSize(),
434 iMin(), jMin(), dPhi(), dijTemp(), dMin() { isAnti = (power < 0);
435 isKT = (power > 0); R2 = R*R; pT2jetMin = pTjetMin*pTjetMin;
436 cutInEta = (etaMax <= 20.); chargedOnly = (select > 2);
437 visibleOnly = (select == 2); modifyMass = (massSet < 2);
438 noHook = (sjHookPtr == 0);}
445 if ( !setup(event) )
return false;
446 if (useFJcore)
return clusterFJ();
447 while (clSize > 0) doStep();
451 bool setup(
const Event& event);
454 virtual bool doStep();
457 bool doNSteps(
int nStep) {
if (useFJcore)
return false;
458 while(nStep > 0 && clSize > 0) { doStep(); --nStep;}
459 return (nStep == 0); }
462 bool stopAtN(
int nStop) {
if (useFJcore)
return false;
463 while (clSize + jtSize > nStop && clSize > 0) doStep();
464 return (clSize + jtSize == nStop); }
468 int sizeJet()
const {
return jtSize;}
469 int sizeAll()
const {
return jtSize + clSize;}
470 double pT(
int i)
const {
return (i < jtSize)
471 ? sqrt(jets[i].pT2) : sqrt(clusters[i - jtSize].pT2);}
472 double y(
int i)
const {
return (i < jtSize)
473 ? jets[i].y : clusters[i - jtSize].y;}
474 double phi(
int i)
const {
return (i < jtSize)
475 ? jets[i].phi : clusters[i - jtSize].phi;}
476 Vec4 p(
int i)
const {
return (i < jtSize)
477 ? jets[i].p : clusters[i - jtSize].p;}
478 double m(
int i)
const {
return (i < jtSize)
479 ? jets[i].p.mCalc() : clusters[i - jtSize].p.mCalc();}
480 int multiplicity(
int i)
const {
return (i < jtSize)
481 ? jets[i].mult : clusters[i - jtSize].mult;}
484 int iNext()
const {
return (iMin == -1) ? -1 : iMin + jtSize;}
485 int jNext()
const {
return (jMin == -1) ? -1 : jMin + jtSize;}
486 double dNext()
const {
return dMin;}
489 void list(
bool listAll =
false)
const;
493 for (set<int>::iterator idxTmp = jets[j].idx.begin();
494 idxTmp != jets[j].idx.end(); ++idxTmp) cTemp.push_back( *idxTmp);
500 for (set<int>::iterator idxTmp = clusters[j].idx.begin();
501 idxTmp != clusters[j].idx.end(); ++idxTmp) cTemp.push_back( *idxTmp);
508 for (
int j = 0; j < sizeJet(); ++j)
509 if (jets[j].idx.find(i) != jets[j].idx.end())
return j;
515 if (i < 0 || i >= jtSize)
return;
516 jets.erase(jets.begin() + i);
524 static const double PIMASS,
TINY;
528 double R, pTjetMin, etaMax, R2, pT2jetMin;
532 bool useFJcore, useStandardR, isAnti, isKT, cutInEta, chargedOnly,
533 visibleOnly, modifyMass, noHook;
537 vector<SingleSlowJet> jets;
545 double dPhi, dijTemp, dMin;
548 virtual void findNext();
SingleClusterJet(Vec4 pJetIn=0., int motherIn=0)
Constructors.
Definition: Analysis.h:133
int nError() const
Tell how many events could not be analyzed.
Definition: Analysis.h:219
virtual ~SlowJet()
Destructor.
Definition: Analysis.h:441
Definition: Analysis.h:307
double thrust() const
Return info on results of analysis.
Definition: Analysis.h:92
int jetAssignment(int i) const
Return belonging of particle to one of the jets (-1 if none).
Definition: Analysis.h:205
Definition: Analysis.h:395
The Event class holds all info on the generated event.
Definition: Event.h:453
Definition: Analysis.h:128
bool analyze(const Event &event)
Analyze event, all in one go.
Definition: Analysis.h:444
int jetAssignment(int i)
Definition: Analysis.h:507
int nError() const
Tell how many events could not be analyzed.
Definition: Analysis.h:103
Definition: Analysis.h:179
vector< int > clusConstituents(int j)
Give a list of all particles in the cluster.
Definition: Analysis.h:499
int size() const
Return info on results of analysis.
Definition: Analysis.h:325
int nError() const
Tell how many events could not be analyzed.
Definition: Analysis.h:53
Definition: Analysis.h:282
int iNext() const
Return info on next step to be taken.
Definition: Analysis.h:484
void removeJet(int i)
Remove a jet.
Definition: Analysis.h:514
double dist2Fun(int measure, const SingleClusterJet &j1, const SingleClusterJet &j2)
Namespace function declarations; friend of SingleClusterJet.
Definition: Analysis.cc:384
Definition: Analysis.h:27
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)
Constructor.
Definition: Analysis.h:427
Vec4 pJet
Definition: Analysis.h:148
Vec4 p
Properties of jet.
Definition: Analysis.h:410
vector< SingleSlowJet > clusters
Intermediate clustering objects and final jet objects.
Definition: Analysis.h:536
Definition: Analysis.h:258
static const double TINY
Small number to avoid division by zero.
Definition: Analysis.h:524
bool stopAtN(int nStop)
Do recombinations until fixed numbers of clusters and jets remain.
Definition: Analysis.h:462
bool doNSteps(int nStep)
Do several recombinations steps, if possible.
Definition: Analysis.h:457
ClusterJet(string measureIn="Lund", int selectIn=2, int massSetIn=2, bool preclusterIn=false, bool reassignIn=false)
Constructor.
Definition: Analysis.h:184
Thrust(int selectIn=2)
Constructor.
Definition: Analysis.h:85
Definition: Analysis.h:422
double eTjet
Properties of jet.
Definition: Analysis.h:296
vector< int > constituents(int j)
Give a list of all particles in the jet.
Definition: Analysis.h:492
int iCell
Properties of cell.
Definition: Analysis.h:270
SlowJetHook * sjHookPtr
SlowJetHook can be used to tailor particle selection step.
Definition: Analysis.h:531
static const int TIMESTOPRINT
Constants: could only be changed in the code itself.
Definition: Analysis.h:523
double sphericity() const
Return info on results of analysis.
Definition: Analysis.h:42
int size() const
Return info on jets produced.
Definition: Analysis.h:200
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)
Constructor.
Definition: Analysis.h:312
Definition: Analysis.h:80
vector< double > diB
Intermediate clustering distances.
Definition: Analysis.h:540
SingleSlowJet(Vec4 pIn=0., double pT2In=0., double yIn=0., double phiIn=0., int idxIn=0)
Constructors.
Definition: Analysis.h:400
double phi(const Vec4 &v1, const Vec4 &v2)
phi is azimuthal angle between v1 and v2 around z axis.
Definition: Basics.cc:693
Header for classes to set beam momentum and interaction vertex spread.
Definition: Analysis.h:20
double m(const Vec4 &v1)
Invariant mass and its square.
Definition: Basics.cc:595
int sizeOrig() const
Return info on jet (+cluster) results of analysis.
Definition: Analysis.h:467
virtual ~SlowJetHook()
Destructor.
Definition: Analysis.h:376
Sphericity(double powerIn=2., int selectIn=2)
Constructor.
Definition: Analysis.h:32
int power
Properties of analysis as such.
Definition: Analysis.h:527
void list() const
Provide a listing of the info.
Definition: Analysis.cc:181
int nError() const
Tell how many events could not be analyzed: so far never.
Definition: Analysis.h:342
SingleCell(int iCellIn=0, double etaCellIn=0., double phiCellIn=0., double eTcellIn=0., int multiplicityIn=0)
Constructor.
Definition: Analysis.h:263
int origSize
Other intermediate variables.
Definition: Analysis.h:544
Definition: Analysis.h:371
int distanceSize() const
Return info on clustering values.
Definition: Analysis.h:214
SingleCellJet(double eTjetIn=0., double etaCenterIn=0., double phiCenterIn=0., double etaWeightedIn=0., double phiWeightedIn=0., int multiplicityIn=0, Vec4 pMassiveIn=0.)
Constructor.
Definition: Analysis.h:287
bool analyze(const Event &event)
Analyze event.
Definition: Analysis.cc:40