19 #include <TMCParticle.h>
20 #include <TObjArray.h>
21 #include <TProcessID.h>
46 std::unique_ptr<EventPythia> event(
BuildEvent());
52 return event.release();
57 int objectNumber = TProcessID::GetObjectCount();
59 TPythia6* pythia = TPythia6::Instance();
60 pythia->GenerateEvent();
62 TObjArray* particles = pythia->ImportParticles(
"All");
65 std::unique_ptr<EventPythia> event(
new EventPythia);
67 event->SetNucleon(pythia->GetMSTI(12));
68 event->SetTargetParton(pythia->GetMSTI(16));
69 event->SetBeamParton(pythia->GetMSTI(15));
70 event->SetGenEvent(1);
71 event->SetTargetPartonX(pythia->GetPARI(34));
72 event->SetBeamPartonX(pythia->GetPARI(33));
73 event->SetBeamPartonTheta(pythia->GetPARI(53));
74 event->SetLeptonPhi(pythia->GetVINT(313));
75 event->SetHardS(pythia->GetPARI(14));
76 event->SetHardT(pythia->GetPARI(15));
77 event->SetHardU(pythia->GetPARI(16));
78 event->SetHardQ2(pythia->GetPARI(22));
79 event->SetHardPt2(pythia->GetPARI(18));
80 event->SetPhotonFlux(pythia->GetVINT(319));
81 event->SetProcess(pythia->GetMSTI(1));
85 const double eLepton =
86 static_cast<TMCParticle*
>(particles->At(0))->GetEnergy();
87 const double eHadron =
88 static_cast<TMCParticle*
>(particles->At(1))->GetEnergy();
89 const double mHadron =
90 static_cast<TMCParticle*
>(particles->At(1))->GetMass();
94 double y = pythia->GetVINT(309);
95 double Q2 = pythia->GetVINT(307);
96 double x = Q2 / y / 4. / eLepton / eHadron;
97 double W2 = pow(mHadron, 2.) + Q2 * (1. / x - 1.);
98 double nu = (W2 + Q2 - pow(mHadron, 2.)) / 2. / mHadron;
100 event->SetTrueQ2(Q2);
102 event->SetTrueW2(W2);
103 event->SetTrueNu(nu);
105 event->SetN(pythia->GetMSTI(5));
106 event->SetGenEvent(pythia->GetPyint5()->NGEN[2][0] -
mNTrials);
107 mNTrials = pythia->GetPyint5()->NGEN[2][0];
110 for (
int i(0); i < particles->GetEntries(); ++i) {
112 static_cast<TMCParticle*
>(particles->At(i));
114 particle->SetIndex(i + 1);
115 particle->SetEvent(event.get());
116 event->AddLast(particle.get());
123 event->SetLeptonKinematics(*nm);
126 event->SetJacquetBlondelKinematics(*jb);
129 event->SetDoubleAngleKinematics(*da);
139 TVector3 boost = -h.BoostVector();
142 event->SetELeptonInNuclearFrame(l.E());
143 event->SetEScatteredInNuclearFrame(s.E());
145 for (
unsigned i(0); i <
event->GetNTracks(); ++i) {
146 event->GetTrack(i)->ComputeEventDependentQuantities(*event);
153 TProcessID::SetObjectCount(objectNumber);
154 return event.release();
158 return EventPythia::Class()->GetName();
164 tree.Branch(name.c_str(),
EventName().c_str(), &event, 32000, 99);
165 tree.ResetBranchAddress(branch);
171 branch.ResetAddress();
176 branch.SetAddress(&
mEvent);