Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Please help me debug this C++ script. Thank you // Description : This is a toy monte carlo generator to simulate the // two-body decay

Please help me debug this C++ script. Thank you

image text in transcribedimage text in transcribed

// Description : This is a toy monte carlo generator to simulate the // two-body decay of a massive particle with a mass of 15 GeV and a width of 3 GeV // assuming it is a Gaussian. It will print the event kinematics of the two // outgoing particles. #include #include // HINT : You may need to include a header to use random stuff in c++ #include // HINT : You may need to include a header to give access to the FourVector class // start tools for generating Gaussian random numbers std::default_random_engine generator; std:: normal distribution gen_mass (15.0,3.0); std::uniform_real_distribution gen_esplit(0.2,0.7); std:: uniform_real_distribution gen_theta(0.0,M_PI); std:: uniform_real_distribution gen_phi(0.0,2*M_PI); // function prototype for the generation of a single event kinematics void GenEvent (FourVector *vi, FourVector *v2); int main(int argc, char *argv[]) { std::coutPrint(); fv2->Print(); return 23; // where the magin happens and we generate the decays of a massive particle void GenEvent (FourVector *v1, FourVector *v2) { std::coutSetFourVector(pxl, py1, pzi, el); // conservation of momentum to get p2 FourVector *mother = new FourVector(0,0,0,mass); V2->Set FourVector(mother->GetPx()-v1->GetPx(), mother->GetPy()-v1->GetPy(), mother->GetPzO-v1->GetPzO, mother->GetE()-v1->GetE(); // Description : This is a toy monte carlo generator to simulate the // two-body decay of a massive particle with a mass of 15 GeV and a width of 3 GeV // assuming it is a Gaussian. It will print the event kinematics of the two // outgoing particles. #include #include // HINT : You may need to include a header to use random stuff in c++ #include // HINT : You may need to include a header to give access to the FourVector class // start tools for generating Gaussian random numbers std::default_random_engine generator; std:: normal distribution gen_mass (15.0,3.0); std::uniform_real_distribution gen_esplit(0.2,0.7); std:: uniform_real_distribution gen_theta(0.0,M_PI); std:: uniform_real_distribution gen_phi(0.0,2*M_PI); // function prototype for the generation of a single event kinematics void GenEvent (FourVector *vi, FourVector *v2); int main(int argc, char *argv[]) { std::coutPrint(); fv2->Print(); return 23; // where the magin happens and we generate the decays of a massive particle void GenEvent (FourVector *v1, FourVector *v2) { std::coutSetFourVector(pxl, py1, pzi, el); // conservation of momentum to get p2 FourVector *mother = new FourVector(0,0,0,mass); V2->Set FourVector(mother->GetPx()-v1->GetPx(), mother->GetPy()-v1->GetPy(), mother->GetPzO-v1->GetPzO, mother->GetE()-v1->GetE()

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Current Trends In Database Technology Edbt 2006 Edbt 2006 Workshops Phd Datax Iidb Iiha Icsnw Qlqp Pim Parma And Reactivity On The Web Munich Germany March 2006 Revised Selected Papers Lncs 4254

Authors: Torsten Grust ,Hagen Hopfner ,Arantza Illarramendi ,Stefan Jablonski ,Marco Mesiti ,Sascha Muller ,Paula-Lavinia Patranjan ,Kai-Uwe Sattler ,Myra Spiliopoulou ,Jef Wijsen

2006th Edition

3540467882, 978-3540467885

More Books

Students also viewed these Databases questions