Fork me on GitHub

Changeset d836f45 in git


Ignore:
Timestamp:
Dec 16, 2014, 10:20:18 PM (10 years ago)
Author:
Pavel Demin <pavel-demin@…>
Branches:
ImprovedOutputFile, Timing, dual_readout, llp, master
Children:
9d03c3b
Parents:
280667b
Message:

Update README.md

File:
1 edited

Legend:

Unmodified
Added
Removed
  • README.md

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