Fork me on GitHub

Changes in README_4LHCb [2b01e13:be386ff] in git


Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • README_4LHCb

    r2b01e13 rbe386ff  
    50502) Simulate p p -> b b~ events
    5151
    52 
    53   wget http://cp3.irmp.ucl.ac.be/downloads/pp2bb.hep.tgz
    5452  tar -xzvf pp2bb.hep.tgz
    5553  ./DelphesSTDHEP examples/delphes_card_prelLHCb.tcl delphes_output.root pp2bb.hep
     
    6159
    6260
     61
     62Simple analysis using TTree::Draw
     63=================================
     64
     65Now we can start ROOT and look at the data stored in the output ROOT file.
     66
     67Start ROOT and load Delphes shared library:
     68
     69   root -l
     70   gSystem->Load("libDelphes");
     71
     72Open ROOT file and do some basic analysis using Draw or TBrowser:
     73
     74   TFile::Open("delphes_output.root");
     75   Delphes->Draw("Track.PT");
     76   TBrowser browser;
     77
     78Note 1: Delphes - tree name, it can be learned e.g. from TBrowser
     79
     80Note 2: Track - branch name; PT - variable (leaf) of this branch
     81
     82Complete description of all branches can be found in
     83
     84   doc/RootTreeDescription.html
     85
     86This information is also available at
     87
     88   https://cp3.irmp.ucl.ac.be/projects/delphes/wiki/WorkBook/RootTreeDescription
     89
     90
     91Macro-based analysis
     92====================
     93
     94Analysis macro consists of histogram booking, event loop (histogram filling),
     95histogram display.
     96
     97Start ROOT and load Delphes shared library:
     98
     99   root -l
     100   gSystem->Load("libDelphes");
     101
     102Basic analysis macro:
     103
     104{
     105  // Create chain of root trees
     106  TChain chain("Delphes");
     107  chain.Add("delphes_output.root");
     108 
     109  // Create object of class ExRootTreeReader
     110  ExRootTreeReader *treeReader = new ExRootTreeReader(&chain);
     111  Long64_t numberOfEntries = treeReader->GetEntries();
     112 
     113  // Get pointers to branches used in this analysis
     114  TClonesArray *branchTrack = treeReader->UseBranch("Track");
     115
     116  // Book histograms
     117  TH1 *histTrackPT = new TH1F("track pt", "track P_{T}", 50, 0.0, 20.0);
     118
     119  // Loop over all events
     120  for(Int_t entry = 0; entry < numberOfEntries; ++entry)
     121  {
     122
     123    // Load selected branches with data from specified event
     124    treeReader->ReadEntry(entry);
     125 
     126    // If event contains at least 1 track
     127    if(branchTrack->GetEntries() > 0)
     128    {
     129      // Take first track
     130      Track *track = (Track*) branchTrack->At(0);
     131     
     132      // Plot track transverse momentum
     133      histTrackPT->Fill(track->PT);
     134     
     135      // Print electron transverse momentum and Particle Data Group ID
     136      cout << track->PID<< "   " << track->PT << endl;
     137    }
     138
     139  }
     140
     141  // Show resulting histograms
     142  histTrackPT->Draw();
     143}
     144
Note: See TracChangeset for help on using the changeset viewer.