Skip to content

A framework for fast simulation of a generic collider experiment

License

Notifications You must be signed in to change notification settings

jiheekim222/delphes

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Additions

Getting started from SDCC from BNL

Login into eic node

rterm -i

Set up work space

mkdir /gpfs02/eic/jkim
ln -s /gpfs02/eic/jkim

Set up environment and all the software lives under $EICDIRECTORY

setenv EIC_LEVEL EIC2022a
source /cvmfs/eic.opensciencegrid.org/gcc-8.3/MCEG/releases/etc/eic_cshrc.csh

How to install DELPHES

Clone delphes project

git clone https://github.com/delphes/delphes.git

Set environment variables for compiling

setenv HAS_PYTHIA8 true
setenv PYTHIA8 ${path_to_Pythia8}

Configure and build

cd delphes/
./configure
make
make display

Inputs

Input cards were imported from https://github.com/eic/delphes_EIC.

  • Detector configuration card
  • Pythia 8 configuration file

How to configure and run DELPHES

./DelphesPythia8 ./2ndDET_cards/delphes_card_ATHENA.tcl ./2ndDET_pythia8cards/CC_DIS.cmnd test_output.root

How to run analysis scripts

root -l 2ndDET_analysis/resolution.C'("CC_DIS_ATHENA_3T_1M_20230802_output.root")'
root -l 2ndDET_analysis/track.C'("CC_DIS_ATHENA_3T_1M_20230802_output.root")'

CI DOI

Delphes

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

More details can be found on the Delphes website http://cp3.irmp.ucl.ac.be/projects/delphes

Quick start with Delphes

Commands to get the code:

   wget http://cp3.irmp.ucl.ac.be/downloads/Delphes-3.5.0.tar.gz

   tar -zxf Delphes-3.5.0.tar.gz

Commands to compile the code:

   cd Delphes-3.5.0

   make

Finally, we can run Delphes:

   ./DelphesHepMC3

Command line parameters:

   ./DelphesHepMC3 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:

   wget http://cp3.irmp.ucl.ac.be/downloads/z_ee.hep.gz
   gunzip z_ee.hep.gz
   ./DelphesSTDHEP cards/delphes_card_CMS.tcl delphes_output.root z_ee.hep

or

   curl -s http://cp3.irmp.ucl.ac.be/downloads/z_ee.hep.gz | gunzip | ./DelphesSTDHEP cards/delphes_card_CMS.tcl delphes_output.root

For more detailed documentation, please visit https://cp3.irmp.ucl.ac.be/projects/delphes/wiki/WorkBook

Configure Delphes on lxplus.cern.ch

git clone git://github.com/delphes/delphes.git Delphes

cd Delphes

source /cvmfs/sft.cern.ch/lcg/views/LCG_99/x86_64-centos7-gcc10-opt/setup.sh

make 

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
   gSystem->Load("libDelphes");

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

   TFile *f = TFile::Open("delphes_output.root");
   f->Get("Delphes")->Draw("Electron.PT");
   TBrowser browser;

Notes:

  • 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
   gSystem->Load("libDelphes");

Basic analysis macro:

{
  // Create chain of root trees
  TChain chain("Delphes");
  chain.Add("delphes_output.root");
  
  // 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
    treeReader->ReadEntry(entry);
  
    // If event contains at least 1 electron
    if(branchElectron->GetEntries() > 0)
    {
      // Take first electron
      Electron *electron = (Electron*) branchElectron->At(0);
      
      // Plot electron transverse momentum
      histElectronPT->Fill(electron->PT);
      
      // Print electron transverse momentum
      cout << electron->PT << endl;
    }

  }

  // Show resulting histograms
  histElectronPT->Draw();
}

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");

or

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

About

A framework for fast simulation of a generic collider experiment

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Tcl 78.8%
  • C++ 13.7%
  • C 3.7%
  • Python 2.3%
  • Makefile 1.3%
  • CMake 0.1%
  • Shell 0.1%