User Tools

Site Tools


snowmass2013:analyse_d3

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
snowmass2013:analyse_d3 [2013/06/01 02:47]
asc
snowmass2013:analyse_d3 [2014/04/24 01:51] (current)
Line 1: Line 1:
 [[snowmass2013:montecarlo| <<back]] [[snowmass2013:montecarlo| <<back]]
  
-=== How to analyze in C++ ===+==== How to analyze in C++ ====
  
-This example shows how to run a program over all files in a certain directory, fill histograms (pT and jet mass) and +This example shows how to run a C+= program over all Delphes ROOT files located in  a certain directory, fill histograms (pT and jet mass) and save them in an output ROOT file.
-save histograms in an output ROOT file.+
  
 Look at the workbook of Delphes3 [[https://cp3.irmp.ucl.ac.be/projects/delphes/wiki/WorkBook| Delphes3 workbook]]. Look at the workbook of Delphes3 [[https://cp3.irmp.ucl.ac.be/projects/delphes/wiki/WorkBook| Delphes3 workbook]].
Line 17: Line 16:
  
  
-=== Advanced  Delphes3 example  ===+==== Advanced C++ example  ====
  
 This assumes that Delphes3 is already installed. You have the directory "Delphes3" with the shared file "libDelphes.so" inside. This assumes that Delphes3 is already installed. You have the directory "Delphes3" with the shared file "libDelphes.so" inside.
Line 23: Line 22:
 Get the analysis file: {{:snowmass2013:antup.tgz|}} Get the analysis file: {{:snowmass2013:antup.tgz|}}
  
-<code>+<code bash>
 tar -zvxf antup.tgz tar -zvxf antup.tgz
 cd antup cd antup
Line 29: Line 28:
  
 So you will see 2 directories: So you will see 2 directories:
-<code>+<code bash>
 delphes3 delphes3
 antup antup
Line 37: Line 36:
 Now go to the directory "antup"  and link the existing  Delphes3 installation: Now go to the directory "antup"  and link the existing  Delphes3 installation:
  
-<code>+<code bash>
 ln -s  ../Delphes3  delphes ln -s  ../Delphes3  delphes
 </code> </code>
Line 43: Line 42:
 In my case, it will look as: In my case, it will look as:
  
-<code>+<code bash>
 analysis.h analysis.h
 A_RUN_TEST A_RUN_TEST
Line 55: Line 54:
 Check that you see the shared Delphes3 file Check that you see the shared Delphes3 file
  
-<code>+<code bash>
 ls -l delphes/*so ls -l delphes/*so
 </code> </code>
Line 67: Line 66:
 But before you do this, you will need to set "DATA_DIR" variable inside "A_RUN_TEST" to navigate to the directory with your "ROOT" files. But before you do this, you will need to set "DATA_DIR" variable inside "A_RUN_TEST" to navigate to the directory with your "ROOT" files.
  
-=== How to analyze in PyROOT ===+==== How to analyze in PyROOT ====
  
-If ROOT was compiled using "python" option, you can use PyROOT to loop over events. Here is a small example to plot transverse moment of electrons (based on the original code of Peter Onyisi with some modifications): +If ROOT was compiled using "python" option, you can use PyROOT to loop over events. Here is a small example to plot transverse moment of electrons (based on the original code of Peter Onyisiwith some modifications, see 
- +[[https://indico.cern.ch/getFile.py/access?contribId=5&resId=0&materialId=slides&confId=255032| his talk]]):
-<code python>+
  
 +<code python test.py>
 #!/usr/bin/env python #!/usr/bin/env python
 # Based on P.Onyisi example # Based on P.Onyisi example
Line 87: Line 86:
 t=f.Delphes # extract the tree t=f.Delphes # extract the tree
 h=TH1D('ele','Electron #eta',8,-4,4) # initialize a histogram h=TH1D('ele','Electron #eta',8,-4,4) # initialize a histogram
-c=TCanvas() # build a canvas+c1=TCanvas() # build a canvas
  
 n=0 n=0
Line 99: Line 98:
 if (raw_input("Press any key to exit") != "-9999"): if (raw_input("Press any key to exit") != "-9999"):
     c1.Close(); sys.exit(1);     c1.Close(); sys.exit(1);
 +</code>
  
 +Run this code as: 
 +<code>
 +python test.py file.root
 </code> </code>
  
 +You will see this image:
 +{{:snowmass2013:screenshot_from_2013-05-31_21_55_04.png?200|}}
 +
 +====How to analyze in Java====
 +
 +MC truth information and most of ROOT files with Delphes outputs
 + are stored in the PROMC file format which can be analyzed on any platform.
 +Read this [[snowmass2013:analyse_d36_promc| this section]].
  
  --- //[[[email protected]|Sergei Chekanov]] 2013/03/13 10:23//  --- //[[[email protected]|Sergei Chekanov]] 2013/03/13 10:23//
  
  
snowmass2013/analyse_d3.1370054845.txt.gz · Last modified: 2013/06/01 02:47 by asc