Version 10 (modified by 12 years ago) ( diff ) | ,
---|
Installing Delphes from Source
To successfully build Delphes the following prerequisite packages should be installed:
Commands to download Delphes' source and build Delphes:
setup ROOT environment variables wget --no-check-certificate https://cp3.irmp.ucl.ac.be/projects/delphes/raw-attachment/wiki/WikiStart/Delphes_V_3.0.0.tar.gz tar -zxf Delphes_V_3.0.0.tar.gz cd Delphes_V_3.0.0 make -j 4
Running Delphes
When running Delphes without parameters or when supplying an invalid command line, the following message will be shown:
./DelphesHepMC Usage: DelphesHepMC config_file output_file [input_file(s)] config_file - configuration file in Tcl format, output_file - output file in ROOT format, input_file(s) - input file(s) in HepMC format, with no input_file, or when input_file is -, read standard input.
Running Delphes with HepMC input files:
./DelphesHepMC examples/delphes_card_CMS.tcl output.root input.hepmc
Running Delphes with STDHEP (XDR) input files:
./DelphesSTDHEP examples/delphes_card_CMS.tcl delphes_output.root input.hep
Running Delphes with LHEF input files:
./DelphesLHEF examples/delphes_card_CMS.tcl delphes_output.root input.lhef
Running Delphes with files stored in CASTOR:
rfcat /castor/cern.ch/user/d/demine/test.hepmc.gz | gunzip | ./DelphesHepMC examples/delphes_card_CMS.tcl delphes_output.root
Running Delphes with files accessible via HTTP:
curl http://cp3.irmp.ucl.ac.be/~demin/test.hepmc.gz | gunzip | ./DelphesHepMC examples/delphes_card_CMS.tcl delphes_output.root
Analyzing Delphes' Output
Delphes' output can be analyzed with the ROOT data analysis framework.
Simple analysis using TTree::Draw
Start ROOT and load Delphes' shared library:
root gSystem->Load("libDelphes");
Open ROOT tree file and do some basic analysis using Draw or TBrowser:
TFile::Open("delphes_output.root"); Delphes->Draw("Electron.PT"); TBrowser browser;
Note 1: Delphes - tree name, it can be learnt e.g. from TBrowser
Note 2: Electron - branch name; PT - variable (leaf) of this branch
Complete description of all branches can be found at WorkBook/RootTreeDescription
Macro-based analysis
The examples
directory contains a basic ROOT analysis macro called Example1.C
.
This ROOT analysis macro consists of histogram booking, event loop (histogram filling),
histogram display.
Here are commands to run this macro:
root gSystem->Load("libDelphes"); .X examples/Example1.C("delphes_output.root");
And here is the full source code of this macro:
void Example1(const char *inputFile) { // Create chain of root trees TChain chain("Delphes"); chain.Add(inputFile); // Create object of class ExRootTreeReader ExRootTreeReader *treeReader = new ExRootTreeReader(&chain); Long64_t numberOfEntries = treeReader->GetEntries(); // Get pointers to branches used in this analysis TClonesArray *branchJet = treeReader->UseBranch("Jet"); TClonesArray *branchElectron = treeReader->UseBranch("Electron"); // Book histograms TH1 *histJetPT = new TH1F("jet_pt", "jet P_{T}", 100, 0.0, 100.0); TH1 *histMass = new TH1F("mass", "M_{inv}(e_{1}, e_{2})", 100, 40.0, 140.0); // Loop over all events for(Int_t entry = 0; entry < numberOfEntries; ++entry) { // Load selected branches with data from specified event treeReader->ReadEntry(entry); // If event contains at least 1 jet if(branchJet->GetEntries() > 0) { // Take first jet TRootJet *jet = (TRootJet*) branchJet->At(0); // Plot jet transverse momentum histJetPT->Fill(jet->PT); // Print jet transverse momentum cout << jet->PT << endl; } TRootElectron *elec1, *elec2; TLorentzVector vec1, vec2; // If event contains at least 2 electrons if(branchElectron->GetEntries() > 1) { // Take first two electrons elec1 = (TRootElectron *) branchElectron->At(0); elec2 = (TRootElectron *) branchElectron->At(1); // Create two 4-vectors for the electrons vec1.SetPtEtaPhiM(elec1->PT, elec1->Eta, elec1->Phi, 0.0); vec2.SetPtEtaPhiM(elec2->PT, elec2->Eta, elec2->Phi, 0.0); // Plot their invariant mass histMass->Fill((vec1 + vec2).M()); } } // Show resulting histograms histJetPT->Draw(); histMass->Draw(); }
More advanced macro-based analysis
The examples
directory contains a ROOT macro called Example2.C
demonstrating how to use class ExRootTreeReader
to
access data and class ExRootResult
to manage histograms booking and output.
Here are commands to run this macro:
root gSystem->Load("libDelphes"); .X examples/Example2.C("delphes_output.root");