This project has the purpose of generating a 3D animation of an ALICE particle collision event, inside the LHC, using data obtained from CERN's Open Data Portal, which makes ESDs - Event Summary Data files, that contain information about such events - open and available for analysis.
This project has the purpose of generating 3D animations of ALICE particle collision events, inside the LHC, using data obtained from CERN's Open Data Portal, which makes ESDs - Event Summary Data files, that contain information about such events - open and available for analysis.
ESD files regarding the ALICE experiment can be found on http://opendata.cern.ch/search?page=1&size=20&experiment=ALICE, and they should be processed using the Aliroot software, as indicated in the 'Aliroot' section below.
ESD files regarding the ALICE experiment can be found on http://opendata.cern.ch/search?page=1&size=20&experiment=ALICE, and they should be somehow referenced along the process, as explained further.
The software that makes the animation is Blender, which is free and open source. Blender's 2.79b version should be downloaded for this project, and can be found on https://www.blender.org/download/releases/2-79/
The software that makes the animation is Blender, which is free and open source. Blender's 2.79b version should be downloaded for this project, and can be found on https://www.blender.org/download/releases/2-79/
The animation making can be summarized in three basic steps:
The animation making can be summarized in three basic steps:
1) Downloading an ESD file;
1) Installing aliRoot;
2) Installing aliRoot and running macros;
2) Getting an ESD file;
3) Run bash to generate Blender animation using the ESD processing results.
3) Run script to process ESD data and generate Blender animations using its results.
In case you are not conCERNed about the data being used for the animation and only wish to generate a standard one, skip to the Default Animation section below. For detailed steps on how to make the animation from ESDs, as described above, read the following sections.
In case you are not conCERNed about the data being used for the animation and only wish to generate a standard one, skip to the Default Animation section below. For detailed steps on how to make the animation from ESDs, as described above, read the following sections.
## Step 1 - Downloading ESD files
## Step 1 - Installing aliRoot
ESD files regarding the ALICE experiment can be found on http://opendata.cern.ch/search?page=1&size=20&experiment=ALICE. If you have doubts on which file to pick for a test, you can select any file on this list: http://opendata.cern.ch/record/1102.
You must save your ESD file inside the 'aliRoot' directory, which is obtained by cloning this repository as mentioned above.
## Step 2 - Installing aliRoot
Here is the sequence of steps for installing aliRoot, so you are able to process the relevant information for the project.
Here is the sequence of steps for installing aliRoot, so you are able to process the relevant information for the project.
...
@@ -50,82 +44,42 @@ $ aliDoctor AliPhysics
...
@@ -50,82 +44,42 @@ $ aliDoctor AliPhysics
```bash
```bash
aliBuild build AliPhysics --defaults user -z aliroot5
aliBuild build AliPhysics --defaults user -z aliroot5
```
```
5) Enter AliPhysics environment
```bash
alienv enter AliPhysics/latest-aliroot5-user
```
6) Run the macro with number of ESD event as an input
```bash
cd ~/alice/alice-blender-animation/aliRoot
aliroot -q-b"runAnalysis.C(7)"
```
Number seven is just an example. An empty input will do the analysis on event number 0.
## Step 2 - Getting an ESD file
With the last step, ESD analysis results will be saved on a text file called `esd-detail.dat`. You must then move this file into the 'animate' folder, where the Blender scripts are.
ESD files regarding the ALICE experiment can be found on http://opendata.cern.ch/search?page=1&size=20&experiment=ALICE. If you have doubts on which file to pick for a test, you can select any file on this list: http://opendata.cern.ch/record/1102.
Here, there are two options from which you can choose:
## Step 3 - Generating animation
- the first one is to download your ESD file and save it in the `alice-blender-animation` directory, which was cloned from the git repository. Make sure you save it on the same path as this `README.md` file and the `workflow_sketch.sh` script, not inside the "aliRoot" or "animate" directories. Also make sure the file is named `AliESDs.root`.
Go inside the 'animate' directory:
- the second one is to copy the URL for the ESD file (the address you would click to download it) and paste it on the command line when you run the script that generates the animation, according to the next section.
```bash
## Step 3 - Generating animation
cd ~/alice/alice-blender-animation/animate
```
Run the python script `animate_particles.py` as in the example below:
Once you are all set, run the `workflow_sketch.sh` script through your terminal in the following way:
where everything that follows the double dashes are input arguments for generating the animation. Here is what each argument means:
where <DOWNLOAD> is either "true" of "false", depending on whether you wish to download the ESD file or just go with the one you have already downloaded.
-radius:
particle radius; must be a number; type float
-duration:
If you type in "true", fill in the <URL> field with your ESD's URL, copied in the previous section. The code will then automatically download and run the analysis on the file.
animation duration, in seconds; must be a number; type int
If you type in "false" - in which case you should have downloaded the ESD file yourself - just leave the <URL> field blank.
Have in mind that it will take a long time to generate all the animations.
-camera:
After running the script, your Blender animations should be ready! For each event inside the ESD file, there will be three animations saved in .mp4 format, each one corresponding to a different view of the event. They will be available inside the `output` directory. Enjoy!
defines animation point of view; must be a string; available options: "OverviewCamera", "BarrelCamera", "ForwardCamera"
-datafile:
filename for event data file; must be a string; must the name your text file: "esd-detail.dat"
-simulated_t:
simulated time of event, in microsseconds; must be a number; type float
-fps:
frames per second; must be a number; type int
-resolution:
animation resolution percent; must be a number; type int
After running the script, your Blender animation should be ready! It will be saved in format .mp4 on the address `/tmp/blender`. Enjoy!
# Default Animation
# Default Animation
For generating a default animation, simply run the animation python code inside the 'animate' folder, using the `d-esd-detail.dat` file (where 'd' is for 'default') as the input file, as showed below:
For generating a default animation, simply run the script `workflow_sketch.sh` in your terminal as below:
// and extract some information from them which we'll store in a histogram
Int_tiTracks(fESD->GetNumberOfTracks());// see how many tracks there are in the event
Double_tVx=0.01*fESD->GetPrimaryVertex()->GetX();// gets vertexes from individual events, in METERS
fESD=dynamic_cast<AliESDEvent*>(InputEvent());// get an event (called fESD) from the input file
Double_tVy=0.01*fESD->GetPrimaryVertex()->GetY();
Double_tVz=0.01*fESD->GetPrimaryVertex()->GetZ();
Double_tMagneticField=0.1*fESD->GetMagneticField();// gets magnetic field, in TESLA
// there's another event format (ESD) which works in a similar way
/*
Assumed Units: Mass (GeV/c^2)[CONFIRMED] || Energy (GeV) || Momentum (GeV/c) || Charge (* 1.6*10^-19 C)
if(!fESD)return;// if the pointer to the event is empty (getting it failed) skip this event
// example part: i'll show how to loop over the tracks in an event
// and extract some information from them which we'll store in a histogram
*/
Int_tiTracks(fESD->GetNumberOfTracks());// see how many tracks there are in the event
if(selectedEventID==esd_event_id){// when we get to the selected event, fill histograms and write data
Double_tVx=0.01*fESD->GetPrimaryVertex()->GetX();// gets vertexes from individual events, in METERS
Double_tVy=0.01*fESD->GetPrimaryVertex()->GetY();
Double_tVz=0.01*fESD->GetPrimaryVertex()->GetZ();
Double_tMagneticField=0.1*fESD->GetMagneticField();// gets magnetic field, in TESLA
for(Int_ti(0);i<iTracks;i++){// loop over all these tracks
AliESDtrack*track=static_cast<AliESDtrack*>(fESD->GetTrack(i));// get a track (type AliESDtrack) from the event
/*
if(!track)continue;// if we failed, skip this track
Assumed Units: Mass (GeV/c^2)[CONFIRMED] || Energy (GeV) || Momentum (GeV/c) || Charge (* 1.6*10^-19 C)
Double_tMass=track->M();// returns the pion mass, if the particle can't be identified properly
*/
Double_tEnergy=track->E();// Returns the energy of the particle given its assumed mass, but assumes the pion mass if the particle can't be identified properly.
Double_tPx=track->Px();
if(selectedEventID==esd_event_id){// when we get to the selected event, fill histograms and write data
Double_tPy=track->Py();
Double_tPt=track->Pt();// transversal momentum, in case we need it
Double_tPz=track->Pz();
Double_tCharge=track->Charge();
for(Int_ti(0);i<iTracks;i++){// loop over all these tracks
// Add VERTEX (x, y, z), MASS, CHARGE and MOMENTUM (x, y, z) to esd-detail.dat file
AliESDtrack*track=static_cast<AliESDtrack*>(fESD->GetTrack(i));// get a track (type AliESDtrack) from the event
esd_detail<<Vx<<" "<<Vy<<" "<<Vz<<" ";
esd_detail<<Mass<<" "<<Charge<<" ";
esd_detail<<Px<<" "<<Py<<" "<<Pz<<endl;
fHistPt->Fill(Pt);// plot the pt value of the track in a histogram
if(!track)continue;// if we failed, skip this track
fHistMass->Fill(Mass);
Double_tMass=track->M();// returns the pion mass, if the particle can't be identified properly
Double_tEnergy=track->E();// Returns the energy of the particle given its assumed mass, but assumes the pion mass if the particle can't be identified properly.
}
Double_tPx=track->Px();
Double_tPy=track->Py();
Double_tPt=track->Pt();// transversal momentum, in case we need it
Double_tPz=track->Pz();
}
Double_tCharge=track->Charge();
// Add VERTEX (x, y, z), MASS, CHARGE and MOMENTUM (x, y, z) to esd-detail.dat file
esd_detail<<Vx<<" "<<Vy<<" "<<Vz<<" ";
esd_detail<<Mass<<" "<<Charge<<" ";
esd_detail<<Px<<" "<<Py<<" "<<Pz<<endl;
fHistPt->Fill(Pt);// plot the pt value of the track in a histogram
fHistMass->Fill(Mass);
}
}
esd_detail.close();
}
Event++;
Event++;
esd_event_id++;// Increment global esd_event_id
esd_event_id++;// Increment global esd_event_id
fHistEvents->Fill(Event);
fHistEvents->Fill(Event);
esd_detail.close();
// continue until all the tracks are processed
// continue until all the tracks are processed
PostData(1,fOutputList);// stream the results the analysis of this event to
PostData(1,fOutputList);// stream the results the analysis of this event to