1 | Delphes
|
---|
2 | =======
|
---|
3 |
|
---|
4 | Delphes is a C++ framework, performing a fast multipurpose detector response simulation.
|
---|
5 |
|
---|
6 | More details can be found on the Delphes website http://cp3.irmp.ucl.ac.be/projects/delphes
|
---|
7 |
|
---|
8 | Quick start with Delphes
|
---|
9 | ========================
|
---|
10 |
|
---|
11 | Commands 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 |
|
---|
19 | Commands to compile the code:
|
---|
20 |
|
---|
21 | ```
|
---|
22 | cd Delphes-3.4.1
|
---|
23 |
|
---|
24 | make
|
---|
25 | ```
|
---|
26 |
|
---|
27 | Finally, we can run Delphes:
|
---|
28 |
|
---|
29 | ```
|
---|
30 | ./DelphesHepMC
|
---|
31 | ```
|
---|
32 |
|
---|
33 | Command 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 |
|
---|
43 | Let'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 |
|
---|
51 | or
|
---|
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 |
|
---|
57 | For more detailed documentation, please visit
|
---|
58 |
|
---|
59 | https://cp3.irmp.ucl.ac.be/projects/delphes/wiki/WorkBook
|
---|
60 |
|
---|
61 | Configure Delphes on lxplus.cern.ch
|
---|
62 | ====================================
|
---|
63 |
|
---|
64 | ```
|
---|
65 | git clone git://github.com/delphes/delphes.git Delphes
|
---|
66 |
|
---|
67 | cd Delphes
|
---|
68 |
|
---|
69 | source /afs/cern.ch/sw/lcg/external/gcc/4.9.3/x86_64-slc6/setup.sh
|
---|
70 |
|
---|
71 | source /afs/cern.ch/sw/lcg/app/releases/ROOT/6.06.00/x86_64-slc6-gcc49-opt/root/bin/thisroot.sh
|
---|
72 |
|
---|
73 | make
|
---|
74 | ```
|
---|
75 |
|
---|
76 |
|
---|
77 | Simple analysis using TTree::Draw
|
---|
78 | =================================
|
---|
79 |
|
---|
80 | Now we can start ROOT and look at the data stored in the output ROOT file.
|
---|
81 |
|
---|
82 | Start ROOT and load Delphes shared library:
|
---|
83 |
|
---|
84 | ```
|
---|
85 | root -l
|
---|
86 | gSystem->Load("libDelphes");
|
---|
87 | ```
|
---|
88 |
|
---|
89 | Open ROOT file and do some basic analysis using Draw or TBrowser:
|
---|
90 |
|
---|
91 | ```
|
---|
92 | TFile::Open("delphes_output.root");
|
---|
93 | Delphes->Draw("Electron.PT");
|
---|
94 | TBrowser browser;
|
---|
95 | ```
|
---|
96 |
|
---|
97 | Note 1: Delphes - tree name, it can be learned e.g. from TBrowser
|
---|
98 |
|
---|
99 | Note 2: Electron - branch name; PT - variable (leaf) of this branch
|
---|
100 |
|
---|
101 | Complete description of all branches can be found in
|
---|
102 |
|
---|
103 | doc/RootTreeDescription.html
|
---|
104 |
|
---|
105 | This information is also available at
|
---|
106 |
|
---|
107 | https://cp3.irmp.ucl.ac.be/projects/delphes/wiki/WorkBook/RootTreeDescription
|
---|
108 |
|
---|
109 | Macro-based analysis
|
---|
110 | ====================
|
---|
111 |
|
---|
112 | Analysis macro consists of histogram booking, event loop (histogram filling),
|
---|
113 | histogram display.
|
---|
114 |
|
---|
115 | Start ROOT and load Delphes shared library:
|
---|
116 |
|
---|
117 | ```
|
---|
118 | root -l
|
---|
119 | gSystem->Load("libDelphes");
|
---|
120 | ```
|
---|
121 |
|
---|
122 | Basic analysis macro:
|
---|
123 |
|
---|
124 | ```
|
---|
125 | {
|
---|
126 | // Create chain of root trees
|
---|
127 | TChain chain("Delphes");
|
---|
128 | chain.Add("delphes_output.root");
|
---|
129 |
|
---|
130 | // Create object of class ExRootTreeReader
|
---|
131 | ExRootTreeReader *treeReader = new ExRootTreeReader(&chain);
|
---|
132 | Long64_t numberOfEntries = treeReader->GetEntries();
|
---|
133 |
|
---|
134 | // Get pointers to branches used in this analysis
|
---|
135 | TClonesArray *branchElectron = treeReader->UseBranch("Electron");
|
---|
136 |
|
---|
137 | // Book histograms
|
---|
138 | TH1 *histElectronPT = new TH1F("electron pt", "electron P_{T}", 50, 0.0, 100.0);
|
---|
139 |
|
---|
140 | // Loop over all events
|
---|
141 | for(Int_t entry = 0; entry < numberOfEntries; ++entry)
|
---|
142 | {
|
---|
143 |
|
---|
144 | // Load selected branches with data from specified event
|
---|
145 | treeReader->ReadEntry(entry);
|
---|
146 |
|
---|
147 | // If event contains at least 1 electron
|
---|
148 | if(branchElectron->GetEntries() > 0)
|
---|
149 | {
|
---|
150 | // Take first electron
|
---|
151 | Electron *electron = (Electron*) branchElectron->At(0);
|
---|
152 |
|
---|
153 | // Plot electron transverse momentum
|
---|
154 | histElectronPT->Fill(electron->PT);
|
---|
155 |
|
---|
156 | // Print electron transverse momentum
|
---|
157 | cout << electron->PT << endl;
|
---|
158 | }
|
---|
159 |
|
---|
160 | }
|
---|
161 |
|
---|
162 | // Show resulting histograms
|
---|
163 | histElectronPT->Draw();
|
---|
164 | }
|
---|
165 | ```
|
---|
166 |
|
---|
167 |
|
---|
168 | More advanced macro-based analysis
|
---|
169 | ==================================
|
---|
170 |
|
---|
171 | The 'examples' directory contains ROOT macros Example1.C, Example2.C and Example3.C.
|
---|
172 |
|
---|
173 | Here are the commands to run these ROOT macros:
|
---|
174 |
|
---|
175 | ```
|
---|
176 | root -l
|
---|
177 | .X examples/Example1.C("delphes_output.root");
|
---|
178 | ```
|
---|
179 |
|
---|
180 | or
|
---|
181 |
|
---|
182 | ```
|
---|
183 | root -l examples/Example1.C'("delphes_output.root")'
|
---|
184 | ```
|
---|