ROOT beginers' guide
To get started, you can first learn a little C++ and ROOT:
https://root.cern.ch/
To install it on your own laptop, go to:
https://root.cern.ch/downloading-root
You can find a version that works for your operating system,
and you don't have to install the latest version.
To read the user manual, go to:
https://root.cern/root/htmldoc/guides/users-guide/ROOTUsersGuide.html
You can go through Chapters 1-6, then 11 and 12.
Once you are done, I can give you some further assignments.
1. calculate PI
2. calculate e
Or the root of the function: y(x) = log(x) -1. You start with a trial value of x0 = 1, and find y is -1. Then you increases x by a step, e.g, 0.1, and check out the value of y again. If it's still negative, you keep increasing x, until y becomes positive. Once y is positive, you start to decrease x by a smaller step, and stop when y is negative again. Then increase x and so on. In the end, y is very close to zero, and x is very close to the value of e.
3. sorting
Here's the 3rd assignment, which contains 3 steps.
And you don't need to send me the code. The final figures are fine.
1) randomly generate 20 numbers, and sort them in an ascending order.
To do this, we have two approaches. The 1st one loops through every
element, and find the smallest number, and then loop over the rest for
the 2nd smallest, and loop again until the 20th. This approach takes
a fixed number of comparisons between two numbers.
The 2nd approach compares the first and second numbers, and if they
obey the ascending order, leave them, otherwise swap them.
Then try the next pair. When you reach the end, come back from the beginning.
Keep doing this, until no more swap is needed.
This is faster, and requires fewer comparisons. Please try both approaches.
2) for the second approach only, every time you deal with 20 random numbers,
you will count the number of comparisons, Nc. When you have another set
of 20 random numbers, you get another Nc. I want you to fill a Histogram,
or a distribution of Nc, after trying many sets of 20 random numbers.
3) Similar to step 2, but this time we are not limited to "20".
You can try 10, 20, 30 until 100 random numbers, and each time you get a Nc.
I want you to fill a TProfile for Nc vs N, where N is the number of the random numbers,
10, 20 and so on. In this way, we can study the relationship between Nc and N.
You can try to fit it with some function forms. If you are not familiar with profile,
read the ROOT manual again.
4. input/output
1) fill a histogram many times with 2 Gaussian random numbers,
one with mean at 0, and rms of 1, and
the other with mean at 2 and rms of 3.
The first type of random number can be filled two times as many as the second type.
So in the end you will have two overlapping Gaussians in a single histogram.
Then write this histogram into a ROOT file.
2) open the previous ROOT file, obtain the saved histogram,
and fit it with a predefined function. The fit function is a
2-Gaussian, of course. Try to retrieve the parameters you just input.
5. shifting
In reality, the reconstructed particle angles are not evenly distributed, and we need to force them to be flat. You start with the histogram from the last assignment, the 2-Gaussian one. Fold it into a two-PI range, like -PI to PI. It will not be flat. Use this histogram as a random number generator (with GetRandom() function). Follow the procedure below to calculate the Fourier coefficients, and shift each raw angle a little according to the recipe. Then fill a new histogram with the new shifted angles. If you do everything right, the new histogram should look flat.
I've attached the paper for the shifting method, which is described in the appendix. To know more about the shifting method, you can read Ch 6.1.2 of my thesis: https://drupal.star.bnl.gov/STAR/files/startheses/2005/wang_gang.pdf You can also read the first 3 chapters to know more about the physics and our experiment. You may apply the shifting correction up to 10th order harmonics, and the final distribution should be flat enough.
6. flow simulation
7. Recentering and shifting
8. Q-cumulant method
9. Freeze-out parameters
- rexwg's blog
- Login or register to post comments