Fork me on GitHub

source: svn/trunk/README@ 1395

Last change on this file since 1395 was 1391, checked in by Pavel Demin, 11 years ago

set version to 3.1.2

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