Fork me on GitHub

source: git/README.md@ f3598d0

ImprovedOutputFile Timing dual_readout llp
Last change on this file since f3598d0 was 44b0a31, checked in by Christophe Delaere <christophe.delaere@…>, 7 years ago

Formating

  • Property mode set to 100644
File size: 4.1 KB
Line 
1Delphes
2=======
3
4Delphes is a C++ framework, performing a fast multipurpose detector response simulation.
5
6More details can be found on the Delphes website http://cp3.irmp.ucl.ac.be/projects/delphes
7
8Quick start with Delphes
9========================
10
11Commands to get the code:
12
13```
14 wget http://cp3.irmp.ucl.ac.be/downloads/Delphes-3.4.1.tar.gz
15
16 tar -zxf Delphes-3.4.1.tar.gz
17```
18
19Commands to compile the code:
20
21```
22 cd Delphes-3.4.1
23
24 make
25```
26
27Finally, we can run Delphes:
28
29```
30 ./DelphesHepMC
31```
32
33Command line parameters:
34
35```
36 ./DelphesHepMC config_file output_file [input_file(s)]
37 config_file - configuration file in Tcl format
38 output_file - output file in ROOT format,
39 input_file(s) - input file(s) in HepMC format,
40 with no input_file, or when input_file is -, read standard input.
41```
42
43Let's simulate some Z->ee events:
44
45```
46 wget http://cp3.irmp.ucl.ac.be/downloads/z_ee.hep.gz
47 gunzip z_ee.hep.gz
48 ./DelphesSTDHEP cards/delphes_card_CMS.tcl delphes_output.root z_ee.hep
49```
50
51or
52
53```
54 curl -s http://cp3.irmp.ucl.ac.be/downloads/z_ee.hep.gz | gunzip | ./DelphesSTDHEP cards/delphes_card_CMS.tcl delphes_output.root
55```
56
57For more detailed documentation, please visit https://cp3.irmp.ucl.ac.be/projects/delphes/wiki/WorkBook
58
59Configure Delphes on lxplus.cern.ch
60====================================
61
62```
63git clone git://github.com/delphes/delphes.git Delphes
64
65cd Delphes
66
67source /afs/cern.ch/sw/lcg/external/gcc/4.9.3/x86_64-slc6/setup.sh
68
69source /afs/cern.ch/sw/lcg/app/releases/ROOT/6.06.00/x86_64-slc6-gcc49-opt/root/bin/thisroot.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::Open("delphes_output.root");
90 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.