Fork me on GitHub

source: git/README.md@ 0f8390e

ImprovedOutputFile Timing dual_readout llp
Last change on this file since 0f8390e was 17826f2, checked in by Michele Selvaggi <michele.selvaggi@…>, 10 years ago

Update README.md

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