GithubHelp home page GithubHelp logo

michelif / delphes Goto Github PK

View Code? Open in Web Editor NEW

This project forked from sethzenz/delphes

0.0 2.0 0.0 1.54 MB

CMS "short-term" version of Delphes - starting with ECFA_v2

Tcl 6.03% C++ 52.85% Objective-C 0.12% C 39.45% Shell 0.19% Python 1.36%

delphes's Introduction

GETTING STARTED WITH CMS VERSION OF DELPHES
===========================================

Set up GitHub per instructions on http://cms-sw.github.io/cmssw/usercode-faq.html (and linked pages)
Then do:
 
git clone https://github.com/sethzenz/Delphes.git
cd Delphes
./configure
make


Quick start with Delphes
========================

Commands to get the code:

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

   tar -zxf Delphes-3.0.10.tar.gz

Commands to compile the code:

   cd Delphes-3.0.10

   make

Finally, we can run Delphes:

   ./DelphesHepMC

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:

   wget http://cp3.irmp.ucl.ac.be/downloads/z_ee.hep.gz
   gunzip z_ee.hep.gz
   ./DelphesSTDHEP examples/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 examples/delphes_card_CMS.tcl delphes_output.root

For more detailed documentation, please visit 

https://cp3.irmp.ucl.ac.be/projects/delphes/wiki/WorkBook


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::Open("delphes_output.root");
   Delphes->Draw("Electron.PT");
   TBrowser browser;

Note 1: Delphes - tree name, it can be learned e.g. from TBrowser

Note 2: Electron - branch name; PT - variable (leaf) of this branch

Complete description of all branches can be found in

   doc/RootTreeDescription.html

This information is also available at

   https://cp3.irmp.ucl.ac.be/projects/delphes/wiki/WorkBook/RootTreeDescription


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

delphes's People

Contributors

michelif avatar sethzenz avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.