Question: Please help me with this C++ script concerning classes. Even a start would be helpful, thank you. In this question you will practice the creation
Please help me with this C++ script concerning classes. Even a start would be helpful, thank you.

In this question you will practice the creation of classes. In HEP, one of the most common types of things we work with are four vectors (You already dealt with these in Assignment 1 but practice makes perfect!) when describing the kinematics of particles at the LHC and have the form (E PxPy:P:). In this exercise, write a piece of code in which you do the following. 1. Define a class that represents a four-vector. Call this class FourVector. 2. Constructor : Should be implemented to force the user to initialize the members of the class 3. Class Members : This should contain fundamental memory types that represent the energy and three- momentum (P., Pype) of a given particle. Do not use a vector to represent energy or momentum. Call these members E, Pr, Py, and Pz. 4. Class Method 1 : Should be called and replace the contents of the full four vector with the E, Pr, Py, and P: that you specify as arguments. Call this function Set FourVector. 5. Class Method 2 : Should be called and return the invariant mass of the four vector (as a float). Call this function GetMass. 6. Class Method 3 : Should be called and return the pseudorapity (: Greek "eta") of the four vector (as a float). Call this function GetEta 7. Class Method 4 : Should be called with one argument which is an instance of another four vector and calculate the difference in the azimuthal angle (0) between the two three-momenta of these vectors. Make sure that you take into account that the largest angular distance between two three-vectors is . Call this function DeltaPhi. 8. Class Method 5 : Should be called with one argument that is another four vector and calculates the difference in the pseudorapity (n) of the two four-vectors. Call this function DeltaEta. You should implement all of this along with examples that show its usage within a single main() function such that I can compile it via g++ as we have been using and seeing these past sessions. You can organize your code as you like, perhaps using a header to define the class and make the function prototypes, but the code must be well-commented, use appropriate indentation to make it readable. In this question you will practice the creation of classes. In HEP, one of the most common types of things we work with are four vectors (You already dealt with these in Assignment 1 but practice makes perfect!) when describing the kinematics of particles at the LHC and have the form (E PxPy:P:). In this exercise, write a piece of code in which you do the following. 1. Define a class that represents a four-vector. Call this class FourVector. 2. Constructor : Should be implemented to force the user to initialize the members of the class 3. Class Members : This should contain fundamental memory types that represent the energy and three- momentum (P., Pype) of a given particle. Do not use a vector to represent energy or momentum. Call these members E, Pr, Py, and Pz. 4. Class Method 1 : Should be called and replace the contents of the full four vector with the E, Pr, Py, and P: that you specify as arguments. Call this function Set FourVector. 5. Class Method 2 : Should be called and return the invariant mass of the four vector (as a float). Call this function GetMass. 6. Class Method 3 : Should be called and return the pseudorapity (: Greek "eta") of the four vector (as a float). Call this function GetEta 7. Class Method 4 : Should be called with one argument which is an instance of another four vector and calculate the difference in the azimuthal angle (0) between the two three-momenta of these vectors. Make sure that you take into account that the largest angular distance between two three-vectors is . Call this function DeltaPhi. 8. Class Method 5 : Should be called with one argument that is another four vector and calculates the difference in the pseudorapity (n) of the two four-vectors. Call this function DeltaEta. You should implement all of this along with examples that show its usage within a single main() function such that I can compile it via g++ as we have been using and seeing these past sessions. You can organize your code as you like, perhaps using a header to define the class and make the function prototypes, but the code must be well-commented, use appropriate indentation to make it readable
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
