Fork me on GitHub

source: git/README.md@ d248604

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

update zenodo badge

  • Property mode set to 100644
File size: 4.3 KB
Line 
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)
2
3Delphes
4=======
5
6Delphes is a C++ framework, performing a fast multipurpose detector response simulation.
7
8More details can be found on the Delphes website http://cp3.irmp.ucl.ac.be/projects/delphes
9
10Quick start with Delphes
11========================
12
13Commands to get the code:
14
15```
16 wget http://cp3.irmp.ucl.ac.be/downloads/Delphes-3.4.2.tar.gz
17
18 tar -zxf Delphes-3.4.2.tar.gz
19```
20
21Commands to compile the code:
22
23```
24 cd Delphes-3.4.2
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
59For more detailed documentation, please visit https://cp3.irmp.ucl.ac.be/projects/delphes/wiki/WorkBook
60
61Configure Delphes on lxplus.cern.ch
62====================================
63
64```
65git clone git://github.com/delphes/delphes.git Delphes
66
67cd Delphes
68
69source /cvmfs/sft.cern.ch/lcg/views/LCG_99/x86_64-centos7-gcc10-opt/setup.sh
70
71make
72```
73
74Simple analysis using TTree::Draw
75=================================
76
77Now we can start [ROOT](root.cern) and look at the data stored in the output ROOT file.
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```
89 TFile *f = TFile::Open("delphes_output.root");
90 f->Get("Delphes")->Draw("Electron.PT");
91 TBrowser browser;
92```
93
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.
97
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).
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
162The 'examples' directory contains ROOT macros [Example1.C](examples/Example1.C), [Example2.C](examples/Example2.C) and [Example3.C](examples/Example3.C).
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.