[[community:hepsim:|<< back to HepSim manual]]
====== Electron ion collier studies ======
//A mini-tutorial for EIC LDRD work//
A first version of an "all-silicon" detector for EIC is posted to the [[http://atlaswww.hep.anl.gov/hepsim/soft/detectors/| HepSim detector geometry repository]]. Look for the detector called **sieic1**.
The description link describes this detector. A working name of this detector is SiEIC (v1). Take time and study [[http://atlaswww.hep.anl.gov/hepsim/soft/detectors/sieic1/sieic1.html|this detector]].
====== Visualizing the detector ======
You can visualize the SiEIC detector using Java (Jas4pp) or ROOT/C++.
This assumes that you are using the **bash shell** on Linux/Mac with Java8 (Windows will be discussed later). Install [[http://atlaswww.hep.anl.gov/asc/jas4pp/|Jas4pp program]] and run these commands to install the hepsim package:
wget http://atlaswww.hep.anl.gov/asc/jas4pp/download/current.php -O jas4pp.tgz
tar -zvxf jas4pp.tgz
cd jas4pp
source ./setup.sh # takes 5 sec for first-time optimization
Then copy the detector geometry file to the local directory where the file "jas4pp" is:
wget http://atlaswww.hep.anl.gov/hepsim/soft/detectors/sieic1/sieic1.heprep
Now we can visualize the detector as **[File]-[Open data source]-[HepRep]** XML and select file "sidloi3.heprep".
This is how to do this using the command line:
jas4pp sieic1.heprep
Now you should see the detector layout. Read more on Jas4pp [[https://atlaswww.hep.anl.gov/asc/wikidoc/doku.php?id=asc:jas4pp|here]].
You can also visualize the detector using ROOT. Here are a few steps:
wget http://atlaswww.hep.anl.gov/hepsim/soft/detectors/sieic1/sieic1.gdml.gz
gunzip sieic1.gdml.gz
root # start root and type:
TGeoManager::Import("sieic1.gdml");
gGeoManager->GetTopVolume()->Draw("ogl");
You can get an image like this. You can explore different volumes by making them visible/invisible.
{{:fcs:eic:sieicv1.png?400|}}
====== Data analysis ======
===== EVGEN single particle studies =====
The goal of this tutorial is to show how to benchmark this detector using single electrons. You can calculate Q2 and x_bj from the position of reconstructed electrons, and calculate the resolution and efficiency.
First, look at the prepared sample of electrons. This sample is called [[http://atlaswww.hep.anl.gov/hepsim/info.php?item=214|pgun_elec_eta45_30gev]]. Use this [[https://atlaswww.hep.anl.gov/asc/wikidoc/doku.php?id=community:hepsim:usage_download|EVGEN tutorial]] for studying such files. Check the files as:
hs-ls pgun_elec_eta45_30gev # check truth level files
You can download EVGEN files and run jobs locally. You can also stream data to the analysis program.
Here is a simple validation test assumed that you have setup Jas4pp and Linux/Mac prompt:
wget http://mc.hep.anl.gov/asc/hepsim/events/misc/pgun/pgun_eta45_p30_elec/macros/check_promc_single.py
fpad check_promc_single.py
It makes a few distributions. You can try to calculate Q2 and x_bj using position and energy of the truth-level electrons. Look at the [[community:hepsim:usage_analysis|Analysis tutorial]].
You can download all files as:
hs-get pgun_elec_eta45_30gev
If you use Windows, start "jaspp" program and open the "check_promc_single.py" file inside the editor. The you can run this file. If you use C++, you will need to install [[https://atlaswww.hep.anl.gov/asc/promc/|ProMC C++]] library
====== Reconstructed events ======
Each detector in HepSim has "reconstruction" tag, i.e. a data folder where files after simulation and reconstruction are located. How to find the name of such folder?
Click this link: [[http://atlaswww.hep.anl.gov/hepsim/lookup.php?info=sieic1|check sieic1 tag]]. It shows that this detector has the [[http://atlaswww.hep.anl.gov/hepsim/list.php?find=rfull051|rfull051 tag]].
The reconstruction tags are shown in the info page of this sample [[http://atlaswww.hep.anl.gov/hepsim/info.php?item=214|pgun_elec_eta45_30gev]]. List available files after the full simulation and reconstruction using [[http://atlaswww.hep.anl.gov/hepsim/list.php?find=rfull051|rfull051 tag]]:
hs-ls pgun_elec_eta45_30gev%rfull051
Note that the number of files is less than EVGEN files due to some OSG problem. We usually reconstruct 1000 events from EVGEN files.
To download the fully simulated and reconstructed events in the LCIO format, use:
hs-get pgun_elec_eta45_30gev%rfull051
You can analyse LCIO files using either Python scripts or C++. For Python/Jython scripts, use examples located in the directory "examples" of the Jas4pp program.
You can run such scripts using "fpad" (Linux/Mac) or jaspp GUI (Windows).
Look at the tutorial [[community:hepsim:usage_full|here]] which shows how to use C++/ROOT for reading SLCIO files. We show this Python example since it does not require compilation, and you can run it on Windows. For more sophisticated studies that involve FastJet and other tools, use C++/ROOT.
Here is an example of plotting the distribution of pseudorapidity for truth and reconstructed electrons:
{{:fcs:eic:mc_electrons.py|}}. After you have finished downloading the files, you will see the directory "pgun_elec_eta45_30gev%rfull051".
Run the example python code as:
hs-get pgun_elec_eta45_30gev%rfull051 # get all data
wget https://atlaswww.hep.anl.gov/asc/wikidoc/lib/exe/fetch.php?media=fcs:eic:mc_electrons.py -O mc_electrons.py
fpad mc_electrons.py # make a plot with Eta
This code creates this image of the SiEIC-v1 detector:
{{:fcs:eic:mc_electrons.png?400|}}
Note that the plot is done for all electrons starting from 1 GeV (a region where the efficiency is quite small).
====== Hit timing information ======
You can also look at timing of silicon tracker using this script: {{:fcs:eic:mc_hits_time.py|eic:mc_hits_time.py}}
hs-get pgun_elec_eta4_pt30gev%rfull052 data # 2 100 get 100 files in 2 threads in the directory "data"
fpad eic:mc_hits_time.py
The plot is shown here:
{{:fcs:eic:electrons_hit_timing.png?400|}}
====== Looking at track resolution ======
You can also look at single particles with flat pT, Eta and Phi. Here is an example this using a simple validation script {{:fcs:eic:mc_truth_flat.py|}}
for the MCparticle container inside LCIO file. We will use the "flat pT" sample called [[http://atlaswww.hep.anl.gov/hepsim/info.php?item=242|pgun_elec_eta4_pt30gev]] reconstructed with the tag "rfull052" (SiEIC with 1T solenoid):
hs-get pgun_elec_eta4_pt30gev%rfull052 data 2 100 # get 100 files in 2 threads in the directory "data"
fpad mc_truth_flat.py
The resulting image is:
{{:fcs:eic:mc_truth_pt_ele.png?500|}}
Now, let's calculate track resolution. We will use this script {{:fcs:eic:track_resolution.py|track_resolution.py}} which
makes fit of pT(reco)/pT(truth) and plots the resolution as a function of pT(truth).
This command shown below makes resolution plots, fits with a Gaussian function, and plot resolution as a function of pT:
hs-get pgun_elec_eta4_pt30gev%rfull052 data 2 20 # get 20 files in 2 threads in the directory "data"
fpad track_resolution.py
The final plot is shown below:
{{:fcs:eic:pt_resolution.png?400|}}
====== How to continue ======
Now you can use this template to study:
* electron efficiency as a function of pT
* electron efficiency as a function of Eta in bins of pT
* resolution as a function of pT and Eta
* duplicate tracks
* fake rate (cannot be done with this sample!)
* calculate Q2 and x_bj, check efficiency and resolutions for these variable
====== Displaying reconstructed events ======
If you already setup Jas4pp program, you can visualize the reconstructed events.
we will read the simulated events: Open any *.slcio file you copied from HepSim using the menu
**[File]-[Open data source]-[LCIO]**
For e-p events, use this LCIO file from [[http://atlaswww.hep.anl.gov/hepsim/list.php?find=rfull051|rfull051]].
wget http://mc.hep.anl.gov/asc/hepsim/events/misc/pgun/pgun_eta45_p30_elec/rfull051/pgun_elec30gev_001_pandora.slcio
Then click a small button [Go] (top menu bar). It will process
events. Then select again **[File]-[New]-[Wired 4 view]**. If you want to see how data records are organized inside the slcio file,
do this **[File]-[New]-[LCSim Event browser]**
====== Event display ======
Here are images of ep collision with a scattered electron identified using the PFA.
The images were done using DIS ep samples [[http://atlaswww.hep.anl.gov/hepsim/info.php?item=159]].
Reconstructed electron energy from PFA: E=16.92 GeV
“EVGEN” energy: 16.90 GeV
{{:fcs:eic_ep.png?400}}
{{:fcs:eic_ep1.png?400}}
--- //[[chekanov@anl.gov|Sergei Chekanov]] 2016/09/19 07:06//