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