File indexing completed on 2026-05-05 08:46:57
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012 #ifndef Pythia8_HeavyIons_H
0013 #define Pythia8_HeavyIons_H
0014
0015 #include "Pythia8/HIInfo.h"
0016 #include "Pythia8/PhysicsBase.h"
0017
0018 namespace Pythia8 {
0019
0020
0021 class Pythia;
0022
0023
0024
0025
0026
0027
0028
0029
0030
0031 class HeavyIons : public PhysicsBase {
0032
0033 public:
0034
0035
0036
0037
0038 HeavyIons(Pythia& mainPythiaIn)
0039 : mainPythiaPtr(&mainPythiaIn), HIHooksPtr(0),
0040 pythia(vector<Pythia*>(1, &mainPythiaIn)) {
0041 }
0042
0043
0044 virtual ~HeavyIons() {}
0045
0046
0047
0048
0049
0050
0051
0052 virtual bool init() = 0;
0053
0054
0055
0056
0057
0058 virtual bool next() = 0;
0059
0060
0061
0062 static void addSpecialSettings(Settings& settings);
0063
0064
0065
0066 static bool isHeavyIon(Settings& settings);
0067
0068
0069 bool setHIUserHooksPtr(HIUserHooksPtr userHooksPtrIn) {
0070 HIHooksPtr = userHooksPtrIn; return true;
0071 }
0072
0073
0074 virtual bool setKinematics(double ) {
0075 loggerPtr->ERROR_MSG("method not implemented for this heavy ion model");
0076 return false; }
0077 virtual bool setKinematics(double , double ) {
0078 loggerPtr->ERROR_MSG("method not implemented for this heavy ion model");
0079 return false; }
0080 virtual bool setKinematics(double, double, double, double, double, double) {
0081 loggerPtr->ERROR_MSG("method not implemented for this heavy ion model");
0082 return false; }
0083 virtual bool setKinematics(Vec4, Vec4) {
0084 loggerPtr->ERROR_MSG("method not implemented for this heavy ion model");
0085 return false; }
0086
0087
0088 virtual bool setBeamIDs(int , int = 0) {
0089 loggerPtr->ERROR_MSG("method not implemented for this heavy ion model");
0090 return false; }
0091
0092
0093
0094 HIInfo hiInfo;
0095
0096
0097 virtual void stat();
0098
0099 protected:
0100
0101
0102
0103 void updateInfo();
0104
0105
0106
0107
0108
0109
0110 void clearProcessLevel(Pythia& pyt);
0111
0112
0113 static void setupSpecials(Settings& settings, string match);
0114
0115
0116
0117 static void setupSpecials(Pythia& p, string match);
0118
0119
0120 int idProj, idTarg;
0121
0122
0123
0124 Pythia * mainPythiaPtr;
0125
0126
0127
0128 SigmaTotal sigTotNN;
0129
0130
0131
0132 HIUserHooksPtr HIHooksPtr;
0133
0134
0135
0136 vector<Pythia *> pythia;
0137
0138
0139 vector<string> pythiaNames;
0140
0141
0142 vector<Info*> info;
0143
0144
0145
0146 struct InfoGrabber : public UserHooks {
0147
0148
0149 Info* getInfo() {
0150 return infoPtr;
0151 }
0152
0153 };
0154
0155 };
0156
0157
0158
0159
0160
0161 class Angantyr : public HeavyIons {
0162
0163 public:
0164
0165
0166 enum PythiaObject {
0167 HADRON = 0,
0168 MBIAS = 1,
0169 SASD = 2,
0170 SIGPP = 3,
0171 SIGPN = 4,
0172 SIGNP = 5,
0173 SIGNN = 6,
0174 ALL = 7
0175 };
0176
0177 public:
0178
0179
0180
0181
0182 Angantyr(Pythia& mainPythiaIn);
0183
0184 virtual ~Angantyr();
0185
0186
0187 virtual bool init() override;
0188
0189
0190 virtual bool next() override;
0191
0192
0193 bool setUserHooksPtr(PythiaObject sel, UserHooksPtr userHooksPtrIn);
0194
0195
0196 bool setKinematicsCM();
0197 bool setKinematics(double eCMIn) override;
0198 bool setKinematics(double eAIn, double eBIn) override;
0199 bool setKinematics(double, double, double, double, double, double) override;
0200 bool setKinematics(Vec4, Vec4) override;
0201 bool setKinematics();
0202
0203
0204 bool setBeamIDs(int idAIn, int idBIn = 0) override;
0205
0206
0207 void unifyFrames();
0208
0209
0210 void banner() const;
0211
0212
0213 const SubCollisionSet& subCollisions() const {
0214 return subColls; }
0215
0216
0217 const SubCollisionModel& subCollisionModel() const {
0218 return *collPtr.get(); }
0219
0220 SubCollisionModel* subCollPtr() {
0221 return collPtr.get();
0222 }
0223
0224
0225 const ImpactParameterGenerator impactParameterGenerator() const {
0226 return *bGenPtr.get(); }
0227
0228
0229 const Nucleus& projectile() const {
0230 return proj; }
0231
0232
0233 const Nucleus& target() const {
0234 return targ; }
0235
0236
0237 const NucleusModel& projectileModel() const {
0238 return *projPtr.get(); }
0239
0240
0241 const NucleusModel& targetModel() const {
0242 return *targPtr.get(); }
0243
0244
0245 const SigmaTotal sigmaNN() const {
0246 return sigTotNN; }
0247
0248 protected:
0249
0250 virtual void onInitInfoPtr() override {
0251 registerSubObject(sigTotNN); }
0252
0253
0254 void setBeamKinematics(int idA, int idB);
0255
0256
0257
0258 bool init(PythiaObject sel, string name, int n = 0);
0259
0260
0261 EventInfo mkEventInfo(Pythia &, Info &, const SubCollision * coll = 0);
0262
0263
0264 EventInfo getSignal(const SubCollision& coll);
0265 EventInfo getND() { return getMBIAS(0, 101); }
0266 EventInfo getND(const SubCollision& coll) { return getMBIAS(&coll, 101); }
0267 EventInfo getEl(const SubCollision& coll) { return getMBIAS(&coll, 102); }
0268 EventInfo getSDP(const SubCollision& coll) { return getMBIAS(&coll, 103); }
0269 EventInfo getSDT(const SubCollision& coll) { return getMBIAS(&coll, 104); }
0270 EventInfo getDD(const SubCollision& coll) { return getMBIAS(&coll, 105); }
0271 EventInfo getCD(const SubCollision& coll) { return getMBIAS(&coll, 106); }
0272 EventInfo getSDabsP(const SubCollision& coll)
0273 { return getSASD(&coll, 103); }
0274 EventInfo getSDabsT(const SubCollision& coll)
0275 { return getSASD(&coll, 104); }
0276 EventInfo getMBIAS(const SubCollision * coll, int procid);
0277 EventInfo getSASD(const SubCollision * coll, int procid);
0278
0279 bool genAbs(SubCollisionSet& subCollsIn, list<EventInfo>& subEventsIn);
0280 void addSASD(const SubCollisionSet& subCollsIn);
0281 bool addDD(const SubCollisionSet& subCollsIn, list<EventInfo>& subEventsIn);
0282 bool addSD(const SubCollisionSet& subCollsIn, list<EventInfo>& subEventsIn);
0283 void addSDsecond(const SubCollisionSet& subCollsIn);
0284 bool addCD(const SubCollisionSet& subCollsIn, list<EventInfo>& subEventsIn);
0285 void addCDsecond(const SubCollisionSet& subCollsIn);
0286 bool addEL(const SubCollisionSet& subCollsIn, list<EventInfo>& subEventsIn);
0287 void addELsecond(const SubCollisionSet& subCollsIn);
0288
0289 void resetEvent();
0290 bool buildEvent(list<EventInfo>& subEventsIn);
0291
0292 bool setupFullCollision(EventInfo& ei, const SubCollision& coll,
0293 Nucleon::Status projStatus, Nucleon::Status targStatus);
0294 bool isRemnant(const EventInfo& ei, int i, int past = 1 ) const {
0295 int statNow = ei.event[i].status()*past;
0296 if ( statNow == 63 ) return true;
0297 if ( statNow > 70 && statNow < 80 )
0298 return isRemnant(ei, ei.event[i].mother1(), -1);
0299 return false;
0300 }
0301 bool fixIsoSpin(EventInfo& ei);
0302 EventInfo& shiftEvent(EventInfo& ei);
0303 static int getBeam(Event& ev, int i);
0304
0305
0306 bool nextSASD(int proc);
0307
0308
0309
0310 bool addNucleonExcitation(EventInfo& orig, EventInfo& add,
0311 bool colConnect = false);
0312
0313
0314
0315 vector<int> findRecoilers(const Event& e, bool tside, int beam, int end,
0316 const Vec4& pdiff, const Vec4& pbeam);
0317
0318
0319 void addSubEvent(Event& evnt, Event& sub);
0320 static void addJunctions(Event& evnt, Event& sub, int coloff);
0321
0322
0323
0324 bool addNucleusRemnants();
0325
0326 public:
0327
0328
0329
0330 static bool
0331 getTransforms(Vec4 p1, Vec4 p2, const Vec4& p1p,
0332 pair<RotBstMatrix,RotBstMatrix>& R12);
0333 static double mT2(const Vec4& p) { return p.pPos()*p.pNeg(); }
0334 static double mT(const Vec4& p) { return sqrt(max(mT2(p), 0.0)); }
0335
0336 private:
0337
0338
0339 struct ProcessSelectorHook: public UserHooks {
0340
0341 ProcessSelectorHook(): proc(0), b(-1.0) {}
0342
0343
0344 virtual bool canVetoProcessLevel() {
0345 return true;
0346 }
0347
0348
0349 virtual bool doVetoProcessLevel(Event&) {
0350 return proc > 0 && infoPtr->code() != proc;
0351 }
0352
0353
0354 virtual bool canSetImpactParameter() const {
0355 return b >= 0.0;
0356 }
0357
0358
0359 virtual double doSetImpactParameter() {
0360 return b;
0361 }
0362
0363
0364 int proc;
0365
0366
0367 double b;
0368
0369 };
0370
0371
0372 struct HoldProcess {
0373
0374
0375 HoldProcess(shared_ptr<ProcessSelectorHook> hook, int proc,
0376 double b = -1.0) : saveHook(hook), saveProc(hook->proc), saveB(hook->b) {
0377 hook->proc = proc;
0378 hook->b = b;
0379 }
0380
0381
0382 ~HoldProcess() {
0383 if ( saveHook ) {
0384 saveHook->proc = saveProc;
0385 saveHook->b = saveB;
0386 }
0387 }
0388
0389
0390 shared_ptr<ProcessSelectorHook> saveHook;
0391
0392
0393 int saveProc;
0394
0395
0396 double saveB;
0397
0398 };
0399
0400
0401 shared_ptr<ProcessSelectorHook> selectMB;
0402
0403
0404 shared_ptr<ProcessSelectorHook> selectSASD;
0405
0406 private:
0407
0408 static const int MAXTRY = 999;
0409 static const int MAXEVSAVE = 999;
0410
0411
0412
0413 bool hasSignal;
0414
0415
0416 bool doHadronLevel;
0417
0418
0419 bool doSDTest;
0420
0421
0422 bool glauberOnly;
0423
0424
0425 SubCollisionSet subColls;
0426
0427
0428
0429 shared_ptr<SubCollisionModel> collPtr;
0430
0431
0432 shared_ptr<ImpactParameterGenerator> bGenPtr;
0433
0434
0435 Nucleus proj;
0436 Nucleus targ;
0437
0438
0439
0440 shared_ptr<NucleusModel> projPtr;
0441 shared_ptr<NucleusModel> targPtr;
0442
0443
0444 bool doVarECM;
0445
0446
0447
0448 int recoilerMode;
0449
0450
0451 int bMode;
0452
0453
0454 bool doAbort;
0455
0456 };
0457
0458
0459
0460 }
0461
0462 #endif