Fork me on GitHub

source: git/README@ 576428a

ImprovedOutputFile Timing dual_readout llp
Last change on this file since 576428a was e715e8c, checked in by Michele Selvaggi <michele.selvaggi@…>, 9 years ago

added instruction for running on lxplus

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