File indexing completed on 2025-08-05 08:21:08
0001
0002
0003
0004
0005
0006
0007
0008
0009 #include "factory.h"
0010
0011 #include <TBranch.h>
0012 #include <TLorentzVector.h>
0013 #include <TTree.h>
0014 #include <TVector3.h>
0015
0016 #include <eicsmear/erhic/EventPythia.h>
0017 #include <eicsmear/erhic/Kinematics.h>
0018
0019 #include "pythia_commons.h"
0020 #include "pythia_erhic.h"
0021
0022
0023
0024 Factory::Factory()
0025 : mEvent(new erhic::EventPythia()) {
0026 }
0027
0028
0029
0030 Factory::~Factory() {
0031 if(mEvent) {
0032 delete mEvent;
0033 mEvent = NULL;
0034 }
0035 }
0036
0037
0038
0039
0040
0041
0042 erhic::EventPythia* Factory::Create() {
0043 mEvent->Clear("");
0044
0045
0046 mEvent->SetGenEvent(__pythia6_MOD_genevent);
0047 mEvent->SetProcess(msti(1));
0048 mEvent->SetNucleon(msti(12));
0049 mEvent->SetTargetParton(msti(16));
0050 mEvent->SetBeamParton(msti(15));
0051 mEvent->SetTargetPartonX(pari(34));
0052 mEvent->SetBeamPartonX(pari(33));
0053 mEvent->SetBeamPartonTheta(pari(53));
0054 mEvent->SetLeptonPhi(vint(313));
0055 mEvent->SetF1(__pythia6_MOD_f1);
0056 mEvent->SetF2(__pythia6_MOD_f2);
0057 mEvent->SetSigmaRad(__pythia6_MOD_sigma_rad);
0058 mEvent->SetHardS(pari(14));
0059 mEvent->SetHardT(pari(15));
0060 mEvent->SetHardU(pari(16));
0061 mEvent->SetHardQ2(pari(22));
0062 mEvent->SetHardPt2(pari(18));
0063 mEvent->SetSigRadCor(__pythia6_MOD_sigradcor);
0064 mEvent->SetEBrems(__pythia6_MOD_ebrems);
0065 mEvent->SetPhotonFlux(vint(319));
0066 mEvent->SetTrueY(vint(309));
0067 mEvent->SetTrueQ2(vint(307));
0068 mEvent->SetTrueX(__pythia6_MOD_truex);
0069 mEvent->SetTrueW2(__pythia6_MOD_truew2);
0070 mEvent->SetTrueNu(__pythia6_MOD_truenu);
0071 mEvent->SetR(__pythia6_MOD_r);
0072 static std::stringstream stream;
0073 const int ntracks = pyjets_.n;
0074
0075
0076
0077 for(int i(1); i <= ntracks; ++i) {
0078 erhic::ParticleMC* track = new erhic::ParticleMC;
0079 track->SetIndex(i);
0080 track->SetStatus(k(i, 1));
0081 track->SetId(k(i, 2));
0082 track->SetParentIndex(k(i, 3));
0083 track->SetChild1Index(k(i, 4));
0084 track->SetChildNIndex(k(i, 5));
0085 track->Set4Vector(TLorentzVector(p(i, 1), p(i, 2),
0086 p(i, 3), p(i, 4)));
0087 track->SetM(p(i, 5));
0088 track->SetVertex(TVector3(v(i, 1), v(i, 2), v(i, 3)));
0089 track->SetEvent(mEvent);
0090 mEvent->AddLast(track);
0091 }
0092
0093 if(__pythia6_MOD_ebrems > 0.) {
0094 erhic::ParticleMC* track = new erhic::ParticleMC;
0095 track->SetIndex(mEvent->GetNTracks() + 1);
0096 track->SetStatus(55);
0097 track->SetId(22);
0098 track->SetParentIndex(1);
0099 track->SetChild1Index(0);
0100 track->SetChildNIndex(0);
0101 track->Set4Vector(TLorentzVector(__pythia6_MOD_radgamp[0],
0102 __pythia6_MOD_radgamp[1],
0103 __pythia6_MOD_radgamp[2],
0104 __pythia6_MOD_radgame));
0105 track->SetVertex(TVector3(0., 0., 0.));
0106 track->SetEvent(mEvent);
0107 mEvent->AddLast(track);
0108 }
0109
0110
0111
0112 erhic::DisKinematics* nm =
0113 erhic::LeptonKinematicsComputer(*mEvent).Calculate();
0114 erhic::DisKinematics* jb =
0115 erhic::JacquetBlondelComputer(*mEvent).Calculate();
0116 erhic::DisKinematics* da =
0117 erhic::DoubleAngleComputer(*mEvent).Calculate();
0118 if(nm) {
0119 mEvent->SetLeptonKinematics(*nm);
0120 delete nm;
0121 }
0122 if(jb) {
0123 mEvent->SetJacquetBlondelKinematics(*jb);
0124 delete jb;
0125 }
0126 if(da) {
0127 mEvent->SetDoubleAngleKinematics(*da);
0128 delete da;
0129 }
0130
0131
0132
0133 for(unsigned i(0); i < mEvent->GetNTracks(); ++i) {
0134 mEvent->GetTrack(i)->ComputeEventDependentQuantities(*mEvent);
0135 }
0136 return mEvent;
0137 }
0138
0139
0140
0141
0142
0143
0144
0145 std::string Factory::EventName() const {
0146 return mEvent->Class()->GetName();
0147 }
0148
0149
0150
0151
0152
0153
0154 TBranch* Factory::Branch(TTree& tree, const std::string& name) {
0155 return tree.Branch(name.c_str(), &mEvent);
0156 }