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