1 | Quick start with Delphes |
---|
2 | ======================== |
---|
3 | |
---|
4 | Commands to get the code: |
---|
5 | |
---|
6 | wget http://cp3.irmp.ucl.ac.be/downloads/Delphes-3.0.9.tar.gz |
---|
7 | |
---|
8 | tar -zxf Delphes-3.0.9.tar.gz |
---|
9 | |
---|
10 | Commands to compile the code: |
---|
11 | |
---|
12 | cd Delphes-3.0.9 |
---|
13 | |
---|
14 | make |
---|
15 | |
---|
16 | Finally, we can run Delphes: |
---|
17 | |
---|
18 | ./DelphesHepMC |
---|
19 | |
---|
20 | Command 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 | |
---|
28 | Let's simulate some Z->ee events: |
---|
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 | |
---|
34 | or |
---|
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 | |
---|
38 | For more detailed documentation, please visit |
---|
39 | |
---|
40 | https://cp3.irmp.ucl.ac.be/projects/delphes/wiki/WorkBook |
---|
41 | |
---|
42 | |
---|
43 | Simple analysis using TTree::Draw |
---|
44 | ================================= |
---|
45 | |
---|
46 | Now we can start ROOT and look at the data stored in the output ROOT file. |
---|
47 | |
---|
48 | Start ROOT and load Delphes shared library: |
---|
49 | |
---|
50 | root -l |
---|
51 | gSystem->Load("libDelphes"); |
---|
52 | |
---|
53 | Open 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 | |
---|
59 | Note 1: Delphes - tree name, it can be learned e.g. from TBrowser |
---|
60 | |
---|
61 | Note 2: Electron - branch name; PT - variable (leaf) of this branch |
---|
62 | |
---|
63 | Complete description of all branches can be found in |
---|
64 | |
---|
65 | doc/RootTreeDescription.html |
---|
66 | |
---|
67 | This information is also available at |
---|
68 | |
---|
69 | https://cp3.irmp.ucl.ac.be/projects/delphes/wiki/WorkBook/RootTreeDescription |
---|
70 | |
---|
71 | |
---|
72 | Macro-based analysis |
---|
73 | ==================== |
---|
74 | |
---|
75 | Analysis macro consists of histogram booking, event loop (histogram filling), |
---|
76 | histogram display. |
---|
77 | |
---|
78 | Start ROOT and load Delphes shared library: |
---|
79 | |
---|
80 | root -l |
---|
81 | gSystem->Load("libDelphes"); |
---|
82 | |
---|
83 | Basic 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 |
---|
98 | TH1 *histElectronPT = new TH1F("electron pt", "electron P_{T}", 50, 0.0, 100.0); |
---|
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 | |
---|
127 | More advanced macro-based analysis |
---|
128 | ================================== |
---|
129 | |
---|
130 | The 'examples' directory contains ROOT macros Example1.C, Example2.C and Example3.C. |
---|
131 | |
---|
132 | Here are the commands to run these ROOT macros: |
---|
133 | |
---|
134 | root -l |
---|
135 | .X examples/Example1.C("delphes_output.root"); |
---|
136 | |
---|
137 | or |
---|
138 | |
---|
139 | root -l examples/Example1.C\(\"delphes_output.root\"\) |
---|