Awesome Open Source
Awesome Open Source

CircleCI DOI


Delphes is a C++ framework, performing a fast multipurpose detector response simulation.

More details can be found on the Delphes website

Quick start with Delphes

Commands to get the code:


   tar -zxf Delphes-3.4.2.tar.gz

Commands to compile the code:

   cd Delphes-3.4.2


Finally, we can run Delphes:


Command line parameters:

   ./DelphesHepMC config_file output_file [input_file(s)]
     config_file - configuration file in Tcl format
     output_file - output file in ROOT format,
     input_file(s) - input file(s) in HepMC format,
     with no input_file, or when input_file is -, read standard input.

Let's simulate some Z->ee events:

   gunzip z_ee.hep.gz
   ./DelphesSTDHEP cards/delphes_card_CMS.tcl delphes_output.root z_ee.hep


   curl -s | gunzip | ./DelphesSTDHEP cards/delphes_card_CMS.tcl delphes_output.root

For more detailed documentation, please visit

Configure Delphes on

git clone git:// Delphes

cd Delphes

source  /afs/

source /afs/


Simple analysis using TTree::Draw

Now we can start ROOT and look at the data stored in the output ROOT file.

Start ROOT and load Delphes shared library:

   root -l

Open ROOT file and do some basic analysis using Draw or TBrowser:

   TFile *f = TFile::Open("delphes_output.root");
   TBrowser browser;


  • Delphes is the tree name. It can be learned e.g. from TBrowser.
  • Electronis the branch name; PT is a variable (leaf) of this branch.

Complete description of all branches can be found in doc/RootTreeDescription.html. This information is also available in the workbook.

Macro-based analysis

Analysis macro consists of histogram booking, event loop (histogram filling), histogram display.

Start ROOT and load Delphes shared library:

   root -l

Basic analysis macro:

  // Create chain of root trees
  TChain chain("Delphes");
  // Create object of class ExRootTreeReader
  ExRootTreeReader *treeReader = new ExRootTreeReader(&chain);
  Long64_t numberOfEntries = treeReader->GetEntries();
  // Get pointers to branches used in this analysis
  TClonesArray *branchElectron = treeReader->UseBranch("Electron");

  // Book histograms
  TH1 *histElectronPT = new TH1F("electron pt", "electron P_{T}", 50, 0.0, 100.0);

  // Loop over all events
  for(Int_t entry = 0; entry < numberOfEntries; ++entry)

    // Load selected branches with data from specified event
    // If event contains at least 1 electron
    if(branchElectron->GetEntries() > 0)
      // Take first electron
      Electron *electron = (Electron*) branchElectron->At(0);
      // Plot electron transverse momentum
      // Print electron transverse momentum
      cout << electron->PT << endl;


  // Show resulting histograms

More advanced macro-based analysis

The 'examples' directory contains ROOT macros Example1.C, Example2.C and Example3.C.

Here are the commands to run these ROOT macros:

   root -l
   .X examples/Example1.C("delphes_output.root");


   root -l examples/Example1.C'("delphes_output.root")'

Get A Weekly Email With Trending Projects For These Topics
No Spam. Unsubscribe easily at any time.
tcl (72
physics-simulation (36
hep (19

Find Open Source By Browsing 7,000 Topics Across 59 Categories