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