Fork me on GitHub

Changeset 640d6d3 in git for README.md


Ignore:
Timestamp:
Sep 5, 2014, 9:02:58 AM (10 years ago)
Author:
Pavel Demin <pavel.demin@…>
Branches:
ImprovedOutputFile, Timing, dual_readout, llp, master
Children:
deecda3
Parents:
5b5a56b
Message:

add marked down quick start guide to README.md

File:
1 edited

Legend:

Unmodified
Added
Removed
  • README.md

    r5b5a56b r640d6d3  
    1 delphes
    2 =======
     1Quick start with Delphes
     2========================
    33
    4 A framework for fast simulation of a generic collider experiment
     4Commands to get the code:
     5```
     6wget http://cp3.irmp.ucl.ac.be/downloads/Delphes-3.1.2.tar.gz
     7
     8tar -zxf Delphes-3.1.2.tar.gz
     9```
     10Commands to compile the code:
     11```
     12cd Delphes-3.1.2
     13
     14make
     15```
     16Finally, we can run Delphes:
     17```
     18./DelphesHepMC
     19```
     20Command line parameters:
     21```
     22./DelphesHepMC config_file output_file [input_file(s)]
     23  config_file - configuration file in Tcl format
     24  output_file - output file in ROOT format,
     25  input_file(s) - input file(s) in HepMC format,
     26  with no input_file, or when input_file is -, read standard input.
     27```
     28Let's simulate some Z->ee events:
     29```
     30wget http://cp3.irmp.ucl.ac.be/downloads/z_ee.hep.gz
     31gunzip z_ee.hep.gz
     32./DelphesSTDHEP examples/delphes_card_CMS.tcl delphes_output.root z_ee.hep
     33```
     34or
     35```
     36curl -s http://cp3.irmp.ucl.ac.be/downloads/z_ee.hep.gz | gunzip | ./DelphesSTDHEP examples/delphes_card_CMS.tcl delphes_output.root
     37```
     38For more detailed documentation, please visit
     39
     40https://cp3.irmp.ucl.ac.be/projects/delphes/wiki/WorkBook
     41
     42
     43Simple analysis using TTree::Draw
     44=================================
     45
     46Now we can start ROOT and look at the data stored in the output ROOT file.
     47
     48Start ROOT and load Delphes shared library:
     49```
     50root -l
     51gSystem->Load("libDelphes");
     52```
     53Open ROOT file and do some basic analysis using Draw or TBrowser:
     54```
     55TFile::Open("delphes_output.root");
     56Delphes->Draw("Electron.PT");
     57TBrowser browser;
     58```
     59Note 1: Delphes - tree name, it can be learned e.g. from TBrowser
     60
     61Note 2: Electron - branch name; PT - variable (leaf) of this branch
     62
     63Complete description of all branches can be found in
     64
     65doc/RootTreeDescription.html
     66
     67This information is also available at
     68
     69https://cp3.irmp.ucl.ac.be/projects/delphes/wiki/WorkBook/RootTreeDescription
     70
     71
     72Macro-based analysis
     73====================
     74
     75Analysis macro consists of histogram booking, event loop (histogram filling),
     76histogram display.
     77
     78Start ROOT and load Delphes shared library:
     79```
     80root -l
     81gSystem->Load("libDelphes");
     82```
     83Basic analysis macro:
     84```
     85{
     86  // Create chain of root trees
     87  TChain chain("Delphes");
     88  chain.Add("delphes_output.root");
     89 
     90  // Create object of class ExRootTreeReader
     91  ExRootTreeReader *treeReader = new ExRootTreeReader(&chain);
     92  Long64_t numberOfEntries = treeReader->GetEntries();
     93 
     94  // Get pointers to branches used in this analysis
     95  TClonesArray *branchElectron = treeReader->UseBranch("Electron");
     96
     97  // Book histograms
     98  TH1 *histElectronPT = new TH1F("electron pt", "electron P_{T}", 50, 0.0, 100.0);
     99
     100  // Loop over all events
     101  for(Int_t entry = 0; entry < numberOfEntries; ++entry)
     102  {
     103
     104    // Load selected branches with data from specified event
     105    treeReader->ReadEntry(entry);
     106 
     107    // If event contains at least 1 electron
     108    if(branchElectron->GetEntries() > 0)
     109    {
     110      // Take first electron
     111      Electron *electron = (Electron*) branchElectron->At(0);
     112     
     113      // Plot electron transverse momentum
     114      histElectronPT->Fill(electron->PT);
     115     
     116      // Print electron transverse momentum
     117      cout << electron->PT << endl;
     118    }
     119
     120  }
     121
     122  // Show resulting histograms
     123  histElectronPT->Draw();
     124}
     125```
     126
     127More advanced macro-based analysis
     128==================================
     129
     130The 'examples' directory contains ROOT macros Example1.C, Example2.C and Example3.C.
     131
     132Here are the commands to run these ROOT macros:
     133```
     134root -l
     135.X examples/Example1.C("delphes_output.root");
     136```
     137or
     138```
     139root -l examples/Example1.C\(\"delphes_output.root\"\)
     140```
Note: See TracChangeset for help on using the changeset viewer.