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