Fork me on GitHub

source: git/README.md@ 7c0fcd5

ImprovedOutputFile Timing dual_readout llp
Last change on this file since 7c0fcd5 was 21f3c04, checked in by Pavel Demin <demin@…>, 10 years ago

replace \(\"...\"\) with '("...")' in ROOT command line examples

  • Property mode set to 100644
File size: 3.4 KB
Line 
1Quick start with Delphes
2========================
3
4Commands to get the code:
5
6```
7wget http://cp3.irmp.ucl.ac.be/downloads/Delphes-3.1.2.tar.gz
8
9tar -zxf Delphes-3.1.2.tar.gz
10```
11
12Commands to compile the code:
13
14```
15cd Delphes-3.1.2
16
17make
18```
19
20Finally, we can run Delphes:
21
22```
23./DelphesHepMC
24```
25
26Command 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
36Let's simulate some Z->ee events:
37
38```
39wget http://cp3.irmp.ucl.ac.be/downloads/z_ee.hep.gz
40gunzip z_ee.hep.gz
41./DelphesSTDHEP examples/delphes_card_CMS.tcl delphes_output.root z_ee.hep
42```
43
44or
45
46```
47curl -s http://cp3.irmp.ucl.ac.be/downloads/z_ee.hep.gz | gunzip | ./DelphesSTDHEP examples/delphes_card_CMS.tcl delphes_output.root
48```
49
50For more detailed documentation, please visit
51
52https://cp3.irmp.ucl.ac.be/projects/delphes/wiki/WorkBook
53
54
55Simple analysis using TTree::Draw
56=================================
57
58Now we can start ROOT and look at the data stored in the output ROOT file.
59
60Start ROOT and load Delphes shared library:
61
62```
63root -l
64gSystem->Load("libDelphes");
65```
66
67Open ROOT file and do some basic analysis using Draw or TBrowser:
68
69```
70TFile::Open("delphes_output.root");
71Delphes->Draw("Electron.PT");
72TBrowser browser;
73```
74
75Note 1: Delphes - tree name, it can be learned e.g. from TBrowser
76
77Note 2: Electron - branch name; PT - variable (leaf) of this branch
78
79Complete description of all branches can be found in
80
81doc/RootTreeDescription.html
82
83This information is also available at
84
85https://cp3.irmp.ucl.ac.be/projects/delphes/wiki/WorkBook/RootTreeDescription
86
87
88Macro-based analysis
89====================
90
91Analysis macro consists of histogram booking, event loop (histogram filling),
92histogram display.
93
94Start ROOT and load Delphes shared library:
95
96```
97root -l
98gSystem->Load("libDelphes");
99```
100
101Basic 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
147More advanced macro-based analysis
148==================================
149
150The 'examples' directory contains ROOT macros Example1.C, Example2.C and Example3.C.
151
152Here are the commands to run these ROOT macros:
153
154```
155root -l
156.X examples/Example1.C("delphes_output.root");
157```
158
159or
160
161```
162root -l examples/Example1.C'("delphes_output.root")'
163```
Note: See TracBrowser for help on using the repository browser.