File indexing completed on 2025-08-05 08:19:19
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029
0030
0031
0032
0033
0034
0035
0036
0037
0038
0039
0040
0041
0042
0043
0044
0045
0046
0047
0048
0049
0050
0051
0052
0053
0054
0055
0056 #ifndef JETSCAPEPARTICLES_H
0057 #define JETSCAPEPARTICLES_H
0058
0059 #include <stdio.h>
0060 #include <math.h>
0061 #include "GTL/graph.h"
0062 #include "JetScapeConstants.h"
0063 #include "FourVector.h"
0064 #include "fjcore.hh"
0065 #include "JetScapeLogger.h"
0066 #include "PartonShower.h"
0067
0068 #include "Pythia8/Pythia.h"
0069
0070 #include <vector>
0071 #include <memory>
0072 #include <iostream>
0073 #include <sstream>
0074 #include <iomanip>
0075
0076 using std::ostream;
0077 using std::weak_ptr;
0078
0079 namespace Jetscape {
0080
0081 class PartonShower;
0082
0083
0084
0085
0086
0087 class JetScapeParticleBase : protected fjcore::PseudoJet {
0088 friend class fjcore::PseudoJet;
0089
0090
0091
0092
0093
0094
0095 public:
0096
0097
0098
0099
0100
0101
0102 inline void reset_momentum(const double px, const double py, const double pz,
0103 const double e) {
0104 fjcore::PseudoJet::reset_momentum(px, py, pz, e);
0105 }
0106
0107 inline void reset_momentum(const FourVector &p) {
0108 fjcore::PseudoJet::reset_momentum(p.x(), p.y(), p.z(), p.t());
0109 }
0110
0111
0112
0113
0114
0115
0116
0117
0118
0119
0120
0121
0122
0123
0124
0125
0126
0127
0128
0129
0130
0131
0132
0133
0134
0135 fjcore::PseudoJet GetPseudoJet() const { return PseudoJet(*this); }
0136
0137
0138 using fjcore::PseudoJet::px;
0139 using fjcore::PseudoJet::py;
0140 using fjcore::PseudoJet::pz;
0141 using fjcore::PseudoJet::e;
0142 using fjcore::PseudoJet::E;
0143
0144 using fjcore::PseudoJet::phi;
0145 using fjcore::PseudoJet::phi_std;
0146 using fjcore::PseudoJet::phi_02pi;
0147 using fjcore::PseudoJet::rap;
0148 using fjcore::PseudoJet::rapidity;
0149 using fjcore::PseudoJet::pseudorapidity;
0150 using fjcore::PseudoJet::eta;
0151 using fjcore::PseudoJet::pt2;
0152 using fjcore::PseudoJet::pt;
0153 using fjcore::PseudoJet::perp2;
0154 using fjcore::PseudoJet::perp;
0155 using fjcore::PseudoJet::kt2;
0156
0157 using fjcore::PseudoJet::modp2;
0158 using fjcore::PseudoJet::modp;
0159 using fjcore::PseudoJet::Et;
0160 using fjcore::PseudoJet::Et2;
0161
0162 using fjcore::PseudoJet::kt_distance;
0163 using fjcore::PseudoJet::plain_distance;
0164 using fjcore::PseudoJet::squared_distance;
0165 using fjcore::PseudoJet::delta_R;
0166 using fjcore::PseudoJet::delta_phi_to;
0167 using fjcore::PseudoJet::beam_distance;
0168
0169 using fjcore::PseudoJet::operator*=;
0170 using fjcore::PseudoJet::operator/=;
0171 using fjcore::PseudoJet::operator+=;
0172 using fjcore::PseudoJet::operator-=;
0173
0174 using fjcore::PseudoJet::user_index;
0175 using fjcore::PseudoJet::set_user_index;
0176 using fjcore::PseudoJet::UserInfoBase;
0177 using fjcore::PseudoJet::InexistentUserInfo;
0178
0179 using fjcore::PseudoJet::user_info;
0180 using fjcore::PseudoJet::set_user_info;
0181 using fjcore::PseudoJet::has_user_info;
0182 using fjcore::PseudoJet::user_info_ptr;
0183 using fjcore::PseudoJet::user_info_shared_ptr;
0184
0185 using fjcore::PseudoJet::description;
0186
0187
0188
0189
0190
0191
0192
0193
0194
0195
0196
0197
0198
0199
0200
0201
0202
0203
0204 public:
0205 JetScapeParticleBase() : PseudoJet(){};
0206 JetScapeParticleBase(int label, int id, int stat, const FourVector &p,
0207 const FourVector &x);
0208 JetScapeParticleBase(int label, int id, int stat, double pt, double eta,
0209 double phi, double e, double *x = 0);
0210 JetScapeParticleBase(int label, int id, int stat, const FourVector &p,
0211 const FourVector &x, double mass);
0212 JetScapeParticleBase(const JetScapeParticleBase &srp);
0213
0214 virtual ~JetScapeParticleBase();
0215
0216 void clear();
0217
0218
0219 void set_label(int label);
0220 void set_id(int id);
0221 void set_stat(int stat);
0222 void set_x(double x[4]);
0223
0224 void init_jet_v();
0225 void set_jet_v(double v[4]);
0226 void set_jet_v(FourVector j);
0227
0228
0229
0230 bool SetController(string controller = "") {
0231 bool wascontrolled = controlled_;
0232 controlled_ = true;
0233 controller_ = controller;
0234 return wascontrolled;
0235 };
0236
0237 void UnsetController() {
0238 controller_ = "";
0239 controlled_ = false;
0240 };
0241
0242
0243
0244 const int pid() const;
0245 const int pstat() const;
0246 const int plabel() const;
0247
0248
0249 const double time() const;
0250
0251 std::vector<JetScapeParticleBase> parents();
0252
0253 const FourVector p_in() const;
0254 const FourVector &x_in() const;
0255 const FourVector &jet_v() const;
0256
0257 const double restmass();
0258 const double p(int i);
0259 double pl();
0260 const double nu();
0261 const double t_max();
0262
0263 virtual JetScapeParticleBase &operator=(JetScapeParticleBase &c);
0264 virtual JetScapeParticleBase &operator=(const JetScapeParticleBase &c);
0265
0266
0267 string GetController() const { return controller_; };
0268
0269 bool GetControlled() const { return controlled_; };
0270
0271
0272
0273
0274
0275 static Pythia8::Pythia InternalHelperPythia;
0276
0277 protected:
0278 void set_restmass(
0279 double
0280 mass_input);
0281
0282 int pid_;
0283 int pstat_;
0284 int plabel_;
0285 double
0286 mass_;
0287
0288 FourVector x_in_;
0289 FourVector
0290 jet_v_;
0291
0292
0293
0294
0295
0296
0297
0298
0299 bool controlled_ = false;
0300 string controller_ = "";
0301 };
0302
0303
0304
0305 ostream &operator<<(ostream &output, JetScapeParticleBase &p);
0306
0307
0308
0309
0310 class Parton : public JetScapeParticleBase {
0311
0312 public:
0313 virtual void set_mean_form_time();
0314 virtual void set_form_time(double form_time);
0315
0316 virtual double form_time();
0317 virtual const double mean_form_time();
0318 virtual void reset_p(double px, double py, double pz);
0319 virtual void set_color(unsigned int col);
0320 virtual void
0321 set_anti_color(unsigned int acol);
0322 virtual void
0323 set_max_color(unsigned int col);
0324 virtual void
0325 set_min_color(unsigned int col);
0326 virtual void
0327 set_min_anti_color(unsigned int acol);
0328 bool isPhoton(
0329 int pid);
0330
0331 Parton(int label, int id, int stat, const FourVector &p, const FourVector &x);
0332 Parton(int label, int id, int stat, double pt, double eta, double phi,
0333 double e, double *x = 0);
0334 Parton(const Parton &srp);
0335
0336 Parton &operator=(Parton &c);
0337 Parton &operator=(const Parton &c);
0338
0339 const double t();
0340 void set_t(
0341 double
0342 t);
0343 unsigned int color();
0344 unsigned int anti_color();
0345 unsigned int max_color();
0346 unsigned int min_color();
0347 unsigned int min_anti_color();
0348
0349 const int edgeid() const;
0350 void set_edgeid(const int id);
0351
0352 void set_shower(const shared_ptr<PartonShower> pShower);
0353 void set_shower(const weak_ptr<PartonShower> pShower);
0354 const weak_ptr<PartonShower> shower() const;
0355
0356 std::vector<Parton> parents();
0357
0358 protected:
0359 double mean_form_time_;
0360 double form_time_;
0361 unsigned int Color_;
0362 unsigned int antiColor_;
0363 unsigned int MaxColor_;
0364 unsigned int MinColor_;
0365 unsigned int MinAntiColor_;
0366
0367 weak_ptr<PartonShower> pShower_;
0368 int edgeid_;
0369
0370
0371 void initialize_form_time();
0372 void CheckAcceptability(int id);
0373 };
0374
0375 class Hadron : public JetScapeParticleBase {
0376 public:
0377 Hadron(int label, int id, int stat, const FourVector &p, const FourVector &x);
0378 Hadron(int label, int id, int stat, double pt, double eta, double phi,
0379 double e, double *x = 0);
0380 Hadron(int label, int id, int stat, const FourVector &p, const FourVector &x,
0381 double mass);
0382 Hadron(const Hadron &srh);
0383
0384 Hadron &operator=(Hadron &c);
0385 Hadron &operator=(const Hadron &c);
0386
0387 void set_decay_width(double width) { width_ = width; }
0388
0389 double decay_width() { return (width_); }
0390
0391
0392
0393
0394 bool CheckOrForceHadron(const int id, const double mass = 0);
0395
0396
0397 bool has_no_position();
0398
0399 protected:
0400 double width_;
0401 };
0402
0403 class Photon : public Parton {
0404 public:
0405 Photon(int label, int id, int stat, const FourVector &p, const FourVector &x);
0406 Photon(int label, int id, int stat, double pt, double eta, double phi,
0407 double e, double *x = 0);
0408 Photon(const Photon &srh);
0409
0410 Photon &operator=(Photon &ph);
0411 Photon &operator=(const Photon &ph);
0412 };
0413
0414 };
0415
0416 #endif