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.4.2.tar.gz
|
---|
7 |
|
---|
8 | tar -zxf Delphes-3.4.2.tar.gz
|
---|
9 |
|
---|
10 | Commands to compile the code:
|
---|
11 |
|
---|
12 | cd Delphes-3.4.2
|
---|
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 cards/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 cards/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 | Configure Delphes on lxplus.cern.ch
|
---|
43 | ====================================
|
---|
44 |
|
---|
45 | git clone git://github.com/delphes/delphes.git Delphes
|
---|
46 |
|
---|
47 | cd Delphes
|
---|
48 |
|
---|
49 | source /cvmfs/sft.cern.ch/lcg/views/LCG_99/x86_64-centos7-gcc10-opt/setup.sh
|
---|
50 |
|
---|
51 | make
|
---|
52 |
|
---|
53 |
|
---|
54 | Simple analysis using TTree::Draw
|
---|
55 | =================================
|
---|
56 |
|
---|
57 | Now we can start ROOT and look at the data stored in the output ROOT file.
|
---|
58 |
|
---|
59 | Start ROOT and load Delphes shared library:
|
---|
60 |
|
---|
61 | root -l
|
---|
62 | gSystem->Load("libDelphes");
|
---|
63 |
|
---|
64 | Open ROOT file and do some basic analysis using Draw or TBrowser:
|
---|
65 |
|
---|
66 | TFile *f = TFile::Open("delphes_output.root");
|
---|
67 | f->Get("Delphes")->Draw("Electron.PT");
|
---|
68 | TBrowser browser;
|
---|
69 |
|
---|
70 | Note 1: Delphes - tree name, it can be learned e.g. from TBrowser
|
---|
71 |
|
---|
72 | Note 2: Electron - branch name; PT - variable (leaf) of this branch
|
---|
73 |
|
---|
74 | Complete description of all branches can be found in
|
---|
75 |
|
---|
76 | doc/RootTreeDescription.html
|
---|
77 |
|
---|
78 | This information is also available at
|
---|
79 |
|
---|
80 | https://cp3.irmp.ucl.ac.be/projects/delphes/wiki/WorkBook/RootTreeDescription
|
---|
81 |
|
---|
82 | Macro-based analysis
|
---|
83 | ====================
|
---|
84 |
|
---|
85 | Analysis macro consists of histogram booking, event loop (histogram filling),
|
---|
86 | histogram display.
|
---|
87 |
|
---|
88 | Start ROOT and load Delphes shared library:
|
---|
89 |
|
---|
90 | root -l
|
---|
91 | gSystem->Load("libDelphes");
|
---|
92 |
|
---|
93 | Basic analysis macro:
|
---|
94 |
|
---|
95 | {
|
---|
96 | // Create chain of root trees
|
---|
97 | TChain chain("Delphes");
|
---|
98 | chain.Add("delphes_output.root");
|
---|
99 |
|
---|
100 | // Create object of class ExRootTreeReader
|
---|
101 | ExRootTreeReader *treeReader = new ExRootTreeReader(&chain);
|
---|
102 | Long64_t numberOfEntries = treeReader->GetEntries();
|
---|
103 |
|
---|
104 | // Get pointers to branches used in this analysis
|
---|
105 | TClonesArray *branchElectron = treeReader->UseBranch("Electron");
|
---|
106 |
|
---|
107 | // Book histograms
|
---|
108 | TH1 *histElectronPT = new TH1F("electron pt", "electron P_{T}", 50, 0.0, 100.0);
|
---|
109 |
|
---|
110 | // Loop over all events
|
---|
111 | for(Int_t entry = 0; entry < numberOfEntries; ++entry)
|
---|
112 | {
|
---|
113 |
|
---|
114 | // Load selected branches with data from specified event
|
---|
115 | treeReader->ReadEntry(entry);
|
---|
116 |
|
---|
117 | // If event contains at least 1 electron
|
---|
118 | if(branchElectron->GetEntries() > 0)
|
---|
119 | {
|
---|
120 | // Take first electron
|
---|
121 | Electron *electron = (Electron*) branchElectron->At(0);
|
---|
122 |
|
---|
123 | // Plot electron transverse momentum
|
---|
124 | histElectronPT->Fill(electron->PT);
|
---|
125 |
|
---|
126 | // Print electron transverse momentum
|
---|
127 | cout << electron->PT << endl;
|
---|
128 | }
|
---|
129 |
|
---|
130 | }
|
---|
131 |
|
---|
132 | // Show resulting histograms
|
---|
133 | histElectronPT->Draw();
|
---|
134 | }
|
---|
135 |
|
---|
136 |
|
---|
137 | More advanced macro-based analysis
|
---|
138 | ==================================
|
---|
139 |
|
---|
140 | The 'examples' directory contains ROOT macros Example1.C, Example2.C and Example3.C.
|
---|
141 |
|
---|
142 | Here are the commands to run these ROOT macros:
|
---|
143 |
|
---|
144 | root -l
|
---|
145 | .X examples/Example1.C("delphes_output.root");
|
---|
146 |
|
---|
147 | or
|
---|
148 |
|
---|
149 | root -l examples/Example1.C'("delphes_output.root")'
|
---|