[640d6d3] | 1 | Quick start with Delphes
|
---|
| 2 | ========================
|
---|
[fe6bd24] | 3 |
|
---|
[640d6d3] | 4 | Commands to get the code:
|
---|
[deecda3] | 5 |
|
---|
[640d6d3] | 6 | ```
|
---|
| 7 | wget http://cp3.irmp.ucl.ac.be/downloads/Delphes-3.1.2.tar.gz
|
---|
| 8 |
|
---|
| 9 | tar -zxf Delphes-3.1.2.tar.gz
|
---|
| 10 | ```
|
---|
[deecda3] | 11 |
|
---|
[640d6d3] | 12 | Commands to compile the code:
|
---|
[deecda3] | 13 |
|
---|
[640d6d3] | 14 | ```
|
---|
| 15 | cd Delphes-3.1.2
|
---|
| 16 |
|
---|
| 17 | make
|
---|
| 18 | ```
|
---|
[deecda3] | 19 |
|
---|
[640d6d3] | 20 | Finally, we can run Delphes:
|
---|
[deecda3] | 21 |
|
---|
[640d6d3] | 22 | ```
|
---|
| 23 | ./DelphesHepMC
|
---|
| 24 | ```
|
---|
[deecda3] | 25 |
|
---|
[640d6d3] | 26 | Command 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] | 36 | Let's simulate some Z->ee events:
|
---|
[deecda3] | 37 |
|
---|
[640d6d3] | 38 | ```
|
---|
| 39 | wget http://cp3.irmp.ucl.ac.be/downloads/z_ee.hep.gz
|
---|
| 40 | gunzip z_ee.hep.gz
|
---|
| 41 | ./DelphesSTDHEP examples/delphes_card_CMS.tcl delphes_output.root z_ee.hep
|
---|
| 42 | ```
|
---|
[deecda3] | 43 |
|
---|
[640d6d3] | 44 | or
|
---|
[deecda3] | 45 |
|
---|
[640d6d3] | 46 | ```
|
---|
| 47 | curl -s http://cp3.irmp.ucl.ac.be/downloads/z_ee.hep.gz | gunzip | ./DelphesSTDHEP examples/delphes_card_CMS.tcl delphes_output.root
|
---|
| 48 | ```
|
---|
[deecda3] | 49 |
|
---|
[640d6d3] | 50 | For more detailed documentation, please visit
|
---|
| 51 |
|
---|
| 52 | https://cp3.irmp.ucl.ac.be/projects/delphes/wiki/WorkBook
|
---|
| 53 |
|
---|
| 54 |
|
---|
| 55 | Simple analysis using TTree::Draw
|
---|
| 56 | =================================
|
---|
| 57 |
|
---|
| 58 | Now we can start ROOT and look at the data stored in the output ROOT file.
|
---|
| 59 |
|
---|
| 60 | Start ROOT and load Delphes shared library:
|
---|
[deecda3] | 61 |
|
---|
[640d6d3] | 62 | ```
|
---|
| 63 | root -l
|
---|
| 64 | gSystem->Load("libDelphes");
|
---|
| 65 | ```
|
---|
[deecda3] | 66 |
|
---|
[640d6d3] | 67 | Open ROOT file and do some basic analysis using Draw or TBrowser:
|
---|
[deecda3] | 68 |
|
---|
[640d6d3] | 69 | ```
|
---|
| 70 | TFile::Open("delphes_output.root");
|
---|
| 71 | Delphes->Draw("Electron.PT");
|
---|
| 72 | TBrowser browser;
|
---|
| 73 | ```
|
---|
[deecda3] | 74 |
|
---|
[640d6d3] | 75 | Note 1: Delphes - tree name, it can be learned e.g. from TBrowser
|
---|
| 76 |
|
---|
| 77 | Note 2: Electron - branch name; PT - variable (leaf) of this branch
|
---|
| 78 |
|
---|
| 79 | Complete description of all branches can be found in
|
---|
| 80 |
|
---|
| 81 | doc/RootTreeDescription.html
|
---|
| 82 |
|
---|
| 83 | This information is also available at
|
---|
| 84 |
|
---|
| 85 | https://cp3.irmp.ucl.ac.be/projects/delphes/wiki/WorkBook/RootTreeDescription
|
---|
| 86 |
|
---|
| 87 |
|
---|
| 88 | Macro-based analysis
|
---|
| 89 | ====================
|
---|
| 90 |
|
---|
| 91 | Analysis macro consists of histogram booking, event loop (histogram filling),
|
---|
| 92 | histogram display.
|
---|
| 93 |
|
---|
| 94 | Start ROOT and load Delphes shared library:
|
---|
[deecda3] | 95 |
|
---|
[640d6d3] | 96 | ```
|
---|
| 97 | root -l
|
---|
| 98 | gSystem->Load("libDelphes");
|
---|
| 99 | ```
|
---|
[deecda3] | 100 |
|
---|
[640d6d3] | 101 | Basic 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] | 147 | More advanced macro-based analysis
|
---|
| 148 | ==================================
|
---|
| 149 |
|
---|
| 150 | The 'examples' directory contains ROOT macros Example1.C, Example2.C and Example3.C.
|
---|
| 151 |
|
---|
| 152 | Here are the commands to run these ROOT macros:
|
---|
[deecda3] | 153 |
|
---|
[640d6d3] | 154 | ```
|
---|
| 155 | root -l
|
---|
| 156 | .X examples/Example1.C("delphes_output.root");
|
---|
| 157 | ```
|
---|
[deecda3] | 158 |
|
---|
[640d6d3] | 159 | or
|
---|
[deecda3] | 160 |
|
---|
[640d6d3] | 161 | ```
|
---|
[21f3c04] | 162 | root -l examples/Example1.C'("delphes_output.root")'
|
---|
[640d6d3] | 163 | ```
|
---|