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