Fork me on GitHub

source: git/README.md@ 95a917c

Last change on this file since 95a917c was 08d82fe, checked in by Pavel Demin <pavel.demin@…>, 4 years ago

update zenodo badge

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